Skip to content

Commit

Permalink
Merge pull request #4064 from kolyshkin/ce7-skip-flake
Browse files Browse the repository at this point in the history
ci: skip TestPodSkipDevicesUpdate on CentOS 7
  • Loading branch information
thaJeztah authored Oct 12, 2023
2 parents 0274ca2 + bdf78b4 commit c494c47
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions libcontainer/cgroups/devices/systemd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os"
"os/exec"
"strings"
"sync"
"testing"

"github.com/opencontainers/runc/libcontainer/cgroups"
Expand All @@ -26,6 +27,7 @@ func TestPodSkipDevicesUpdate(t *testing.T) {
if os.Geteuid() != 0 {
t.Skip("Test requires root.")
}
skipOnCentOS7(t)

podName := "system-runc_test_pod" + t.Name() + ".slice"
podConfig := &configs.Cgroup{
Expand Down Expand Up @@ -116,18 +118,35 @@ func TestPodSkipDevicesUpdate(t *testing.T) {
}
}

var (
centosVer string
centosVerOnce sync.Once
)

func centosVersion() string {
centosVerOnce.Do(func() {
ver, _ := exec.Command("rpm", "-q", "--qf", "%{version}", "centos-release").CombinedOutput()
centosVer = string(ver)
})
return centosVer
}

func skipOnCentOS7(t *testing.T) {
t.Helper()
// https://github.com/opencontainers/runc/issues/3743
if centosVersion() == "7" {
t.Skip("Flaky on CentOS 7")
}
}

func testSkipDevices(t *testing.T, skipDevices bool, expected []string) {
if !systemd.IsRunningSystemd() {
t.Skip("Test requires systemd.")
}
if os.Geteuid() != 0 {
t.Skip("Test requires root.")
}
// https://github.com/opencontainers/runc/issues/3743
centosVer, _ := exec.Command("rpm", "-q", "--qf", "%{version}", "centos-release").CombinedOutput()
if string(centosVer) == "7" {
t.Skip("Flaky on CentOS 7")
}
skipOnCentOS7(t)

podConfig := &configs.Cgroup{
Parent: "system.slice",
Expand Down

0 comments on commit c494c47

Please sign in to comment.