diff --git a/tests/foreman/ui/test_errata.py b/tests/foreman/ui/test_errata.py index fb4c9f4419e..6e2b7d0362f 100644 --- a/tests/foreman/ui/test_errata.py +++ b/tests/foreman/ui/test_errata.py @@ -187,20 +187,21 @@ def function_registered_contenthost( organization=module_org, environment=[module_lce], ).create() - content_view.publish() - latest_cvv_id = sorted(cvv.id for cvv in content_view.read().version)[-1] - latest_cv_version = [ - version for version in content_view.read().version if version.id == latest_cvv_id - ][-1] - latest_cv_version.promote(data={'environment_ids': module_lce.id}) - content_view = content_view.read() activation_key = module_target_sat.api.ActivationKey( organization=module_org, environment=module_lce, - content_view=content_view, ).create() + #result = custom_repo.sync()['humanized'] + #assert len(result['errors']) == 0, f'Failed to sync custom repository: {str(result["errors"])}' + + #out1 = rhel_contenthost.execute(r'subscription-manager refresh') + #out2 = rhel_contenthost.execute(f'subscription-manager repos --enable {custom_repo_id}') + #out3 = rhel_contenthost.execute(r'subscription-manager repos --enable \*') + #out4 = rhel_contenthost.execute(r'yum-config-manager --enable \*') + + rhel_contenthost.create_custom_repos(custom_repo=repo_url) custom_repo_id = module_target_sat.cli_factory.setup_org_for_a_custom_repo( { 'url': repo_url, @@ -210,14 +211,7 @@ def function_registered_contenthost( 'content-view-id': content_view.id, } )['repository-id'] - rhel_contenthost.create_custom_repos(repo=repo_url) - rhel_contenthost.execute(r'subscription-manager repos --enable \*') - rhel_contenthost.execute(r'yum-config-manager --enable \*') - custom_repo = module_target_sat.api.Repository(id=custom_repo_id).read() - assert custom_repo - result = custom_repo.sync()['humanized'] - assert len(result['errors']) == 0, f'Failed to sync custom repository: {str(result["errors"])}' - rhel_contenthost.execute(r'subscription-manager refresh') + result = rhel_contenthost.register( activation_keys=activation_key.name, lifecycle_environment=module_lce, @@ -225,14 +219,28 @@ def function_registered_contenthost( org=module_org, loc=None, ) - assert result.status == 0, f'Failed to register host: {result.stderr}' + breakpoint() + + assert result.status == 0, f'Failed to register host: {result.stdout}' + assert rhel_contenthost.subscribed + + rhel_contenthost.create_custom_repos(custom_repo=repo_url) rhel_contenthost.execute(r'subscription-manager refresh') - rhel_contenthost.execute(f'yum-config-manager --enable {custom_repo_id}') - result = rhel_contenthost.execute(f'subscription-manager repos --enable {custom_repo_id}') + + + breakpoint() + + custom_repo = module_target_sat.api.Repository(id=custom_repo_id).read() + assert custom_repo + + result = custom_repo.sync()['humanized'] + assert len(result['errors']) == 0, f'Failed to sync custom repository: {str(result["errors"])}' + + result = rhel_contenthost.execute(f'subscription-manager repos --enable {custom_repo.id}') + breakpoint() assert ( result.status == 0 ), f'Failed to enable custom repo with subscription-manager: {result.stderr}' - assert rhel_contenthost.subscribed, f'Failed to subscribe the registered host: {result.stderr}' yield rhel_contenthost @@ -265,7 +273,7 @@ def function_registered_contenthost( def test_end_to_end( session, function_registered_contenthost, - module_entitlement_manifest_org, + module_org, module_lce, module_cv, module_target_sat,