Add GC of layers in Clair

Fixes https://www.pivotaltracker.com/story/show/135583207
This commit is contained in:
Joseph Schorr 2016-12-06 19:52:56 -05:00
parent 0aa6e6cd58
commit 49872838ab
5 changed files with 57 additions and 23 deletions

View file

@ -547,6 +547,19 @@ class TestSecurityScanner(unittest.TestCase):
notification = model.notification.create_repo_notification(repo, 'vulnerability_found', 'quay_notification', {}, {'level': 0})
self.assertFalse(VulnerabilityFoundEvent().should_perform(event_data, notification))
def test_garbage_collection(self):
requests_made = set()
@urlmatch(netloc=r'(.*\.)?mockclairservice', path=r'/v1/layers/(.+)')
def delete_layer(url, request):
requests_made.add(request.method)
with HTTMock(delete_layer):
# Purge a repository.
model.repository.purge_repository('devtable', 'simple')
# Ensure that DELETE is called (and only DELETE) for the layers in the security scanner.
self.assertEquals(set(['DELETE']), requests_made)
def test_notification_worker(self):
pages_called = []