Fix pushing of manifests whose layers share blobs
If a blob was repeated previously, we would get a constraint error from the ManifestBlob table
This commit is contained in:
parent
92743ca57b
commit
9669320df2
2 changed files with 39 additions and 8 deletions
|
@ -1104,3 +1104,25 @@ def test_login_scopes(username, password, scopes, expected_access, expect_succes
|
|||
{'SERVER_HOSTNAME': 'localhost:5000'})
|
||||
assert payload is not None
|
||||
assert payload['access'] == expected_access
|
||||
|
||||
|
||||
def test_push_pull_same_blobs(pusher, puller, liveserver_session, app_reloader):
|
||||
""" Test: Push and pull of an image to a new repository where a blob is shared between layers. """
|
||||
credentials = ('devtable', 'password')
|
||||
|
||||
layer_bytes = layer_bytes_for_contents('some contents')
|
||||
images = [
|
||||
Image(id='parentid', bytes=layer_bytes, parent_id=None),
|
||||
Image(id='someid', bytes=layer_bytes, parent_id='parentid'),
|
||||
]
|
||||
|
||||
options = ProtocolOptions()
|
||||
options.skip_head_checks = True # Since the blob will already exist.
|
||||
|
||||
# Push a new repository.
|
||||
pusher.push(liveserver_session, 'devtable', 'newrepo', 'latest', images,
|
||||
credentials=credentials, options=options)
|
||||
|
||||
# Pull the repository to verify.
|
||||
puller.pull(liveserver_session, 'devtable', 'newrepo', 'latest', images,
|
||||
credentials=credentials, options=options)
|
||||
|
|
Reference in a new issue