Get rid of remaining slow query for garbage collection.
This commit is contained in:
parent
b0bffe56ca
commit
05e2773fa7
3 changed files with 33 additions and 16 deletions
|
@ -1,8 +1,6 @@
|
|||
import unittest
|
||||
import time
|
||||
|
||||
from peewee import fn, JOIN_LEFT_OUTER
|
||||
|
||||
from app import app, storage
|
||||
from initdb import setup_database_for_testing, finished_database_for_testing
|
||||
from data import model, database
|
||||
|
@ -166,13 +164,13 @@ class TestGarbageCollection(unittest.TestCase):
|
|||
repository = self.createRepository(latest=['i1', 'i2', 'i3'])
|
||||
|
||||
# Ensure that no repositories are returned by the has garbage check.
|
||||
self.assertIsNone(model.repository.find_repository_with_garbage())
|
||||
self.assertIsNone(model.repository.find_repository_with_garbage(1000000000))
|
||||
|
||||
# Delete a tag.
|
||||
self.deleteTag(repository, 'latest', perform_gc=False)
|
||||
|
||||
# There should still not be any repositories with garbage, due to time machine.
|
||||
self.assertIsNone(model.repository.find_repository_with_garbage())
|
||||
self.assertIsNone(model.repository.find_repository_with_garbage(1000000000))
|
||||
|
||||
# Change the time machine expiration on the namespace.
|
||||
(database.User.update(removed_tag_expiration_s=0)
|
||||
|
@ -180,7 +178,7 @@ class TestGarbageCollection(unittest.TestCase):
|
|||
.execute())
|
||||
|
||||
# Now we should find the repository for GC.
|
||||
repository = model.repository.find_repository_with_garbage()
|
||||
repository = model.repository.find_repository_with_garbage(0)
|
||||
self.assertIsNotNone(repository)
|
||||
self.assertEquals(REPO, repository.name)
|
||||
|
||||
|
@ -188,7 +186,7 @@ class TestGarbageCollection(unittest.TestCase):
|
|||
model.repository.garbage_collect_repository(repository.namespace_user.username, repository.name)
|
||||
|
||||
# There should now be no repositories with garbage.
|
||||
self.assertIsNone(model.repository.find_repository_with_garbage())
|
||||
self.assertIsNone(model.repository.find_repository_with_garbage(0))
|
||||
|
||||
|
||||
def test_one_tag(self):
|
||||
|
|
Reference in a new issue