Skip to content

Commit

Permalink
support passing "N-#" to rhel_ver_match fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
damoore044 committed Nov 5, 2024
1 parent 2ee732d commit 600d836
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
28 changes: 19 additions & 9 deletions pytest_plugins/fixture_markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def pytest_generate_tests(metafunc):
function_marks = getattr(metafunc.function, 'pytestmark', [])
no_containers = any(mark.name == 'no_containers' for mark in function_marks)
# process eventual rhel_version_list markers
matchers = [i.args for i in function_marks if i.name == 'rhel_ver_list']
matchers = [i.args for i in function_marks if i.name == 'rhel_ver_list']
list_params = []
for matcher in matchers:
list_params.extend(
Expand All @@ -35,14 +35,24 @@ def pytest_generate_tests(metafunc):
# process eventual rhel_version_match markers
matchers = [i.args for i in function_marks if i.name == 'rhel_ver_match']
match_params = []
for matcher in matchers:
match_params.extend(
[
setting_rhel_ver
for setting_rhel_ver in settings.supportability.content_hosts.rhel.versions
if re.fullmatch(str(matcher[0]), str(setting_rhel_ver))
]
)
# collect latest N-# major versions supported, excluding fips
if matchers[0][0].startswith('N-') and len(matchers[0][0]) == 3:
num_versions = int(matchers[0][0].split('-')[1])
filtered_versions = [
ver for ver in settings.supportability.content_hosts.rhel.versions
if "fips" not in str(ver)
][-num_versions:]
match_params.extend(filtered_versions)
# match versions if not specified by 'N-#'
else:
for matcher in matchers:
match_params.extend(
[
setting_rhel_ver
for setting_rhel_ver in settings.supportability.content_hosts.rhel.versions
if re.fullmatch(str(matcher[0]), str(setting_rhel_ver))
]
)
network_params = ['ipv6' if settings.server.is_ipv6 else 'ipv4']
rhel_params = []
ids = []
Expand Down
2 changes: 1 addition & 1 deletion tests/foreman/api/test_errata.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ def _publish_and_wait(sat, org, cv, search_rate=1, max_tries=10):

@pytest.mark.upgrade
@pytest.mark.tier3
@pytest.mark.rhel_ver_match('[^7]|10')
@pytest.mark.rhel_ver_match('N-2')
@pytest.mark.no_containers
@pytest.mark.e2e
def test_positive_install_in_hc(
Expand Down

0 comments on commit 600d836

Please sign in to comment.