From 4566fdf355cb81cf66da9e588ac592f95362480d Mon Sep 17 00:00:00 2001 From: Vladimir Sedmik Date: Mon, 18 Nov 2024 17:47:35 +0100 Subject: [PATCH] Update the legacy upgrade scenario too --- robottelo/constants/__init__.py | 2 +- tests/upgrades/test_repository.py | 63 ++++++++++++++++++------------- 2 files changed, 38 insertions(+), 27 deletions(-) diff --git a/robottelo/constants/__init__.py b/robottelo/constants/__init__.py index 8cf4cb3b648..9b0a73a277f 100644 --- a/robottelo/constants/__init__.py +++ b/robottelo/constants/__init__.py @@ -721,7 +721,7 @@ }, 'manifest_list': { 'count': 1, - 'bootable': False, + 'bootable': True, 'flatpak': False, 'labels_count': 0, 'annotations_count': 0, diff --git a/tests/upgrades/test_repository.py b/tests/upgrades/test_repository.py index 3bb8c810b4d..bb730ca847e 100644 --- a/tests/upgrades/test_repository.py +++ b/tests/upgrades/test_repository.py @@ -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: