-
Notifications
You must be signed in to change notification settings - Fork 6
tests: Add an actual integration test #101
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
Conversation
Reviewer's GuideIntroduces a comprehensive integration test for the pam_pwd role covering all configuration paths, fixes a missing authselect installation step to enable custom policy application, and updates documentation to clarify pam_pwd_policy_name availability. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This comment was marked as resolved.
This comment was marked as resolved.
|
@Tronde can you please have a quick look? The intention is surely that the changes actually become active? Is that working for you? If so, which OS are you using? Thanks! |
|
@Tronde unping, sorry -- forgot flush_handlers 🙈 |
|
Much better -- the tests now only fail in c9-container, for a rather shallow reason:
Fixing.. |
"RHEL 8 only" sounds "only for old OS" from today's perspective. When it was introduced, that was probably "the future". There is only a special case for RHEL/CentOS 7 where `authselect` does not yet exist, so the setting does not apply there.
Cause: Not every environment has `authselect` installed, in particular the standard CentOS 9 container. Consequence: The role failed trying to call `authselect` in these environments. Fix: Ensure that the authselect package is installed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @martinpitt - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Review instructions: all looks good
- 🟢 Testing: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| state: present | ||
| backup: true | ||
|
|
||
| - name: Ensure authselect is installed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be done on EL 7 since above you mention that pam_pwd_policy_name is not supported on EL7?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, maybe not -- but there are no tests running for RHEL 7 anyway, so this is all untested code 😢 I'll add an exception though, I want to re-push anyway as I have a bootc integration test as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correction, this is actually fine. RHEL 7 uses tasks/setup/RedHat_7.yml instead, which is completely different. default.yml unconditionally calls authselect, so it should also unconditionally install it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
later RHEL 7 failure, once more with feeling. Sorry @spetrosi for the premature review request, I'm not yet used to the automatic requests after sending a PR (will keep at draft while tests are still red) |
tests_default.yml doesn't actually do anything other than making sure that the role succees. It does not have any assertions. Add tests_all_settings.yml based on examples/playbook_with_vars.yml which validates that the role has the desired effect.
|
[citest] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @martinpitt - I've reviewed your changes - here's some feedback:
- Wrap the new authselect package installation in an OS/version conditional (e.g. RHEL 8+) so it doesn’t fail on systems that lack that package.
- Add an assert that the custom authselect profile (pam_pwd_policy_name) is actually activated to ensure the role truly applies it.
- Consider using Ansible’s ini lookup or ini_file module in the tests instead of grepping with cat for more robust config validation.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Review instructions: all looks good
- 🟢 Testing: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
tests_default.yml doesn't actually do anything other than making sure that the role succees. It does not have any assertions.
Add tests_all_settings.yml based on examples/playbook_with_vars.yml which validates that the role has the desired effect.
This uncovers a bug that the custom authselect policy is not applied properly.
Yak shaving - I was about to add a bootc end-to-end test, then noticed that this role is lacking a test, and wrote one.
Summary by Sourcery
Add a comprehensive integration test for the pam_pwd role that applies all configuration options and verifies the resulting pwquality, PAM, and faillock settings, and ensure the authselect package is installed before configuring policies.
Bug Fixes:
Documentation:
Tests: