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 Clients support, test in Errata e2e parametrized registered hosts #16807

Merged
merged 3 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion conf/supportability.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ supportability:
content_hosts:
default_os_name: "RedHat"
rhel:
versions: [7,'7_fips', 8, '8_fips', 9, '9_fips']
versions: [7,'7_fips', 8, '8_fips', 9, '9_fips', 10,]
29 changes: 21 additions & 8 deletions pytest_plugins/fixture_markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,27 @@ 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))
]
)
# check if param matches format 'N-x'
if matchers and len(matchers[0][0]) == 3 and matchers[0][0].startswith('N-'):
# num of desired prior versions
num_versions = int(matchers[0][0].split('-')[1])
# grab major versions, excluding fips, from tail of supportability list
filtered_versions = [
setting_rhel_ver
for setting_rhel_ver in settings.supportability.content_hosts.rhel.versions
if 'fips' not in str(setting_rhel_ver)
][-(num_versions + 1) :] # inclusive (+1) to collect N as well
match_params.extend(filtered_versions)
# match versions with existing regex markers
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 pytest_plugins/markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def pytest_configure(config):
"run_in_one_thread: Sequential tests",
"build_sanity: Fast, basic tests that confirm build is ready for full test suite",
"rhel_ver_list: Filter rhel_contenthost versions by list",
"rhel_ver_match: Filter rhel_contenthost versions by regexp",
"rhel_ver_match: Filter rhel_contenthost versions by regexp, or format 'N-#'",
"no_containers: Disable container hosts from being used in favor of VMs",
"include_capsule: For satellite-maintain tests to run on Satellite and Capsule both",
"capsule_only: For satellite-maintain tests to run only on Capsules",
Expand Down
4 changes: 2 additions & 2 deletions 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('[^6]')
@pytest.mark.rhel_ver_match(r'^(?!.*fips).*$') # all major versions, excluding fips
@pytest.mark.no_containers
@pytest.mark.e2e
def test_positive_install_in_hc(
Expand Down Expand Up @@ -656,7 +656,7 @@ def test_positive_install_in_hc(


@pytest.mark.tier3
@pytest.mark.rhel_ver_match('[^6]')
@pytest.mark.rhel_ver_match(r'^(?!.*fips).*$') # all major versions, excluding fips
@pytest.mark.no_containers
@pytest.mark.e2e
@pytest.mark.pit_client
Expand Down
12 changes: 6 additions & 6 deletions tests/foreman/cli/test_errata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,7 @@ def errata_host(

@pytest.mark.tier2
@pytest.mark.no_containers
@pytest.mark.rhel_ver_match('8')
@pytest.mark.rhel_ver_match('N-1') # Newest major RHEL version (N), and the one prior.
def test_apply_errata_using_default_content_view(errata_host, module_sca_manifest_org, target_sat):
"""Updating an applicable errata on a host attached to the default content view
causes the errata to not be applicable.
Expand Down Expand Up @@ -1281,7 +1281,7 @@ def test_apply_errata_using_default_content_view(errata_host, module_sca_manifes

@pytest.mark.tier2
@pytest.mark.no_containers
@pytest.mark.rhel_ver_match('8')
@pytest.mark.rhel_ver_match('N-1')
def test_update_applicable_package_using_default_content_view(errata_host, target_sat):
"""Updating an applicable package on a host attached to the default content view causes the
package to not be applicable or installable.
Expand Down Expand Up @@ -1340,7 +1340,7 @@ def test_update_applicable_package_using_default_content_view(errata_host, targe

@pytest.mark.tier2
@pytest.mark.no_containers
@pytest.mark.rhel_ver_match('8')
@pytest.mark.rhel_ver_match('N-1')
def test_downgrade_applicable_package_using_default_content_view(errata_host, target_sat):
"""Downgrading a package on a host attached to the default content view
causes the package to become applicable and installable.
Expand Down Expand Up @@ -1389,7 +1389,7 @@ def test_downgrade_applicable_package_using_default_content_view(errata_host, ta


@pytest.mark.tier2
@pytest.mark.rhel_ver_match('8')
@pytest.mark.rhel_ver_match('N-2')
def test_install_applicable_package_to_registered_host(errata_host, target_sat):
"""Installing an older package to an already registered host should show the newer package
and errata as applicable and installable.
Expand Down Expand Up @@ -1437,7 +1437,7 @@ def test_install_applicable_package_to_registered_host(errata_host, target_sat):

@pytest.mark.tier2
@pytest.mark.no_containers
@pytest.mark.rhel_ver_match('8')
@pytest.mark.rhel_ver_match('N-2')
def test_downgrading_package_shows_errata_from_library(
errata_host, module_sca_manifest_org, target_sat
):
Expand Down Expand Up @@ -1542,7 +1542,7 @@ def test_errata_list_by_contentview_filter(module_sca_manifest_org, module_targe
assert errata_count != errata_count_cvf


@pytest.mark.rhel_ver_match('8')
@pytest.mark.rhel_ver_match('N-2')
def test_positive_verify_errata_recalculate_tasks(target_sat, errata_host):
"""Verify 'Actions::Katello::Applicability::Hosts::BulkGenerate' tasks proceed on 'worker-hosts-queue-1.service'

Expand Down
40 changes: 22 additions & 18 deletions tests/foreman/ui/test_errata.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def cleanup():

@pytest.mark.e2e
@pytest.mark.tier3
@pytest.mark.rhel_ver_match('[^6]')
@pytest.mark.rhel_ver_match('N-3') # Newest major RHEL version (N), and three prior.
@pytest.mark.parametrize('registered_contenthost', [[CUSTOM_REPO_URL]], indirect=True)
@pytest.mark.no_containers
def test_end_to_end(
Expand Down Expand Up @@ -486,7 +486,7 @@ def test_end_to_end(

@pytest.mark.tier2
@pytest.mark.no_containers
@pytest.mark.rhel_ver_match('8')
@pytest.mark.rhel_ver_match('N-2')
@pytest.mark.parametrize('registered_contenthost', [[CUSTOM_REPO_3_URL]], indirect=True)
@pytest.mark.skipif((not settings.robottelo.REPOS_HOSTING_URL), reason='Missing repos_hosting_url')
def test_host_content_errata_tab_pagination(
Expand All @@ -502,7 +502,7 @@ def test_host_content_errata_tab_pagination(
# Test apply by REX using Select All for BZ#1846670

:setup:
1. rhel8 registered contenthost with custom repos enabled.
1. registered contenthost with custom repos enabled.
2. enable and sync rh repository.
3. add rh repo to cv for registered host and publish/promote.

Expand Down Expand Up @@ -793,7 +793,7 @@ def test_positive_list_permission(
product only.
"""
module_target_sat.api_factory.enable_sync_redhat_repo(
constants.REPOS['rhsclient8'],
constants.REPOS['rhsclient9'],
function_sca_manifest_org.id,
)
custom_repo = module_target_sat.api.Repository(
Expand All @@ -808,7 +808,7 @@ def test_positive_list_permission(
query={'search': 'resource_type="Katello::Product"'}
),
role=role,
search=f'name = "{PRDS["rhel8"]}"',
search=f'name = "{PRDS["rhel9"]}"',
).create()
# generate login credentials for new role
user_password = gen_string('alphanumeric')
Expand Down Expand Up @@ -854,7 +854,7 @@ def test_positive_apply_for_all_hosts(

:setup:
1. Create and sync one custom repo for all hosts, add to a content-view.
2. Checkout four rhel9 contenthosts via Broker.
2. Checkout four contenthosts, latest rhel ver, via Broker.
3. Register all of the hosts to the same AK, CV, single repo.

:steps:
Expand All @@ -865,15 +865,15 @@ def test_positive_apply_for_all_hosts(
hosts.
"""
num_hosts = 4
distro = 'rhel9'
distro = 'rhel10'
# one custom repo on satellite, for all hosts to use
custom_repo = target_sat.api.Repository(url=CUSTOM_REPO_URL, product=module_product).create()
custom_repo.sync()
module_cv.repository = [custom_repo]
module_cv.update(['repository'])
with Broker(
nick=distro,
workflow='deploy-rhel',
workflow='deploy-template',
host_class=ContentHost,
_count=num_hosts,
deploy_network_type='ipv6' if settings.server.is_ipv6 else 'ipv4',
Expand Down Expand Up @@ -968,7 +968,7 @@ def test_positive_apply_for_all_hosts(

@pytest.mark.tier2
@pytest.mark.upgrade
@pytest.mark.rhel_ver_match('8')
@pytest.mark.rhel_ver_match('N-1')
def test_positive_view_cve(session, module_product, module_sca_manifest_org, target_sat):
"""View CVE number(s) in Errata Details page

Expand Down Expand Up @@ -1034,7 +1034,9 @@ def test_positive_filter_by_environment(
module_cv.repository = [custom_repo]
module_cv.update(['repository'])

with Broker(nick='rhel8', host_class=ContentHost, _count=3) as clients:
with Broker(
nick='rhel10', workflow='deploy-template', host_class=ContentHost, _count=3
) as clients:
for client in clients:
# register all hosts to the same AK, CV:
setup = target_sat.api_factory.register_host_and_needed_setup(
Expand Down Expand Up @@ -1093,7 +1095,7 @@ def test_positive_filter_by_environment(
[[CUSTOM_REPO_URL]],
indirect=True,
)
@pytest.mark.rhel_ver_match('8')
@pytest.mark.rhel_ver_match('N-2')
def test_positive_content_host_previous_env(
session,
module_cv,
Expand Down Expand Up @@ -1162,7 +1164,7 @@ def test_positive_content_host_previous_env(


@pytest.mark.tier2
@pytest.mark.rhel_ver_match('8')
@pytest.mark.rhel_ver_match('N-2')
@pytest.mark.parametrize(
'registered_contenthost',
[[CUSTOM_REPO_URL]],
Expand Down Expand Up @@ -1194,7 +1196,7 @@ def test_positive_check_errata(session, registered_contenthost):


@pytest.mark.tier3
@pytest.mark.rhel_ver_match('[8, 9]')
@pytest.mark.rhel_ver_match('N-2')
@pytest.mark.parametrize(
'registered_contenthost',
[['Library', CUSTOM_REPO_URL]],
Expand Down Expand Up @@ -1266,7 +1268,7 @@ def test_positive_host_content_library(


@pytest.mark.tier3
@pytest.mark.rhel_ver_match('8')
@pytest.mark.rhel_ver_match('N-1')
@pytest.mark.parametrize(
'registered_contenthost',
[[CUSTOM_REPO_URL]],
Expand Down Expand Up @@ -1331,7 +1333,7 @@ def test_positive_errata_search_type(session, module_sca_manifest_org, registere


@pytest.mark.tier3
@pytest.mark.rhel_ver_match('8')
@pytest.mark.rhel_ver_match('N-2')
@pytest.mark.parametrize(
'registered_contenthost',
[[CUSTOM_REPO_URL]],
Expand Down Expand Up @@ -1437,7 +1439,7 @@ def test_positive_show_count_on_host_pages(session, module_org, registered_conte


@pytest.mark.tier3
@pytest.mark.rhel_ver_match('8')
@pytest.mark.rhel_ver_match('N-2')
@pytest.mark.parametrize(
'registered_contenthost',
[[CUSTOM_REPO_URL]],
Expand Down Expand Up @@ -1511,7 +1513,7 @@ def test_positive_check_errata_counts_by_type_on_host_details_page(
@pytest.mark.upgrade
@pytest.mark.skipif((not settings.robottelo.REPOS_HOSTING_URL), reason='Missing repos_hosting_url')
@pytest.mark.parametrize('setting_update', ['errata_status_installable'], indirect=True)
@pytest.mark.rhel_ver_match('8')
@pytest.mark.rhel_ver_match('N-1')
@pytest.mark.parametrize(
'registered_contenthost',
[[CUSTOM_REPO_URL]],
Expand Down Expand Up @@ -1663,7 +1665,9 @@ def test_content_host_errata_search_commands(
cvs = [module_cv.read(), content_view.read()] # client0, client1
# walrus-0.71-1.noarch (RHSA), kangaroo-0.1-1.noarch (RHBA)
packages = [FAKE_1_CUSTOM_PACKAGE, FAKE_4_CUSTOM_PACKAGE]
with Broker(nick='rhel8', host_class=ContentHost, _count=2) as clients:
with Broker(
nick='rhel10', workflow='deploy-template', host_class=ContentHost, _count=2
) as clients:
for (
client,
cv,
Expand Down