forked from TrueCloudLab/restic
fuse: Fix file test
This commit is contained in:
parent
c86e425df6
commit
154816ffd0
1 changed files with 11 additions and 2 deletions
|
@ -14,6 +14,7 @@ import (
|
||||||
"restic/repository"
|
"restic/repository"
|
||||||
|
|
||||||
"bazil.org/fuse"
|
"bazil.org/fuse"
|
||||||
|
"bazil.org/fuse/fs"
|
||||||
|
|
||||||
"restic"
|
"restic"
|
||||||
. "restic/test"
|
. "restic/test"
|
||||||
|
@ -108,13 +109,21 @@ func TestFuseFile(t *testing.T) {
|
||||||
Size: filesize,
|
Size: filesize,
|
||||||
Content: content,
|
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)
|
OK(t, err)
|
||||||
|
|
||||||
attr := fuse.Attr{}
|
attr := fuse.Attr{}
|
||||||
OK(t, f.Attr(ctx, &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.Mode, attr.Mode)
|
||||||
Equals(t, node.Size, attr.Size)
|
Equals(t, node.Size, attr.Size)
|
||||||
Equals(t, (node.Size/uint64(attr.BlockSize))+1, attr.Blocks)
|
Equals(t, (node.Size/uint64(attr.BlockSize))+1, attr.Blocks)
|
||||||
|
|
Loading…
Reference in a new issue