Browse code

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>

Sebastiaan van Stijn authored on 2019/01/03 20:32:05
Showing 2 changed files
... ...
@@ -92,7 +92,7 @@ func testIpcNonePrivateShareable(t *testing.T, mode string, mustBeMounted bool,
92 92
 // (--ipc none) works as expected. It makes sure there is no
93 93
 // /dev/shm mount inside the container.
94 94
 func TestIpcModeNone(t *testing.T) {
95
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux" || testEnv.IsRemoteDaemon())
95
+	skip.If(t, testEnv.IsRemoteDaemon)
96 96
 
97 97
 	testIpcNonePrivateShareable(t, "none", false, false)
98 98
 }
... ...
@@ -102,7 +102,7 @@ func TestIpcModeNone(t *testing.T) {
102 102
 // of /dev/shm mount from the container, and makes sure there is no
103 103
 // such pair on the host.
104 104
 func TestIpcModePrivate(t *testing.T) {
105
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux" || testEnv.IsRemoteDaemon())
105
+	skip.If(t, testEnv.IsRemoteDaemon)
106 106
 
107 107
 	testIpcNonePrivateShareable(t, "private", true, false)
108 108
 }
... ...
@@ -112,7 +112,7 @@ func TestIpcModePrivate(t *testing.T) {
112 112
 // of /dev/shm mount from the container, and makes sure such pair
113 113
 // also exists on the host.
114 114
 func TestIpcModeShareable(t *testing.T) {
115
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux" || testEnv.IsRemoteDaemon())
115
+	skip.If(t, testEnv.IsRemoteDaemon)
116 116
 
117 117
 	testIpcNonePrivateShareable(t, "shareable", true, true)
118 118
 }
... ...
@@ -175,7 +175,7 @@ func testIpcContainer(t *testing.T, donorMode string, mustWork bool) {
175 175
 // 1) a container created with --ipc container:ID can use IPC of another shareable container.
176 176
 // 2) a container created with --ipc container:ID can NOT use IPC of another private container.
177 177
 func TestAPIIpcModeShareableAndContainer(t *testing.T) {
178
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
178
+	skip.If(t, testEnv.IsRemoteDaemon)
179 179
 
180 180
 	testIpcContainer(t, "shareable", true)
181 181
 
... ...
@@ -186,7 +186,8 @@ func TestAPIIpcModeShareableAndContainer(t *testing.T) {
186 186
  * can use IPC of the host system.
187 187
  */
188 188
 func TestAPIIpcModeHost(t *testing.T) {
189
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux" || testEnv.IsRemoteDaemon() || testEnv.IsUserNamespace())
189
+	skip.If(t, testEnv.IsRemoteDaemon)
190
+	skip.If(t, testEnv.IsUserNamespace)
190 191
 
191 192
 	cfg := containertypes.Config{
192 193
 		Image: "busybox",
... ...
@@ -257,14 +258,14 @@ func testDaemonIpcPrivateShareable(t *testing.T, mustBeShared bool, arg ...strin
257 257
 
258 258
 // TestDaemonIpcModeShareable checks that --default-ipc-mode shareable works as intended.
259 259
 func TestDaemonIpcModeShareable(t *testing.T) {
260
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux" || testEnv.IsRemoteDaemon())
260
+	skip.If(t, testEnv.IsRemoteDaemon)
261 261
 
262 262
 	testDaemonIpcPrivateShareable(t, true, "--default-ipc-mode", "shareable")
263 263
 }
264 264
 
265 265
 // TestDaemonIpcModePrivate checks that --default-ipc-mode private works as intended.
266 266
 func TestDaemonIpcModePrivate(t *testing.T) {
267
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux" || testEnv.IsRemoteDaemon())
267
+	skip.If(t, testEnv.IsRemoteDaemon)
268 268
 
269 269
 	testDaemonIpcPrivateShareable(t, false, "--default-ipc-mode", "private")
270 270
 }
... ...
@@ -280,14 +281,14 @@ func testDaemonIpcFromConfig(t *testing.T, mode string, mustExist bool) {
280 280
 
281 281
 // TestDaemonIpcModePrivateFromConfig checks that "default-ipc-mode: private" config works as intended.
282 282
 func TestDaemonIpcModePrivateFromConfig(t *testing.T) {
283
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux" || testEnv.IsRemoteDaemon())
283
+	skip.If(t, testEnv.IsRemoteDaemon)
284 284
 
285 285
 	testDaemonIpcFromConfig(t, "private", false)
286 286
 }
287 287
 
288 288
 // TestDaemonIpcModeShareableFromConfig checks that "default-ipc-mode: shareable" config works as intended.
289 289
 func TestDaemonIpcModeShareableFromConfig(t *testing.T) {
290
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux" || testEnv.IsRemoteDaemon())
290
+	skip.If(t, testEnv.IsRemoteDaemon)
291 291
 
292 292
 	testDaemonIpcFromConfig(t, "shareable", true)
293 293
 }
... ...
@@ -25,7 +25,7 @@ import (
25 25
 
26 26
 func TestContainerNetworkMountsNoChown(t *testing.T) {
27 27
 	// chown only applies to Linux bind mounted volumes; must be same host to verify
28
-	skip.If(t, testEnv.DaemonInfo.OSType == "windows" || testEnv.IsRemoteDaemon())
28
+	skip.If(t, testEnv.IsRemoteDaemon)
29 29
 
30 30
 	defer setupTest(t)()
31 31
 
... ...
@@ -85,7 +85,7 @@ func TestContainerNetworkMountsNoChown(t *testing.T) {
85 85
 }
86 86
 
87 87
 func TestMountDaemonRoot(t *testing.T) {
88
-	skip.If(t, testEnv.DaemonInfo.OSType == "windows" || testEnv.IsRemoteDaemon())
88
+	skip.If(t, testEnv.IsRemoteDaemon)
89 89
 
90 90
 	defer setupTest(t)()
91 91
 	client := testEnv.APIClient()
... ...
@@ -212,7 +212,7 @@ func TestMountDaemonRoot(t *testing.T) {
212 212
 }
213 213
 
214 214
 func TestContainerBindMountNonRecursive(t *testing.T) {
215
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux" || testEnv.IsRemoteDaemon())
215
+	skip.If(t, testEnv.IsRemoteDaemon)
216 216
 	skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.40"), "BindOptions.NonRecursive requires API v1.40")
217 217
 
218 218
 	defer setupTest(t)()