@pytest.mark.topology(KnownTopology.Shadow)
-def test_useradd__specific_large_uid(shadow: Shadow):
+@pytest.mark.parametrize(
+ "uid_value",
+ [
+ pytest.param(2147483647, id="maximum_signed_32bit_uid"),
+ pytest.param(4294967294, id="maximum_unsigned_32bit_uid"),
+ ],
+)
+def test_useradd__successful_large_uid(shadow: Shadow, uid_value: int):
"""
- :title: Verify user creation at the upper boundary for UID
+ :title: Verify user creation succeeds with large valid UIDs
:steps:
- 1. Create user with UID 2147483647 (2^31 - 1, maximum signed 32-bit integer)
+ 1. Create user with UID {uid_value}
2. Check passwd entry
3. Check group entry
:expectedresults:
1. User is created successfully
- 2. Passwd entry exists with correct UID 2147483647
+ 2. Passwd entry exists with correct UID {uid_value}
3. Group entry exists
:customerscenario: False
"""
- shadow.useradd("test1 -u 2147483647")
+ shadow.useradd(f"test1 -u {uid_value}")
passwd_entry = shadow.tools.getent.passwd("test1")
assert passwd_entry is not None, "User test1 should be found in passwd"
assert passwd_entry.name == "test1", "Incorrect username"
- assert passwd_entry.uid == 2147483647, f"Incorrect UID, expected 2147483647, got {passwd_entry.uid}"
+ assert passwd_entry.uid == uid_value, f"Incorrect UID, expected {uid_value}, got {passwd_entry.uid}"
group_entry = shadow.tools.getent.group("test1")
assert group_entry is not None, "Group test1 should be found"
assert group_entry.name == "test1", "Incorrect group name"
+