Fix issue accessing a null tagmanifest under a tag in a repository
This commit is contained in:
parent
cf8e71f1e8
commit
c34eacb4fa
4 changed files with 41 additions and 2 deletions
|
@ -13,7 +13,8 @@ from flask import jsonify, g
|
|||
from flask_principal import Identity
|
||||
|
||||
from app import storage
|
||||
from data.database import close_db_filter, configure, DerivedStorageForImage, QueueItem, Image
|
||||
from data.database import (close_db_filter, configure, DerivedStorageForImage, QueueItem, Image,
|
||||
TagManifest)
|
||||
from data import model
|
||||
from endpoints.csrf import generate_csrf_token
|
||||
from util.log import logfile_path
|
||||
|
@ -105,6 +106,10 @@ def registry_server_executor(app):
|
|||
namespace_obj.save()
|
||||
return 'OK'
|
||||
|
||||
def delete_manifests():
|
||||
TagManifest.delete().execute()
|
||||
return 'OK'
|
||||
|
||||
executor = LiveServerExecutor()
|
||||
executor.register('generate_csrf', generate_csrf)
|
||||
executor.register('set_supports_direct_download', set_supports_direct_download)
|
||||
|
@ -118,6 +123,7 @@ def registry_server_executor(app):
|
|||
executor.register('reload_app', reload_app)
|
||||
executor.register('create_app_repository', create_app_repository)
|
||||
executor.register('disable_namespace', disable_namespace)
|
||||
executor.register('delete_manifests', delete_manifests)
|
||||
return executor
|
||||
|
||||
|
||||
|
|
|
@ -34,6 +34,23 @@ def test_basic_push_pull(pusher, puller, basic_images, liveserver_session, app_r
|
|||
credentials=credentials)
|
||||
|
||||
|
||||
def test_no_tag_manifests(pusher, puller, basic_images, liveserver_session, app_reloader,
|
||||
liveserver, registry_server_executor):
|
||||
""" Test: Basic pull without manifests. """
|
||||
credentials = ('devtable', 'password')
|
||||
|
||||
# Push a new repository.
|
||||
pusher.push(liveserver_session, 'devtable', 'newrepo', 'latest', basic_images,
|
||||
credentials=credentials)
|
||||
|
||||
# Delete all tag manifests.
|
||||
registry_server_executor.on(liveserver).delete_manifests()
|
||||
|
||||
# Ensure we can still pull.
|
||||
puller.pull(liveserver_session, 'devtable', 'newrepo', 'latest', basic_images,
|
||||
credentials=credentials)
|
||||
|
||||
|
||||
def test_basic_push_pull_by_manifest(manifest_protocol, basic_images, liveserver_session,
|
||||
app_reloader):
|
||||
""" Test: Basic push and pull-by-manifest of an image to a new repository. """
|
||||
|
|
Reference in a new issue