From 154816ffd0c7fcb0042c8a2369eb34fb87937a3f Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 18 Jun 2017 16:29:00 +0200 Subject: [PATCH] fuse: Fix file test --- src/restic/fuse/file_test.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/restic/fuse/file_test.go b/src/restic/fuse/file_test.go index 4c4550282..46a33fc6a 100644 --- a/src/restic/fuse/file_test.go +++ b/src/restic/fuse/file_test.go @@ -14,6 +14,7 @@ import ( "restic/repository" "bazil.org/fuse" + "bazil.org/fuse/fs" "restic" . "restic/test" @@ -108,13 +109,21 @@ func TestFuseFile(t *testing.T) { Size: filesize, Content: content, } - f, err := newFile(repo, node, false, nil) + root := &Root{ + blobSizeCache: NewBlobSizeCache(context.TODO(), repo.Index()), + repo: repo, + } + + t.Logf("blob cache has %d entries", len(root.blobSizeCache.m)) + + inode := fs.GenerateDynamicInode(1, "foo") + f, err := newFile(context.TODO(), root, inode, node) OK(t, err) attr := fuse.Attr{} OK(t, f.Attr(ctx, &attr)) - Equals(t, node.Inode, attr.Inode) + Equals(t, inode, attr.Inode) Equals(t, node.Mode, attr.Mode) Equals(t, node.Size, attr.Size) Equals(t, (node.Size/uint64(attr.BlockSize))+1, attr.Blocks)