Skip to content

Commit 4156562

Browse files
authored
export import increamental yum repo (#18547)
1 parent f1115ac commit 4156562

File tree

1 file changed

+39
-33
lines changed

1 file changed

+39
-33
lines changed

tests/foreman/cli/test_satellitesync.py

Lines changed: 39 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2926,31 +2926,25 @@ def test_positive_custom_cdn_with_credential(
29262926
@pytest.mark.pit_client
29272927
@pytest.mark.no_containers
29282928
@pytest.mark.rhel_ver_list([settings.content_host.default_rhel_version])
2929-
@pytest.mark.parametrize(
2930-
'function_synced_rh_repo',
2931-
['rhsclient9'],
2932-
indirect=True,
2933-
)
29342929
def test_positive_export_import_consume_incremental_yum_repo(
29352930
self,
29362931
target_sat,
29372932
export_import_cleanup_function,
29382933
config_export_import_settings,
2939-
function_sca_manifest_org,
2940-
function_import_org_with_manifest,
2941-
function_synced_rh_repo,
2934+
function_org,
2935+
function_import_org,
2936+
function_synced_custom_repo,
29422937
rhel_contenthost,
29432938
):
2944-
"""Export and import RH yum repo incrementally and consume it on a content host.
2939+
"""Export and import custom repo incrementally and consume it on a content host.
29452940
29462941
:id: f5515168-c3c9-4351-9f83-ba6265689db3
29472942
29482943
:setup:
2949-
1. Enabled and synced RH yum repository (RH Satellite Client for this case).
2950-
2. An unregistered RHEL8 host.
2944+
1. Enabled and synced custom yum repository.
29512945
29522946
:steps:
2953-
1. Create a CV with the RH yum repository.
2947+
1. Create a CV with the yum repository.
29542948
2. Add exclude RPM filter to filter out one package, publish version 1 and export it.
29552949
3. On the importing side import version 1, check the package count.
29562950
4. Create an AK with the imported CV, register the content host and check
@@ -2971,13 +2965,13 @@ def test_positive_export_import_consume_incremental_yum_repo(
29712965
# Create a CV with the RH yum repository.
29722966
exp_cv = target_sat.cli_factory.make_content_view(
29732967
{
2974-
'organization-id': function_sca_manifest_org.id,
2975-
'repository-ids': [function_synced_rh_repo['id']],
2968+
'organization-id': function_org.id,
2969+
'repository-ids': [function_synced_custom_repo['id']],
29762970
}
29772971
)
29782972

29792973
# Add exclude RPM filter to filter out one package, publish version 1 and export it.
2980-
filtered_pkg = 'katello-host-tools'
2974+
filtered_pkg = 'dog'
29812975
cvf = target_sat.cli_factory.make_content_view_filter(
29822976
{'content-view-id': exp_cv['id'], 'type': 'rpm'}
29832977
)
@@ -2990,17 +2984,15 @@ def test_positive_export_import_consume_incremental_yum_repo(
29902984
cvv_1 = exp_cv['versions'][0]
29912985
pkg_cnt_1 = target_sat.api.ContentViewVersion(id=cvv_1['id']).read().package_count
29922986
export_1 = target_sat.cli.ContentExport.completeVersion({'id': cvv_1['id']})
2993-
assert '1.0' in target_sat.validate_pulp_filepath(
2994-
function_sca_manifest_org, PULP_EXPORT_DIR
2995-
)
2987+
assert '1.0' in target_sat.validate_pulp_filepath(function_org, PULP_EXPORT_DIR)
29962988

29972989
# On the importing side import version 1, check the package count.
2998-
import_path1 = target_sat.move_pulp_archive(function_sca_manifest_org, export_1['message'])
2990+
import_path1 = target_sat.move_pulp_archive(function_org, export_1['message'])
29992991
target_sat.cli.ContentImport.version(
3000-
{'organization-id': function_import_org_with_manifest.id, 'path': import_path1}
2992+
{'organization-id': function_import_org.id, 'path': import_path1}
30012993
)
30022994
imp_cv = target_sat.cli.ContentView.info(
3003-
{'name': exp_cv['name'], 'organization-id': function_import_org_with_manifest.id}
2995+
{'name': exp_cv['name'], 'organization-id': function_import_org.id}
30042996
)
30052997
assert len(imp_cv['versions']) == 1
30062998
imp_cvv = imp_cv['versions'][0]
@@ -3012,19 +3004,24 @@ def test_positive_export_import_consume_incremental_yum_repo(
30123004
{
30133005
'content-view': exp_cv['name'],
30143006
'lifecycle-environment': ENVIRONMENT,
3015-
'organization-id': function_import_org_with_manifest.id,
3007+
'organization-id': function_import_org.id,
30163008
}
30173009
)
3010+
repo_content_label = target_sat.cli.Repository.info(
3011+
{
3012+
'name': function_synced_custom_repo['name'],
3013+
'product': function_synced_custom_repo['product']['name'],
3014+
'organization-id': function_import_org.id,
3015+
}
3016+
)['content-label']
30183017
target_sat.cli.ActivationKey.content_override(
30193018
{
30203019
'id': ak.id,
3021-
'content-label': function_synced_rh_repo['content-label'],
3020+
'content-label': repo_content_label,
30223021
'value': 'true',
30233022
}
30243023
)
3025-
res = rhel_contenthost.register(
3026-
function_import_org_with_manifest, None, ak.name, target_sat
3027-
)
3024+
res = rhel_contenthost.register(function_import_org, None, ak.name, target_sat)
30283025
assert res.status == 0, (
30293026
f'Failed to register host: {rhel_contenthost.hostname}\n'
30303027
f'StdOut: {res.stdout}\nStdErr: {res.stderr}'
@@ -3055,24 +3052,33 @@ def test_positive_export_import_consume_incremental_yum_repo(
30553052
pkg_cnt_2 = target_sat.api.ContentViewVersion(id=cvv_2['id']).read().package_count
30563053
assert pkg_cnt_2 > pkg_cnt_1
30573054
export_2 = target_sat.cli.ContentExport.incrementalVersion({'id': cvv_2['id']})
3058-
assert '2.0' in target_sat.validate_pulp_filepath(
3059-
function_sca_manifest_org, PULP_EXPORT_DIR
3060-
)
3055+
assert '2.0' in target_sat.validate_pulp_filepath(function_org, PULP_EXPORT_DIR)
30613056

30623057
# Import version 2, check the package count.
3063-
import_path2 = target_sat.move_pulp_archive(function_sca_manifest_org, export_2['message'])
3058+
import_path2 = target_sat.move_pulp_archive(function_org, export_2['message'])
30643059
target_sat.cli.ContentImport.version(
3065-
{'organization-id': function_import_org_with_manifest.id, 'path': import_path2}
3060+
{'organization-id': function_import_org.id, 'path': import_path2}
30663061
)
30673062
imp_cv = target_sat.cli.ContentView.info(
3068-
{'name': exp_cv['name'], 'organization-id': function_import_org_with_manifest.id}
3063+
{'name': exp_cv['name'], 'organization-id': function_import_org.id}
30693064
)
30703065
assert len(imp_cv['versions']) == 2
30713066
imp_cvv = max(imp_cv['versions'], key=lambda x: int(x['id']))
3067+
3068+
# Get actual package count from export organization
3069+
package_count = int(
3070+
target_sat.cli.Repository.info(
3071+
{
3072+
'name': function_synced_custom_repo['name'],
3073+
'product': function_synced_custom_repo['product']['name'],
3074+
'organization-id': function_org.id,
3075+
}
3076+
)['content-counts']['packages']
3077+
)
30723078
assert (
30733079
target_sat.api.ContentViewVersion(id=imp_cvv['id']).read().package_count
30743080
== pkg_cnt_2
3075-
== int(function_synced_rh_repo['content-counts']['packages'])
3081+
== package_count
30763082
), 'Unexpected package count after second import'
30773083

30783084
# Check the package count available to install on the content host.

0 commit comments

Comments
 (0)