Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1439 from mikebrow/fix-selinux-unit-test
Browse files Browse the repository at this point in the history
fixes bad unit test when selinux is enabled
  • Loading branch information
mikebrow committed Apr 15, 2020
2 parents 8b6377b + aa9b188 commit 3d250b8
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions pkg/server/helpers_selinux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ func TestInitSelinuxOpts(t *testing.T) {

func TestCheckSelinuxLevel(t *testing.T) {
for desc, test := range map[string]struct {
level string
expectErr bool
level string
expectNoMatch bool
}{
"s0": {
level: "s0",
Expand Down Expand Up @@ -136,30 +136,30 @@ func TestCheckSelinuxLevel(t *testing.T) {
level: "s0-s0:c0,c3.c6",
},
"s0,c0,c3": {
level: "s0,c0,c3",
expectErr: true,
level: "s0,c0,c3",
expectNoMatch: true,
},
"s0:c0.c3.c6": {
level: "s0:c0.c3.c6",
expectErr: true,
level: "s0:c0.c3.c6",
expectNoMatch: true,
},
"s0-s0,c0,c3": {
level: "s0-s0,c0,c3",
expectErr: true,
level: "s0-s0,c0,c3",
expectNoMatch: true,
},
"s0-s0:c0.c3.c6": {
level: "s0-s0:c0.c3.c6",
expectErr: true,
level: "s0-s0:c0.c3.c6",
expectNoMatch: true,
},
"s0-s0:c0,c3.c6.c8": {
level: "s0-s0:c0,c3.c6.c8",
expectErr: true,
level: "s0-s0:c0,c3.c6.c8",
expectNoMatch: true,
},
} {
t.Run(desc, func(t *testing.T) {
ok, err := checkSelinuxLevel(test.level)
if test.expectErr {
assert.Error(t, err)
if test.expectNoMatch {
assert.NoError(t, err)
assert.False(t, ok)
} else {
assert.NoError(t, err)
Expand Down

0 comments on commit 3d250b8

Please sign in to comment.