Simplifying queries around images and placements
Only verbs needs to load placements for multiple images, so we can vastly simplify and optimize most queries by making it two-step, and having the rest of the image loads not worry about placements
This commit is contained in:
parent
0c7c9a7a0a
commit
8146646761
7 changed files with 78 additions and 141 deletions
|
@ -58,7 +58,7 @@ class TestImageTree(unittest.TestCase):
|
|||
return True
|
||||
|
||||
result = tree.find_longest_path(base_image.id, checker)
|
||||
self.assertEquals(4, len(result))
|
||||
self.assertEquals(5, len(result))
|
||||
self.assertEquals('prod', tree.tag_containing_image(result[-1]))
|
||||
|
||||
def test_filtering(self):
|
||||
|
@ -74,23 +74,6 @@ class TestImageTree(unittest.TestCase):
|
|||
result = tree.find_longest_path(base_image.id, checker)
|
||||
self.assertEquals(0, len(result))
|
||||
|
||||
def test_find_tag_parent_image(self):
|
||||
all_images = list(model.image.get_repository_images(NAMESPACE, COMPLEX_REPO))
|
||||
all_tags = list(model.tag.list_repository_tags(NAMESPACE, COMPLEX_REPO))
|
||||
tree = ImageTree(all_images, all_tags)
|
||||
|
||||
base_image = self._get_base_image(all_images)
|
||||
|
||||
def checker(index, image):
|
||||
return True
|
||||
|
||||
result = tree.find_longest_path(base_image.id, checker)
|
||||
self.assertEquals(4, len(result))
|
||||
|
||||
# Only use the first two images. They don't have tags, but the method should
|
||||
# still return the tag that contains them.
|
||||
self.assertEquals('staging', tree.tag_containing_image(result[0]))
|
||||
|
||||
def test_longest_path_simple_repo_direct_lookup(self):
|
||||
repository = model.repository.get_repository(NAMESPACE, SIMPLE_REPO)
|
||||
all_images = list(model.image.get_repository_images(NAMESPACE, SIMPLE_REPO))
|
||||
|
|
Reference in a new issue