Commit f45e18d6 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

unionfs: fix capitalization of TTL

parent 7f7894d2
...@@ -16,13 +16,13 @@ import ( ...@@ -16,13 +16,13 @@ import (
"github.com/hanwen/go-fuse/internal/testutil" "github.com/hanwen/go-fuse/internal/testutil"
) )
const entryTtl = 100 * time.Millisecond const entryTTL = 100 * time.Millisecond
var testAOpts = AutoUnionFsOptions{ var testAOpts = AutoUnionFsOptions{
UnionFsOptions: testOpts, UnionFsOptions: testOpts,
Options: nodefs.Options{ Options: nodefs.Options{
EntryTimeout: entryTtl, EntryTimeout: entryTTL,
AttrTimeout: entryTtl, AttrTimeout: entryTTL,
NegativeTimeout: 0, NegativeTimeout: 0,
Debug: testutil.VerboseTest(), Debug: testutil.VerboseTest(),
LookupKnownChildren: true, LookupKnownChildren: true,
......
...@@ -33,9 +33,9 @@ func TestFilePathHash(t *testing.T) { ...@@ -33,9 +33,9 @@ func TestFilePathHash(t *testing.T) {
} }
var testOpts = UnionFsOptions{ var testOpts = UnionFsOptions{
DeletionCacheTTL: entryTtl, DeletionCacheTTL: entryTTL,
DeletionDirName: "DELETIONS", DeletionDirName: "DELETIONS",
BranchCacheTTL: entryTtl, BranchCacheTTL: entryTTL,
HiddenFiles: []string{"hidden"}, HiddenFiles: []string{"hidden"},
} }
...@@ -94,9 +94,9 @@ func setupUfs(t *testing.T) (wd string, cleanup func()) { ...@@ -94,9 +94,9 @@ func setupUfs(t *testing.T) (wd string, cleanup func()) {
// We configure timeouts are smaller, so we can check for // We configure timeouts are smaller, so we can check for
// UnionFs's cache consistency. // UnionFs's cache consistency.
opts := &nodefs.Options{ opts := &nodefs.Options{
EntryTimeout: entryTtl / 2, EntryTimeout: entryTTL / 2,
AttrTimeout: entryTtl / 2, AttrTimeout: entryTTL / 2,
NegativeTimeout: entryTtl / 2, NegativeTimeout: entryTTL / 2,
PortableInodes: true, PortableInodes: true,
Debug: testutil.VerboseTest(), Debug: testutil.VerboseTest(),
LookupKnownChildren: true, LookupKnownChildren: true,
...@@ -832,7 +832,7 @@ func TestUnionFsCopyChmod(t *testing.T) { ...@@ -832,7 +832,7 @@ func TestUnionFsCopyChmod(t *testing.T) {
if fi.Mode()&0111 == 0 { if fi.Mode()&0111 == 0 {
t.Errorf("Lstat(%v): mode %o", fn, fi.Mode()) t.Errorf("Lstat(%v): mode %o", fn, fi.Mode())
} }
time.Sleep(entryTtl) time.Sleep(entryTTL)
fi, err = os.Lstat(fn) fi, err = os.Lstat(fn)
if err != nil { if err != nil {
t.Fatalf("Lstat(%v) after sleep: %v", fn, err) t.Fatalf("Lstat(%v) after sleep: %v", fn, err)
...@@ -1040,7 +1040,7 @@ func TestUnionFsDropDeletionCache(t *testing.T) { ...@@ -1040,7 +1040,7 @@ func TestUnionFsDropDeletionCache(t *testing.T) {
} }
// Expire kernel entry. // Expire kernel entry.
time.Sleep((6 * entryTtl) / 10) time.Sleep((6 * entryTTL) / 10)
err = ioutil.WriteFile(wd+"/mnt/.drop_cache", []byte(""), 0644) err = ioutil.WriteFile(wd+"/mnt/.drop_cache", []byte(""), 0644)
if err != nil { if err != nil {
t.Fatalf("WriteFile: %v", err) t.Fatalf("WriteFile: %v", err)
...@@ -1164,9 +1164,9 @@ func TestUnionFsDisappearing(t *testing.T) { ...@@ -1164,9 +1164,9 @@ func TestUnionFsDisappearing(t *testing.T) {
} }
opts := &nodefs.Options{ opts := &nodefs.Options{
EntryTimeout: entryTtl, EntryTimeout: entryTTL,
AttrTimeout: entryTtl, AttrTimeout: entryTTL,
NegativeTimeout: entryTtl, NegativeTimeout: entryTTL,
Debug: testutil.VerboseTest(), Debug: testutil.VerboseTest(),
LookupKnownChildren: true, LookupKnownChildren: true,
} }
...@@ -1192,7 +1192,7 @@ func TestUnionFsDisappearing(t *testing.T) { ...@@ -1192,7 +1192,7 @@ func TestUnionFsDisappearing(t *testing.T) {
} }
wrFs.visibleChan <- false wrFs.visibleChan <- false
time.Sleep((3 * entryTtl) / 2) time.Sleep((3 * entryTTL) / 2)
_, err = ioutil.ReadDir(wd + "/mnt") _, err = ioutil.ReadDir(wd + "/mnt")
if err == nil { if err == nil {
...@@ -1205,7 +1205,7 @@ func TestUnionFsDisappearing(t *testing.T) { ...@@ -1205,7 +1205,7 @@ func TestUnionFsDisappearing(t *testing.T) {
} }
// Wait for the caches to purge, and then restore. // Wait for the caches to purge, and then restore.
time.Sleep((3 * entryTtl) / 2) time.Sleep((3 * entryTTL) / 2)
wrFs.visibleChan <- true wrFs.visibleChan <- true
_, err = ioutil.ReadDir(wd + "/mnt") _, err = ioutil.ReadDir(wd + "/mnt")
......
...@@ -54,15 +54,15 @@ func TestXAttrCaching(t *testing.T) { ...@@ -54,15 +54,15 @@ func TestXAttrCaching(t *testing.T) {
} }
ufs, err := NewUnionFs([]pathfs.FileSystem{rwFS, ufs, err := NewUnionFs([]pathfs.FileSystem{rwFS,
NewCachingFileSystem(roFS, entryTtl)}, testOpts) NewCachingFileSystem(roFS, entryTTL)}, testOpts)
if err != nil { if err != nil {
t.Fatalf("NewUnionFs: %v", err) t.Fatalf("NewUnionFs: %v", err)
} }
opts := &nodefs.Options{ opts := &nodefs.Options{
EntryTimeout: entryTtl / 2, EntryTimeout: entryTTL / 2,
AttrTimeout: entryTtl / 2, AttrTimeout: entryTTL / 2,
NegativeTimeout: entryTtl / 2, NegativeTimeout: entryTTL / 2,
Debug: testutil.VerboseTest(), Debug: testutil.VerboseTest(),
LookupKnownChildren: true, LookupKnownChildren: true,
} }
...@@ -94,7 +94,7 @@ func TestXAttrCaching(t *testing.T) { ...@@ -94,7 +94,7 @@ func TestXAttrCaching(t *testing.T) {
t.Fatalf("Got %q want %q", got, err) t.Fatalf("Got %q want %q", got, err)
} }
time.Sleep(entryTtl / 3) time.Sleep(entryTTL / 3)
n, err = Getxattr(wd+"/mnt/file", "user.attr", buf) n, err = Getxattr(wd+"/mnt/file", "user.attr", buf)
if err != nil { if err != nil {
...@@ -105,7 +105,7 @@ func TestXAttrCaching(t *testing.T) { ...@@ -105,7 +105,7 @@ func TestXAttrCaching(t *testing.T) {
t.Fatalf("Got %q want %q", got, err) t.Fatalf("Got %q want %q", got, err)
} }
time.Sleep(entryTtl / 3) time.Sleep(entryTTL / 3)
// Make sure that an interceding Getxattr() to a filesystem that doesn't implement GetXAttr() doesn't affect future calls. // Make sure that an interceding Getxattr() to a filesystem that doesn't implement GetXAttr() doesn't affect future calls.
Getxattr(wd, "whatever", buf) Getxattr(wd, "whatever", buf)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment