Use regex to skip no matter runc version

Signed-off-by: Taylor Silva <tsilva@pivotal.io>
Co-authored-by: Esteban Foronda <eforonda@vmware.com>
This commit is contained in:
Taylor Silva 2021-03-15 15:09:10 -04:00
parent 175f53ca99
commit c6227fdf3e
1 changed files with 9 additions and 3 deletions

View File

@ -1,7 +1,7 @@
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")
}