Merge pull request #1662 from jakedt/gcrandomtest

Add a test to make sure the random policy function runs.
This commit is contained in:
Jake Moshenko 2016-08-01 18:49:24 -04:00 committed by GitHub
commit 61bc358516

View file

@ -1,6 +1,8 @@
import unittest
import time
from playhouse.test_utils import assert_query_count
from app import app, storage
from initdb import setup_database_for_testing, finished_database_for_testing
from data import model, database
@ -189,6 +191,13 @@ class TestGarbageCollection(unittest.TestCase):
self.assertIsNone(model.repository.find_repository_with_garbage(0))
def test_find_garbage_policy_functions(self):
with assert_query_count(1):
one_policy = model.repository.get_random_gc_policy()
all_policies = model.repository._get_gc_expiration_policies()
self.assertIn(one_policy, all_policies)
def test_one_tag(self):
""" Create a repository with a single tag, then remove that tag and verify that the repository
is now empty. """