mirror of
https://github.com/rancher/os.git
synced 2025-09-05 08:42:38 +00:00
migrate to upstream libcompose in one and a half go
This commit is contained in:
36
vendor/github.com/opencontainers/runc/libcontainer/user/user_test.go
generated
vendored
36
vendor/github.com/opencontainers/runc/libcontainer/user/user_test.go
generated
vendored
@@ -434,3 +434,39 @@ this is just some garbage data
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetAdditionalGroupsNumeric(t *testing.T) {
|
||||
tests := []struct {
|
||||
groups []string
|
||||
expected []int
|
||||
hasError bool
|
||||
}{
|
||||
{
|
||||
// numeric groups only
|
||||
groups: []string{"1234", "5678"},
|
||||
expected: []int{1234, 5678},
|
||||
},
|
||||
{
|
||||
// numeric and alphabetic
|
||||
groups: []string{"1234", "fake"},
|
||||
expected: nil,
|
||||
hasError: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
gids, err := GetAdditionalGroups(test.groups, nil)
|
||||
if test.hasError && err == nil {
|
||||
t.Errorf("Parse(%#v) expects error but has none", test)
|
||||
continue
|
||||
}
|
||||
if !test.hasError && err != nil {
|
||||
t.Errorf("Parse(%#v) has error %v", test, err)
|
||||
continue
|
||||
}
|
||||
sort.Sort(sort.IntSlice(gids))
|
||||
if !reflect.DeepEqual(gids, test.expected) {
|
||||
t.Errorf("Gids(%v), expect %v from groups %v", gids, test.expected, test.groups)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user