Skip to content

Commit

Permalink
Update scap tests to use deploy_flavor and Global Registration (#12098)
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Talreja <[email protected]>
(cherry picked from commit eee703e)
  • Loading branch information
Gauravtalreja1 committed Aug 29, 2023
1 parent 728c2ce commit fb59704
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 44 deletions.
2 changes: 0 additions & 2 deletions robottelo/constants/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1538,8 +1538,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'

Expand Down
48 changes: 6 additions & 42 deletions tests/foreman/longrun/test_oscap.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,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
Expand Down Expand Up @@ -132,7 +130,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
Expand Down Expand Up @@ -199,29 +196,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(),
Expand Down Expand Up @@ -255,7 +236,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
Expand Down Expand Up @@ -315,24 +295,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')
Expand All @@ -341,7 +306,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(),
Expand Down

0 comments on commit fb59704

Please sign in to comment.