Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn authored on 2018/01/15 23:32:06... | ... |
@@ -30,7 +30,7 @@ func (s *DockerSuite) TestBuildAPIDockerFileRemote(c *check.C) { |
30 | 30 |
testRequires(c, NotUserNamespace) |
31 | 31 |
|
32 | 32 |
var testD string |
33 |
- if testEnv.DaemonPlatform() == "windows" { |
|
33 |
+ if testEnv.OSType == "windows" { |
|
34 | 34 |
testD = `FROM busybox |
35 | 35 |
RUN find / -name ba* |
36 | 36 |
RUN find /tmp/` |
... | ... |
@@ -1016,7 +1016,7 @@ func (s *DockerSuite) TestContainerAPIWait(c *check.C) { |
1016 | 1016 |
name := "test-api-wait" |
1017 | 1017 |
|
1018 | 1018 |
sleepCmd := "/bin/sleep" |
1019 |
- if testEnv.DaemonPlatform() == "windows" { |
|
1019 |
+ if testEnv.OSType == "windows" { |
|
1020 | 1020 |
sleepCmd = "sleep" |
1021 | 1021 |
} |
1022 | 1022 |
dockerCmd(c, "run", "--name", name, "busybox", sleepCmd, "2") |
... | ... |
@@ -1216,7 +1216,7 @@ func (s *DockerSuite) TestContainerAPIDeleteRemoveVolume(c *check.C) { |
1216 | 1216 |
testRequires(c, SameHostDaemon) |
1217 | 1217 |
|
1218 | 1218 |
vol := "/testvolume" |
1219 |
- if testEnv.DaemonPlatform() == "windows" { |
|
1219 |
+ if testEnv.OSType == "windows" { |
|
1220 | 1220 |
vol = `c:\testvolume` |
1221 | 1221 |
} |
1222 | 1222 |
|
... | ... |
@@ -1890,7 +1890,7 @@ func (s *DockerSuite) TestContainersAPICreateMountsCreate(c *check.C) { |
1890 | 1890 |
var ( |
1891 | 1891 |
testImg string |
1892 | 1892 |
) |
1893 |
- if testEnv.DaemonPlatform() != "windows" { |
|
1893 |
+ if testEnv.OSType != "windows" { |
|
1894 | 1894 |
testImg = "test-mount-config" |
1895 | 1895 |
buildImageSuccessfully(c, testImg, build.WithDockerfile(` |
1896 | 1896 |
FROM busybox |
... | ... |
@@ -1987,7 +1987,7 @@ func (s *DockerSuite) TestContainersAPICreateMountsCreate(c *check.C) { |
1987 | 1987 |
} |
1988 | 1988 |
} |
1989 | 1989 |
|
1990 |
- if testEnv.DaemonPlatform() != "windows" { // Windows does not support volume populate |
|
1990 |
+ if testEnv.OSType != "windows" { // Windows does not support volume populate |
|
1991 | 1991 |
cases = append(cases, []testCase{ |
1992 | 1992 |
{ |
1993 | 1993 |
spec: mounttypes.Mount{Type: "volume", Target: destPath, VolumeOptions: &mounttypes.VolumeOptions{NoCopy: true}}, |
... | ... |
@@ -80,7 +80,7 @@ func (s *DockerSuite) TestAPIImagesDelete(c *check.C) { |
80 | 80 |
c.Assert(err, checker.IsNil) |
81 | 81 |
defer cli.Close() |
82 | 82 |
|
83 |
- if testEnv.DaemonPlatform() != "windows" { |
|
83 |
+ if testEnv.OSType != "windows" { |
|
84 | 84 |
testRequires(c, Network) |
85 | 85 |
} |
86 | 86 |
name := "test-api-images-delete" |
... | ... |
@@ -104,7 +104,7 @@ func (s *DockerSuite) TestAPIImagesHistory(c *check.C) { |
104 | 104 |
c.Assert(err, checker.IsNil) |
105 | 105 |
defer cli.Close() |
106 | 106 |
|
107 |
- if testEnv.DaemonPlatform() != "windows" { |
|
107 |
+ if testEnv.OSType != "windows" { |
|
108 | 108 |
testRequires(c, Network) |
109 | 109 |
} |
110 | 110 |
name := "test-api-images-history" |
... | ... |
@@ -39,7 +39,7 @@ func (s *DockerSuite) TestAPIStatsNoStreamGetCpu(c *check.C) { |
39 | 39 |
|
40 | 40 |
var cpuPercent = 0.0 |
41 | 41 |
|
42 |
- if testEnv.DaemonPlatform() != "windows" { |
|
42 |
+ if testEnv.OSType != "windows" { |
|
43 | 43 |
cpuDelta := float64(v.CPUStats.CPUUsage.TotalUsage - v.PreCPUStats.CPUUsage.TotalUsage) |
44 | 44 |
systemDelta := float64(v.CPUStats.SystemUsage - v.PreCPUStats.SystemUsage) |
45 | 45 |
cpuPercent = (cpuDelta / systemDelta) * float64(len(v.CPUStats.CPUUsage.PercpuUsage)) * 100.0 |
... | ... |
@@ -105,7 +105,7 @@ func (s *DockerSuite) TestAPIStatsNetworkStats(c *check.C) { |
105 | 105 |
|
106 | 106 |
// Retrieve the container address |
107 | 107 |
net := "bridge" |
108 |
- if testEnv.DaemonPlatform() == "windows" { |
|
108 |
+ if testEnv.OSType == "windows" { |
|
109 | 109 |
net = "nat" |
110 | 110 |
} |
111 | 111 |
contIP := findContainerIP(c, id, net) |
... | ... |
@@ -153,7 +153,7 @@ func (s *DockerSuite) TestAPIStatsNetworkStats(c *check.C) { |
153 | 153 |
// On Linux, account for ARP. |
154 | 154 |
expRxPkts := preRxPackets + uint64(numPings) |
155 | 155 |
expTxPkts := preTxPackets + uint64(numPings) |
156 |
- if testEnv.DaemonPlatform() != "windows" { |
|
156 |
+ if testEnv.OSType != "windows" { |
|
157 | 157 |
expRxPkts++ |
158 | 158 |
expTxPkts++ |
159 | 159 |
} |
... | ... |
@@ -33,7 +33,7 @@ func (s *DockerSuite) TestAPIGetEnabledCORS(c *check.C) { |
33 | 33 |
} |
34 | 34 |
|
35 | 35 |
func (s *DockerSuite) TestAPIClientVersionOldNotSupported(c *check.C) { |
36 |
- if testEnv.DaemonPlatform() != runtime.GOOS { |
|
36 |
+ if testEnv.OSType != runtime.GOOS { |
|
37 | 37 |
c.Skip("Daemon platform doesn't match test platform") |
38 | 38 |
} |
39 | 39 |
if api.MinVersion == api.DefaultVersion { |
... | ... |
@@ -40,7 +40,7 @@ func (s *DockerSuite) TestBuildJSONEmptyRun(c *check.C) { |
40 | 40 |
func (s *DockerSuite) TestBuildShCmdJSONEntrypoint(c *check.C) { |
41 | 41 |
name := "testbuildshcmdjsonentrypoint" |
42 | 42 |
expected := "/bin/sh -c echo test" |
43 |
- if testEnv.DaemonPlatform() == "windows" { |
|
43 |
+ if testEnv.OSType == "windows" { |
|
44 | 44 |
expected = "cmd /S /C echo test" |
45 | 45 |
} |
46 | 46 |
|
... | ... |
@@ -78,7 +78,7 @@ func (s *DockerSuite) TestBuildEnvironmentReplacementVolume(c *check.C) { |
78 | 78 |
|
79 | 79 |
var volumePath string |
80 | 80 |
|
81 |
- if testEnv.DaemonPlatform() == "windows" { |
|
81 |
+ if testEnv.OSType == "windows" { |
|
82 | 82 |
volumePath = "c:/quux" |
83 | 83 |
} else { |
84 | 84 |
volumePath = "/quux" |
... | ... |
@@ -135,7 +135,7 @@ func (s *DockerSuite) TestBuildEnvironmentReplacementWorkdir(c *check.C) { |
135 | 135 |
res := inspectFieldJSON(c, name, "Config.WorkingDir") |
136 | 136 |
|
137 | 137 |
expected := `"/work"` |
138 |
- if testEnv.DaemonPlatform() == "windows" { |
|
138 |
+ if testEnv.OSType == "windows" { |
|
139 | 139 |
expected = `"C:\\work"` |
140 | 140 |
} |
141 | 141 |
if res != expected { |
... | ... |
@@ -1304,7 +1304,7 @@ func (s *DockerSuite) TestBuildRelativeWorkdir(c *check.C) { |
1304 | 1304 |
expectedFinal string |
1305 | 1305 |
) |
1306 | 1306 |
|
1307 |
- if testEnv.DaemonPlatform() == "windows" { |
|
1307 |
+ if testEnv.OSType == "windows" { |
|
1308 | 1308 |
expected1 = `C:/` |
1309 | 1309 |
expected2 = `C:/test1` |
1310 | 1310 |
expected3 = `C:/test2` |
... | ... |
@@ -1383,7 +1383,7 @@ func (s *DockerSuite) TestBuildWorkdirWithEnvVariables(c *check.C) { |
1383 | 1383 |
name := "testbuildworkdirwithenvvariables" |
1384 | 1384 |
|
1385 | 1385 |
var expected string |
1386 |
- if testEnv.DaemonPlatform() == "windows" { |
|
1386 |
+ if testEnv.OSType == "windows" { |
|
1387 | 1387 |
expected = `C:\test1\test2` |
1388 | 1388 |
} else { |
1389 | 1389 |
expected = `/test1/test2` |
... | ... |
@@ -1405,7 +1405,7 @@ func (s *DockerSuite) TestBuildRelativeCopy(c *check.C) { |
1405 | 1405 |
testRequires(c, NotUserNamespace) |
1406 | 1406 |
|
1407 | 1407 |
var expected string |
1408 |
- if testEnv.DaemonPlatform() == "windows" { |
|
1408 |
+ if testEnv.OSType == "windows" { |
|
1409 | 1409 |
expected = `C:/test1/test2` |
1410 | 1410 |
} else { |
1411 | 1411 |
expected = `/test1/test2` |
... | ... |
@@ -2189,7 +2189,7 @@ func (s *DockerSuite) TestBuildAddFileNotFound(c *check.C) { |
2189 | 2189 |
name := "testbuildaddnotfound" |
2190 | 2190 |
expected := "foo: no such file or directory" |
2191 | 2191 |
|
2192 |
- if testEnv.DaemonPlatform() == "windows" { |
|
2192 |
+ if testEnv.OSType == "windows" { |
|
2193 | 2193 |
expected = "foo: The system cannot find the file specified" |
2194 | 2194 |
} |
2195 | 2195 |
|
... | ... |
@@ -2243,7 +2243,7 @@ func (s *DockerSuite) TestBuildOnBuild(c *check.C) { |
2243 | 2243 |
// gh #2446 |
2244 | 2244 |
func (s *DockerSuite) TestBuildAddToSymlinkDest(c *check.C) { |
2245 | 2245 |
makeLink := `ln -s /foo /bar` |
2246 |
- if testEnv.DaemonPlatform() == "windows" { |
|
2246 |
+ if testEnv.OSType == "windows" { |
|
2247 | 2247 |
makeLink = `mklink /D C:\bar C:\foo` |
2248 | 2248 |
} |
2249 | 2249 |
name := "testbuildaddtosymlinkdest" |
... | ... |
@@ -3198,7 +3198,7 @@ func (s *DockerSuite) TestBuildCmdShDashC(c *check.C) { |
3198 | 3198 |
|
3199 | 3199 |
res := inspectFieldJSON(c, name, "Config.Cmd") |
3200 | 3200 |
expected := `["/bin/sh","-c","echo cmd"]` |
3201 |
- if testEnv.DaemonPlatform() == "windows" { |
|
3201 |
+ if testEnv.OSType == "windows" { |
|
3202 | 3202 |
expected = `["cmd","/S","/C","echo cmd"]` |
3203 | 3203 |
} |
3204 | 3204 |
if res != expected { |
... | ... |
@@ -3271,7 +3271,7 @@ func (s *DockerSuite) TestBuildEntrypointCanBeOverriddenByChildInspect(c *check. |
3271 | 3271 |
expected = `["/bin/sh","-c","echo quux"]` |
3272 | 3272 |
) |
3273 | 3273 |
|
3274 |
- if testEnv.DaemonPlatform() == "windows" { |
|
3274 |
+ if testEnv.OSType == "windows" { |
|
3275 | 3275 |
expected = `["cmd","/S","/C","echo quux"]` |
3276 | 3276 |
} |
3277 | 3277 |
|
... | ... |
@@ -3328,7 +3328,7 @@ func (s *DockerSuite) TestBuildVerifySingleQuoteFails(c *check.C) { |
3328 | 3328 |
// it should barf on it. |
3329 | 3329 |
name := "testbuildsinglequotefails" |
3330 | 3330 |
expectedExitCode := 2 |
3331 |
- if testEnv.DaemonPlatform() == "windows" { |
|
3331 |
+ if testEnv.OSType == "windows" { |
|
3332 | 3332 |
expectedExitCode = 127 |
3333 | 3333 |
} |
3334 | 3334 |
|
... | ... |
@@ -3344,7 +3344,7 @@ func (s *DockerSuite) TestBuildVerboseOut(c *check.C) { |
3344 | 3344 |
name := "testbuildverboseout" |
3345 | 3345 |
expected := "\n123\n" |
3346 | 3346 |
|
3347 |
- if testEnv.DaemonPlatform() == "windows" { |
|
3347 |
+ if testEnv.OSType == "windows" { |
|
3348 | 3348 |
expected = "\n123\r\n" |
3349 | 3349 |
} |
3350 | 3350 |
|
... | ... |
@@ -3360,7 +3360,7 @@ func (s *DockerSuite) TestBuildWithTabs(c *check.C) { |
3360 | 3360 |
res := inspectFieldJSON(c, name, "ContainerConfig.Cmd") |
3361 | 3361 |
expected1 := `["/bin/sh","-c","echo\tone\t\ttwo"]` |
3362 | 3362 |
expected2 := `["/bin/sh","-c","echo\u0009one\u0009\u0009two"]` // syntactically equivalent, and what Go 1.3 generates |
3363 |
- if testEnv.DaemonPlatform() == "windows" { |
|
3363 |
+ if testEnv.OSType == "windows" { |
|
3364 | 3364 |
expected1 = `["cmd","/S","/C","echo\tone\t\ttwo"]` |
3365 | 3365 |
expected2 = `["cmd","/S","/C","echo\u0009one\u0009\u0009two"]` // syntactically equivalent, and what Go 1.3 generates |
3366 | 3366 |
} |
... | ... |
@@ -3555,7 +3555,7 @@ func (s *DockerSuite) TestBuildStderr(c *check.C) { |
3555 | 3555 |
result.Assert(c, icmd.Success) |
3556 | 3556 |
|
3557 | 3557 |
// Windows to non-Windows should have a security warning |
3558 |
- if runtime.GOOS == "windows" && testEnv.DaemonPlatform() != "windows" && !strings.Contains(result.Stdout(), "SECURITY WARNING:") { |
|
3558 |
+ if runtime.GOOS == "windows" && testEnv.OSType != "windows" && !strings.Contains(result.Stdout(), "SECURITY WARNING:") { |
|
3559 | 3559 |
c.Fatalf("Stdout contains unexpected output: %q", result.Stdout()) |
3560 | 3560 |
} |
3561 | 3561 |
|
... | ... |
@@ -3667,7 +3667,7 @@ func (s *DockerSuite) TestBuildVolumesRetainContents(c *check.C) { |
3667 | 3667 |
volName = "/foo" |
3668 | 3668 |
) |
3669 | 3669 |
|
3670 |
- if testEnv.DaemonPlatform() == "windows" { |
|
3670 |
+ if testEnv.OSType == "windows" { |
|
3671 | 3671 |
volName = "C:/foo" |
3672 | 3672 |
} |
3673 | 3673 |
|
... | ... |
@@ -3968,7 +3968,7 @@ RUN echo " \ |
3968 | 3968 |
|
3969 | 3969 |
expected := "\n foo \n" |
3970 | 3970 |
// Windows uses the builtin echo, which preserves quotes |
3971 |
- if testEnv.DaemonPlatform() == "windows" { |
|
3971 |
+ if testEnv.OSType == "windows" { |
|
3972 | 3972 |
expected = "\" foo \"" |
3973 | 3973 |
} |
3974 | 3974 |
|
... | ... |
@@ -4002,7 +4002,7 @@ func (s *DockerSuite) TestBuildMissingArgs(c *check.C) { |
4002 | 4002 |
"INSERT": {}, |
4003 | 4003 |
} |
4004 | 4004 |
|
4005 |
- if testEnv.DaemonPlatform() == "windows" { |
|
4005 |
+ if testEnv.OSType == "windows" { |
|
4006 | 4006 |
skipCmds = map[string]struct{}{ |
4007 | 4007 |
"CMD": {}, |
4008 | 4008 |
"RUN": {}, |
... | ... |
@@ -4135,7 +4135,7 @@ func (s *DockerSuite) TestBuildRUNErrMsg(c *check.C) { |
4135 | 4135 |
name := "testbuildbadrunerrmsg" |
4136 | 4136 |
shell := "/bin/sh -c" |
4137 | 4137 |
exitCode := 127 |
4138 |
- if testEnv.DaemonPlatform() == "windows" { |
|
4138 |
+ if testEnv.OSType == "windows" { |
|
4139 | 4139 |
shell = "cmd /S /C" |
4140 | 4140 |
// architectural - Windows has to start the container to determine the exe is bad, Linux does not |
4141 | 4141 |
exitCode = 1 |
... | ... |
@@ -4287,7 +4287,7 @@ func (s *DockerTrustSuite) TestTrustedBuildTagIgnoresOtherDelegationRoles(c *che |
4287 | 4287 |
func (s *DockerSuite) TestBuildNullStringInAddCopyVolume(c *check.C) { |
4288 | 4288 |
name := "testbuildnullstringinaddcopyvolume" |
4289 | 4289 |
volName := "nullvolume" |
4290 |
- if testEnv.DaemonPlatform() == "windows" { |
|
4290 |
+ if testEnv.OSType == "windows" { |
|
4291 | 4291 |
volName = `C:\\nullvolume` |
4292 | 4292 |
} |
4293 | 4293 |
|
... | ... |
@@ -4327,7 +4327,7 @@ func (s *DockerSuite) TestBuildBuildTimeArg(c *check.C) { |
4327 | 4327 |
envKey := "foo" |
4328 | 4328 |
envVal := "bar" |
4329 | 4329 |
var dockerfile string |
4330 |
- if testEnv.DaemonPlatform() == "windows" { |
|
4330 |
+ if testEnv.OSType == "windows" { |
|
4331 | 4331 |
// Bugs in Windows busybox port - use the default base image and native cmd stuff |
4332 | 4332 |
dockerfile = fmt.Sprintf(`FROM `+minimalBaseImage()+` |
4333 | 4333 |
ARG %s |
... | ... |
@@ -4942,7 +4942,7 @@ func (s *DockerSuite) TestBuildMultiStageUnusedArg(c *check.C) { |
4942 | 4942 |
func (s *DockerSuite) TestBuildNoNamedVolume(c *check.C) { |
4943 | 4943 |
volName := "testname:/foo" |
4944 | 4944 |
|
4945 |
- if testEnv.DaemonPlatform() == "windows" { |
|
4945 |
+ if testEnv.OSType == "windows" { |
|
4946 | 4946 |
volName = "testname:C:\\foo" |
4947 | 4947 |
} |
4948 | 4948 |
dockerCmd(c, "run", "-v", volName, "busybox", "sh", "-c", "touch /foo/oops") |
... | ... |
@@ -6345,7 +6345,7 @@ WORKDIR /foo/bar |
6345 | 6345 |
|
6346 | 6346 |
// The Windows busybox image has a blank `cmd` |
6347 | 6347 |
lookingFor := `["sh"]` |
6348 |
- if testEnv.DaemonPlatform() == "windows" { |
|
6348 |
+ if testEnv.OSType == "windows" { |
|
6349 | 6349 |
lookingFor = "null" |
6350 | 6350 |
} |
6351 | 6351 |
c.Assert(strings.TrimSpace(out), checker.Equals, lookingFor) |
... | ... |
@@ -125,7 +125,7 @@ func (s *DockerSuite) TestCommitChange(c *check.C) { |
125 | 125 |
// ENV. On windows, the container doesn't have a `PATH` ENV variable so |
126 | 126 |
// the ordering is the same as the cli. |
127 | 127 |
expectedEnv := "[PATH=/foo DEBUG=true test=1]" |
128 |
- if testEnv.DaemonPlatform() == "windows" { |
|
128 |
+ if testEnv.OSType == "windows" { |
|
129 | 129 |
expectedEnv = "[DEBUG=true test=1 PATH=/foo]" |
130 | 130 |
} |
131 | 131 |
|
... | ... |
@@ -60,7 +60,7 @@ func (s *DockerSuite) TestCreateArgs(c *check.C) { |
60 | 60 |
// Make sure we can grow the container's rootfs at creation time. |
61 | 61 |
func (s *DockerSuite) TestCreateGrowRootfs(c *check.C) { |
62 | 62 |
// Windows and Devicemapper support growing the rootfs |
63 |
- if testEnv.DaemonPlatform() != "windows" { |
|
63 |
+ if testEnv.OSType != "windows" { |
|
64 | 64 |
testRequires(c, Devicemapper) |
65 | 65 |
} |
66 | 66 |
out, _ := dockerCmd(c, "create", "--storage-opt", "size=120G", "busybox") |
... | ... |
@@ -224,7 +224,7 @@ func (s *DockerSuite) TestCreateLabelFromImage(c *check.C) { |
224 | 224 |
func (s *DockerSuite) TestCreateHostnameWithNumber(c *check.C) { |
225 | 225 |
image := "busybox" |
226 | 226 |
// Busybox on Windows does not implement hostname command |
227 |
- if testEnv.DaemonPlatform() == "windows" { |
|
227 |
+ if testEnv.OSType == "windows" { |
|
228 | 228 |
image = testEnv.PlatformDefaults.BaseImage |
229 | 229 |
} |
230 | 230 |
out, _ := dockerCmd(c, "run", "-h", "web.0", image, "hostname") |
... | ... |
@@ -378,7 +378,7 @@ func (s *DockerSuite) TestCreateWithWorkdir(c *check.C) { |
378 | 378 |
|
379 | 379 |
dockerCmd(c, "create", "--name", name, "-w", dir, "busybox") |
380 | 380 |
// Windows does not create the workdir until the container is started |
381 |
- if testEnv.DaemonPlatform() == "windows" { |
|
381 |
+ if testEnv.OSType == "windows" { |
|
382 | 382 |
dockerCmd(c, "start", name) |
383 | 383 |
} |
384 | 384 |
dockerCmd(c, "cp", fmt.Sprintf("%s:%s", name, dir), prefix+slash+"tmp") |
... | ... |
@@ -20,7 +20,7 @@ func (s *DockerSuite) TestDiffFilenameShownInOutput(c *check.C) { |
20 | 20 |
// a "Files/" prefix. |
21 | 21 |
containerID := strings.TrimSpace(out) |
22 | 22 |
lookingFor := "A /foo/bar" |
23 |
- if testEnv.DaemonPlatform() == "windows" { |
|
23 |
+ if testEnv.OSType == "windows" { |
|
24 | 24 |
cli.WaitExited(c, containerID, 60*time.Second) |
25 | 25 |
lookingFor = "C Files/foo/bar" |
26 | 26 |
} |
... | ... |
@@ -659,7 +659,7 @@ func (s *DockerSuite) TestEventsContainerRestart(c *check.C) { |
659 | 659 |
|
660 | 660 |
// wait until test2 is auto removed. |
661 | 661 |
waitTime := 10 * time.Second |
662 |
- if testEnv.DaemonPlatform() == "windows" { |
|
662 |
+ if testEnv.OSType == "windows" { |
|
663 | 663 |
// Windows takes longer... |
664 | 664 |
waitTime = 90 * time.Second |
665 | 665 |
} |
... | ... |
@@ -36,7 +36,7 @@ func (s *DockerSuite) TestInfoEnsureSucceeds(c *check.C) { |
36 | 36 |
"Live Restore Enabled:", |
37 | 37 |
} |
38 | 38 |
|
39 |
- if testEnv.DaemonPlatform() == "linux" { |
|
39 |
+ if testEnv.OSType == "linux" { |
|
40 | 40 |
stringsToCheck = append(stringsToCheck, "Init Binary:", "Security Options:", "containerd version:", "runc version:", "init version:") |
41 | 41 |
} |
42 | 42 |
|
... | ... |
@@ -61,7 +61,7 @@ func (s *DockerSuite) TestInspectStatus(c *check.C) { |
61 | 61 |
|
62 | 62 |
// Windows does not support pause/unpause on Windows Server Containers. |
63 | 63 |
// (RS1 does for Hyper-V Containers, but production CI is not setup for that) |
64 |
- if testEnv.DaemonPlatform() != "windows" { |
|
64 |
+ if testEnv.OSType != "windows" { |
|
65 | 65 |
dockerCmd(c, "pause", out) |
66 | 66 |
inspectOut = inspectField(c, out, "State.Status") |
67 | 67 |
c.Assert(inspectOut, checker.Equals, "paused") |
... | ... |
@@ -206,7 +206,7 @@ func (s *DockerSuite) TestInspectContainerGraphDriver(c *check.C) { |
206 | 206 |
func (s *DockerSuite) TestInspectBindMountPoint(c *check.C) { |
207 | 207 |
modifier := ",z" |
208 | 208 |
prefix, slash := getPrefixAndSlashFromDaemonPlatform() |
209 |
- if testEnv.DaemonPlatform() == "windows" { |
|
209 |
+ if testEnv.OSType == "windows" { |
|
210 | 210 |
modifier = "" |
211 | 211 |
// Linux creates the host directory if it doesn't exist. Windows does not. |
212 | 212 |
os.Mkdir(`c:\data`, os.ModeDir) |
... | ... |
@@ -229,7 +229,7 @@ func (s *DockerSuite) TestInspectBindMountPoint(c *check.C) { |
229 | 229 |
c.Assert(m.Driver, checker.Equals, "") |
230 | 230 |
c.Assert(m.Source, checker.Equals, prefix+slash+"data") |
231 | 231 |
c.Assert(m.Destination, checker.Equals, prefix+slash+"data") |
232 |
- if testEnv.DaemonPlatform() != "windows" { // Windows does not set mode |
|
232 |
+ if testEnv.OSType != "windows" { // Windows does not set mode |
|
233 | 233 |
c.Assert(m.Mode, checker.Equals, "ro"+modifier) |
234 | 234 |
} |
235 | 235 |
c.Assert(m.RW, checker.Equals, false) |
... | ... |
@@ -216,7 +216,7 @@ func (s *DockerSuite) TestPsListContainersFilterStatus(c *check.C) { |
216 | 216 |
}) |
217 | 217 |
|
218 | 218 |
// Windows doesn't support pausing of containers |
219 |
- if testEnv.DaemonPlatform() != "windows" { |
|
219 |
+ if testEnv.OSType != "windows" { |
|
220 | 220 |
// pause running container |
221 | 221 |
out = cli.DockerCmd(c, "run", "-itd", "busybox").Combined() |
222 | 222 |
pausedID := strings.TrimSpace(out) |
... | ... |
@@ -269,7 +269,7 @@ func (s *DockerSuite) TestRestartContainerwithRestartPolicy(c *check.C) { |
269 | 269 |
id1 := strings.TrimSpace(string(out1)) |
270 | 270 |
id2 := strings.TrimSpace(string(out2)) |
271 | 271 |
waitTimeout := 15 * time.Second |
272 |
- if testEnv.DaemonPlatform() == "windows" { |
|
272 |
+ if testEnv.OSType == "windows" { |
|
273 | 273 |
waitTimeout = 150 * time.Second |
274 | 274 |
} |
275 | 275 |
err := waitInspect(id1, "{{ .State.Restarting }} {{ .State.Running }}", "false false", waitTimeout) |
... | ... |
@@ -68,7 +68,7 @@ func (s *DockerSuite) TestRmiImgIDMultipleTag(c *check.C) { |
68 | 68 |
|
69 | 69 |
// Wait for it to exit as cannot commit a running container on Windows, and |
70 | 70 |
// it will take a few seconds to exit |
71 |
- if testEnv.DaemonPlatform() == "windows" { |
|
71 |
+ if testEnv.OSType == "windows" { |
|
72 | 72 |
cli.WaitExited(c, containerID, 60*time.Second) |
73 | 73 |
} |
74 | 74 |
|
... | ... |
@@ -109,7 +109,7 @@ func (s *DockerSuite) TestRmiImgIDForce(c *check.C) { |
109 | 109 |
|
110 | 110 |
// Wait for it to exit as cannot commit a running container on Windows, and |
111 | 111 |
// it will take a few seconds to exit |
112 |
- if testEnv.DaemonPlatform() == "windows" { |
|
112 |
+ if testEnv.OSType == "windows" { |
|
113 | 113 |
cli.WaitExited(c, containerID, 60*time.Second) |
114 | 114 |
} |
115 | 115 |
|
... | ... |
@@ -72,7 +72,7 @@ func (s *DockerSuite) TestRunLeakyFileDescriptors(c *check.C) { |
72 | 72 |
// this will fail when Internet access is unavailable |
73 | 73 |
func (s *DockerSuite) TestRunLookupGoogleDNS(c *check.C) { |
74 | 74 |
testRequires(c, Network, NotArm) |
75 |
- if testEnv.DaemonPlatform() == "windows" { |
|
75 |
+ if testEnv.OSType == "windows" { |
|
76 | 76 |
// nslookup isn't present in Windows busybox. Is built-in. Further, |
77 | 77 |
// nslookup isn't present in nanoserver. Hence just use PowerShell... |
78 | 78 |
dockerCmd(c, "run", testEnv.PlatformDefaults.BaseImage, "powershell", "Resolve-DNSName", "google.com") |
... | ... |
@@ -137,7 +137,7 @@ func (s *DockerSuite) TestRunDetachedContainerIDPrinting(c *check.C) { |
137 | 137 |
func (s *DockerSuite) TestRunWorkingDirectory(c *check.C) { |
138 | 138 |
dir := "/root" |
139 | 139 |
image := "busybox" |
140 |
- if testEnv.DaemonPlatform() == "windows" { |
|
140 |
+ if testEnv.OSType == "windows" { |
|
141 | 141 |
dir = `C:/Windows` |
142 | 142 |
} |
143 | 143 |
|
... | ... |
@@ -160,7 +160,7 @@ func (s *DockerSuite) TestRunWorkingDirectory(c *check.C) { |
160 | 160 |
func (s *DockerSuite) TestRunWithoutNetworking(c *check.C) { |
161 | 161 |
count := "-c" |
162 | 162 |
image := "busybox" |
163 |
- if testEnv.DaemonPlatform() == "windows" { |
|
163 |
+ if testEnv.OSType == "windows" { |
|
164 | 164 |
count = "-n" |
165 | 165 |
image = testEnv.PlatformDefaults.BaseImage |
166 | 166 |
} |
... | ... |
@@ -354,7 +354,7 @@ func (s *DockerSuite) TestRunWithVolumesFromExited(c *check.C) { |
354 | 354 |
) |
355 | 355 |
|
356 | 356 |
// Create a file in a volume |
357 |
- if testEnv.DaemonPlatform() == "windows" { |
|
357 |
+ if testEnv.OSType == "windows" { |
|
358 | 358 |
out, exitCode = dockerCmd(c, "run", "--name", "test-data", "--volume", `c:\some\dir`, testEnv.PlatformDefaults.BaseImage, "cmd", "/c", `echo hello > c:\some\dir\file`) |
359 | 359 |
} else { |
360 | 360 |
out, exitCode = dockerCmd(c, "run", "--name", "test-data", "--volume", "/some/dir", "busybox", "touch", "/some/dir/file") |
... | ... |
@@ -364,7 +364,7 @@ func (s *DockerSuite) TestRunWithVolumesFromExited(c *check.C) { |
364 | 364 |
} |
365 | 365 |
|
366 | 366 |
// Read the file from another container using --volumes-from to access the volume in the second container |
367 |
- if testEnv.DaemonPlatform() == "windows" { |
|
367 |
+ if testEnv.OSType == "windows" { |
|
368 | 368 |
out, exitCode = dockerCmd(c, "run", "--volumes-from", "test-data", testEnv.PlatformDefaults.BaseImage, "cmd", "/c", `type c:\some\dir\file`) |
369 | 369 |
} else { |
370 | 370 |
out, exitCode = dockerCmd(c, "run", "--volumes-from", "test-data", "busybox", "cat", "/some/dir/file") |
... | ... |
@@ -396,7 +396,7 @@ func (s *DockerSuite) TestRunCreateVolumesInSymlinkDir(c *check.C) { |
396 | 396 |
// In the case of Windows to Windows CI, if the machine is setup so that |
397 | 397 |
// the temp directory is not the C: drive, this test is invalid and will |
398 | 398 |
// not work. |
399 |
- if testEnv.DaemonPlatform() == "windows" && strings.ToLower(dir[:1]) != "c" { |
|
399 |
+ if testEnv.OSType == "windows" && strings.ToLower(dir[:1]) != "c" { |
|
400 | 400 |
c.Skip("Requires TEMP to point to C: drive") |
401 | 401 |
} |
402 | 402 |
|
... | ... |
@@ -406,7 +406,7 @@ func (s *DockerSuite) TestRunCreateVolumesInSymlinkDir(c *check.C) { |
406 | 406 |
} |
407 | 407 |
f.Close() |
408 | 408 |
|
409 |
- if testEnv.DaemonPlatform() == "windows" { |
|
409 |
+ if testEnv.OSType == "windows" { |
|
410 | 410 |
dockerFile = fmt.Sprintf("FROM %s\nRUN mkdir %s\nRUN mklink /D c:\\test %s", testEnv.PlatformDefaults.BaseImage, dir, dir) |
411 | 411 |
containerPath = `c:\test\test` |
412 | 412 |
cmd = "tasklist" |
... | ... |
@@ -431,7 +431,7 @@ func (s *DockerSuite) TestRunCreateVolumesInSymlinkDir2(c *check.C) { |
431 | 431 |
testRequires(c, SameHostDaemon, DaemonIsLinux) |
432 | 432 |
name := "test-volume-symlink2" |
433 | 433 |
|
434 |
- if testEnv.DaemonPlatform() == "windows" { |
|
434 |
+ if testEnv.OSType == "windows" { |
|
435 | 435 |
dockerFile = fmt.Sprintf("FROM %s\nRUN mkdir c:\\%s\nRUN mklink /D c:\\test c:\\%s", testEnv.PlatformDefaults.BaseImage, name, name) |
436 | 436 |
containerPath = `c:\test\test` |
437 | 437 |
cmd = "tasklist" |
... | ... |
@@ -455,7 +455,7 @@ func (s *DockerSuite) TestRunVolumesFromInReadonlyModeFails(c *check.C) { |
455 | 455 |
volumeDir string |
456 | 456 |
fileInVol string |
457 | 457 |
) |
458 |
- if testEnv.DaemonPlatform() == "windows" { |
|
458 |
+ if testEnv.OSType == "windows" { |
|
459 | 459 |
volumeDir = `c:/test` // Forward-slash as using busybox |
460 | 460 |
fileInVol = `c:/test/file` |
461 | 461 |
} else { |
... | ... |
@@ -476,7 +476,7 @@ func (s *DockerSuite) TestRunVolumesFromInReadWriteMode(c *check.C) { |
476 | 476 |
volumeDir string |
477 | 477 |
fileInVol string |
478 | 478 |
) |
479 |
- if testEnv.DaemonPlatform() == "windows" { |
|
479 |
+ if testEnv.OSType == "windows" { |
|
480 | 480 |
volumeDir = `c:/test` // Forward-slash as using busybox |
481 | 481 |
fileInVol = `c:/test/file` |
482 | 482 |
} else { |
... | ... |
@@ -497,7 +497,7 @@ func (s *DockerSuite) TestRunVolumesFromInReadWriteMode(c *check.C) { |
497 | 497 |
func (s *DockerSuite) TestVolumesFromGetsProperMode(c *check.C) { |
498 | 498 |
testRequires(c, SameHostDaemon) |
499 | 499 |
prefix, slash := getPrefixAndSlashFromDaemonPlatform() |
500 |
- hostpath := RandomTmpDirPath("test", testEnv.DaemonPlatform()) |
|
500 |
+ hostpath := RandomTmpDirPath("test", testEnv.OSType) |
|
501 | 501 |
if err := os.MkdirAll(hostpath, 0755); err != nil { |
502 | 502 |
c.Fatalf("Failed to create %s: %q", hostpath, err) |
503 | 503 |
} |
... | ... |
@@ -520,11 +520,11 @@ func (s *DockerSuite) TestVolumesFromGetsProperMode(c *check.C) { |
520 | 520 |
|
521 | 521 |
// Test for GH#10618 |
522 | 522 |
func (s *DockerSuite) TestRunNoDupVolumes(c *check.C) { |
523 |
- path1 := RandomTmpDirPath("test1", testEnv.DaemonPlatform()) |
|
524 |
- path2 := RandomTmpDirPath("test2", testEnv.DaemonPlatform()) |
|
523 |
+ path1 := RandomTmpDirPath("test1", testEnv.OSType) |
|
524 |
+ path2 := RandomTmpDirPath("test2", testEnv.OSType) |
|
525 | 525 |
|
526 | 526 |
someplace := ":/someplace" |
527 |
- if testEnv.DaemonPlatform() == "windows" { |
|
527 |
+ if testEnv.OSType == "windows" { |
|
528 | 528 |
// Windows requires that the source directory exists before calling HCS |
529 | 529 |
testRequires(c, SameHostDaemon) |
530 | 530 |
someplace = `:c:\someplace` |
... | ... |
@@ -573,7 +573,7 @@ func (s *DockerSuite) TestRunNoDupVolumes(c *check.C) { |
573 | 573 |
// Test for #1351 |
574 | 574 |
func (s *DockerSuite) TestRunApplyVolumesFromBeforeVolumes(c *check.C) { |
575 | 575 |
prefix := "" |
576 |
- if testEnv.DaemonPlatform() == "windows" { |
|
576 |
+ if testEnv.OSType == "windows" { |
|
577 | 577 |
prefix = `c:` |
578 | 578 |
} |
579 | 579 |
dockerCmd(c, "run", "--name", "parent", "-v", prefix+"/test", "busybox", "touch", prefix+"/test/foo") |
... | ... |
@@ -582,7 +582,7 @@ func (s *DockerSuite) TestRunApplyVolumesFromBeforeVolumes(c *check.C) { |
582 | 582 |
|
583 | 583 |
func (s *DockerSuite) TestRunMultipleVolumesFrom(c *check.C) { |
584 | 584 |
prefix := "" |
585 |
- if testEnv.DaemonPlatform() == "windows" { |
|
585 |
+ if testEnv.OSType == "windows" { |
|
586 | 586 |
prefix = `c:` |
587 | 587 |
} |
588 | 588 |
dockerCmd(c, "run", "--name", "parent1", "-v", prefix+"/test", "busybox", "touch", prefix+"/test/foo") |
... | ... |
@@ -612,7 +612,7 @@ func (s *DockerSuite) TestRunVerifyContainerID(c *check.C) { |
612 | 612 |
// Test that creating a container with a volume doesn't crash. Regression test for #995. |
613 | 613 |
func (s *DockerSuite) TestRunCreateVolume(c *check.C) { |
614 | 614 |
prefix := "" |
615 |
- if testEnv.DaemonPlatform() == "windows" { |
|
615 |
+ if testEnv.OSType == "windows" { |
|
616 | 616 |
prefix = `c:` |
617 | 617 |
} |
618 | 618 |
dockerCmd(c, "run", "-v", prefix+"/var/lib/data", "busybox", "true") |
... | ... |
@@ -668,7 +668,7 @@ func (s *DockerSuite) TestRunVolumesFromSymlinkPath(c *check.C) { |
668 | 668 |
RUN ln -s home /foo |
669 | 669 |
VOLUME ["/foo/bar"]` |
670 | 670 |
|
671 |
- if testEnv.DaemonPlatform() == "windows" { |
|
671 |
+ if testEnv.OSType == "windows" { |
|
672 | 672 |
prefix = `c:` |
673 | 673 |
dfContents = `FROM ` + testEnv.PlatformDefaults.BaseImage + ` |
674 | 674 |
RUN mkdir c:\home |
... | ... |
@@ -714,7 +714,7 @@ func (s *DockerSuite) TestRunExitCode(c *check.C) { |
714 | 714 |
|
715 | 715 |
func (s *DockerSuite) TestRunUserDefaults(c *check.C) { |
716 | 716 |
expected := "uid=0(root) gid=0(root)" |
717 |
- if testEnv.DaemonPlatform() == "windows" { |
|
717 |
+ if testEnv.OSType == "windows" { |
|
718 | 718 |
expected = "uid=1000(ContainerAdministrator) gid=1000(ContainerAdministrator)" |
719 | 719 |
} |
720 | 720 |
out, _ := dockerCmd(c, "run", "busybox", "id") |
... | ... |
@@ -920,7 +920,7 @@ func (s *DockerSuite) TestRunEnvironmentOverride(c *check.C) { |
920 | 920 |
} |
921 | 921 |
|
922 | 922 |
func (s *DockerSuite) TestRunContainerNetwork(c *check.C) { |
923 |
- if testEnv.DaemonPlatform() == "windows" { |
|
923 |
+ if testEnv.OSType == "windows" { |
|
924 | 924 |
// Windows busybox does not have ping. Use built in ping instead. |
925 | 925 |
dockerCmd(c, "run", testEnv.PlatformDefaults.BaseImage, "ping", "-n", "1", "127.0.0.1") |
926 | 926 |
} else { |
... | ... |
@@ -1220,7 +1220,7 @@ func (s *DockerSuite) TestRunModeHostname(c *check.C) { |
1220 | 1220 |
func (s *DockerSuite) TestRunRootWorkdir(c *check.C) { |
1221 | 1221 |
out, _ := dockerCmd(c, "run", "--workdir", "/", "busybox", "pwd") |
1222 | 1222 |
expected := "/\n" |
1223 |
- if testEnv.DaemonPlatform() == "windows" { |
|
1223 |
+ if testEnv.OSType == "windows" { |
|
1224 | 1224 |
expected = "C:" + expected |
1225 | 1225 |
} |
1226 | 1226 |
if out != expected { |
... | ... |
@@ -1229,7 +1229,7 @@ func (s *DockerSuite) TestRunRootWorkdir(c *check.C) { |
1229 | 1229 |
} |
1230 | 1230 |
|
1231 | 1231 |
func (s *DockerSuite) TestRunAllowBindMountingRoot(c *check.C) { |
1232 |
- if testEnv.DaemonPlatform() == "windows" { |
|
1232 |
+ if testEnv.OSType == "windows" { |
|
1233 | 1233 |
// Windows busybox will fail with Permission Denied on items such as pagefile.sys |
1234 | 1234 |
dockerCmd(c, "run", "-v", `c:\:c:\host`, testEnv.PlatformDefaults.BaseImage, "cmd", "-c", "dir", `c:\host`) |
1235 | 1235 |
} else { |
... | ... |
@@ -1240,7 +1240,7 @@ func (s *DockerSuite) TestRunAllowBindMountingRoot(c *check.C) { |
1240 | 1240 |
func (s *DockerSuite) TestRunDisallowBindMountingRootToRoot(c *check.C) { |
1241 | 1241 |
mount := "/:/" |
1242 | 1242 |
targetDir := "/host" |
1243 |
- if testEnv.DaemonPlatform() == "windows" { |
|
1243 |
+ if testEnv.OSType == "windows" { |
|
1244 | 1244 |
mount = `c:\:c\` |
1245 | 1245 |
targetDir = "c:/host" // Forward slash as using busybox |
1246 | 1246 |
} |
... | ... |
@@ -1704,7 +1704,7 @@ func (s *DockerSuite) TestRunCleanupCmdOnEntrypoint(c *check.C) { |
1704 | 1704 |
} |
1705 | 1705 |
out = strings.TrimSpace(out) |
1706 | 1706 |
expected := "root" |
1707 |
- if testEnv.DaemonPlatform() == "windows" { |
|
1707 |
+ if testEnv.OSType == "windows" { |
|
1708 | 1708 |
if strings.Contains(testEnv.PlatformDefaults.BaseImage, "windowsservercore") { |
1709 | 1709 |
expected = `user manager\containeradministrator` |
1710 | 1710 |
} else { |
... | ... |
@@ -1720,7 +1720,7 @@ func (s *DockerSuite) TestRunCleanupCmdOnEntrypoint(c *check.C) { |
1720 | 1720 |
func (s *DockerSuite) TestRunWorkdirExistsAndIsFile(c *check.C) { |
1721 | 1721 |
existingFile := "/bin/cat" |
1722 | 1722 |
expected := "not a directory" |
1723 |
- if testEnv.DaemonPlatform() == "windows" { |
|
1723 |
+ if testEnv.OSType == "windows" { |
|
1724 | 1724 |
existingFile = `\windows\system32\ntdll.dll` |
1725 | 1725 |
expected = `The directory name is invalid.` |
1726 | 1726 |
} |
... | ... |
@@ -1736,7 +1736,7 @@ func (s *DockerSuite) TestRunExitOnStdinClose(c *check.C) { |
1736 | 1736 |
|
1737 | 1737 |
meow := "/bin/cat" |
1738 | 1738 |
delay := 60 |
1739 |
- if testEnv.DaemonPlatform() == "windows" { |
|
1739 |
+ if testEnv.OSType == "windows" { |
|
1740 | 1740 |
meow = "cat" |
1741 | 1741 |
} |
1742 | 1742 |
runCmd := exec.Command(dockerBinary, "run", "--name", name, "-i", "busybox", meow) |
... | ... |
@@ -1881,7 +1881,7 @@ func (s *DockerSuite) TestRunEntrypoint(c *check.C) { |
1881 | 1881 |
|
1882 | 1882 |
func (s *DockerSuite) TestRunBindMounts(c *check.C) { |
1883 | 1883 |
testRequires(c, SameHostDaemon) |
1884 |
- if testEnv.DaemonPlatform() == "linux" { |
|
1884 |
+ if testEnv.OSType == "linux" { |
|
1885 | 1885 |
testRequires(c, DaemonIsLinux, NotUserNamespace) |
1886 | 1886 |
} |
1887 | 1887 |
|
... | ... |
@@ -1902,7 +1902,7 @@ func (s *DockerSuite) TestRunBindMounts(c *check.C) { |
1902 | 1902 |
} |
1903 | 1903 |
|
1904 | 1904 |
// test writing to bind mount |
1905 |
- if testEnv.DaemonPlatform() == "windows" { |
|
1905 |
+ if testEnv.OSType == "windows" { |
|
1906 | 1906 |
dockerCmd(c, "run", "-v", fmt.Sprintf(`%s:c:\tmp:rw`, tmpDir), "busybox", "touch", "c:/tmp/holla") |
1907 | 1907 |
} else { |
1908 | 1908 |
dockerCmd(c, "run", "-v", fmt.Sprintf("%s:/tmp:rw", tmpDir), "busybox", "touch", "/tmp/holla") |
... | ... |
@@ -1917,7 +1917,7 @@ func (s *DockerSuite) TestRunBindMounts(c *check.C) { |
1917 | 1917 |
} |
1918 | 1918 |
|
1919 | 1919 |
// Windows does not (and likely never will) support mounting a single file |
1920 |
- if testEnv.DaemonPlatform() != "windows" { |
|
1920 |
+ if testEnv.OSType != "windows" { |
|
1921 | 1921 |
// test mount a file |
1922 | 1922 |
dockerCmd(c, "run", "-v", fmt.Sprintf("%s/holla:/tmp/holla:rw", tmpDir), "busybox", "sh", "-c", "echo -n 'yotta' > /tmp/holla") |
1923 | 1923 |
content := readFile(path.Join(tmpDir, "holla"), c) // Will fail if the file doesn't exist |
... | ... |
@@ -1942,7 +1942,7 @@ func (s *DockerSuite) TestRunCidFileCleanupIfEmpty(c *check.C) { |
1942 | 1942 |
tmpCidFile := path.Join(tmpDir, "cid") |
1943 | 1943 |
|
1944 | 1944 |
image := "emptyfs" |
1945 |
- if testEnv.DaemonPlatform() == "windows" { |
|
1945 |
+ if testEnv.OSType == "windows" { |
|
1946 | 1946 |
// Windows can't support an emptyfs image. Just use the regular Windows image |
1947 | 1947 |
image = testEnv.PlatformDefaults.BaseImage |
1948 | 1948 |
} |
... | ... |
@@ -1988,7 +1988,7 @@ func (s *DockerSuite) TestRunCidFileCheckIDLength(c *check.C) { |
1988 | 1988 |
func (s *DockerSuite) TestRunSetMacAddress(c *check.C) { |
1989 | 1989 |
mac := "12:34:56:78:9a:bc" |
1990 | 1990 |
var out string |
1991 |
- if testEnv.DaemonPlatform() == "windows" { |
|
1991 |
+ if testEnv.OSType == "windows" { |
|
1992 | 1992 |
out, _ = dockerCmd(c, "run", "-i", "--rm", fmt.Sprintf("--mac-address=%s", mac), "busybox", "sh", "-c", "ipconfig /all | grep 'Physical Address' | awk '{print $12}'") |
1993 | 1993 |
mac = strings.Replace(strings.ToUpper(mac), ":", "-", -1) // To Windows-style MACs |
1994 | 1994 |
} else { |
... | ... |
@@ -2185,7 +2185,7 @@ func (s *DockerSuite) TestVolumesNoCopyData(c *check.C) { |
2185 | 2185 |
c.Fatalf("Data was copied on volumes-from but shouldn't be:\n%q", out) |
2186 | 2186 |
} |
2187 | 2187 |
|
2188 |
- tmpDir := RandomTmpDirPath("docker_test_bind_mount_copy_data", testEnv.DaemonPlatform()) |
|
2188 |
+ tmpDir := RandomTmpDirPath("docker_test_bind_mount_copy_data", testEnv.OSType) |
|
2189 | 2189 |
if out, _, err := dockerCmdWithError("run", "-v", tmpDir+":/foo", "dataimage", "ls", "-lh", "/foo/bar"); err == nil || !strings.Contains(out, "No such file or directory") { |
2190 | 2190 |
c.Fatalf("Data was copied on bind mount but shouldn't be:\n%q", out) |
2191 | 2191 |
} |
... | ... |
@@ -2558,7 +2558,7 @@ func (s *DockerSuite) TestRunNonLocalMacAddress(c *check.C) { |
2558 | 2558 |
args := []string{"run", "--mac-address", addr} |
2559 | 2559 |
expected := addr |
2560 | 2560 |
|
2561 |
- if testEnv.DaemonPlatform() != "windows" { |
|
2561 |
+ if testEnv.OSType != "windows" { |
|
2562 | 2562 |
args = append(args, "busybox", "ifconfig") |
2563 | 2563 |
} else { |
2564 | 2564 |
args = append(args, testEnv.PlatformDefaults.BaseImage, "ipconfig", "/all") |
... | ... |
@@ -2654,7 +2654,7 @@ func (s *DockerSuite) TestRunSetDefaultRestartPolicy(c *check.C) { |
2654 | 2654 |
func (s *DockerSuite) TestRunRestartMaxRetries(c *check.C) { |
2655 | 2655 |
out, _ := dockerCmd(c, "run", "-d", "--restart=on-failure:3", "busybox", "false") |
2656 | 2656 |
timeout := 10 * time.Second |
2657 |
- if testEnv.DaemonPlatform() == "windows" { |
|
2657 |
+ if testEnv.OSType == "windows" { |
|
2658 | 2658 |
timeout = 120 * time.Second |
2659 | 2659 |
} |
2660 | 2660 |
|
... | ... |
@@ -3022,7 +3022,7 @@ func (s *DockerSuite) TestVolumeFromMixedRWOptions(c *check.C) { |
3022 | 3022 |
dockerCmd(c, "run", "--volumes-from", "parent:ro", "--name", "test-volumes-1", "busybox", "true") |
3023 | 3023 |
dockerCmd(c, "run", "--volumes-from", "parent:rw", "--name", "test-volumes-2", "busybox", "true") |
3024 | 3024 |
|
3025 |
- if testEnv.DaemonPlatform() != "windows" { |
|
3025 |
+ if testEnv.OSType != "windows" { |
|
3026 | 3026 |
mRO, err := inspectMountPoint("test-volumes-1", prefix+slash+"test") |
3027 | 3027 |
c.Assert(err, checker.IsNil, check.Commentf("failed to inspect mount point")) |
3028 | 3028 |
if mRO.RW { |
... | ... |
@@ -3482,7 +3482,7 @@ func (s *DockerSuite) TestRunLoopbackOnlyExistsWhenNetworkingDisabled(c *check.C |
3482 | 3482 |
|
3483 | 3483 |
// Issue #4681 |
3484 | 3484 |
func (s *DockerSuite) TestRunLoopbackWhenNetworkDisabled(c *check.C) { |
3485 |
- if testEnv.DaemonPlatform() == "windows" { |
|
3485 |
+ if testEnv.OSType == "windows" { |
|
3486 | 3486 |
dockerCmd(c, "run", "--net=none", testEnv.PlatformDefaults.BaseImage, "ping", "-n", "1", "127.0.0.1") |
3487 | 3487 |
} else { |
3488 | 3488 |
dockerCmd(c, "run", "--net=none", "busybox", "ping", "-c", "1", "127.0.0.1") |
... | ... |
@@ -3749,7 +3749,7 @@ func (s *DockerSuite) TestRunNonExistingCmd(c *check.C) { |
3749 | 3749 |
// as that's when the check is made (and yes, by its design...) |
3750 | 3750 |
func (s *DockerSuite) TestCmdCannotBeInvoked(c *check.C) { |
3751 | 3751 |
expected := 126 |
3752 |
- if testEnv.DaemonPlatform() == "windows" { |
|
3752 |
+ if testEnv.OSType == "windows" { |
|
3753 | 3753 |
expected = 127 |
3754 | 3754 |
} |
3755 | 3755 |
name := "testCmdCannotBeInvoked" |
... | ... |
@@ -13,7 +13,7 @@ func (s *DockerSuite) TestTopMultipleArgs(c *check.C) { |
13 | 13 |
cleanedContainerID := strings.TrimSpace(out) |
14 | 14 |
|
15 | 15 |
var expected icmd.Expected |
16 |
- switch testEnv.DaemonPlatform() { |
|
16 |
+ switch testEnv.OSType { |
|
17 | 17 |
case "windows": |
18 | 18 |
expected = icmd.Expected{ExitCode: 1, Err: "Windows does not support arguments to top"} |
19 | 19 |
default: |
... | ... |
@@ -34,7 +34,7 @@ func (s *DockerSuite) TestTopNonPrivileged(c *check.C) { |
34 | 34 |
// Windows will list the name of the launched executable which in this case is busybox.exe, without the parameters. |
35 | 35 |
// Linux will display the command executed in the container |
36 | 36 |
var lookingFor string |
37 |
- if testEnv.DaemonPlatform() == "windows" { |
|
37 |
+ if testEnv.OSType == "windows" { |
|
38 | 38 |
lookingFor = "busybox.exe" |
39 | 39 |
} else { |
40 | 40 |
lookingFor = "top" |
... | ... |
@@ -13,7 +13,7 @@ import ( |
13 | 13 |
func (s *DockerSuite) TestUpdateRestartPolicy(c *check.C) { |
14 | 14 |
out := cli.DockerCmd(c, "run", "-d", "--restart=on-failure:3", "busybox", "sh", "-c", "sleep 1 && false").Combined() |
15 | 15 |
timeout := 60 * time.Second |
16 |
- if testEnv.DaemonPlatform() == "windows" { |
|
16 |
+ if testEnv.OSType == "windows" { |
|
17 | 17 |
timeout = 180 * time.Second |
18 | 18 |
} |
19 | 19 |
|
... | ... |
@@ -36,7 +36,7 @@ func (s *DockerSuite) TestDeprecatedContainerAPIStartVolumeBinds(c *check.C) { |
36 | 36 |
// TODO Windows CI: Investigate further why this fails on Windows to Windows CI. |
37 | 37 |
testRequires(c, DaemonIsLinux) |
38 | 38 |
path := "/foo" |
39 |
- if testEnv.DaemonPlatform() == "windows" { |
|
39 |
+ if testEnv.OSType == "windows" { |
|
40 | 40 |
path = `c:\foo` |
41 | 41 |
} |
42 | 42 |
name := "testing" |
... | ... |
@@ -49,7 +49,7 @@ func (s *DockerSuite) TestDeprecatedContainerAPIStartVolumeBinds(c *check.C) { |
49 | 49 |
c.Assert(err, checker.IsNil) |
50 | 50 |
c.Assert(res.StatusCode, checker.Equals, http.StatusCreated) |
51 | 51 |
|
52 |
- bindPath := RandomTmpDirPath("test", testEnv.DaemonPlatform()) |
|
52 |
+ bindPath := RandomTmpDirPath("test", testEnv.OSType) |
|
53 | 53 |
config = map[string]interface{}{ |
54 | 54 |
"Binds": []string{bindPath + ":" + path}, |
55 | 55 |
} |
... | ... |
@@ -76,8 +76,8 @@ func (s *DockerSuite) TestDeprecatedContainerAPIStartDupVolumeBinds(c *check.C) |
76 | 76 |
c.Assert(err, checker.IsNil) |
77 | 77 |
c.Assert(res.StatusCode, checker.Equals, http.StatusCreated) |
78 | 78 |
|
79 |
- bindPath1 := RandomTmpDirPath("test1", testEnv.DaemonPlatform()) |
|
80 |
- bindPath2 := RandomTmpDirPath("test2", testEnv.DaemonPlatform()) |
|
79 |
+ bindPath1 := RandomTmpDirPath("test1", testEnv.OSType) |
|
80 |
+ bindPath2 := RandomTmpDirPath("test2", testEnv.OSType) |
|
81 | 81 |
|
82 | 82 |
config = map[string]interface{}{ |
83 | 83 |
"Binds": []string{bindPath1 + ":/tmp", bindPath2 + ":/tmp"}, |
... | ... |
@@ -48,12 +48,3 @@ func New() (*Execution, error) { |
48 | 48 |
dockerBinary: dockerBinary, |
49 | 49 |
}, nil |
50 | 50 |
} |
51 |
- |
|
52 |
-// DaemonPlatform is held globally so that tests can make intelligent |
|
53 |
-// decisions on how to configure themselves according to the platform |
|
54 |
-// of the daemon. This is initialized in docker_utils by sending |
|
55 |
-// a version call to the daemon and examining the response header. |
|
56 |
-// Deprecated: use Execution.OSType |
|
57 |
-func (e *Execution) DaemonPlatform() string { |
|
58 |
- return e.OSType |
|
59 |
-} |
... | ... |
@@ -38,7 +38,7 @@ func ensureSyscallTest(c *check.C) { |
38 | 38 |
|
39 | 39 |
// if no match, must build in docker, which is significantly slower |
40 | 40 |
// (slower mostly because of the vfs graphdriver) |
41 |
- if testEnv.DaemonPlatform() != runtime.GOOS { |
|
41 |
+ if testEnv.OSType != runtime.GOOS { |
|
42 | 42 |
ensureSyscallTestBuild(c) |
43 | 43 |
return |
44 | 44 |
} |
... | ... |
@@ -93,7 +93,7 @@ func ensureSyscallTestBuild(c *check.C) { |
93 | 93 |
|
94 | 94 |
func ensureNNPTest(c *check.C) { |
95 | 95 |
defer testEnv.ProtectImage(c, "nnp-test:latest") |
96 |
- if testEnv.DaemonPlatform() != runtime.GOOS { |
|
96 |
+ if testEnv.OSType != runtime.GOOS { |
|
97 | 97 |
ensureNNPTestBuild(c) |
98 | 98 |
return |
99 | 99 |
} |
... | ... |
@@ -4,7 +4,7 @@ package main |
4 | 4 |
// the command is for a sleeping container based on the daemon platform. |
5 | 5 |
// The Windows busybox image does not have a `top` command. |
6 | 6 |
func sleepCommandForDaemonPlatform() []string { |
7 |
- if testEnv.DaemonPlatform() == "windows" { |
|
7 |
+ if testEnv.OSType == "windows" { |
|
8 | 8 |
return []string{"sleep", "240"} |
9 | 9 |
} |
10 | 10 |
return []string{"top"} |