Tests: Add system tests for groupadd in test_groupadd.py#1655
Open
asakure wants to merge 3 commits into
Open
Conversation
ikerexxe
reviewed
Jun 24, 2026
This is Python transformation of the test located in `tests/grouptools/groupadd/05_groupadd_set_GID/groupadd.test` which checks that `groupadd` can create group with sepcified GID using -g flag Signed-off-by: Akshay Sakure <asakure@redhat.com>
8ba884c to
9cafdaf
Compare
ikerexxe
reviewed
Jun 25, 2026
ikerexxe
left a comment
Collaborator
There was a problem hiding this comment.
This has been improved quite a bit. There are still some minor things to improve, but I think we are on the right track
Comment on lines
+98
to
+99
| 1. Check group entry in group file | ||
| 2. Check group entry in gshadow file |
Collaborator
There was a problem hiding this comment.
No need for the in * file suffix. This should be:
1. Check group entry
2. Check gshadow entry
Comment on lines
+125
to
+127
| 1. Command groupadd -f tgroup exits successfully without error | ||
| 2. Group entry in group file is unchanged with the original name | ||
| 3. Group entry in gshadow file is unchanged with the original name |
| :customerscenario: False | ||
| """ | ||
| shadow.groupadd("-p Secret123 tgroup") | ||
|
|
Collaborator
There was a problem hiding this comment.
You are missing the group entry check:
group_entry = shadow.tools.getent.group("tgroup")
assert group_entry is not None, "Group tgroup should be found"
...
|
|
||
|
|
||
| @pytest.mark.topology(KnownTopology.Shadow) | ||
| def test_groupadd__f_option_add_existing_group(shadow: Shadow): |
Collaborator
There was a problem hiding this comment.
How about test_groupadd__force_group_creation?
Comment on lines
+132
to
+133
| existing_group_entry = shadow.tools.getent.group("tgroup") | ||
| assert existing_group_entry is not None, "Group should be found" |
Collaborator
There was a problem hiding this comment.
This is missing in the steps
| :setup: | ||
| 1. Create group tgroup | ||
| :steps: | ||
| 1. Run groupadd command with -f option to add an existing group |
Collaborator
There was a problem hiding this comment.
Rephrase this to bring it into line with the project’s conventions
ikerexxe
reviewed
Jun 25, 2026
|
|
||
| if shadow.host.features["gshadow"]: | ||
| gshadow_entry = shadow.tools.getent.gshadow("tgroup") | ||
| assert gshadow_entry is noit None, "Group should be found" |
Collaborator
|
Please also check CI failures |
9cafdaf to
2680fa4
Compare
This is Python transformation of the test located in `tests/grouptools/groupadd/04_groupadd_set_password/groupadd.test` which checks that `groupadd` can create group with password using -p flag Signed-off-by: Akshay Sakure <asakure@redhat.com>
This is Python transformation of the test located in `tests/grouptools/groupadd/06_groupadd_-f_add_existing_group/groupadd.test` which verifies if groupadd -f exits successfully when the specified group already exists. Signed-off-by: Akshay Sakure <asakure@redhat.com>
2680fa4 to
4010eba
Compare
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.
Add system tests for groupadd in test_groupadd.py.