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

make oscap tests run on rhel9 backend #14716

Merged
merged 3 commits into from
Apr 23, 2024
Merged

Conversation

pondrejk
Copy link
Contributor

@pondrejk pondrejk commented Apr 10, 2024

Problem Statement

Part of the oscap tests were too rhel8 backend specific and didn't run on rhel9 sat

Solution

Making the tests more flexible

Related Issues

Requires satelliteqe-jenkins mr 1300

Results form local rhel9 sat run:

pytest tests/foreman/cli/test_oscap.py 
...
============ 68 passed, 3 deselected, 35 warnings in 971.49s (0:16:11) =============

@pondrejk pondrejk added the No-CherryPick PR doesnt need CherryPick to previous branches label Apr 10, 2024
@pondrejk pondrejk self-assigned this Apr 10, 2024
@pondrejk pondrejk requested review from a team as code owners April 10, 2024 11:37
Copy link
Contributor

@Griffin-Sullivan Griffin-Sullivan left a comment

Choose a reason for hiding this comment

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

This should also fix our fapolicyd pipeline on RHEL9. Thanks for the quick fix

robottelo/constants/__init__.py Outdated Show resolved Hide resolved
@pondrejk
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/cli/test_oscap.py

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 6483
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/cli/test_oscap.py --external-logging
Test Result : ==== 42 passed, 3 deselected, 143 warnings, 26 errors in 950.81s (0:15:50) =====

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

trigger: test-robottelo
pytest: tests/foreman/cli/test_oscap.py

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 6485
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/cli/test_oscap.py --external-logging
Test Result : ========= 68 passed, 3 deselected, 187 warnings in 1152.37s (0:19:12) ==========

@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 Apr 12, 2024
def oscap_content_path(session_target_sat):
def oscap_content_source(session_target_sat):
"""Get scap content file path"""
return f'{settings.oscap.content_dir}/ssg-rhel{session_target_sat.os_distribution_version.split(".")[0]}-ds.xml'
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return f'{settings.oscap.content_dir}/ssg-rhel{session_target_sat.os_distribution_version.split(".")[0]}-ds.xml'
return f'{settings.oscap.content_dir}/ssg-rhel{session_target_sat.os_version.major}-ds.xml'

Same suggestion for all the other os_distribution_version occurrences.

@Griffin-Sullivan
Copy link
Contributor

When you rerun PRT add deploy_rhel_version: 9

@jameerpathan111
Copy link
Contributor

jameerpathan111 commented Apr 12, 2024

@pondrejk How about we update oscap.yaml in CI repo based on Satellite RHEL version? It should solve the issues for all the versions.
It should look something like:

OSCAP:
  RHEL_MAJOR_VERSION: "@jinja {{this.server.version.rhel_version | int }}"
  CONTENT_PATH: '@format /usr/share/xml/scap/ssg/content/ssg-rhel{this.oscap.rhel_major_version}-ds.xml'
  # see: robottelo/constants/__init__.py OSCAP_PROFILE
  PROFILE: '@format security{this.oscap.rhel_major_version}'
  CONTENT_DIR: /usr/share/xml/scap/ssg/content

@pondrejk
Copy link
Contributor Author

@pondrejk How about we update oscap.yaml in CI repo based on Satellite RHEL version? It should solve the issues for all the versions. It should look something like:

OSCAP:
  RHEL_MAJOR_VERSION: "@jinja {{this.server.version.rhel_version | int }}"
  CONTENT_PATH: '@format /usr/share/xml/scap/ssg/content/ssg-rhel{this.oscap.rhel_major_version}-ds.xml'
  # see: robottelo/constants/__init__.py OSCAP_PROFILE
  PROFILE: '@format security{this.oscap.rhel_major_version}'
  CONTENT_DIR: /usr/share/xml/scap/ssg/content

ok that seems superior, let me test it out

@pondrejk pondrejk marked this pull request as draft April 22, 2024 08:57
@Satellite-QE Satellite-QE removed the PRT-Passed Indicates that latest PRT run is passed for the PR label Apr 22, 2024
@pondrejk
Copy link
Contributor Author

@jameerpathan111 @Griffin-Sullivan could you please take a look at satellite-jenkins mr !1316

@pondrejk pondrejk marked this pull request as ready for review April 22, 2024 11:59
@pondrejk
Copy link
Contributor Author

Awaits satellite-jenkins config merge for prt run, local results with latest changes look good

@pondrejk
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/cli/test_oscap.py

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 6649
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/cli/test_oscap.py --external-logging
Test Result : ========= 68 passed, 3 deselected, 192 warnings in 1119.44s (0:18:39) ==========

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

trigger: test-robottelo
pytest: tests/foreman/cli/test_oscap.py

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

PRT Result

Build Number: 6653
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/cli/test_oscap.py --external-logging
Test Result : ========= 68 passed, 3 deselected, 188 warnings in 1176.13s (0:19:36) ==========

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

pre-commit.ci autofix

@Satellite-QE Satellite-QE removed the PRT-Passed Indicates that latest PRT run is passed for the PR label Apr 23, 2024
@ogajduse ogajduse enabled auto-merge (squash) April 23, 2024 13:55
@ogajduse ogajduse merged commit f9ba93d into SatelliteQE:master Apr 23, 2024
9 checks passed
pondrejk added a commit to pondrejk/robottelo that referenced this pull request May 7, 2024
Co-authored-by: Ondřej Gajdušek <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
pondrejk added a commit to pondrejk/robottelo that referenced this pull request May 7, 2024
Co-authored-by: Ondřej Gajdušek <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
pondrejk added a commit to pondrejk/robottelo that referenced this pull request May 7, 2024
Co-authored-by: Ondřej Gajdušek <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
pondrejk added a commit that referenced this pull request May 7, 2024
make oscap tests run on rhel9 backend (#14716)

Co-authored-by: Ondřej Gajdušek <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
pondrejk added a commit that referenced this pull request May 7, 2024
make oscap tests run on rhel9 backend (#14716)

Co-authored-by: Ondřej Gajdušek <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
pondrejk added a commit that referenced this pull request May 7, 2024
make oscap tests run on rhel9 backend (#14716)

Co-authored-by: Ondřej Gajdušek <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
jyejare pushed a commit to jyejare/robottelo that referenced this pull request Oct 19, 2024
Co-authored-by: Ondřej Gajdušek <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants