From c6227fdf3e916f0eb01fbf3fd2f7734ed26a4d8c Mon Sep 17 00:00:00 2001 From: Taylor Silva Date: Mon, 15 Mar 2021 15:09:10 -0400 Subject: [PATCH] Use regex to skip no matter runc version Signed-off-by: Taylor Silva Co-authored-by: Esteban Foronda --- testflight/container_limits_test.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/testflight/container_limits_test.go b/testflight/container_limits_test.go index 47ced567a..584d3e17e 100644 --- a/testflight/container_limits_test.go +++ b/testflight/container_limits_test.go @@ -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") }