mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-03-03 19:03:42 +00:00
add test for hitting the logic path that panics
This commit is contained in:
parent
9d7cbf5783
commit
e8ee59ee00
@ -435,6 +435,25 @@ asyncchecksuite "RepoStore":
|
||||
(await repo.delBlock(treeCid2, 0.Natural)).tryGet()
|
||||
check not (await sharedBlock.cid in repo)
|
||||
|
||||
test "should not panic (underflow) when deleting a manifest as a leaf":
|
||||
let
|
||||
repo = RepoStore.new(repoDs, metaDs, clock = mockClock, quotaMaxBytes =
|
||||
1000'nb)
|
||||
(_, tree, manifest) = makeDataset(
|
||||
await makeRandomBlocks(datasetSize = 2 * 256, blockSize = 256'nb)
|
||||
).tryGet()
|
||||
treeCid = tree.rootCid.tryGet()
|
||||
proof = tree.getProof(1).tryGet()
|
||||
|
||||
let encodedVerifiable = manifest.encode().tryGet
|
||||
let blk = bt.Block.new(data = encodedVerifiable, codec = ManifestCodec).tryGet
|
||||
|
||||
(await repo.putCidAndProof(treeCid, 0.Natural, blk.cid, proof)).tryGet()
|
||||
|
||||
(await repo.delBlock(treeCid, 0.Natural)).tryGet
|
||||
|
||||
check not (await blk.cid in repo)
|
||||
|
||||
test "should clear leaf metadata when block is deleted from dataset":
|
||||
let
|
||||
repo = RepoStore.new(repoDs, metaDs, clock = mockClock, quotaMaxBytes =
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user