Use regex to skip no matter runc version
package testflight_test
import (
- "strings"
+ "regexp"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@@ -16,8 +16,11 @@ var _ = Describe("A job with a task that has container limits", func() {
watch := spawnFly("trigger-job", "-j", inPipeline("container-limits-job"), "-w")
<-watch.Exited
+ match, _ := regexp.MatchString(`open /sys/fs/cgroup/memory/.*/memory\.memsw\.limit_in_bytes: (permission denied)?(no such file or directory)?`,
+ string(watch.Out.Contents()))
+
// Guardian runtime will always fail this test unless it's explicitly told not to set the swap limit
- if strings.Contains(string(watch.Out.Contents()), "memsw.limit_in_bytes: no such file or directory") {
+ if match {
Skip("swap limits not enabled; skipping")
}
@@ -31,8 +34,11 @@ var _ = Describe("A job with a task that has container limits", func() {
watch := spawnFly("trigger-job", "-j", inPipeline("container-limits-failing-job"), "-w")
<-watch.Exited
+ match, _ := regexp.MatchString(`open /sys/fs/cgroup/memory/.*/memory\.memsw\.limit_in_bytes: (permission denied)?(no such file or directory)?`,
+ string(watch.Out.Contents()))
+
// Guardian runtime will always fail this test unless it's explicitly told not to set the swap limit
- if strings.Contains(string(watch.Out.Contents()), "memsw.limit_in_bytes: no such file or directory") {
+ if match {
Skip("swap limits not enabled; skipping")
}
