Skip to content

Commit

Permalink
test/selinux: update boolean name
Browse files Browse the repository at this point in the history
Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
  • Loading branch information
tormath1 committed Sep 13, 2023
1 parent 78f5261 commit 8d1321c
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions kola/tests/misc/selinux.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ import (
"regexp"
"strings"

"github.com/coreos/go-semver/semver"
"github.com/flatcar/mantle/kola/cluster"
"github.com/flatcar/mantle/kola/register"
"github.com/flatcar/mantle/platform"
)

var seBoolean = "container_use_nfs"

func init() {
register.Register(&register.Test{
Run: SelinuxEnforce,
Expand All @@ -40,6 +43,15 @@ func init() {
Distros: []string{"cl", "fcos", "rhcos"},
// This test is normally not related to the cloud environment
Platforms: []string{"qemu", "qemu-unpriv"},
SkipFunc: func(version semver.Version, channel, arch, platform string) bool {
// Workaround to set the SELinux boolean name based of the Flatcar version.
// Note: it works only if we test '*'
if version.LessThan(semver.Version{Major: 3637}) {
seBoolean = "virt_use_nfs"
}

return false
},
})
register.Register(&register.Test{
Run: SelinuxBooleanPersist,
Expand All @@ -48,6 +60,15 @@ func init() {
Distros: []string{"fcos", "rhcos"},
// This test is normally not related to the cloud environment
Platforms: []string{"qemu", "qemu-unpriv"},
SkipFunc: func(version semver.Version, channel, arch, platform string) bool {
// Workaround to set the SELinux boolean name based of the Flatcar version.
// Note: it works only if we test '*'
if version.LessThan(semver.Version{Major: 3637}) {
seBoolean = "virt_use_nfs"
}

return false
},
})
register.Register(&register.Test{
Run: SelinuxManage,
Expand Down Expand Up @@ -155,8 +176,6 @@ func SelinuxEnforce(c cluster.TestCluster) {

// SelinuxBoolean checks that you can tweak a boolean in the current session
func SelinuxBoolean(c cluster.TestCluster) {
seBoolean := "virt_use_nfs"

m := c.Machines()[0]

tempBoolState, err := getSelinuxBooleanState(c, m, seBoolean)
Expand Down Expand Up @@ -186,8 +205,6 @@ func SelinuxBoolean(c cluster.TestCluster) {
// SelinuxBooleanPersist checks that you can tweak a boolean and have it
// persist across reboots
func SelinuxBooleanPersist(c cluster.TestCluster) {
seBoolean := "virt_use_nfs"

m := c.Machines()[0]

persistBoolState, err := getSelinuxBooleanState(c, m, seBoolean)
Expand Down

0 comments on commit 8d1321c

Please sign in to comment.