[MOKOSH] RHEL-1843 - Test for improved capsh --print output - #8
Open
Koncpa wants to merge 12 commits into
Open
Conversation
Reviewer's GuideAdds a new beakerlib-based regression test for RHEL-1843 to validate improved File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The temporary
capsh_test_useraccount is created and deleted inside the test phase; consider moving creation to Setup and deletion to Cleanup (and making both idempotent) so that failures in the middle of the test don't leave stray users behind. - You call
capsh --printmultiple times and only grep for a subset of fields each time; to reduce runtime and potential flakiness, you could capture the output once per scenario and assert all expected lines from that single invocation.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The temporary `capsh_test_user` account is created and deleted inside the test phase; consider moving creation to Setup and deletion to Cleanup (and making both idempotent) so that failures in the middle of the test don't leave stray users behind.
- You call `capsh --print` multiple times and only grep for a subset of fields each time; to reduce runtime and potential flakiness, you could capture the output once per scenario and assert all expected lines from that single invocation.
## Individual Comments
### Comment 1
<location path="Regression/RHEL-1843-capsh-print-all/runtest.sh" line_range="24-28" />
<code_context>
+ rlAssertGrep "Ambient set: none" "$rlRun_LOG" "Check for 'none' in Ambient set"
+ rlPhaseEnd
+
+ rlPhaseStartTest "Verify capsh --print output for a non-root user (no capabilities)"
+ rlRun "useradd capsh_test_user"
+ rlRun "su - capsh_test_user -c 'capsh --print'"
+ rlAssertGrep "Current: =" "$rlRun_LOG" "Current capabilities should be empty for non-root user"
+ rlRun "userdel -r capsh_test_user"
+ rlPhaseEnd
+
</code_context>
<issue_to_address>
**issue (testing):** Make user lifecycle handling more robust to pre-existing users or failures during useradd/userdel.
This test relies on `useradd capsh_test_user` and `userdel -r capsh_test_user` succeeding unconditionally. If the user already exists or deletion fails, the phase may misbehave or become flaky. Please make the setup/teardown more resilient, e.g. by using a more unique username, checking for existence before create/delete, or relaxing `rlRun` expectations with explicit handling of non-zero return codes.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was generated by the QE automation pipeline and requires human review.
Summary
This PR introduces a new regression test for RHEL-1843, which addresses an RFE to improve the output of the
capsh --printcommand.Test Description
The test verifies the following:
capsh --printnow displays "all" instead of a long, difficult-to-read list of every individual capability.capsh --printnow displays "none" for clarity.How to Run
The test can be run using TMT:
Reference Tests
The following existing tests were used as a reference for framework, metadata, and structure:
Sanity/capsh-basic-functionalityRegression/bz722694-capsh-does-not-chdir-after-chrootSummary by Sourcery
Add a new regression test validating the improved capsh --print output for capability sets.
Tests: