Avoid returning the UID when resolving the GIDs. (#2689)

* Fix GetUIDAndGIDFromString test.

* Avoid returning by default the UID when resolving the GIDs.
This commit is contained in:
Diego Gonzalez
2023-08-31 18:05:27 -07:00
committed by GitHub
parent 237778c179
commit 2b6b5948da
3 changed files with 39 additions and 31 deletions
+9 -8
View File
@@ -705,7 +705,7 @@ func Test_GetUIDAndGIDFromString(t *testing.T) {
},
expected: expected{
userID: 1001,
groupID: uint32(currentUserGID),
groupID: expectedCurrentUser.groupID,
},
},
{
@@ -714,15 +714,13 @@ func Test_GetUIDAndGIDFromString(t *testing.T) {
userGroupStr: fmt.Sprintf("%d:%s", 1001, "hello-world-group"),
fallbackToUID: true,
},
expected: expected{
userID: 1001,
groupID: 1001,
},
wantErr: true,
},
{
testname: "uid and non existing group-name",
testname: "uid and non existing group-name without fallbackToUID",
args: args{
userGroupStr: fmt.Sprintf("%d:%s", 1001, "hello-world-group"),
userGroupStr: fmt.Sprintf("%d:%s", 1001, "hello-world-group"),
fallbackToUID: false,
},
wantErr: true,
},
@@ -742,7 +740,10 @@ func Test_GetUIDAndGIDFromString(t *testing.T) {
userGroupStr: fmt.Sprintf("%d", currentUserUID),
fallbackToUID: false,
},
wantErr: true,
expected: expected{
userID: expectedCurrentUser.userID,
groupID: 0,
},
},
{
testname: "only uid and fallback is true",