diff options
Diffstat (limited to 'zenstore/compactcas.cpp')
| -rw-r--r-- | zenstore/compactcas.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/zenstore/compactcas.cpp b/zenstore/compactcas.cpp index fe0fc8f6b..b816869c3 100644 --- a/zenstore/compactcas.cpp +++ b/zenstore/compactcas.cpp @@ -1400,6 +1400,40 @@ TEST_CASE("compactcas.gc.basic") IoHash ChunkHash = IoHash::HashBuffer(Chunk); const auto InsertResult = Cas.InsertChunk(Chunk, ChunkHash); + CHECK(InsertResult.New); + + GcContext GcCtx; + GcCtx.CollectSmallObjects(true); + + Cas.CollectGarbage(GcCtx); + + CHECK(!Cas.HaveChunk(ChunkHash)); +} + +TEST_CASE("compactcas.gc.removefile") +{ + ScopedTemporaryDirectory TempDir; + + CasStoreConfiguration CasConfig; + CasConfig.RootDirectory = TempDir.Path(); + CreateDirectories(CasConfig.RootDirectory); + + IoBuffer Chunk = CreateChunk(128); + IoHash ChunkHash = IoHash::HashBuffer(Chunk); + { + CasGc Gc; + CasContainerStrategy Cas(CasConfig, Gc); + Cas.Initialize("cb", 65536, 1 << 4, true); + + const auto InsertResult = Cas.InsertChunk(Chunk, ChunkHash); + CHECK(InsertResult.New); + const auto InsertResultDup = Cas.InsertChunk(Chunk, ChunkHash); + CHECK(!InsertResultDup.New); + } + + CasGc Gc; + CasContainerStrategy Cas(CasConfig, Gc); + Cas.Initialize("cb", 65536, 1 << 4, false); GcContext GcCtx; GcCtx.CollectSmallObjects(true); |