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 <github@gone.nl>
(cherry picked from commit 69c0b7e476)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2019-01-03 12:32:05 +01:00
parent b4c0a7efd4
commit bb6db57acc
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
2 changed files with 12 additions and 11 deletions

View file

@ -92,7 +92,7 @@ func testIpcNonePrivateShareable(t *testing.T, mode string, mustBeMounted bool,
// (--ipc none) works as expected. It makes sure there is no // (--ipc none) works as expected. It makes sure there is no
// /dev/shm mount inside the container. // /dev/shm mount inside the container.
func TestIpcModeNone(t *testing.T) { func TestIpcModeNone(t *testing.T) {
skip.If(t, testEnv.DaemonInfo.OSType != "linux" || testEnv.IsRemoteDaemon()) skip.If(t, testEnv.IsRemoteDaemon)
testIpcNonePrivateShareable(t, "none", false, false) 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 // of /dev/shm mount from the container, and makes sure there is no
// such pair on the host. // such pair on the host.
func TestIpcModePrivate(t *testing.T) { func TestIpcModePrivate(t *testing.T) {
skip.If(t, testEnv.DaemonInfo.OSType != "linux" || testEnv.IsRemoteDaemon()) skip.If(t, testEnv.IsRemoteDaemon)
testIpcNonePrivateShareable(t, "private", true, false) 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 // of /dev/shm mount from the container, and makes sure such pair
// also exists on the host. // also exists on the host.
func TestIpcModeShareable(t *testing.T) { func TestIpcModeShareable(t *testing.T) {
skip.If(t, testEnv.DaemonInfo.OSType != "linux" || testEnv.IsRemoteDaemon()) skip.If(t, testEnv.IsRemoteDaemon)
testIpcNonePrivateShareable(t, "shareable", true, true) 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. // 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. // 2) a container created with --ipc container:ID can NOT use IPC of another private container.
func TestAPIIpcModeShareableAndContainer(t *testing.T) { func TestAPIIpcModeShareableAndContainer(t *testing.T) {
skip.If(t, testEnv.DaemonInfo.OSType != "linux") skip.If(t, testEnv.IsRemoteDaemon)
testIpcContainer(t, "shareable", true) testIpcContainer(t, "shareable", true)
@ -186,7 +186,8 @@ func TestAPIIpcModeShareableAndContainer(t *testing.T) {
* can use IPC of the host system. * can use IPC of the host system.
*/ */
func TestAPIIpcModeHost(t *testing.T) { 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{ cfg := containertypes.Config{
Image: "busybox", 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. // TestDaemonIpcModeShareable checks that --default-ipc-mode shareable works as intended.
func TestDaemonIpcModeShareable(t *testing.T) { 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") testDaemonIpcPrivateShareable(t, true, "--default-ipc-mode", "shareable")
} }
// TestDaemonIpcModePrivate checks that --default-ipc-mode private works as intended. // TestDaemonIpcModePrivate checks that --default-ipc-mode private works as intended.
func TestDaemonIpcModePrivate(t *testing.T) { 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") 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. // TestDaemonIpcModePrivateFromConfig checks that "default-ipc-mode: private" config works as intended.
func TestDaemonIpcModePrivateFromConfig(t *testing.T) { func TestDaemonIpcModePrivateFromConfig(t *testing.T) {
skip.If(t, testEnv.DaemonInfo.OSType != "linux" || testEnv.IsRemoteDaemon()) skip.If(t, testEnv.IsRemoteDaemon)
testDaemonIpcFromConfig(t, "private", false) testDaemonIpcFromConfig(t, "private", false)
} }
// TestDaemonIpcModeShareableFromConfig checks that "default-ipc-mode: shareable" config works as intended. // TestDaemonIpcModeShareableFromConfig checks that "default-ipc-mode: shareable" config works as intended.
func TestDaemonIpcModeShareableFromConfig(t *testing.T) { func TestDaemonIpcModeShareableFromConfig(t *testing.T) {
skip.If(t, testEnv.DaemonInfo.OSType != "linux" || testEnv.IsRemoteDaemon()) skip.If(t, testEnv.IsRemoteDaemon)
testDaemonIpcFromConfig(t, "shareable", true) testDaemonIpcFromConfig(t, "shareable", true)
} }

View file

@ -20,7 +20,7 @@ import (
func TestContainerNetworkMountsNoChown(t *testing.T) { func TestContainerNetworkMountsNoChown(t *testing.T) {
// chown only applies to Linux bind mounted volumes; must be same host to verify // 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)() defer setupTest(t)()
@ -80,7 +80,7 @@ func TestContainerNetworkMountsNoChown(t *testing.T) {
} }
func TestMountDaemonRoot(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)() defer setupTest(t)()
client := testEnv.APIClient() client := testEnv.APIClient()