From c1424095983992f56ffa50e79c0139cef8893f6d Mon Sep 17 00:00:00 2001 From: Miloslav Trmač Date: Wed, 18 Jul 2018 21:11:10 +0200 Subject: Skip seccomp-dependent tests on non-Linux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, getRuntimeSpec always fails on non-Linux because spec.CreateConfigToOCISpec always fails, because the podman CLI sets up a seccomp path, and processing that on non-Linux is not supported. This breaks testing of entirely unrelated options. We can either skip the tests on non-Linux, or explicitly disable seccomp inside the tests. Linux testing matters much more than other platforms, and the tests are more reliable when they don't change supposedly unrelated options; so, skip the tests on non-Linux. Signed-off-by: Miloslav Trmač Closes: #1115 Approved by: rhatdan --- cmd/podman/run_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'cmd') diff --git a/cmd/podman/run_test.go b/cmd/podman/run_test.go index 93e42f5bd..a421c4a20 100644 --- a/cmd/podman/run_test.go +++ b/cmd/podman/run_test.go @@ -1,6 +1,7 @@ package main import ( + "runtime" "testing" units "github.com/docker/go-units" @@ -90,6 +91,12 @@ func getRuntimeSpec(c *cli.Context) (*spec.Spec, error) { // TestPIDsLimit verifies the inputted pid-limit is correctly defined in the spec func TestPIDsLimit(t *testing.T) { + // The default configuration of podman enables seccomp, which is not available on non-Linux systems. + // Thus, any tests that use the default seccomp setting would fail. + // Skip the tests on non-Linux platforms rather than explicitly disable seccomp in the test and possibly affect the test result. + if runtime.GOOS != "linux" { + t.Skip("seccomp, which is enabled by default, is only supported on Linux") + } a := createCLI() args := []string{"--pids-limit", "22"} a.Run(append(cmd, args...)) @@ -102,6 +109,12 @@ func TestPIDsLimit(t *testing.T) { // TestBLKIOWeightDevice verifies the inputted blkio weigh device is correctly defined in the spec func TestBLKIOWeightDevice(t *testing.T) { + // The default configuration of podman enables seccomp, which is not available on non-Linux systems. + // Thus, any tests that use the default seccomp setting would fail. + // Skip the tests on non-Linux platforms rather than explicitly disable seccomp in the test and possibly affect the test result. + if runtime.GOOS != "linux" { + t.Skip("seccomp, which is enabled by default, is only supported on Linux") + } a := createCLI() args := []string{"--blkio-weight-device", "/dev/zero:100"} a.Run(append(cmd, args...)) @@ -114,6 +127,12 @@ func TestBLKIOWeightDevice(t *testing.T) { // TestMemorySwap verifies that the inputted memory swap is correctly defined in the spec func TestMemorySwap(t *testing.T) { + // The default configuration of podman enables seccomp, which is not available on non-Linux systems. + // Thus, any tests that use the default seccomp setting would fail. + // Skip the tests on non-Linux platforms rather than explicitly disable seccomp in the test and possibly affect the test result. + if runtime.GOOS != "linux" { + t.Skip("seccomp, which is enabled by default, is only supported on Linux") + } a := createCLI() args := []string{"--memory-swap", "45m", "--memory", "40m"} a.Run(append(cmd, args...)) -- cgit v1.2.3-54-g00ecf