Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CV already published + single LCE #13972

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 12 additions & 18 deletions tests/foreman/cli/test_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -2015,16 +2015,19 @@ def test_negative_without_attach(
@pytest.mark.cli_host_subscription
@pytest.mark.tier3
def test_negative_without_attach_with_lce(
target_sat, host_subscription_client, function_org, function_lce
target_sat,
host_subscription_client,
function_org,
function_lce,
):
"""Attempt to enable a repository of a subscription that was not
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should update the description wrt to SCA switch and expected results. Also good to have test name modified for sca switching!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. I'll update :expectedresults: to reflect what we expect to happen with{,out} SCA.

I wouldn't change the test name though in order to keep history. I think it's descriptive enough as it is.

attached to a host
attached to a host.
This test is not using the host_subscription entities except
subscription_name and repository_id

:id: fc469e70-a7cb-4fca-b0ea-3c9e3dfff849

:expectedresults: repository not enabled on host
:expectedresults: Repository enabled due to SCA. Why is this "negative"? To keep history, because pre-6.16, this would have failed.

:parametrized: yes
"""
Expand All @@ -2036,8 +2039,8 @@ def test_negative_without_attach_with_lce(
target_sat.cli_factory.setup_org_for_a_rh_repo(
{
'product': PRDS['rhel'],
'repository-set': REPOSET['rhst7'],
'repository': REPOS['rhst7']['name'],
'repository-set': REPOSET['rhsclient7'],
'repository': REPOS['rhsclient7']['name'],
'organization-id': function_org.id,
'content-view-id': content_view.id,
'lifecycle-environment-id': function_lce.id,
Expand All @@ -2046,27 +2049,18 @@ def test_negative_without_attach_with_lce(
},
force_use_cdn=True,
)
host_lce = target_sat.api.LifecycleEnvironment(organization=function_org).create()
# refresh content view data
content_view.publish()
content_view.read().version[-1].promote(data={'environment_ids': host_lce.id, 'force': False})

# register client
host_subscription_client.register_contenthost(
function_org.name,
lce=f'{host_lce.name}/{content_view.name}',
lce=f'{function_lce.name}/{content_view.name}',
auto_attach=False,
)

# get list of available subscriptions which are matched with default subscription
subscriptions = host_subscription_client.run(
f'subscription-manager list --available --matches "{DEFAULT_SUBSCRIPTION_NAME}" --pool-only'
)
pool_id = subscriptions.stdout.strip()
# attach to plain RHEL subsctiption
host_subscription_client.subscription_manager_attach_pool([pool_id])
assert host_subscription_client.subscribed
host_subscription_client.enable_repo(REPOS['rhst7']['id'])
res = host_subscription_client.enable_repo(REPOS['rhsclient7']['id'])
assert res.status == 0
assert f"Repository '{REPOS['rhsclient7']['id']}' is enabled for this system." in res.stdout


@pytest.mark.e2e
Expand Down