Skip to content

Commit f5d8080

Browse files
committed
test(gc): ensure adding and deleting a tag doesn't affect gc
1 parent f0276f1 commit f5d8080

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/store/gc.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,13 +266,15 @@ mod tests {
266266
let et = blobs.add_slice("e").temp_tag().await?;
267267
let ft = blobs.add_slice("f").temp_tag().await?;
268268
let gt = blobs.add_slice("g").temp_tag().await?;
269+
let ht = blobs.add_slice("h").with_named_tag("h").await?;
269270
let a = *at.hash();
270271
let b = *bt.hash();
271272
let c = *ct.hash();
272273
let d = *dt.hash();
273274
let e = *et.hash();
274275
let f = *ft.hash();
275276
let g = *gt.hash();
277+
let h = ht.hash;
276278
store.tags().set("c", *ct.hash_and_format()).await?;
277279
let dehs = [d, e].into_iter().collect::<HashSeq>();
278280
let hehs = blobs
@@ -292,6 +294,7 @@ mod tests {
292294
store.tags().set("fg", *fghs.hash_and_format()).await?;
293295
drop(fghs);
294296
drop(bt);
297+
store.tags().delete(ht.name).await?;
295298
let mut live = HashSet::new();
296299
gc_run_once(store, &mut live).await?;
297300
// a is protected because we keep the temp tag
@@ -313,6 +316,9 @@ mod tests {
313316
assert!(store.has(f).await?);
314317
assert!(live.contains(&g));
315318
assert!(store.has(g).await?);
319+
// h is not protected because we deleted the tag before gc ran
320+
assert!(!live.contains(&h));
321+
assert!(!store.has(h).await?);
316322
drop(at);
317323
drop(hehs);
318324
Ok(())

0 commit comments

Comments
 (0)