Commit 09e6b67a authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

nodefs: comment for cache_test.

parent 5e3fe891
...@@ -12,7 +12,6 @@ import ( ...@@ -12,7 +12,6 @@ import (
"os" "os"
"sync" "sync"
"testing" "testing"
"time"
"github.com/hanwen/go-fuse/fuse" "github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/internal/testutil" "github.com/hanwen/go-fuse/internal/testutil"
...@@ -83,10 +82,12 @@ func (r *keepCacheRoot) OnAdd(ctx context.Context) { ...@@ -83,10 +82,12 @@ func (r *keepCacheRoot) OnAdd(ctx context.Context) {
i.AddChild("nokeep", i.NewInode(ctx, r.nokeep, NodeAttr{}), true) i.AddChild("nokeep", i.NewInode(ctx, r.nokeep, NodeAttr{}), true)
} }
// Test FOPEN_KEEP_CACHE. This is a little subtle: the automatic cache
// invalidation triggers if mtime or file size is changed, so only
// change content but no metadata.
func TestKeepCache(t *testing.T) { func TestKeepCache(t *testing.T) {
mntDir := testutil.TempDir() mntDir := testutil.TempDir()
defer os.RemoveAll(mntDir) defer os.RemoveAll(mntDir)
sec := time.Second
root := &keepCacheRoot{} root := &keepCacheRoot{}
server, err := Mount(mntDir, root, &Options{ server, err := Mount(mntDir, root, &Options{
MountOptions: fuse.MountOptions{ MountOptions: fuse.MountOptions{
...@@ -94,8 +95,7 @@ func TestKeepCache(t *testing.T) { ...@@ -94,8 +95,7 @@ func TestKeepCache(t *testing.T) {
}, },
FirstAutomaticIno: 1, FirstAutomaticIno: 1,
AttrTimeout: &sec, // no caching.
EntryTimeout: &sec,
}) })
defer server.Unmount() defer server.Unmount()
c1, err := ioutil.ReadFile(mntDir + "/keep") c1, err := ioutil.ReadFile(mntDir + "/keep")
......
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