kola/tests/misc: test if selinux survives reboots
@@ -24,6 +24,7 @@ func init() {
Run: SelinuxEnforce,
ClusterSize: 1,
Name: "coreos.selinux.enforce",
+ Flags: []register.Flag{register.NoEnableSelinux},
})
}
@@ -36,9 +37,12 @@ func SelinuxEnforce(c cluster.TestCluster) {
checkoutput bool
output string
}{
+ {"getenforce", true, "Permissive"},
{"sudo setenforce 1", false, ""},
{"getenforce", true, "Enforcing"},
{"systemctl --no-pager is-active system.slice", true, "active"},
+ {"sudo cp --remove-destination $(readlink -f /etc/selinux/config) /etc/selinux/config", false, ""},
+ {"sudo sed -i 's/SELINUX=permissive/SELINUX=enforcing/' /etc/selinux/config", false, ""},
} {
output, err := m.SSH(cmd.cmdline)
if err != nil {
@@ -49,4 +53,18 @@ func SelinuxEnforce(c cluster.TestCluster) {
c.Fatalf("command %q has unexpected output: want %q got %q", cmd.cmdline, cmd.output, string(output))
}
}
+
+ err := m.Reboot()
+ if err != nil {
+ c.Fatalf("failed to reboot machine: %v", err)
+ }
+
+ output, err := m.SSH("getenforce")
+ if err != nil {
+ c.Fatalf("failed to run \"getenforce\": output: %q status: %q", output, err)
+ }
+
+ if string(output) != "Enforcing" {
+ c.Fatalf("command \"getenforce\" has unexpected output: want \"Enforcing\" got %q", string(output))
+ }
}
