mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2026-01-08 16:21:50 +00:00
PSP: when comparing categories in SELinux levels, ignore its order.
This commit is contained in:
@@ -194,3 +194,38 @@ func TestAllowsHostVolumePath(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestEqualStringSlices(t *testing.T) {
|
||||
tests := map[string]struct {
|
||||
arg1 []string
|
||||
arg2 []string
|
||||
expectedResult bool
|
||||
}{
|
||||
"nil equals to nil": {
|
||||
arg1: nil,
|
||||
arg2: nil,
|
||||
expectedResult: true,
|
||||
},
|
||||
"equal by size": {
|
||||
arg1: []string{"1", "1"},
|
||||
arg2: []string{"1", "1"},
|
||||
expectedResult: true,
|
||||
},
|
||||
"not equal by size": {
|
||||
arg1: []string{"1"},
|
||||
arg2: []string{"1", "1"},
|
||||
expectedResult: false,
|
||||
},
|
||||
"not equal by elements": {
|
||||
arg1: []string{"1", "1"},
|
||||
arg2: []string{"1", "2"},
|
||||
expectedResult: false,
|
||||
},
|
||||
}
|
||||
|
||||
for k, v := range tests {
|
||||
if result := EqualStringSlices(v.arg1, v.arg2); result != v.expectedResult {
|
||||
t.Errorf("%s expected to return %t but got %t", k, v.expectedResult, result)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user