summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2018-07-18 21:11:10 +0200
committerAtomic Bot <atomic-devel@projectatomic.io>2018-07-26 20:47:31 +0000
commitc1424095983992f56ffa50e79c0139cef8893f6d (patch)
treefef96dedee05247e174e43c7cbef6269c778372d
parent2322f272c4ee9fb4f38aff2f6442b0d9f9ce1ad1 (diff)
downloadpodman-c1424095983992f56ffa50e79c0139cef8893f6d.tar.gz
podman-c1424095983992f56ffa50e79c0139cef8893f6d.tar.bz2
podman-c1424095983992f56ffa50e79c0139cef8893f6d.zip
Skip seccomp-dependent tests on non-Linux
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č <mitr@redhat.com> Closes: #1115 Approved by: rhatdan
-rw-r--r--cmd/podman/run_test.go19
1 files changed, 19 insertions, 0 deletions
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...))