Skip to content

Commit

Permalink
Update the legacy upgrade scenario too
Browse files Browse the repository at this point in the history
  • Loading branch information
vsedmik committed Nov 18, 2024
1 parent 2c031b8 commit 4566fdf
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 27 deletions.
2 changes: 1 addition & 1 deletion robottelo/constants/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@
},
'manifest_list': {
'count': 1,
'bootable': False,
'bootable': True,
'flatpak': False,
'labels_count': 0,
'annotations_count': 0,
Expand Down
63 changes: 37 additions & 26 deletions tests/upgrades/test_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,32 +348,43 @@ def test_post_container_repo_sync(self, target_sat, pre_upgrade_data):
"""
for repo_id in pre_upgrade_data.values():
repo = target_sat.api.Repository(id=repo_id).read()
dms = target_sat.api.Repository(id=repo_id).docker_manifests()['results']
assert all(
[CONTAINER_MANIFEST_LABELS.issubset(m.keys()) for m in dms]
), 'Some expected key is missing in the repository manifests'
expected_values = next(
(i for i in LABELLED_REPOS if i['upstream_name'] == repo.docker_upstream_name), None
)
assert expected_values, f'{repo.docker_upstream_name} not found in {LABELLED_REPOS}'
assert (
len(dms) == repo.content_counts['docker_manifest']
), 'Manifests count does not match the repository content counts'
assert (
len(dms) == expected_values['manifests_count']
), 'Manifests count does not meet the expectation'
assert all(
[m['is_bootable'] == expected_values['bootable'] for m in dms]
), 'Unexpected is_bootable flag'
assert all(
[m['is_flatpak'] == expected_values['flatpak'] for m in dms]
), 'Unexpected is_flatpak flag'
assert all(
[len(m['labels']) == expected_values['labels_count'] for m in dms]
), 'Unexpected lables count'
assert all(
[len(m['annotations']) == expected_values['annotations_count'] for m in dms]
), 'Unexpected annotations count'
for entity_type in ['manifest', 'manifest_list']:
entity_data = (
target_sat.api.Repository(id=repo.id).docker_manifests()['results']
if entity_type == 'manifest'
else target_sat.api.Repository(id=repo.id).docker_manifest_lists()['results']
)

assert all(
[CONTAINER_MANIFEST_LABELS.issubset(m.keys()) for m in entity_data]
), f'Some expected key is missing in the repository {entity_type}s'
expected_values = next(
(i for i in LABELLED_REPOS if i['upstream_name'] == repo.docker_upstream_name),
None,
)
assert expected_values, f'{repo.docker_upstream_name} not found in {LABELLED_REPOS}'
expected_values = expected_values[entity_type]
assert (
len(entity_data) == repo.content_counts[f'docker_{entity_type}']
), f'{entity_type}s count does not match the repository content counts'
assert (
len(entity_data) == expected_values['count']
), f'{entity_type}s count does not meet the expectation'
assert all(
[m['is_bootable'] == expected_values['bootable'] for m in entity_data]
), 'Unexpected is_bootable flag'
assert all(
[m['is_flatpak'] == expected_values['flatpak'] for m in entity_data]
), 'Unexpected is_flatpak flag'
assert all(
[len(m['labels']) == expected_values['labels_count'] for m in entity_data]
), 'Unexpected lables count'
assert all(
[
len(m['annotations']) == expected_values['annotations_count']
for m in entity_data
]
), 'Unexpected annotations count'


class TestSimpleContentAccessOnly:
Expand Down

0 comments on commit 4566fdf

Please sign in to comment.