Skip to content

Commit

Permalink
Rename fixture with better name
Browse files Browse the repository at this point in the history
  • Loading branch information
vsedmik authored and pondrejk committed Jan 8, 2024
1 parent 59efe32 commit 6ca5aae
Showing 1 changed file with 44 additions and 42 deletions.
86 changes: 44 additions & 42 deletions tests/foreman/cli/test_satellitesync.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
)
Expand All @@ -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
Expand Down Expand Up @@ -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']})
Expand Down Expand Up @@ -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,
)
Expand All @@ -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.
Expand Down Expand Up @@ -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']})
Expand Down Expand Up @@ -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,
)
Expand All @@ -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.
Expand Down Expand Up @@ -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']})
Expand Down Expand Up @@ -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,
}
)
Expand Down Expand Up @@ -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,
)
Expand All @@ -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,
):
Expand Down Expand Up @@ -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']})
Expand Down Expand Up @@ -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,
)
Expand All @@ -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
Expand Down Expand Up @@ -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']})
Expand Down Expand Up @@ -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,
)
Expand All @@ -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.
Expand Down Expand Up @@ -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']})
Expand Down Expand Up @@ -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,
)
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -1999,16 +1999,16 @@ 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,
}
)
assert import_repo

# 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
Expand All @@ -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(
Expand All @@ -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,
)
Expand All @@ -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,
):
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -2265,15 +2267,15 @@ class TestNetworkSync:

@pytest.mark.tier2
@pytest.mark.parametrize(
'function_synced_rhel_repo',
'function_synced_rh_repo',
['rhae2'],
indirect=True,
)
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,
):
Expand Down Expand Up @@ -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,
Expand All @@ -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'

0 comments on commit 6ca5aae

Please sign in to comment.