def test_delete_tags_for_manifest(initialized_db): for tag in list(filter_to_visible_tags(filter_to_alive_tags(Tag.select()))): repo = tag.repository assert get_tag(repo, tag.name) == tag with assert_query_count(4): assert delete_tags_for_manifest(tag.manifest) == [tag] assert get_tag(repo, tag.name) is None
def test_get_tag(initialized_db): found = False for tag in filter_to_visible_tags(filter_to_alive_tags(Tag.select())): repo = tag.repository with assert_query_count(1): assert get_tag(repo, tag.name) == tag found = True assert found
def test_delete_tag(initialized_db): found = False for tag in list(filter_to_visible_tags(filter_to_alive_tags(Tag.select()))): repo = tag.repository assert get_tag(repo, tag.name) == tag assert tag.lifetime_end_ms is None with assert_query_count(3): assert delete_tag(repo, tag.name) == tag assert get_tag(repo, tag.name) is None found = True assert found
def test_lookup_alive_tags_shallow(initialized_db): found = False for tag in filter_to_visible_tags(filter_to_alive_tags(Tag.select())): tags = lookup_alive_tags_shallow(tag.repository) found = True assert tag in tags assert found # Ensure hidden tags cannot be listed. tag = Tag.get() tag.hidden = True tag.save() tags = lookup_alive_tags_shallow(tag.repository) assert tag not in tags
def test_list_alive_tags(initialized_db): found = False for tag in filter_to_visible_tags(filter_to_alive_tags(Tag.select())): tags = list_alive_tags(tag.repository) assert tag in tags with assert_query_count(1): legacy_images = get_legacy_images_for_tags(tags) for tag in tags: assert ManifestLegacyImage.get(manifest=tag.manifest).image == legacy_images[tag.id] found = True assert found # Ensure hidden tags cannot be listed. tag = Tag.get() tag.hidden = True tag.save() tags = list_alive_tags(tag.repository) assert tag not in tags