Skip to content

Commit

Permalink
Fix upgrade scenarios tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vsedmik committed Sep 20, 2024
1 parent 05501d0 commit 4cda68d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
20 changes: 15 additions & 5 deletions tests/upgrades/test_errata.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def test_pre_scenario_generate_errata_for_client(
1. Create Product and Custom Yum Repo
2. Create custom tools, rhel repos and sync them
3. Create content view and publish it
4. Create activation key and add subscription
4. Create activation key, add subscription if applicable (if the org is SCA-disabled)
5. Register RHEL host to Satellite
6. Generate Errata by installing outdated/older packages
7. Check that errata applicability generated expected errata list for the given client.
Expand Down Expand Up @@ -148,10 +148,20 @@ def test_pre_scenario_generate_errata_for_client(
ak = target_sat.api.ActivationKey(
content_view=content_view, organization=function_org, environment=environment
).create()
subscription = target_sat.api.Subscription(organization=function_org).search(
query={'search': f'name={product.name}'}
)[0]
ak.add_subscriptions(data={'subscription_id': subscription.id})
if not target_sat.is_sca_mode_enabled(function_org.id):
subscription = target_sat.api.Subscription(organization=function_org).search(
query={'search': f'name={product.name}'}
)[0]
ak.add_subscriptions(data={'subscription_id': subscription.id})
# Override/enable all AK repos (disabled by default since 6.15)
c_labels = [
i['label'] for i in ak.product_content(data={'content_access_mode_all': '1'})['results']
]
ak.content_override(
data={
'content_overrides': [{'content_label': label, 'value': '1'} for label in c_labels]
}
)
rhel_contenthost.register(function_org, None, ak.name, target_sat)
rhel_contenthost.add_rex_key(satellite=target_sat)
rhel_contenthost.install_katello_host_tools()
Expand Down
10 changes: 9 additions & 1 deletion tests/upgrades/test_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,16 @@ def test_pre_scenario_custom_repo_check(self, target_sat, sat_upgrade_chost, sav
query={'search': f'name={product.name}'}
)[0]
ak.add_subscriptions(data={'subscription_id': subscription.id})
# Override/enable all AK repos (disabled by default since 6.15)
c_labels = [
i['label'] for i in ak.product_content(data={'content_access_mode_all': '1'})['results']
]
ak.content_override(
data={
'content_overrides': [{'content_label': label, 'value': '1'} for label in c_labels]
}
)
sat_upgrade_chost.register(org, None, ak.name, target_sat)
sat_upgrade_chost.execute('subscription-manager repos --enable=*;yum clean all')
result = sat_upgrade_chost.execute(f'yum install -y {FAKE_0_CUSTOM_PACKAGE_NAME}')
assert result.status == 0

Expand Down

0 comments on commit 4cda68d

Please sign in to comment.