Add a GC test for a noop

This commit is contained in:
Joseph Schorr 2014-10-17 17:48:31 -04:00
parent 6ca0115b5e
commit 0c0cd693dd

View file

@ -58,6 +58,9 @@ class TestGarbageColection(unittest.TestCase):
return repo
def gcNow(self, repository):
model.garbage_collect_repository(repository.namespace_user.username, repository.name)
def deleteTag(self, repository, tag):
model.delete_tag(repository.namespace_user.username, repository.name, tag)
model.garbage_collect_repository(repository.namespace_user.username, repository.name)
@ -182,5 +185,15 @@ class TestGarbageColection(unittest.TestCase):
self.deleteTag(repository, 'newtag')
self.assertDeleted(repository, 'i1')
def test_empty_gc(self):
repository = self.createRepository(
latest = ['i1', 'i2', 'i3'],
other = ['i1', 'f1', 'f2'],
third = ['t1', 't2', 't3'],
fourth = ['i1', 'f1'])
self.gcNow(repository)
self.assertNotDeleted(repository,'i1', 'i2', 'i3', 't1', 't2', 't3', 'f1', 'f2')
if __name__ == '__main__':
unittest.main()