Skip to content

Commit

Permalink
selinux/mustrunas_test.go(TestMustRunAsValidate): add more test cases…
Browse files Browse the repository at this point in the history
… to improve code coverage.
  • Loading branch information
php-coder committed Jan 25, 2018
1 parent 0f4ea61 commit 84d7867
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions pkg/security/securitycontextconstraints/selinux/mustrunas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ func TestMustRunAsValidate(t *testing.T) {
user := newValidOpts()
user.User = "invalid"

level := newValidOpts()
level.Level = "invalid"

seType := newValidOpts()
seType.Type = "invalid"

Expand All @@ -102,15 +99,20 @@ func TestMustRunAsValidate(t *testing.T) {
sccSeLinux: validOpts,
expectedMsg: "user: Invalid value",
},
"invalid level": {
podSeLinux: level,
sccSeLinux: validOpts,
"levels are not equal": {
podSeLinux: newValidOptsWithLevel("s0"),
sccSeLinux: newValidOptsWithLevel("s0:c1,c2"),
expectedMsg: "level: Invalid value",
},
"invalid type": {
podSeLinux: seType,
sccSeLinux: validOpts,
expectedMsg: "type: Invalid value",
"levels differ by sensitivity": {
podSeLinux: newValidOptsWithLevel("s0:c6"),
sccSeLinux: newValidOptsWithLevel("s1:c6"),
expectedMsg: "level: Invalid value",
},
"levels differ by categories": {
podSeLinux: newValidOptsWithLevel("s0:c0,c8"),
sccSeLinux: newValidOptsWithLevel("s0:c1,c7"),
expectedMsg: "level: Invalid value",
},
"valid": {
podSeLinux: validOpts,
Expand Down

0 comments on commit 84d7867

Please sign in to comment.