From 37d514b106f4aa528bf89038d7b82d3a2825076d Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 3 Jan 2019 12:32:05 +0100 Subject: [PATCH] Simplify skip checks These tests are run on a local Linux daemon only, so no need to do a platform-check. Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 69c0b7e47682a2a7a850122a9a2f711259fbb25a) Signed-off-by: Sebastiaan van Stijn Upstream-commit: bb6db57acc8a63f7f85fafe4be0cfe7fa929e3a1 Component: engine --- .../container/ipcmode_linux_test.go | 19 ++++++++++--------- .../container/mounts_linux_test.go | 4 ++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/components/engine/integration/container/ipcmode_linux_test.go b/components/engine/integration/container/ipcmode_linux_test.go index 46a40ac856..49634ca732 100644 --- a/components/engine/integration/container/ipcmode_linux_test.go +++ b/components/engine/integration/container/ipcmode_linux_test.go @@ -92,7 +92,7 @@ func testIpcNonePrivateShareable(t *testing.T, mode string, mustBeMounted bool, // (--ipc none) works as expected. It makes sure there is no // /dev/shm mount inside the container. func TestIpcModeNone(t *testing.T) { - skip.If(t, testEnv.DaemonInfo.OSType != "linux" || testEnv.IsRemoteDaemon()) + skip.If(t, testEnv.IsRemoteDaemon) testIpcNonePrivateShareable(t, "none", false, false) } @@ -102,7 +102,7 @@ func TestIpcModeNone(t *testing.T) { // of /dev/shm mount from the container, and makes sure there is no // such pair on the host. func TestIpcModePrivate(t *testing.T) { - skip.If(t, testEnv.DaemonInfo.OSType != "linux" || testEnv.IsRemoteDaemon()) + skip.If(t, testEnv.IsRemoteDaemon) testIpcNonePrivateShareable(t, "private", true, false) } @@ -112,7 +112,7 @@ func TestIpcModePrivate(t *testing.T) { // of /dev/shm mount from the container, and makes sure such pair // also exists on the host. func TestIpcModeShareable(t *testing.T) { - skip.If(t, testEnv.DaemonInfo.OSType != "linux" || testEnv.IsRemoteDaemon()) + skip.If(t, testEnv.IsRemoteDaemon) testIpcNonePrivateShareable(t, "shareable", true, true) } @@ -175,7 +175,7 @@ func testIpcContainer(t *testing.T, donorMode string, mustWork bool) { // 1) a container created with --ipc container:ID can use IPC of another shareable container. // 2) a container created with --ipc container:ID can NOT use IPC of another private container. func TestAPIIpcModeShareableAndContainer(t *testing.T) { - skip.If(t, testEnv.DaemonInfo.OSType != "linux") + skip.If(t, testEnv.IsRemoteDaemon) testIpcContainer(t, "shareable", true) @@ -186,7 +186,8 @@ func TestAPIIpcModeShareableAndContainer(t *testing.T) { * can use IPC of the host system. */ func TestAPIIpcModeHost(t *testing.T) { - skip.If(t, testEnv.DaemonInfo.OSType != "linux" || testEnv.IsRemoteDaemon() || testEnv.IsUserNamespace()) + skip.If(t, testEnv.IsRemoteDaemon) + skip.If(t, testEnv.IsUserNamespace) cfg := containertypes.Config{ Image: "busybox", @@ -257,14 +258,14 @@ func testDaemonIpcPrivateShareable(t *testing.T, mustBeShared bool, arg ...strin // TestDaemonIpcModeShareable checks that --default-ipc-mode shareable works as intended. func TestDaemonIpcModeShareable(t *testing.T) { - skip.If(t, testEnv.DaemonInfo.OSType != "linux" || testEnv.IsRemoteDaemon()) + skip.If(t, testEnv.IsRemoteDaemon) testDaemonIpcPrivateShareable(t, true, "--default-ipc-mode", "shareable") } // TestDaemonIpcModePrivate checks that --default-ipc-mode private works as intended. func TestDaemonIpcModePrivate(t *testing.T) { - skip.If(t, testEnv.DaemonInfo.OSType != "linux" || testEnv.IsRemoteDaemon()) + skip.If(t, testEnv.IsRemoteDaemon) testDaemonIpcPrivateShareable(t, false, "--default-ipc-mode", "private") } @@ -280,14 +281,14 @@ func testDaemonIpcFromConfig(t *testing.T, mode string, mustExist bool) { // TestDaemonIpcModePrivateFromConfig checks that "default-ipc-mode: private" config works as intended. func TestDaemonIpcModePrivateFromConfig(t *testing.T) { - skip.If(t, testEnv.DaemonInfo.OSType != "linux" || testEnv.IsRemoteDaemon()) + skip.If(t, testEnv.IsRemoteDaemon) testDaemonIpcFromConfig(t, "private", false) } // TestDaemonIpcModeShareableFromConfig checks that "default-ipc-mode: shareable" config works as intended. func TestDaemonIpcModeShareableFromConfig(t *testing.T) { - skip.If(t, testEnv.DaemonInfo.OSType != "linux" || testEnv.IsRemoteDaemon()) + skip.If(t, testEnv.IsRemoteDaemon) testDaemonIpcFromConfig(t, "shareable", true) } diff --git a/components/engine/integration/container/mounts_linux_test.go b/components/engine/integration/container/mounts_linux_test.go index 940c6ab882..8f77bc055a 100644 --- a/components/engine/integration/container/mounts_linux_test.go +++ b/components/engine/integration/container/mounts_linux_test.go @@ -20,7 +20,7 @@ import ( func TestContainerNetworkMountsNoChown(t *testing.T) { // chown only applies to Linux bind mounted volumes; must be same host to verify - skip.If(t, testEnv.DaemonInfo.OSType == "windows" || testEnv.IsRemoteDaemon()) + skip.If(t, testEnv.IsRemoteDaemon) defer setupTest(t)() @@ -80,7 +80,7 @@ func TestContainerNetworkMountsNoChown(t *testing.T) { } func TestMountDaemonRoot(t *testing.T) { - skip.If(t, testEnv.DaemonInfo.OSType == "windows" || testEnv.IsRemoteDaemon()) + skip.If(t, testEnv.IsRemoteDaemon) defer setupTest(t)() client := testEnv.APIClient()