Add interface for batch creation of labels on a manifest
This cannot be a true batch operation right now because of the current mapping table entries needed, but we can create and use the interface now and change the underlying implementation later
This commit is contained in:
parent
8cfb3f4fe8
commit
03789b2210
3 changed files with 51 additions and 0 deletions
|
@ -167,6 +167,21 @@ def test_manifest_labels(pre_oci_model):
|
|||
assert created not in pre_oci_model.list_manifest_labels(found_manifest)
|
||||
|
||||
|
||||
def test_batch_labels(pre_oci_model):
|
||||
repo = model.repository.get_repository('devtable', 'history')
|
||||
repository_ref = RepositoryReference.for_repo_obj(repo)
|
||||
found_tag = pre_oci_model.find_matching_tag(repository_ref, ['latest'])
|
||||
found_manifest = pre_oci_model.get_manifest_for_tag(found_tag)
|
||||
|
||||
with pre_oci_model.batch_create_manifest_labels(found_manifest) as add_label:
|
||||
add_label('foo', '1', 'api')
|
||||
add_label('bar', '2', 'api')
|
||||
add_label('baz', '3', 'api')
|
||||
|
||||
# Ensure we can look them up.
|
||||
assert len(pre_oci_model.list_manifest_labels(found_manifest)) == 3
|
||||
|
||||
|
||||
@pytest.mark.parametrize('repo_namespace, repo_name', [
|
||||
('devtable', 'simple'),
|
||||
('devtable', 'complex'),
|
||||
|
|
Reference in a new issue