From 9f8dddabdd4add2def8dcedc1954c591f7673bc0 Mon Sep 17 00:00:00 2001 From: Gaurav Talreja Date: Thu, 3 Aug 2023 16:07:06 +0530 Subject: [PATCH] Update scap tests to use deploy_flavor and Global Registration (#12098) Signed-off-by: Gaurav Talreja (cherry picked from commit eee703e516449c3bfab0386e749627b53838c780) --- robottelo/constants/__init__.py | 2 -- tests/foreman/longrun/test_oscap.py | 48 ++++------------------------- 2 files changed, 6 insertions(+), 44 deletions(-) diff --git a/robottelo/constants/__init__.py b/robottelo/constants/__init__.py index b71fb7fabc0..a5c05b646b5 100644 --- a/robottelo/constants/__init__.py +++ b/robottelo/constants/__init__.py @@ -1539,8 +1539,6 @@ class Colored(Box): 'mail': 'mail', } -OSCAP_TARGET_CORES = 4 -OSCAP_TARGET_MEMORY = '16GiB' OSCAP_PERIOD = {'weekly': 'Weekly', 'monthly': 'Monthly', 'custom': 'Custom'} OSCAP_TAILORING_FILE = 'ssg-rhel7-ds-tailoring.xml' diff --git a/tests/foreman/longrun/test_oscap.py b/tests/foreman/longrun/test_oscap.py index 0fc13117878..5793c85000c 100644 --- a/tests/foreman/longrun/test_oscap.py +++ b/tests/foreman/longrun/test_oscap.py @@ -35,8 +35,6 @@ from robottelo.constants import OSCAP_DEFAULT_CONTENT from robottelo.constants import OSCAP_PERIOD from robottelo.constants import OSCAP_PROFILE -from robottelo.constants import OSCAP_TARGET_CORES -from robottelo.constants import OSCAP_TARGET_MEMORY from robottelo.constants import OSCAP_WEEKDAY from robottelo.exceptions import ProxyError from robottelo.hosts import ContentHost @@ -133,7 +131,6 @@ def update_scap_content(module_org): Scapcontent.update({'title': content['title'], 'organization-ids': organization_ids}) -@pytest.mark.skip_if_open('BZ:2211437') @pytest.mark.e2e @pytest.mark.upgrade @pytest.mark.tier4 @@ -200,29 +197,13 @@ def test_positive_oscap_run_via_ansible( 'organizations': module_org.name, } ) - with Broker( - nick=distro, - host_class=ContentHost, - target_cores=OSCAP_TARGET_CORES, - target_memory=OSCAP_TARGET_MEMORY, - ) as vm: - host_name, _, host_domain = vm.hostname.partition('.') - vm.install_katello_ca(target_sat) - vm.register_contenthost(module_org.name, ak_name[distro]) - assert vm.subscribed - Host.set_parameter( - { - 'host': vm.hostname.lower(), - 'name': 'remote_execution_connect_by_ip', - 'value': 'True', - 'parameter-type': 'boolean', - } - ) + with Broker(nick=distro, host_class=ContentHost, deploy_flavor=settings.flavors.default) as vm: + result = vm.register(module_org, None, ak_name[distro], target_sat) + assert result.status == 0, f'Failed to register host: {result.stderr}' if distro not in ('rhel7'): vm.create_custom_repos(**rhel_repo) else: vm.create_custom_repos(**{distro: rhel_repo}) - vm.add_rex_key(satellite=target_sat) Host.update( { 'name': vm.hostname.lower(), @@ -256,7 +237,6 @@ def test_positive_oscap_run_via_ansible( assert result is not None -@pytest.mark.skip_if_open('BZ:2211437') @pytest.mark.tier4 def test_positive_oscap_run_via_ansible_bz_1814988( module_org, default_proxy, content_view, lifecycle_env, target_sat @@ -316,24 +296,9 @@ def test_positive_oscap_run_via_ansible_bz_1814988( 'organizations': module_org.name, } ) - with Broker( - nick='rhel7', - host_class=ContentHost, - target_cores=OSCAP_TARGET_CORES, - target_memory=OSCAP_TARGET_MEMORY, - ) as vm: - host_name, _, host_domain = vm.hostname.partition('.') - vm.install_katello_ca(target_sat) - vm.register_contenthost(module_org.name, ak_name['rhel7']) - assert vm.subscribed - Host.set_parameter( - { - 'host': vm.hostname.lower(), - 'name': 'remote_execution_connect_by_ip', - 'value': 'True', - 'parameter-type': 'boolean', - } - ) + with Broker(nick='rhel7', host_class=ContentHost, deploy_flavor=settings.flavors.default) as vm: + result = vm.register(module_org, None, ak_name['rhel7'], target_sat) + assert result.status == 0, f'Failed to register host: {result.stderr}' vm.create_custom_repos(rhel7=settings.repos.rhel7_os) # Harden the rhel7 client with DISA STIG security policy vm.run('yum install -y scap-security-guide') @@ -342,7 +307,6 @@ def test_positive_oscap_run_via_ansible_bz_1814988( '--fetch-remote-resources --results-arf results.xml ' '/usr/share/xml/scap/ssg/content/ssg-rhel7-ds.xml', ) - vm.add_rex_key(satellite=target_sat) Host.update( { 'name': vm.hostname.lower(),