X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/06c2c19bfe18a52348b72d93db59df4b03a4fcaa..0bab5ef7b173a6df95045cfee6b397e2a2638ccc:/sdk/go/arvados/fs_collection_test.go diff --git a/sdk/go/arvados/fs_collection_test.go b/sdk/go/arvados/fs_collection_test.go index fab91d1f77..c2cac3c6ce 100644 --- a/sdk/go/arvados/fs_collection_test.go +++ b/sdk/go/arvados/fs_collection_test.go @@ -1221,7 +1221,8 @@ func (s *CollectionFSSuite) TestFlushFullBlocksOnly(c *check.C) { c.Assert(err, check.IsNil) } } - c.Check(fs.MemorySize(), check.Equals, int64(nDirs*67<<20)) + inodebytes := int64((nDirs*(67*2+1) + 1) * 64) + c.Check(fs.MemorySize(), check.Equals, int64(nDirs*67<<20)+inodebytes) c.Check(flushed, check.Equals, int64(0)) waitForFlush := func(expectUnflushed, expectFlushed int64) { @@ -1232,27 +1233,27 @@ func (s *CollectionFSSuite) TestFlushFullBlocksOnly(c *check.C) { } // Nothing flushed yet - waitForFlush((nDirs*67)<<20, 0) + waitForFlush((nDirs*67)<<20+inodebytes, 0) // Flushing a non-empty dir "/" is non-recursive and there are // no top-level files, so this has no effect fs.Flush("/", false) - waitForFlush((nDirs*67)<<20, 0) + waitForFlush((nDirs*67)<<20+inodebytes, 0) // Flush the full block in dir0 fs.Flush("dir0", false) - waitForFlush((nDirs*67-64)<<20, 64<<20) + waitForFlush((nDirs*67-64)<<20+inodebytes, 64<<20) err = fs.Flush("dir-does-not-exist", false) c.Check(err, check.NotNil) // Flush full blocks in all dirs fs.Flush("", false) - waitForFlush(nDirs*3<<20, nDirs*64<<20) + waitForFlush(nDirs*3<<20+inodebytes, nDirs*64<<20) // Flush non-full blocks, too fs.Flush("", true) - waitForFlush(0, nDirs*67<<20) + waitForFlush(inodebytes, nDirs*67<<20) } // Even when writing lots of files/dirs from different goroutines, as @@ -1441,6 +1442,30 @@ func (s *CollectionFSSuite) TestEdgeCaseManifests(c *check.C) { } } +func (s *CollectionFSSuite) TestSnapshotSplice(c *check.C) { + filedata1 := "hello snapshot+splice world\n" + fs, err := (&Collection{}).FileSystem(s.client, s.kc) + c.Assert(err, check.IsNil) + { + f, err := fs.OpenFile("file1", os.O_CREATE|os.O_RDWR, 0700) + c.Assert(err, check.IsNil) + _, err = f.Write([]byte(filedata1)) + c.Assert(err, check.IsNil) + err = f.Close() + c.Assert(err, check.IsNil) + } + + snap, err := Snapshot(fs, "/") + c.Assert(err, check.IsNil) + err = Splice(fs, "dir1", snap) + c.Assert(err, check.IsNil) + f, err := fs.Open("dir1/file1") + c.Assert(err, check.IsNil) + buf, err := io.ReadAll(f) + c.Assert(err, check.IsNil) + c.Check(string(buf), check.Equals, filedata1) +} + func (s *CollectionFSSuite) TestRefreshSignatures(c *check.C) { filedata1 := "hello refresh signatures world\n" fs, err := (&Collection{}).FileSystem(s.client, s.kc)