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

[RHEL10,9,8] Cover restrict repos by host OS, RHEL major versions #17415

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

damoore044
Copy link
Contributor

@damoore044 damoore044 commented Jan 22, 2025

Problem Statement

Cover [SAT-30636], which adds rhel-10 option to the Repository OS Restrict flag.

  • 3 repos restricted to RHEL-10/9/8 , using one matching registered host of one the selected rhel versions.
  • in 6.16.z and 6.15.z, implicitly selected RHEL versions will be 9/8/7 from supportability.yaml (N-2).

Solution

Implement stubbed coverage, that could have discovered this missing option during initial automation runs.

PRT Case

trigger: test-robottelo
pytest: tests/foreman/api/test_subscription.py::test_positive_os_restriction_on_repos

@damoore044 damoore044 added CherryPick PR needs CherryPick to previous branches Stream Introduced in or relating directly to Satellite Stream/Master 6.15.z Introduced in or relating directly to Satellite 6.15 6.16.z Introduced in or relating directly to Satellite 6.16 labels Jan 22, 2025
@damoore044 damoore044 self-assigned this Jan 22, 2025
@damoore044
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/api/test_subscription.py::test_positive_os_restriction_on_repos

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 9964
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/api/test_subscription.py::test_positive_os_restriction_on_repos --external-logging
Test Result : ================= 3 passed, 133 warnings in 1033.52s (0:17:13) =================

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Jan 22, 2025
@Satellite-QE Satellite-QE removed the PRT-Passed Indicates that latest PRT run is passed for the PR label Jan 23, 2025
Copy link

@ianballou ianballou left a comment

Choose a reason for hiding this comment

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

Just one question, but generally ACK from an SME point of view.

tests/foreman/api/test_subscription.py Outdated Show resolved Hide resolved
@damoore044
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/api/test_subscription.py::test_positive_os_restriction_on_repos

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 9974
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/api/test_subscription.py::test_positive_os_restriction_on_repos --external-logging
Test Result : ================= 3 passed, 131 warnings in 942.14s (0:15:42) ==================

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Jan 23, 2025
@damoore044 damoore044 marked this pull request as ready for review February 6, 2025 16:33
@damoore044 damoore044 requested a review from a team as a code owner February 6, 2025 16:33
@Satellite-QE Satellite-QE removed the PRT-Passed Indicates that latest PRT run is passed for the PR label Feb 6, 2025
@damoore044
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/api/test_subscription.py::test_positive_os_restriction_on_repos

@damoore044 damoore044 changed the title Test OS Restrict for repositories [RHEL10,9,8] Cover restrict repos by host OS, RHEL major versions Feb 6, 2025
@Satellite-QE
Copy link
Collaborator

Satellite-QE commented Feb 6, 2025

PRT Result

Build Number: 10111
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/api/test_subscription.py::test_positive_os_restriction_on_repos --external-logging
Test Result : ============= 2 passed, 81 warnings, 1 error in 798.64s (0:13:18) ==============

^ one Broker checkout error [RHEL9 chost] for

failed on setup with "podman.errors.exceptions.APIError: 409 Client Error: 
Conflict (cannot exec in a container that is not running; container {} is stopped).

@Satellite-QE Satellite-QE added the PRT-Failed Indicates that latest PRT run is failed for the PR label Feb 6, 2025
@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 10112
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/api/test_subscription.py::test_positive_os_restriction_on_repos --external-logging
Test Result : ============= 2 passed, 97 warnings, 1 error in 868.83s (0:14:28) ==============

@damoore044
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/api/test_subscription.py::test_positive_os_restriction_on_repos

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 10115
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/api/test_subscription.py::test_positive_os_restriction_on_repos --external-logging
Test Result : ============= 2 passed, 85 warnings, 1 error in 854.92s (0:14:14) ==============

Copy link
Contributor

@vsedmik vsedmik left a comment

Choose a reason for hiding this comment

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

Left a couple of proposals to consider and a question.

module_sca_manifest_org,
):
"""Verify that you can specify OS restrictions on custom repos for registered host.
parametrized: (3) newest supported RHEL distro (N), and two prior.

:id: fd40842f-48c3-4505-a670-235d8a5f466b
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
:id: fd40842f-48c3-4505-a670-235d8a5f466b
:id: fd40842f-48c3-4505-a670-235d8a5f466b
:parametrized: yes

Comment on lines +464 to +465
for repo in custom_repos:
assert repo.label in sub_man_repos
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
for repo in custom_repos:
assert repo.label in sub_man_repos
assert all(repo.label in sub_man_repos for repo in custom_repos)

assert repo.label in sub_man_repos

# restrict each repo to a different RHEL major version
rhel_majors = [ver for ver in rhel_versions]
Copy link
Contributor

Choose a reason for hiding this comment

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

Aren't the rhel_versions major already?

>>> rhel_versions = [
                    rhel_major_ver
                    for rhel_major_ver in settings.supportability.content_hosts.rhel.versions
                    if 'fips' not in str(rhel_major_ver)
                ][-3:]
>>> rhel_versions
[8, 9, 10]
Suggested change
rhel_majors = [ver for ver in rhel_versions]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes they are I just made a copy list (rhel_majors) to edit without editing the original list (rhel_versions).

Comment on lines +474 to +478
result = target_sat.execute(
f'hammer repository update --os-versions "{formatted}"'
f' --id {r.id} --organization-id {org.id}'
)
assert result.status == 0, f'{result.stdout}'
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
result = target_sat.execute(
f'hammer repository update --os-versions "{formatted}"'
f' --id {r.id} --organization-id {org.id}'
)
assert result.status == 0, f'{result.stdout}'
target_sat.cli.Repository.update({'os-version': formatted, 'id': r.id})

should throw exception for non-zero result

Comment on lines +498 to +499
for label in disabled_repos_labels:
assert label not in sub_man_repos
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
for label in disabled_repos_labels:
assert label not in sub_man_repos
assert all(label not in sub_man_repos for label in disabled_repos_labels)

@damoore044
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/api/test_subscription.py::test_positive_os_restriction_on_repos[rhel9-ipv4]

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 10126
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/api/test_subscription.py::test_positive_os_restriction_on_repos[rhel9-ipv4] --external-logging
Test Result : =================== 9 warnings, 1 error in 599.97s (0:09:59) ===================

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.15.z Introduced in or relating directly to Satellite 6.15 6.16.z Introduced in or relating directly to Satellite 6.16 CherryPick PR needs CherryPick to previous branches PRT-Failed Indicates that latest PRT run is failed for the PR Stream Introduced in or relating directly to Satellite Stream/Master
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants