Skip to content

Conversation

@richm
Copy link
Contributor

@richm richm commented Aug 19, 2025

  1. Only set PQC on RHEL 9.7 and later, but not RHEL 10 and later, and on EL9 platforms other than RHEL 9
  2. Run the crypto_policies role with the variable set to null to get the current policy for resetting
    later.

Signed-off-by: Rich Megginson [email protected]

Summary by Sourcery

Fix PQC test fixtures by targeting only supported RHEL/EL9 versions, retrieving and storing the existing crypto policy for cleanup, and standardizing the restore condition syntax

Bug Fixes:

  • Restrict PQC enablement to RHEL 9.7 and later (but before RHEL 10) or non-RedHat EL9 variants to avoid unsupported platforms

Enhancements:

  • Capture the current crypto policy by running the crypto_policies role with a null setting before enabling PQC
  • Store the original crypto policy in a variable for post-test cleanup

Tests:

  • Adjust the restore step’s when condition to consistently use double quotes for empty-string checks

@richm richm requested a review from tomjelinek as a code owner August 19, 2025 22:12
@sourcery-ai
Copy link

sourcery-ai bot commented Aug 19, 2025

Reviewer's Guide

Refine test fixtures to conditionally apply PQC policies only on supported RHEL/EL9 versions, capture the existing crypto policy before mutation for cleanup, and correct a quoting inconsistency in the reset condition.

File-Level Changes

Change Details Files
Enhanced conditional logic for applying PQC policy
  • Replace simple RHEL9 check with combined distribution and version constraints
  • Wrap policy tasks in a new 'Check if crypto-policies is needed' block
tests/tasks/fixture_psks.yml
Retrieve current crypto policy before setting PQC
  • Introduce a task calling the crypto_policies role with crypto_policies_policy: null
  • Name the task 'Get current crypto policy'
tests/tasks/fixture_psks.yml
Refactor cleanup variable capture
  • Simplify set_fact to always capture crypto_policies_active
  • Remove redundant distribution/version guards from the fact
tests/tasks/fixture_psks.yml
Standardize quoting in reset condition
  • Change single quotes to double quotes in the length check for __crypto_policies_policy
tests/tests_cluster_basic_custom_pcsd_tls.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov
Copy link

codecov bot commented Aug 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.32%. Comparing base (32b8ef7) to head (2eb6aec).
⚠️ Report is 90 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #306      +/-   ##
==========================================
+ Coverage   82.88%   88.32%   +5.44%     
==========================================
  Files           6       11       +5     
  Lines         479      891     +412     
==========================================
+ Hits          397      787     +390     
- Misses         82      104      +22     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@richm
Copy link
Contributor Author

richm commented Aug 19, 2025

[citest]

@richm
Copy link
Contributor Author

richm commented Aug 20, 2025

[citest_bad]

@richm
Copy link
Contributor Author

richm commented Aug 20, 2025

centos-9 is having some infrastructure issues - https://pagure.io/fedora-infrastructure/issue/12571 - I have verified internally that rhel-9.7 and rhel-9.6 work correctly with this PR

@tomjelinek
Copy link
Member

The crypto-policy fix looks good.

However, it seems PQC is not used on RHEL 9 due to this condition in tests/tasks/fixture_psks.yml:

key_algo: "{{ 'mldsa65' if 'MLDSA65' in openssl_algorithms.stdout
  and __ha_cluster_is_rh_distro and ansible_facts['distribution_major_version'] | int > 9
  else 'rsa:2048' }}"

I'm running the patch through CI right now to confirm both statements.

@tomjelinek
Copy link
Member

tomjelinek commented Aug 20, 2025

Confirmed, this patch fixes all the issues except one: RHEL 9 still never generates / uses PQ certificates.

@richm richm force-pushed the test-fix-reset-crypto-policy branch from d900d3a to 8115e94 Compare August 20, 2025 17:07
@richm
Copy link
Contributor Author

richm commented Aug 20, 2025

[citest]

1. If the managed node is RHEL 9.7 and later, but not RHEL 10 and later, and on EL9 platforms other than RHEL 9,
   set the crypto_policy to use PQC
2. Run the crypto_policies role with the variable set to null to get the current policy for resetting
   later.

Signed-off-by: Rich Megginson <[email protected]>
@richm richm force-pushed the test-fix-reset-crypto-policy branch from 8115e94 to 2eb6aec Compare August 20, 2025 20:13
@richm
Copy link
Contributor Author

richm commented Aug 20, 2025

[citest]

@richm richm merged commit 9396d34 into linux-system-roles:main Aug 20, 2025
40 checks passed
@richm richm deleted the test-fix-reset-crypto-policy branch August 20, 2025 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants