Rename store_tag_manifest to indicate clearly it is only to be used for testing

This commit is contained in:
Joseph Schorr 2018-08-07 14:52:59 -04:00
parent e33ccff8cb
commit e3da522d26
3 changed files with 7 additions and 8 deletions

View file

@ -549,8 +549,8 @@ def restore_tag_to_image(repo_obj, tag_name, docker_image_id):
return existing_image
def store_tag_manifest(namespace_name, repository_name, tag_name, manifest, leaf_layer_id=None,
reversion=False):
def store_tag_manifest_for_testing(namespace_name, repository_name, tag_name, manifest,
leaf_layer_id=None):
""" Stores a tag manifest for a specific tag name in the database. Returns the TagManifest
object, as well as a boolean indicating whether the TagManifest was created.
"""
@ -559,8 +559,7 @@ def store_tag_manifest(namespace_name, repository_name, tag_name, manifest, leaf
except Repository.DoesNotExist:
raise DataModelException('Invalid repository %s/%s' % (namespace_name, repository_name))
return store_tag_manifest_for_repo(repo.id, tag_name, manifest, leaf_layer_id=leaf_layer_id,
reversion=False)
return store_tag_manifest_for_repo(repo.id, tag_name, manifest, leaf_layer_id=leaf_layer_id)
def store_tag_manifest_for_repo(repository_id, tag_name, manifest, leaf_layer_id=None,

View file

@ -72,8 +72,8 @@ def store_tag_manifest(namespace, repo_name, tag_name, image_id):
pass
manifest = builder.build(docker_v2_signing_key)
manifest_row, _ = model.tag.store_tag_manifest(namespace, repo_name, tag_name, manifest,
leaf_layer_id=image_id)
manifest_row, _ = model.tag.store_tag_manifest_for_testing(namespace, repo_name, tag_name,
manifest, leaf_layer_id=image_id)
return manifest_row

View file

@ -13,7 +13,7 @@ from data.database import (Image, RepositoryTag, ImageStorage, Repository, Manif
from data.model.repository import create_repository
from data.model.tag import (list_active_repo_tags, create_or_update_tag, delete_tag,
get_matching_tags, _tag_alive, get_matching_tags_for_images,
change_tag_expiration, get_active_tag, store_tag_manifest)
change_tag_expiration, get_active_tag, store_tag_manifest_for_testing)
from data.model.image import find_create_or_link_image
from image.docker.schema1 import DockerSchema1ManifestBuilder
from util.timedeltastring import convert_to_timedelta
@ -234,7 +234,7 @@ def test_store_tag_manifest(initialized_db):
find_create_or_link_image(image_id, repo, 'devtable', {}, 'local_us')
manifest = builder.build(docker_v2_signing_key)
tag_manifest, _ = store_tag_manifest('devtable', 'simple', 'sometag', manifest)
tag_manifest, _ = store_tag_manifest_for_testing('devtable', 'simple', 'sometag', manifest)
# Ensure we have the new-model expected rows.
mapping_row = TagManifestToManifest.get(tag_manifest=tag_manifest)