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

oscap longrun tests parametrized for client rhel versions #15531

Merged
merged 4 commits into from
Jul 31, 2024

Conversation

pondrejk
Copy link
Contributor

Problem Statement

Adjusting existing oscap longrun tests to run on multiple client rhel versions (to increase coverage, make them available for pit-client testing etc.)

Solution

Few notes:

  • As BZ#2176122 is considered not a bug, the default content available on satellite is defined by its underlying rhel version. As per docs, one needs to extract the content for other rhel versions from their respective scap-security-guide packages and do a file upload to satellite. This PR uses contenthosts to do it as they are created anyway. But due to this I cannot do all the preparatory steps in fixtures, as policy can be created only after client exists (hope this makes sense)
  • different content upload strategies (default/file upload) result in different naming for the contents, this PR accounts for that
  • separate CVs are now created per rhel version content, having it all in one CV caused some issues with the AK association
  • atm rhel7 client runs won't pass due to a bug (already fixed, but client repo needs a resnap)

Related Issues

@pondrejk pondrejk 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 labels Jun 27, 2024
@pondrejk pondrejk self-assigned this Jun 27, 2024
@pondrejk pondrejk requested review from a team as code owners June 27, 2024 15:51
@pondrejk
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/longrun/test_oscap.py -k test_positive_oscap_run_via_ansible[rhel9]

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 7564
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/longrun/test_oscap.py -k  test_positive_oscap_run_via_ansible[rhel9] --external-logging
Test Result : ========== 1 failed, 15 deselected, 28 warnings in 1106.80s (0:18:26) ==========

@Satellite-QE Satellite-QE added the PRT-Failed Indicates that latest PRT run is failed for the PR label Jun 27, 2024
@pondrejk
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/longrun/test_oscap.py -k test_positive_oscap_run_via_ansible[rhel9]

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 7566
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/longrun/test_oscap.py -k test_positive_oscap_run_via_ansible[rhel9] --external-logging
Test Result : ========== 1 failed, 15 deselected, 28 warnings in 1221.92s (0:20:21) ==========

@pondrejk pondrejk force-pushed the oscap branch 3 times, most recently from a406629 to 7b627ba Compare July 3, 2024 10:38
@pondrejk
Copy link
Contributor Author

pondrejk commented Jul 3, 2024

trigger: test-robottelo
pytest: tests/foreman/longrun/test_oscap.py -k test_positive_oscap_run_via_ansible[rhel8]

@pondrejk pondrejk requested a review from a team as a code owner July 8, 2024 13:28
@pondrejk
Copy link
Contributor Author

pondrejk commented Jul 8, 2024

trigger: test-robottelo
pytest: tests/foreman/longrun/test_oscap.py -k test_positive_oscap_run_via_ansible[rhel8]

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 7666
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/longrun/test_oscap.py -k test_positive_oscap_run_via_ansible[rhel8] --external-logging
Test Result : ========== 1 passed, 16 deselected, 29 warnings in 1144.38s (0:19:04) ==========

@Satellite-QE Satellite-QE added PRT-Passed Indicates that latest PRT run is passed for the PR and removed PRT-Failed Indicates that latest PRT run is failed for the PR labels Jul 8, 2024
@pondrejk
Copy link
Contributor Author

trigger: test-robottelo
pytest: --component SCAPPlugin --junit-xml=sat-SCAPPlugin-results.xml -o junit_suite_name=sat-SCAPPlugin --durations=20 --durations-min=600.0 tests/foreman
env:
    ROBOTTELO_server__deploy_arguments__deploy_rhel_version: '9'
theforeman:
    foreman_openscap: 575

@pondrejk
Copy link
Contributor Author

sorry for a bit of a sidetrack, I was asked to review theforeman/foreman_openscap#575 and as I'd like to use tests from this pr, I'm using the above prt construct. The results shouldn't be used primarily to judge this pr, see the prt success above.

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 7694
Build Status: UNSTABLE
PRT Comment: pytest --component SCAPPlugin --junit-xml=sat-SCAPPlugin-results.xml -o junit_suite_name=sat-SCAPPlugin --durations=20 --durations-min=600.0 tests/foreman --external-logging
Test Result : = 32 failed, 47 passed, 5428 deselected, 6580 warnings, 28 errors in 6408.87s (1:46:48) =

@Satellite-QE Satellite-QE added PRT-Failed Indicates that latest PRT run is failed for the PR and removed PRT-Passed Indicates that latest PRT run is passed for the PR labels Jul 10, 2024
@pondrejk
Copy link
Contributor Author

trigger: test-robottelo
pytest: --component SCAPPlugin --junit-xml=sat-SCAPPlugin-results.xml -o junit_suite_name=sat-SCAPPlugin --durations=20 --durations-min=600.0 tests/foreman
theforeman:
    foreman_openscap: 575

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 7697
Build Status: UNSTABLE
PRT Comment: pytest --component SCAPPlugin --junit-xml=sat-SCAPPlugin-results.xml -o junit_suite_name=sat-SCAPPlugin --durations=20 --durations-min=600.0 tests/foreman --external-logging
Test Result : = 13 failed, 93 passed, 5428 deselected, 6667 warnings, 1 error in 7356.10s (2:02:36) =

@ogajduse ogajduse dismissed their stale review July 17, 2024 12:54

mistakenly approved wrong PR

@pondrejk
Copy link
Contributor Author

back from PTO, I'll be looking into the proposed changes, just FYI, these tests are affected by SAT-26726

@Satellite-QE Satellite-QE removed the PRT-Passed Indicates that latest PRT run is passed for the PR label Jul 23, 2024
@pondrejk
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/longrun/test_oscap.py -k test_positive_oscap_run_via_ansible[rhel9_fips]

@pondrejk pondrejk added No-CherryPick PR doesnt need CherryPick to previous branches and removed CherryPick PR needs CherryPick to previous branches 6.15.z Introduced in or relating directly to Satellite 6.15 labels Jul 23, 2024
@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 7817
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/longrun/test_oscap.py -k test_positive_oscap_run_via_ansible[rhel9_fips] --external-logging
Test Result : ========== 1 passed, 16 deselected, 29 warnings in 1372.67s (0:22:52) ==========

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Jul 23, 2024
Comment on lines 104 to 117
'repo': settings.repos.satclient_repo.rhel9,
'akname': ak_name['rhel9'],
'cvname': cv_name['rhel9'],
},
{
'repo': settings.repos.satclient_repo.rhel8,
'akname': ak_name['rhel8'],
'cvname': cv_name['rhel8'],
},
{
'repo': settings.repos.satclient_repo.rhel7,
'akname': ak_name['rhel7'],
'cvname': cv_name['rhel7'],
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this being too smart?

Suggested change
'repo': settings.repos.satclient_repo.rhel9,
'akname': ak_name['rhel9'],
'cvname': cv_name['rhel9'],
},
{
'repo': settings.repos.satclient_repo.rhel8,
'akname': ak_name['rhel8'],
'cvname': cv_name['rhel8'],
},
{
'repo': settings.repos.satclient_repo.rhel7,
'akname': ak_name['rhel7'],
'cvname': cv_name['rhel7'],
},
'repo': getattr(settings.repos.satclient_repo, rhel),
'akname': ak_name[rhel],
'cvname': cv_name[rhel],
} for rhel in ('rhel9', 'rhel8', 'rhel7')

profile = OSCAP_PROFILE['ospp8']
@pytest.fixture
def scap_prerequisites(module_org, default_proxy, target_sat):
# TODO: add support for RHEL9 (it doesn't have scap content in Sat by default) and parametrize distro
Copy link
Contributor

Choose a reason for hiding this comment

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

IIRC the problem is that we install scap-security-guide on Satellite, but if that's on RHEL 8 then it doesn't have RHEL 9 content. AFAIK this is why we upload the content from the content host (which you do in upload_scap_content_for_host). Though if the Satellite is on RHEL 9 then it should have the content available.

Would it be better to match the distro to the Satellite distro?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

eh, further complication, this part got in with #15491 while this PR was open, I just rearranged stuff after I pulled in changes. Clearly we should consolidate the approches form thes PRs, but I don't want to touch it within this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's fair. I'd just ask you to address 13fef98#r1691678387 since that does feel in line with this PR (you're introducing profiles in this PR).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ekohl ah that's right, comitted!

@Satellite-QE Satellite-QE removed the PRT-Passed Indicates that latest PRT run is passed for the PR label Jul 26, 2024
@pondrejk
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/longrun/test_oscap.py -k test_positive_oscap_run_via_ansible[rhel9_fips]

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 7883
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/longrun/test_oscap.py -k test_positive_oscap_run_via_ansible[rhel9_fips] --external-logging
Test Result : ========== 1 passed, 16 deselected, 29 warnings in 1222.99s (0:20:22) ==========

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Jul 29, 2024
@pondrejk
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/longrun/test_oscap.py -k test_positive_oscap_run_via_ansible[rhel7]

@Satellite-QE Satellite-QE removed the PRT-Passed Indicates that latest PRT run is passed for the PR label Jul 29, 2024
@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 7889
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/longrun/test_oscap.py -k test_positive_oscap_run_via_ansible[rhel7] --external-logging
Test Result : =========== 16 deselected, 22 warnings, 1 error in 190.75s (0:03:10) ===========

@Satellite-QE Satellite-QE added the PRT-Failed Indicates that latest PRT run is failed for the PR label Jul 29, 2024
@pondrejk
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/longrun/test_oscap.py -k test_positive_oscap_run_via_ansible[rhel7]

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 7890
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/longrun/test_oscap.py -k test_positive_oscap_run_via_ansible[rhel7] --external-logging
Test Result : ========== 1 passed, 16 deselected, 29 warnings in 1085.36s (0:18:05) ==========

@Satellite-QE Satellite-QE added PRT-Passed Indicates that latest PRT run is passed for the PR and removed PRT-Failed Indicates that latest PRT run is failed for the PR labels Jul 29, 2024
Co-authored-by: Ewoud Kohl van Wijngaarden <[email protected]>
@Satellite-QE Satellite-QE removed the PRT-Passed Indicates that latest PRT run is passed for the PR label Jul 29, 2024
@pondrejk pondrejk merged commit 6d22330 into SatelliteQE:master Jul 31, 2024
9 checks passed
jyejare pushed a commit to jyejare/robottelo that referenced this pull request Oct 19, 2024
…E#15531)

* oscap longrun tests parametrized for client rhel versions

* feedback from review

* further refactoring

* Update tests/foreman/longrun/test_oscap.py

Co-authored-by: Ewoud Kohl van Wijngaarden <[email protected]>

---------

Co-authored-by: Ewoud Kohl van Wijngaarden <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
No-CherryPick PR doesnt need CherryPick to previous branches Stream Introduced in or relating directly to Satellite Stream/Master
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants