From 2b51265b48958ab31f4f6acbac5d6d528aa83c25 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Wed, 12 Jul 2017 18:03:27 +0300 Subject: [PATCH] Add a long-chain test for GC --- data/model/test/test_gc.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/data/model/test/test_gc.py b/data/model/test/test_gc.py index 975de1660..e3070e4fb 100644 --- a/data/model/test/test_gc.py +++ b/data/model/test/test_gc.py @@ -620,3 +620,14 @@ def test_purge_repo(app): with patch('app.tuf_metadata_api') as mock_tuf: model.repository.purge_repository("ns", "repo") assert mock_tuf.delete_metadata.called_with("ns", "repo") + + +def test_super_long_image_chain_gc(app, default_tag_policy): + """ Test that a super long chain of images all gets properly GCed. """ + with assert_gc_integrity(): + images = ['i%s' % i for i in range(0, 100)] + repository = create_repository(latest=images) + delete_tag(repository, 'latest') + + # Ensure the repository is now empty. + assert_deleted(repository, *images)