diff --git a/tests/foreman/cli/test_satellitesync.py b/tests/foreman/cli/test_satellitesync.py index c3df11569da..bdb678e59b8 100644 --- a/tests/foreman/cli/test_satellitesync.py +++ b/tests/foreman/cli/test_satellitesync.py @@ -130,8 +130,8 @@ def function_synced_custom_repo(target_sat, function_org, function_product): @pytest.fixture -def function_synced_rhel_repo(request, target_sat, function_sca_manifest_org): - """Enable and synchronize rhel content with immediate policy""" +def function_synced_rh_repo(request, target_sat, function_sca_manifest_org): + """Enable and synchronize RH repo with immediate policy""" repo_dict = ( REPOS['kickstart'][request.param.replace('kickstart', '')[1:]] if 'kickstart' in request.param @@ -325,7 +325,7 @@ def test_positive_export_library_custom_repo( @pytest.mark.tier3 @pytest.mark.upgrade @pytest.mark.parametrize( - 'function_synced_rhel_repo', + 'function_synced_rh_repo', ['rhae2'], indirect=True, ) @@ -334,7 +334,7 @@ def test_positive_export_complete_library_rh_repo( target_sat, export_import_cleanup_function, function_sca_manifest_org, - function_synced_rhel_repo, + function_synced_rh_repo, ): """Export RedHat repo via complete library @@ -363,7 +363,7 @@ def test_positive_export_complete_library_rh_repo( { 'id': cv['id'], 'organization-id': function_sca_manifest_org.id, - 'repository-id': function_synced_rhel_repo['id'], + 'repository-id': function_synced_rh_repo['id'], } ) target_sat.cli.ContentView.publish({'id': cv['id']}) @@ -621,7 +621,7 @@ def test_positive_export_import_cv_end_to_end( @pytest.mark.upgrade @pytest.mark.tier3 @pytest.mark.parametrize( - 'function_synced_rhel_repo', + 'function_synced_rh_repo', ['rhae2'], indirect=True, ) @@ -633,7 +633,7 @@ def test_positive_export_import_default_org_view( function_sca_manifest_org, function_import_org_with_manifest, function_synced_custom_repo, - function_synced_rhel_repo, + function_synced_rh_repo, ): """Export Default Organization View version contents in directory and Import them. @@ -676,7 +676,7 @@ def test_positive_export_import_default_org_view( { 'id': cv['id'], 'organization-id': function_sca_manifest_org.id, - 'repository-id': function_synced_rhel_repo['id'], + 'repository-id': function_synced_rh_repo['id'], } ) target_sat.cli.ContentView.publish({'id': cv['id']}) @@ -897,7 +897,7 @@ def test_positive_export_import_promoted_cv( @pytest.mark.upgrade @pytest.mark.e2e @pytest.mark.parametrize( - 'function_synced_rhel_repo', + 'function_synced_rh_repo', ['kickstart-rhel7', 'kickstart-rhel8_bos', 'rhscl7'], indirect=True, ) @@ -908,7 +908,7 @@ def test_positive_export_import_redhat_cv( config_export_import_settings, function_sca_manifest_org, function_import_org_with_manifest, - function_synced_rhel_repo, + function_synced_rh_repo, ): """Export CV version with RedHat contents in directory and import them. @@ -943,7 +943,7 @@ def test_positive_export_import_redhat_cv( { 'id': cv['id'], 'organization-id': function_sca_manifest_org.id, - 'repository-id': function_synced_rhel_repo['id'], + 'repository-id': function_synced_rh_repo['id'], } ) target_sat.cli.ContentView.publish({'id': cv['id']}) @@ -980,15 +980,15 @@ def test_positive_export_import_redhat_cv( assert len(exported_packages) == len(imported_packages) exported_repo = target_sat.cli.Repository.info( { - 'name': function_synced_rhel_repo['name'], - 'product': function_synced_rhel_repo['product']['name'], + 'name': function_synced_rh_repo['name'], + 'product': function_synced_rh_repo['product']['name'], 'organization-id': function_sca_manifest_org.id, } ) imported_repo = target_sat.cli.Repository.info( { - 'name': function_synced_rhel_repo['name'], - 'product': function_synced_rhel_repo['product']['name'], + 'name': function_synced_rh_repo['name'], + 'product': function_synced_rh_repo['product']['name'], 'organization-id': function_import_org_with_manifest.id, } ) @@ -1321,7 +1321,7 @@ def test_postive_export_import_cv_with_file_content( @pytest.mark.tier2 @pytest.mark.parametrize( - 'function_synced_rhel_repo', + 'function_synced_rh_repo', ['rhae2'], indirect=True, ) @@ -1330,7 +1330,7 @@ def test_positive_export_rerun_failed_import( target_sat, config_export_import_settings, export_import_cleanup_function, - function_synced_rhel_repo, + function_synced_rh_repo, function_sca_manifest_org, function_import_org_with_manifest, ): @@ -1367,7 +1367,7 @@ def test_positive_export_rerun_failed_import( { 'id': cv['id'], 'organization-id': function_sca_manifest_org.id, - 'repository-id': function_synced_rhel_repo['id'], + 'repository-id': function_synced_rh_repo['id'], } ) target_sat.cli.ContentView.publish({'id': cv['id']}) @@ -1548,7 +1548,7 @@ def test_postive_export_import_repo_with_GPG( @pytest.mark.tier3 @pytest.mark.parametrize( - 'function_synced_rhel_repo', + 'function_synced_rh_repo', ['rhae2'], indirect=True, ) @@ -1558,7 +1558,7 @@ def test_negative_import_redhat_cv_without_manifest( export_import_cleanup_function, config_export_import_settings, function_sca_manifest_org, - function_synced_rhel_repo, + function_synced_rh_repo, ): """Redhat content can't be imported into satellite/organization without manifest @@ -1588,7 +1588,7 @@ def test_negative_import_redhat_cv_without_manifest( { 'id': cv['id'], 'organization-id': function_sca_manifest_org.id, - 'repository-id': function_synced_rhel_repo['id'], + 'repository-id': function_synced_rh_repo['id'], } ) target_sat.cli.ContentView.publish({'id': cv['id']}) @@ -1697,7 +1697,7 @@ def test_positive_import_content_for_disconnected_sat_with_existing_content( @pytest.mark.tier3 @pytest.mark.parametrize( - 'function_synced_rhel_repo', + 'function_synced_rh_repo', ['rhae2'], indirect=True, ) @@ -1707,7 +1707,7 @@ def test_positive_export_incremental_syncable_check_content( export_import_cleanup_function, config_export_import_settings, function_sca_manifest_org, - function_synced_rhel_repo, + function_synced_rh_repo, ): """Export complete and incremental CV version in syncable format and assert that all files referenced in the repomd.xml (including productid) are present in the exports. @@ -1743,7 +1743,7 @@ def test_positive_export_incremental_syncable_check_content( { 'id': cv['id'], 'organization-id': function_sca_manifest_org.id, - 'repository-id': function_synced_rhel_repo['id'], + 'repository-id': function_synced_rh_repo['id'], } ) target_sat.cli.ContentView.publish({'id': cv['id']}) @@ -1945,7 +1945,7 @@ def test_positive_export_import_incremental_yum_repo( @pytest.mark.tier3 @pytest.mark.parametrize( - 'function_synced_rhel_repo', + 'function_synced_rh_repo', ['rhae2'], indirect=True, ) @@ -1956,7 +1956,7 @@ def test_positive_export_import_mismatch_label( config_export_import_settings, function_sca_manifest_org, function_import_org_with_manifest, - function_synced_rhel_repo, + function_synced_rh_repo, ): """Export and import repo with mismatched label @@ -1985,7 +1985,7 @@ def test_positive_export_import_mismatch_label( assert target_sat.validate_pulp_filepath(function_sca_manifest_org, PULP_EXPORT_DIR) == '' # Export the repository and check the export directory export = target_sat.cli.ContentExport.completeRepository( - {'id': function_synced_rhel_repo['id']} + {'id': function_synced_rh_repo['id']} ) assert '1.0' in target_sat.validate_pulp_filepath( function_sca_manifest_org, PULP_EXPORT_DIR @@ -1999,8 +1999,8 @@ def test_positive_export_import_mismatch_label( ) import_repo = target_sat.cli.Repository.info( { - 'name': function_synced_rhel_repo['name'], - 'product': function_synced_rhel_repo['product']['name'], + 'name': function_synced_rh_repo['name'], + 'product': function_synced_rh_repo['product']['name'], 'organization-id': function_sca_manifest_org.id, } ) @@ -2008,7 +2008,7 @@ def test_positive_export_import_mismatch_label( # Export again and check the export directory export = target_sat.cli.ContentExport.completeRepository( - {'id': function_synced_rhel_repo['id']} + {'id': function_synced_rh_repo['id']} ) assert '2.0' in target_sat.validate_pulp_filepath( function_sca_manifest_org, PULP_EXPORT_DIR @@ -2017,7 +2017,7 @@ def test_positive_export_import_mismatch_label( # Change the repo label in metadata.json and run the import again import_path = target_sat.move_pulp_archive(function_sca_manifest_org, export['message']) target_sat.execute( - f'''sed -i 's/"label":"{function_synced_rhel_repo['label']}"/''' + f'''sed -i 's/"label":"{function_synced_rh_repo['label']}"/''' f'''"label":"{gen_string("alpha")}"/g' {import_path}/metadata.json''' ) target_sat.cli.ContentImport.repository( @@ -2036,7 +2036,7 @@ def test_positive_export_import_mismatch_label( @pytest.mark.tier3 @pytest.mark.parametrize( - 'function_synced_rhel_repo', + 'function_synced_rh_repo', ['rhae2'], indirect=True, ) @@ -2047,7 +2047,7 @@ def test_positive_custom_cdn_with_credential( export_import_cleanup_function, config_export_import_settings, function_sca_manifest_org, - function_synced_rhel_repo, # TODO rename this to `function_synced_rh_repo` + function_synced_rh_repo, satellite_host, function_sca_manifest, ): @@ -2087,7 +2087,7 @@ def test_positive_custom_cdn_with_credential( # Export the repository in syncable format and move it # to /var/www/html/pub/repos to mimic custom CDN. target_sat.cli.ContentExport.completeRepository( - {'id': function_synced_rhel_repo['id'], 'format': 'syncable'} + {'id': function_synced_rh_repo['id'], 'format': 'syncable'} ) assert '1.0' in target_sat.validate_pulp_filepath( function_sca_manifest_org, PULP_EXPORT_DIR @@ -2136,12 +2136,12 @@ def test_positive_custom_cdn_with_credential( reposet = satellite_host.cli.RepositorySet.list( { 'organization-id': import_org.id, - 'search': f'content_label={function_synced_rhel_repo["content-label"]}', + 'search': f'content_label={function_synced_rh_repo["content-label"]}', } ) assert ( len(reposet) == 1 - ), f'Expected just one reposet for "{function_synced_rhel_repo["content-label"]}"' + ), f'Expected just one reposet for "{function_synced_rh_repo["content-label"]}"' res = satellite_host.cli.RepositorySet.enable( { 'organization-id': import_org.id, @@ -2161,7 +2161,9 @@ def test_positive_custom_cdn_with_credential( f'{target_sat.hostname}/pub/repos/' in repo['url'] ), 'Enabled repo does not point to the upstream Satellite' assert 'Success' in repo['sync']['status'], 'Sync did not succeed' - assert int(repo['content-counts']['packages']) > 0, 'No synced packages downstream' + assert ( + repo['content-counts'] == function_synced_rh_repo['content-counts'] + ), 'Content counts do not match' @pytest.mark.stubbed @pytest.mark.tier3 @@ -2265,7 +2267,7 @@ class TestNetworkSync: @pytest.mark.tier2 @pytest.mark.parametrize( - 'function_synced_rhel_repo', + 'function_synced_rh_repo', ['rhae2'], indirect=True, ) @@ -2273,7 +2275,7 @@ def test_positive_network_sync_rh_repo( self, target_sat, function_sca_manifest_org, - function_synced_rhel_repo, + function_synced_rh_repo, module_downstream_sat, function_downstream_org, ): @@ -2312,12 +2314,12 @@ def test_positive_network_sync_rh_repo( reposet = module_downstream_sat.cli.RepositorySet.list( { 'organization-id': function_downstream_org.id, - 'search': f'content_label={function_synced_rhel_repo["content-label"]}', + 'search': f'content_label={function_synced_rh_repo["content-label"]}', } ) assert ( len(reposet) == 1 - ), f'Expected just one reposet for "{function_synced_rhel_repo["content-label"]}"' + ), f'Expected just one reposet for "{function_synced_rh_repo["content-label"]}"' res = module_downstream_sat.cli.RepositorySet.enable( { 'organization-id': function_downstream_org.id, @@ -2337,5 +2339,5 @@ def test_positive_network_sync_rh_repo( repo = module_downstream_sat.cli.Repository.info({'id': repo['id']}) assert 'Success' in repo['sync']['status'], 'Sync did not succeed' assert ( - repo['content-counts'] == function_synced_rhel_repo['content-counts'] + repo['content-counts'] == function_synced_rh_repo['content-counts'] ), 'Content counts do not match'