mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
selinux/mustrunas_test.go(TestMustRunAsValidate): rename a member to make its meaning obvious.
This commit is contained in:
parent
2e55ffbbbf
commit
3f261537b1
@ -100,31 +100,31 @@ func TestMustRunAsValidate(t *testing.T) {
|
|||||||
seType.Type = "invalid"
|
seType.Type = "invalid"
|
||||||
|
|
||||||
tests := map[string]struct {
|
tests := map[string]struct {
|
||||||
seLinux *api.SELinuxOptions
|
podSeLinux *api.SELinuxOptions
|
||||||
expectedMsg string
|
expectedMsg string
|
||||||
}{
|
}{
|
||||||
"invalid role": {
|
"invalid role": {
|
||||||
seLinux: role,
|
podSeLinux: role,
|
||||||
expectedMsg: "role: Invalid value",
|
expectedMsg: "role: Invalid value",
|
||||||
},
|
},
|
||||||
"invalid user": {
|
"invalid user": {
|
||||||
seLinux: user,
|
podSeLinux: user,
|
||||||
expectedMsg: "user: Invalid value",
|
expectedMsg: "user: Invalid value",
|
||||||
},
|
},
|
||||||
"invalid level": {
|
"invalid level": {
|
||||||
seLinux: level,
|
podSeLinux: level,
|
||||||
expectedMsg: "level: Invalid value",
|
expectedMsg: "level: Invalid value",
|
||||||
},
|
},
|
||||||
"invalid type": {
|
"invalid type": {
|
||||||
seLinux: seType,
|
podSeLinux: seType,
|
||||||
expectedMsg: "type: Invalid value",
|
expectedMsg: "type: Invalid value",
|
||||||
},
|
},
|
||||||
"valid": {
|
"valid": {
|
||||||
seLinux: newValidOpts(),
|
podSeLinux: newValidOpts(),
|
||||||
expectedMsg: "",
|
expectedMsg: "",
|
||||||
},
|
},
|
||||||
"valid with different order of categories": {
|
"valid with different order of categories": {
|
||||||
seLinux: newValidOptsWithLevel("s0:c6,c0"),
|
podSeLinux: newValidOptsWithLevel("s0:c6,c0"),
|
||||||
expectedMsg: "",
|
expectedMsg: "",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -140,7 +140,7 @@ func TestMustRunAsValidate(t *testing.T) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
errs := mustRunAs.Validate(nil, nil, nil, tc.seLinux)
|
errs := mustRunAs.Validate(nil, nil, nil, tc.podSeLinux)
|
||||||
//should've passed but didn't
|
//should've passed but didn't
|
||||||
if len(tc.expectedMsg) == 0 && len(errs) > 0 {
|
if len(tc.expectedMsg) == 0 && len(errs) > 0 {
|
||||||
t.Errorf("%s expected no errors but received %v", name, errs)
|
t.Errorf("%s expected no errors but received %v", name, errs)
|
||||||
|
Loading…
Reference in New Issue
Block a user