Browse code

Windows: Start of enabling tests under integration/

- Add windows CI entrypoint script.

Signed-off-by: John Howard <jhoward@microsoft.com>
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Vincent Demeester authored on 2018/04/19 18:14:15
Showing 46 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,909 @@
0
+# Jenkins CI scripts for Windows to Windows CI (Powershell Version)
1
+# By John Howard (@jhowardmsft) January 2016 - bash version; July 2016 Ported to PowerShell
2
+
3
+$ErrorActionPreference = 'Stop'
4
+$StartTime=Get-Date
5
+#$env:DOCKER_DUT_DEBUG="yes" # Comment out to not be in debug mode
6
+
7
+# -------------------------------------------------------------------------------------------
8
+# When executed, we rely on four variables being set in the environment:
9
+#
10
+# [The reason for being environment variables rather than parameters is historical. No reason
11
+# why it couldn't be updated.]
12
+#
13
+#    SOURCES_DRIVE       is the drive on which the sources being tested are cloned from.
14
+#                        This should be a straight drive letter, no platform semantics.
15
+#                        For example 'c'
16
+#
17
+#    SOURCES_SUBDIR      is the top level directory under SOURCES_DRIVE where the
18
+#                        sources are cloned to. There are no platform semantics in this
19
+#                        as it does not include slashes.
20
+#                        For example 'gopath'
21
+#
22
+#                        Based on the above examples, it would be expected that Jenkins
23
+#                        would clone the sources being tested to
24
+#                        SOURCES_DRIVE\SOURCES_SUBDIR\src\github.com\docker\docker, or
25
+#                        c:\gopath\src\github.com\docker\docker
26
+#
27
+#    TESTRUN_DRIVE       is the drive where we build the binary on and redirect everything
28
+#                        to for the daemon under test. On an Azure D2 type host which has
29
+#                        an SSD temporary storage D: drive, this is ideal for performance.
30
+#                        For example 'd'
31
+#
32
+#    TESTRUN_SUBDIR      is the top level directory under TESTRUN_DRIVE where we redirect
33
+#                        everything to for the daemon under test. For example 'CI'.
34
+#                        Hence, the daemon under test is run under
35
+#                        TESTRUN_DRIVE\TESTRUN_SUBDIR\CI-<CommitID> or
36
+#                        d:\CI\CI-<CommitID>
37
+#
38
+# In addition, the following variables can control the run configuration:
39
+#
40
+#    DOCKER_DUT_DEBUG         if defined starts the daemon under test in debug mode.
41
+#
42
+#    SKIP_VALIDATION_TESTS    if defined skips the validation tests
43
+#
44
+#    SKIP_UNIT_TESTS          if defined skips the unit tests
45
+#
46
+#    SKIP_INTEGRATION_TESTS   if defined skips the integration tests
47
+#
48
+#    SKIP_COPY_GO             if defined skips copy the go installer from the image
49
+#
50
+#    DOCKER_DUT_HYPERV        if default daemon under test default isolation is hyperv
51
+#
52
+#    INTEGRATION_TEST_NAME    to only run partial tests eg "TestInfo*" will only run
53
+#                             any tests starting "TestInfo"
54
+#
55
+#    SKIP_BINARY_BUILD        if defined skips building the binary
56
+#
57
+#    SKIP_ZAP_DUT             if defined doesn't zap the daemon under test directory
58
+#
59
+#    SKIP_IMAGE_BUILD         if defined doesn't build the 'docker' image
60
+#
61
+#    INTEGRATION_IN_CONTAINER if defined, runs the integration tests from inside a container.
62
+#                             As of July 2016, there are known issues with this.
63
+#
64
+#    SKIP_ALL_CLEANUP         if defined, skips any cleanup at the start or end of the run
65
+#
66
+#    WINDOWS_BASE_IMAGE       if defined, uses that as the base image. Note that the
67
+#                             docker integration tests are also coded to use the same
68
+#                             environment variable, and if no set, defaults to microsoft/windowsservercore
69
+# -------------------------------------------------------------------------------------------
70
+#
71
+# Jenkins Integration. Add a Windows Powershell build step as follows:
72
+#
73
+#    Write-Host -ForegroundColor green "INFO: Jenkins build step starting"
74
+#    $CISCRIPT_DEFAULT_LOCATION = "https://raw.githubusercontent.com/jhowardmsft/docker-w2wCIScripts/master/runCI/executeCI.ps1"
75
+#    $CISCRIPT_LOCAL_LOCATION = "$env:TEMP\executeCI.ps1"
76
+#    Write-Host -ForegroundColor green "INFO: Removing cached execution script"
77
+#    Remove-Item $CISCRIPT_LOCAL_LOCATION -Force -ErrorAction SilentlyContinue 2>&1 | Out-Null
78
+#    $wc = New-Object net.webclient
79
+#    try {
80
+#        Write-Host -ForegroundColor green "INFO: Downloading latest execution script..."
81
+#        $wc.Downloadfile($CISCRIPT_DEFAULT_LOCATION, $CISCRIPT_LOCAL_LOCATION)
82
+#    }
83
+#    catch [System.Net.WebException]
84
+#    {
85
+#        Throw ("Failed to download: $_")
86
+#    }
87
+#    & $CISCRIPT_LOCAL_LOCATION
88
+# -------------------------------------------------------------------------------------------
89
+
90
+$SCRIPT_VER="10-May-2017 12:16 PDT"
91
+$FinallyColour="Cyan"
92
+
93
+#$env:SKIP_UNIT_TESTS="yes"
94
+#$env:SKIP_VALIDATION_TESTS="yes"
95
+#$env:SKIP_ZAP_DUT=""
96
+#$env:SKIP_BINARY_BUILD="yes"
97
+#$env:INTEGRATION_TEST_NAME=""
98
+#$env:SKIP_IMAGE_BUILD="yes"
99
+#$env:SKIP_ALL_CLEANUP="yes"
100
+#$env:INTEGRATION_IN_CONTAINER="yes"
101
+#$env:WINDOWS_BASE_IMAGE=""
102
+#$env:SKIP_COPY_GO="yes"
103
+
104
+Function Nuke-Everything {
105
+    $ErrorActionPreference = 'SilentlyContinue'
106
+    if ($env:SKIP_ALL_CLEANUP -ne $null) {
107
+        Write-Host -ForegroundColor Magenta "WARN: Skipping all cleanup"
108
+        return
109
+    }
110
+
111
+    try {
112
+        Write-Host -ForegroundColor green "INFO: Nuke-Everything..."
113
+        $containerCount = ($(docker ps -aq | Measure-Object -line).Lines)
114
+        if (-not $LastExitCode -eq 0) {
115
+            Throw "ERROR: Failed to get container count from control daemon while nuking"
116
+        }
117
+
118
+        Write-Host -ForegroundColor green "INFO: Container count on control daemon to delete is $containerCount"
119
+        if ($(docker ps -aq | Measure-Object -line).Lines -gt 0) {
120
+            docker rm -f $(docker ps -aq)
121
+        }
122
+        $imageCount=($(docker images --format "{{.Repository}}:{{.ID}}" | `
123
+                        select-string -NotMatch "windowsservercore" | `
124
+                        select-string -NotMatch "nanoserver" | `
125
+                        select-string -NotMatch "docker" | `
126
+                        Measure-Object -line).Lines)
127
+        if ($imageCount -gt 0) {
128
+            Write-Host -Foregroundcolor green "INFO: Non-base image count on control daemon to delete is $imageCount"
129
+            docker rmi -f `
130
+                $(docker images --format "{{.Repository}}:{{.ID}}" | `
131
+                        select-string -NotMatch "windowsservercore" | `
132
+                        select-string -NotMatch "nanoserver" | `
133
+                        select-string -NotMatch "docker").ToString().Split(":")[1]
134
+        }
135
+
136
+        # Kill any spurious daemons. The '-' is IMPORTANT otherwise will kill the control daemon!
137
+        $pids=$(get-process | where-object {$_.ProcessName -like 'dockerd-*'}).id
138
+        foreach ($p in $pids) {
139
+            Write-Host "INFO: Killing daemon with PID $p"
140
+            Stop-Process -Id $p -Force -ErrorAction SilentlyContinue
141
+        }
142
+
143
+        Stop-Process -name "cc1" -Force -ErrorAction SilentlyContinue 2>&1 | Out-Null
144
+        Stop-Process -name "link" -Force -ErrorAction SilentlyContinue 2>&1 | Out-Null
145
+        Stop-Process -name "compile" -Force -ErrorAction SilentlyContinue 2>&1 | Out-Null
146
+        Stop-Process -name "ld" -Force -ErrorAction SilentlyContinue 2>&1 | Out-Null
147
+        Stop-Process -name "go" -Force -ErrorAction SilentlyContinue 2>&1 | Out-Null
148
+        Stop-Process -name "git" -Force -ErrorAction SilentlyContinue 2>&1 | Out-Null
149
+        Stop-Process -name "git-remote-https" -Force -ErrorAction SilentlyContinue 2>&1 | Out-Null
150
+        Stop-Process -name "integration-cli.test" -Force -ErrorAction SilentlyContinue 2>&1 | Out-Null
151
+        Stop-Process -name "tail" -Force -ErrorAction SilentlyContinue 2>&1 | Out-Null
152
+
153
+        # Detach any VHDs
154
+        gwmi msvm_mountedstorageimage -namespace root/virtualization/v2 -ErrorAction SilentlyContinue | foreach-object {$_.DetachVirtualHardDisk() }
155
+
156
+        # Stop any compute processes
157
+        Get-ComputeProcess | Stop-ComputeProcess -Force
158
+
159
+        # Delete the directory using our dangerous utility unless told not to
160
+        if (Test-Path "$env:TESTRUN_DRIVE`:\$env:TESTRUN_SUBDIR") {
161
+            if ($env:SKIP_ZAP_DUT -eq $null) {
162
+                Write-Host -ForegroundColor Green "INFO: Nuking $env:TESTRUN_DRIVE`:\$env:TESTRUN_SUBDIR"
163
+                docker-ci-zap "-folder=$env:TESTRUN_DRIVE`:\$env:TESTRUN_SUBDIR"
164
+            } else {
165
+                Write-Host -ForegroundColor Magenta "WARN: Skip nuking $env:TESTRUN_DRIVE`:\$env:TESTRUN_SUBDIR"
166
+            }
167
+        }
168
+
169
+        # RS1 Production Server workaround - Psched
170
+        $reg = "HKLM:\System\CurrentControlSet\Services\Psched\Parameters\NdisAdapters"
171
+        $count=(Get-ChildItem $reg | Measure-Object).Count
172
+        if ($count -gt 0) {
173
+            Write-Warning "There are $count NdisAdapters leaked under Psched\Parameters"
174
+            if ($env:COMPUTERNAME -match "jenkins-rs1-") {
175
+                Write-Warning "Cleaning Psched..."
176
+                Get-ChildItem $reg | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue | Out-Null
177
+            } else {
178
+                Write-Warning "Not cleaning as not a production RS1 server"
179
+            }
180
+        }
181
+
182
+        # RS1 Production Server workaround - WFPLWFS
183
+        $reg = "HKLM:\System\CurrentControlSet\Services\WFPLWFS\Parameters\NdisAdapters"
184
+        $count=(Get-ChildItem $reg | Measure-Object).Count
185
+        if ($count -gt 0) {
186
+            Write-Warning "There are $count NdisAdapters leaked under WFPLWFS\Parameters"
187
+            if ($env:COMPUTERNAME -match "jenkins-rs1-") {
188
+                Write-Warning "Cleaning WFPLWFS..."
189
+                Get-ChildItem $reg | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue | Out-Null
190
+            } else {
191
+                Write-Warning "Not cleaning as not a production RS1 server"
192
+            }
193
+        }
194
+    } catch {
195
+        # Don't throw any errors onwards Throw $_
196
+    }
197
+}
198
+
199
+Try {
200
+    Write-Host -ForegroundColor Cyan "`nINFO: executeCI.ps1 starting at $(date)`n"
201
+    Write-Host  -ForegroundColor Green "INFO: Script version $SCRIPT_VER"
202
+    Set-PSDebug -Trace 0  # 1 to turn on
203
+    $origPath="$env:PATH"            # so we can restore it at the end
204
+    $origDOCKER_HOST="$DOCKER_HOST"  # So we can restore it at the end
205
+    $origGOROOT="$env:GOROOT"        # So we can restore it at the end
206
+    $origGOPATH="$env:GOPATH"        # So we can restore it at the end
207
+
208
+    # Turn off progress bars
209
+    $origProgressPreference=$global:ProgressPreference
210
+    $global:ProgressPreference='SilentlyContinue'
211
+
212
+    # Git version
213
+    Write-Host  -ForegroundColor Green "INFO: Running $(git version)"
214
+
215
+    # OS Version
216
+    $bl=(Get-ItemProperty -Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion"  -Name BuildLabEx).BuildLabEx
217
+    $a=$bl.ToString().Split(".")
218
+    $Branch=$a[3]
219
+    $WindowsBuild=$a[0]+"."+$a[1]+"."+$a[4]
220
+    Write-Host -ForegroundColor green "INFO: Branch:$Branch Build:$WindowsBuild"
221
+
222
+    # List the environment variables
223
+    Write-Host -ForegroundColor green "INFO: Environment variables:"
224
+    Get-ChildItem Env: | Out-String
225
+
226
+    # PR
227
+    if (-not ($env:PR -eq $Null)) { echo "INFO: PR#$env:PR (https://github.com/docker/docker/pull/$env:PR)" }
228
+
229
+    # Make sure docker is installed
230
+    if ((Get-Command "docker" -ErrorAction SilentlyContinue) -eq $null) { Throw "ERROR: docker is not installed or not found on path" }
231
+
232
+    # Make sure docker-ci-zap is installed
233
+    if ((Get-Command "docker-ci-zap" -ErrorAction SilentlyContinue) -eq $null) { Throw "ERROR: docker-ci-zap is not installed or not found on path" }
234
+
235
+    # Make sure SOURCES_DRIVE is set
236
+    if ($env:SOURCES_DRIVE -eq $Null) { Throw "ERROR: Environment variable SOURCES_DRIVE is not set" }
237
+
238
+    # Make sure TESTRUN_DRIVE is set
239
+    if ($env:TESTRUN_DRIVE -eq $Null) { Throw "ERROR: Environment variable TESTRUN_DRIVE is not set" }
240
+
241
+    # Make sure SOURCES_SUBDIR is set
242
+    if ($env:SOURCES_SUBDIR -eq $Null) { Throw "ERROR: Environment variable SOURCES_SUBDIR is not set" }
243
+
244
+    # Make sure TESTRUN_SUBDIR is set
245
+    if ($env:TESTRUN_SUBDIR -eq $Null) { Throw "ERROR: Environment variable TESTRUN_SUBDIR is not set" }
246
+
247
+    # SOURCES_DRIVE\SOURCES_SUBDIR must be a directory and exist
248
+    if (-not (Test-Path -PathType Container "$env:SOURCES_DRIVE`:\$env:SOURCES_SUBDIR")) { Throw "ERROR: $env:SOURCES_DRIVE`:\$env:SOURCES_SUBDIR must be an existing directory" }
249
+
250
+
251
+    # Create the TESTRUN_DRIVE\TESTRUN_SUBDIR if it does not already exist
252
+    New-Item -ItemType Directory -Force -Path "$env:TESTRUN_DRIVE`:\$env:TESTRUN_SUBDIR" -ErrorAction SilentlyContinue | Out-Null
253
+
254
+    Write-Host  -ForegroundColor Green "INFO: Sources under $env:SOURCES_DRIVE`:\$env:SOURCES_SUBDIR\..."
255
+    Write-Host  -ForegroundColor Green "INFO: Test run under $env:TESTRUN_DRIVE`:\$env:TESTRUN_SUBDIR\..."
256
+
257
+    # Check the intended source location is a directory
258
+    if (-not (Test-Path -PathType Container "$env:SOURCES_DRIVE`:\$env:SOURCES_SUBDIR\src\github.com\docker\docker" -ErrorAction SilentlyContinue)) {
259
+        Throw "ERROR: $env:SOURCES_DRIVE`:\$env:SOURCES_SUBDIR\src\github.com\docker\docker is not a directory!"
260
+    }
261
+
262
+    # Make sure we start at the root of the sources
263
+    cd "$env:SOURCES_DRIVE`:\$env:SOURCES_SUBDIR\src\github.com\docker\docker"
264
+    Write-Host  -ForegroundColor Green "INFO: Running in $(pwd)"
265
+
266
+    # Make sure we are in repo
267
+    if (-not (Test-Path -PathType Leaf -Path ".\Dockerfile.windows")) {
268
+        Throw "$(pwd) does not container Dockerfile.Windows!"
269
+    }
270
+    Write-Host  -ForegroundColor Green "INFO: docker/docker repository was found"
271
+
272
+    # Make sure microsoft/windowsservercore:latest image is installed in the control daemon. On public CI machines, windowsservercore.tar and nanoserver.tar
273
+    # are pre-baked and tagged appropriately in the c:\baseimages directory, and can be directly loaded.
274
+    # Note - this script will only work on 10B (Oct 2016) or later machines! Not 9D or previous due to image tagging assumptions.
275
+    #
276
+    # On machines not on Microsoft corpnet, or those which have not been pre-baked, we have to docker pull the image in which case it will
277
+    # will come in directly as microsoft/windowsservercore:latest. The ultimate goal of all this code is to ensure that whatever,
278
+    # we have microsoft/windowsservercore:latest
279
+    #
280
+    # Note we cannot use (as at Oct 2016) nanoserver as the control daemons base image, even if nanoserver is used in the tests themselves.
281
+
282
+    $ErrorActionPreference = "SilentlyContinue"
283
+    $ControlDaemonBaseImage="windowsservercore"
284
+
285
+    $readBaseFrom="c"
286
+    if ($((docker images --format "{{.Repository}}:{{.Tag}}" | Select-String $("microsoft/"+$ControlDaemonBaseImage+":latest") | Measure-Object -Line).Lines) -eq 0) {
287
+        # Try the internal azure CI image version or Microsoft internal corpnet where the base image is already pre-prepared on the disk,
288
+        # either through Invoke-DockerCI or, in the case of Azure CI servers, baked into the VHD at the same location.
289
+        if (Test-Path $("$env:SOURCES_DRIVE`:\baseimages\"+$ControlDaemonBaseImage+".tar")) {
290
+
291
+            # An optimization for CI servers to copy it to the D: drive which is an SSD.
292
+            if ($env:SOURCES_DRIVE -ne $env:TESTRUN_DRIVE) {
293
+                $readBaseFrom=$env:TESTRUN_DRIVE
294
+                if (!(Test-Path "$env:TESTRUN_DRIVE`:\baseimages")) {
295
+                    New-Item "$env:TESTRUN_DRIVE`:\baseimages" -type directory | Out-Null
296
+                }
297
+                if (!(Test-Path "$env:TESTRUN_DRIVE`:\baseimages\windowsservercore.tar")) {
298
+                    if (Test-Path "$env:SOURCES_DRIVE`:\baseimages\windowsservercore.tar") {
299
+                        Write-Host -ForegroundColor Green "INFO: Optimisation - copying $env:SOURCES_DRIVE`:\baseimages\windowsservercore.tar to $env:TESTRUN_DRIVE`:\baseimages"
300
+                        Copy-Item "$env:SOURCES_DRIVE`:\baseimages\windowsservercore.tar" "$env:TESTRUN_DRIVE`:\baseimages"
301
+                    }
302
+                }
303
+                if (!(Test-Path "$env:TESTRUN_DRIVE`:\baseimages\nanoserver.tar")) {
304
+                    if (Test-Path "$env:SOURCES_DRIVE`:\baseimages\nanoserver.tar") {
305
+                        Write-Host -ForegroundColor Green "INFO: Optimisation - copying $env:SOURCES_DRIVE`:\baseimages\nanoserver.tar to $env:TESTRUN_DRIVE`:\baseimages"
306
+                        Copy-Item "$env:SOURCES_DRIVE`:\baseimages\nanoserver.tar" "$env:TESTRUN_DRIVE`:\baseimages"
307
+                    }
308
+                }
309
+                $readBaseFrom=$env:TESTRUN_DRIVE
310
+            }
311
+
312
+            Write-Host  -ForegroundColor Green "INFO: Loading"$ControlDaemonBaseImage".tar from disk. This may take some time..."
313
+            $ErrorActionPreference = "SilentlyContinue"
314
+            docker load -i $("$readBaseFrom`:\baseimages\"+$ControlDaemonBaseImage+".tar")
315
+            $ErrorActionPreference = "Stop"
316
+            if (-not $LastExitCode -eq 0) {
317
+                Throw $("ERROR: Failed to load $readBaseFrom`:\baseimages\"+$ControlDaemonBaseImage+".tar")
318
+            }
319
+            Write-Host -ForegroundColor Green "INFO: docker load of"$ControlDaemonBaseImage" completed successfully"
320
+        } else {
321
+            # We need to docker pull it instead. It will come in directly as microsoft/imagename:latest
322
+            Write-Host -ForegroundColor Green $("INFO: Pulling microsoft/"+$ControlDaemonBaseImage+":latest from docker hub. This may take some time...")
323
+            $ErrorActionPreference = "SilentlyContinue"
324
+            docker pull $("microsoft/"+$ControlDaemonBaseImage)
325
+            $ErrorActionPreference = "Stop"
326
+            if (-not $LastExitCode -eq 0) {
327
+                Throw $("ERROR: Failed to docker pull microsoft/"+$ControlDaemonBaseImage+":latest.")
328
+            }
329
+            Write-Host -ForegroundColor Green $("INFO: docker pull of microsoft/"+$ControlDaemonBaseImage+":latest completed successfully")
330
+        }
331
+    } else {
332
+        Write-Host -ForegroundColor Green "INFO: Image"$("microsoft/"+$ControlDaemonBaseImage+":latest")"is already loaded in the control daemon"
333
+    }
334
+
335
+    # Inspect the pulled image to get the version directly
336
+    $ErrorActionPreference = "SilentlyContinue"
337
+    $imgVersion = $(docker inspect  $("microsoft/"+$ControlDaemonBaseImage) --format "{{.OsVersion}}")
338
+    $ErrorActionPreference = "Stop"
339
+    Write-Host -ForegroundColor Green $("INFO: Version of microsoft/"+$ControlDaemonBaseImage+":latest is '"+$imgVersion+"'")
340
+
341
+    # Provide the docker version for debugging purposes.
342
+    Write-Host  -ForegroundColor Green "INFO: Docker version of control daemon"
343
+    Write-Host
344
+    $ErrorActionPreference = "SilentlyContinue"
345
+    docker version
346
+    $ErrorActionPreference = "Stop"
347
+    if (-not($LastExitCode -eq 0)) {
348
+        Write-Host
349
+        Write-Host  -ForegroundColor Green "---------------------------------------------------------------------------"
350
+        Write-Host  -ForegroundColor Green " Failed to get a response from the control daemon. It may be down."
351
+        Write-Host  -ForegroundColor Green " Try re-running this CI job, or ask on #docker-dev or #docker-maintainers"
352
+        Write-Host  -ForegroundColor Green " to see if the the daemon is running. Also check the nssm configuration."
353
+        Write-Host  -ForegroundColor Green " DOCKER_HOST is set to $DOCKER_HOST."
354
+        Write-Host  -ForegroundColor Green "---------------------------------------------------------------------------"
355
+        Write-Host
356
+        Throw "ERROR: The control daemon does not appear to be running."
357
+    }
358
+    Write-Host
359
+
360
+    # Same as above, but docker info
361
+    Write-Host  -ForegroundColor Green "INFO: Docker info of control daemon"
362
+    Write-Host
363
+    $ErrorActionPreference = "SilentlyContinue"
364
+    docker info
365
+    $ErrorActionPreference = "Stop"
366
+    if (-not($LastExitCode -eq 0)) {
367
+        Throw "ERROR: The control daemon does not appear to be running."
368
+    }
369
+    Write-Host
370
+
371
+    # Get the commit has and verify we have something
372
+    $ErrorActionPreference = "SilentlyContinue"
373
+    $COMMITHASH=$(git rev-parse --short HEAD)
374
+    $ErrorActionPreference = "Stop"
375
+    if (-not($LastExitCode -eq 0)) {
376
+        Throw "ERROR: Failed to get commit hash. Are you sure this is a docker repository?"
377
+    }
378
+    Write-Host  -ForegroundColor Green "INFO: Commit hash is $COMMITHASH"
379
+
380
+    # Nuke everything and go back to our sources after
381
+    Nuke-Everything
382
+    cd "$env:SOURCES_DRIVE`:\$env:SOURCES_SUBDIR\src\github.com\docker\docker"
383
+
384
+    # Redirect to a temporary location.
385
+    $TEMPORIG=$env:TEMP
386
+    $env:TEMP="$env:TESTRUN_DRIVE`:\$env:TESTRUN_SUBDIR\CI-$COMMITHASH"
387
+    $env:LOCALAPPDATA="$TEMP\localappdata"
388
+    $errorActionPreference='Stop'
389
+    New-Item -ItemType Directory "$env:TEMP" -ErrorAction SilentlyContinue | Out-Null
390
+    New-Item -ItemType Directory "$env:TEMP\userprofile" -ErrorAction SilentlyContinue  | Out-Null
391
+    New-Item -ItemType Directory "$env:TEMP\localappdata" -ErrorAction SilentlyContinue | Out-Null
392
+    New-Item -ItemType Directory "$env:TEMP\binary" -ErrorAction SilentlyContinue | Out-Null
393
+    New-Item -ItemType Directory "$env:TEMP\installer" -ErrorAction SilentlyContinue | Out-Null
394
+    if ($env:SKIP_COPY_GO -eq $null) {
395
+        # Wipe the previous version of GO - we're going to get it out of the image
396
+        if (Test-Path "$env:TEMP\go") { Remove-Item "$env:TEMP\go" -Recurse -Force -ErrorAction SilentlyContinue | Out-Null }
397
+        New-Item -ItemType Directory "$env:TEMP\go" -ErrorAction SilentlyContinue | Out-Null
398
+    }
399
+
400
+    Write-Host -ForegroundColor Green "INFO: Location for testing is $env:TEMP"
401
+
402
+    # CI Integrity check - ensure Dockerfile.windows and Dockerfile go versions match
403
+    $goVersionDockerfileWindows=$(Get-Content ".\Dockerfile.windows" | Select-String "ENV GO_VERSION").ToString().Replace("ENV GO_VERSION=","").Replace("\","").Replace("``","").Trim()
404
+    $goVersionDockerfile=$(Get-Content ".\Dockerfile" | Select-String "ENV GO_VERSION").ToString().Split(" ")[2]
405
+    Write-Host  -ForegroundColor Green "INFO: Validating GOLang consistency in Dockerfile.windows..."
406
+    if (-not ($goVersionDockerfile -eq $goVersionDockerfileWindows)) {
407
+        Throw "ERROR: Mismatched GO versions between Dockerfile and Dockerfile.windows. Update your PR to ensure that both files are updated and in sync. $goVersionDockerfile $goVersionDockerfileWindows"
408
+    }
409
+
410
+    # Build the image
411
+    if ($env:SKIP_IMAGE_BUILD -eq $null) {
412
+        Write-Host  -ForegroundColor Cyan "`n`nINFO: Building the image from Dockerfile.windows at $(Get-Date)..."
413
+        Write-Host
414
+        $ErrorActionPreference = "SilentlyContinue"
415
+        $Duration=$(Measure-Command { docker build -t docker -f Dockerfile.windows . | Out-Host })
416
+        $ErrorActionPreference = "Stop"
417
+        if (-not($LastExitCode -eq 0)) {
418
+           Throw "ERROR: Failed to build image from Dockerfile.windows"
419
+        }
420
+        Write-Host  -ForegroundColor Green "INFO: Image build ended at $(Get-Date). Duration`:$Duration"
421
+    } else {
422
+        Write-Host -ForegroundColor Magenta "WARN: Skipping building the docker image"
423
+    }
424
+
425
+    # DON'T THINK THIS IS USED ANYMORE.... $v=$(Get-Content ".\VERSION" -raw).ToString().Replace("`n","").Trim()
426
+    $contPath="$COMMITHASH`:c`:\go\src\github.com\docker\docker\bundles"
427
+
428
+    # After https://github.com/docker/docker/pull/30290, .git was added to .dockerignore. Therefore
429
+    # we have to calculate unsupported outside of the container, and pass the commit ID in through
430
+    # an environment variable for the binary build
431
+    $CommitUnsupported=""
432
+    if ($(git status --porcelain --untracked-files=no).Length -ne 0) {
433
+        $CommitUnsupported="-unsupported"
434
+    }
435
+
436
+    # Build the binary in a container unless asked to skip it.
437
+    if ($env:SKIP_BINARY_BUILD -eq $null) {
438
+        Write-Host  -ForegroundColor Cyan "`n`nINFO: Building the test binaries at $(Get-Date)..."
439
+        $ErrorActionPreference = "SilentlyContinue"
440
+        docker rm -f $COMMITHASH 2>&1 | Out-Null
441
+        if ($CommitUnsupported -ne "") {
442
+            Write-Host ""
443
+            Write-Warning "This version is unsupported because there are uncommitted file(s)."
444
+            Write-Warning "Either commit these changes, or add them to .gitignore."
445
+            git status --porcelain --untracked-files=no | Write-Warning
446
+             Write-Host ""
447
+        }
448
+        $Duration=$(Measure-Command {docker run --name $COMMITHASH -e DOCKER_GITCOMMIT=$COMMITHASH$CommitUnsupported docker hack\make.ps1 -Binary | Out-Host })
449
+        $ErrorActionPreference = "Stop"
450
+        if (-not($LastExitCode -eq 0)) {
451
+            Throw "ERROR: Failed to build binary"
452
+        }
453
+        Write-Host  -ForegroundColor Green "INFO: Binaries build ended at $(Get-Date). Duration`:$Duration"
454
+
455
+        # Copy the binaries and the generated version_autogen.go out of the container
456
+        $ErrorActionPreference = "SilentlyContinue"
457
+        docker cp "$contPath\docker.exe" $env:TEMP\binary\
458
+        if (-not($LastExitCode -eq 0)) {
459
+            Throw "ERROR: Failed to docker cp the client binary (docker.exe) to $env:TEMP\binary"
460
+        }
461
+        docker cp "$contPath\dockerd.exe" $env:TEMP\binary\
462
+        if (-not($LastExitCode -eq 0)) {
463
+            Throw "ERROR: Failed to docker cp the daemon binary (dockerd.exe) to $env:TEMP\binary"
464
+        }
465
+        $ErrorActionPreference = "Stop"
466
+
467
+        # Copy the built dockerd.exe to dockerd-$COMMITHASH.exe so that easily spotted in task manager.
468
+        Write-Host -ForegroundColor Green "INFO: Copying the built daemon binary to $env:TEMP\binary\dockerd-$COMMITHASH.exe..."
469
+        Copy-Item $env:TEMP\binary\dockerd.exe $env:TEMP\binary\dockerd-$COMMITHASH.exe -Force -ErrorAction SilentlyContinue
470
+
471
+        # Copy the built docker.exe to docker-$COMMITHASH.exe
472
+        Write-Host -ForegroundColor Green "INFO: Copying the built client binary to $env:TEMP\binary\docker-$COMMITHASH.exe..."
473
+        Copy-Item $env:TEMP\binary\docker.exe $env:TEMP\binary\docker-$COMMITHASH.exe -Force -ErrorAction SilentlyContinue
474
+
475
+    } else {
476
+        Write-Host -ForegroundColor Magenta "WARN: Skipping building the binaries"
477
+    }
478
+
479
+    Write-Host -ForegroundColor Green "INFO: Copying dockerversion from the container..."
480
+    $ErrorActionPreference = "SilentlyContinue"
481
+    docker cp "$contPath\..\dockerversion\version_autogen.go" "$env:SOURCES_DRIVE`:\$env:SOURCES_SUBDIR\src\github.com\docker\docker\dockerversion"
482
+    if (-not($LastExitCode -eq 0)) {
483
+         Throw "ERROR: Failed to docker cp the generated version_autogen.go to $env:SOURCES_DRIVE`:\$env:SOURCES_SUBDIR\src\github.com\docker\docker\dockerversion"
484
+    }
485
+    $ErrorActionPreference = "Stop"
486
+
487
+    # Grab the golang installer out of the built image. That way, we know we are consistent once extracted and paths set,
488
+    # so there's no need to re-deploy on account of an upgrade to the version of GO being used in docker.
489
+    if ($env:SKIP_COPY_GO -eq $null) {
490
+        Write-Host -ForegroundColor Green "INFO: Copying the golang package from the container to $env:TEMP\installer\go.zip..."
491
+        docker cp "$COMMITHASH`:c`:\go.zip" $env:TEMP\installer\
492
+        if (-not($LastExitCode -eq 0)) {
493
+            Throw "ERROR: Failed to docker cp the golang installer 'go.zip' from container:c:\go.zip to $env:TEMP\installer"
494
+        }
495
+        $ErrorActionPreference = "Stop"
496
+
497
+        # Extract the golang installer
498
+        Write-Host -ForegroundColor Green "INFO: Extracting go.zip to $env:TEMP\go"
499
+        $Duration=$(Measure-Command { Expand-Archive $env:TEMP\installer\go.zip $env:TEMP -Force | Out-Null})
500
+        Write-Host  -ForegroundColor Green "INFO: Extraction ended at $(Get-Date). Duration`:$Duration"
501
+    } else {
502
+        Write-Host -ForegroundColor Magenta "WARN: Skipping copying and extracting golang from the image"
503
+    }
504
+
505
+    # Set the GOPATH
506
+    Write-Host -ForegroundColor Green "INFO: Updating the golang and path environment variables"
507
+    $env:GOPATH="$env:SOURCES_DRIVE`:\$env:SOURCES_SUBDIR"
508
+    Write-Host -ForegroundColor Green "INFO: GOPATH=$env:GOPATH"
509
+
510
+    # Set the path to have the version of go from the image at the front
511
+    $env:PATH="$env:TEMP\go\bin;$env:PATH"
512
+
513
+    # Set the GOROOT to be our copy of go from the image
514
+    $env:GOROOT="$env:TEMP\go"
515
+    Write-Host -ForegroundColor Green "INFO: $(go version)"
516
+
517
+    # Work out the the -H parameter for the daemon under test (DASHH_DUT) and client under test (DASHH_CUT)
518
+    #$DASHH_DUT="npipe:////./pipe/$COMMITHASH" # Can't do remote named pipe
519
+    #$ip = (resolve-dnsname $env:COMPUTERNAME -type A -NoHostsFile -LlmnrNetbiosOnly).IPAddress # Useful to tie down
520
+    $DASHH_CUT="tcp://127.0.0.1`:2357"    # Not a typo for 2375!
521
+    $DASHH_DUT="tcp://0.0.0.0:2357"       # Not a typo for 2375!
522
+
523
+    # Arguments for the daemon under test
524
+    $dutArgs=@()
525
+    $dutArgs += "-H $DASHH_DUT"
526
+    $dutArgs += "--graph $env:TEMP\daemon"
527
+    $dutArgs += "--pidfile $env:TEMP\docker.pid"
528
+
529
+    # Arguments: Are we starting the daemon under test in debug mode?
530
+    if (-not ("$env:DOCKER_DUT_DEBUG" -eq "")) {
531
+        Write-Host -ForegroundColor Green "INFO: Running the daemon under test in debug mode"
532
+        $dutArgs += "-D"
533
+    }
534
+
535
+    # Arguments: Are we starting the daemon under test with Hyper-V containers as the default isolation?
536
+    if (-not ("$env:DOCKER_DUT_HYPERV" -eq "")) {
537
+        Write-Host -ForegroundColor Green "INFO: Running the daemon under test with Hyper-V containers as the default"
538
+        $dutArgs += "--exec-opt isolation=hyperv"
539
+    }
540
+
541
+    # Start the daemon under test, ensuring everything is redirected to folders under $TEMP.
542
+    # Important - we launch the -$COMMITHASH version so that we can kill it without
543
+    # killing the control daemon.
544
+    Write-Host -ForegroundColor Green "INFO: Starting a daemon under test..."
545
+    Write-Host -ForegroundColor Green "INFO: Args: $dutArgs"
546
+    New-Item -ItemType Directory $env:TEMP\daemon -ErrorAction SilentlyContinue  | Out-Null
547
+
548
+    # Cannot fathom why, but always writes to stderr....
549
+    Start-Process "$env:TEMP\binary\dockerd-$COMMITHASH" `
550
+                  -ArgumentList $dutArgs `
551
+                  -RedirectStandardOutput "$env:TEMP\dut.out" `
552
+                  -RedirectStandardError "$env:TEMP\dut.err"
553
+    Write-Host -ForegroundColor Green "INFO: Process started successfully."
554
+    $daemonStarted=1
555
+
556
+    # Start tailing the daemon under test if the command is installed
557
+    if ((Get-Command "tail" -ErrorAction SilentlyContinue) -ne $null) {
558
+        $tail = start-process "tail" -ArgumentList "-f $env:TEMP\dut.out" -ErrorAction SilentlyContinue
559
+    }
560
+
561
+    # Verify we can get the daemon under test to respond
562
+    $tries=20
563
+    Write-Host -ForegroundColor Green "INFO: Waiting for the daemon under test to start..."
564
+    while ($true) {
565
+        $ErrorActionPreference = "SilentlyContinue"
566
+        & "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" version 2>&1 | Out-Null
567
+        $ErrorActionPreference = "Stop"
568
+        if ($LastExitCode -eq 0) {
569
+            break
570
+        }
571
+
572
+        $tries--
573
+        if ($tries -le 0) {
574
+            $DumpDaemonLog=1
575
+            Throw "ERROR: Failed to get a response from the daemon under test"
576
+        }
577
+        Write-Host -NoNewline "."
578
+        sleep 1
579
+    }
580
+    Write-Host -ForegroundColor Green "INFO: Daemon under test started and replied!"
581
+
582
+    # Provide the docker version of the daemon under test for debugging purposes.
583
+    Write-Host -ForegroundColor Green "INFO: Docker version of the daemon under test"
584
+    Write-Host
585
+    $ErrorActionPreference = "SilentlyContinue"
586
+    & "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" version
587
+    $ErrorActionPreference = "Stop"
588
+    if ($LastExitCode -ne 0) {
589
+        Throw "ERROR: The daemon under test does not appear to be running."
590
+        $DumpDaemonLog=1
591
+    }
592
+    Write-Host
593
+
594
+    # Same as above but docker info
595
+    Write-Host -ForegroundColor Green "INFO: Docker info of the daemon under test"
596
+    Write-Host
597
+    $ErrorActionPreference = "SilentlyContinue"
598
+    & "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" info
599
+    $ErrorActionPreference = "Stop"
600
+    if ($LastExitCode -ne 0) {
601
+        Throw "ERROR: The daemon under test does not appear to be running."
602
+        $DumpDaemonLog=1
603
+    }
604
+    Write-Host
605
+
606
+    # Same as above but docker images
607
+    Write-Host -ForegroundColor Green "INFO: Docker images of the daemon under test"
608
+    Write-Host
609
+    $ErrorActionPreference = "SilentlyContinue"
610
+    & "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" images
611
+    $ErrorActionPreference = "Stop"
612
+    if ($LastExitCode -ne 0) {
613
+        Throw "ERROR: The daemon under test does not appear to be running."
614
+        $DumpDaemonLog=1
615
+    }
616
+    Write-Host
617
+
618
+    # Default to windowsservercore for the base image used for the tests. The "docker" image
619
+    # and the control daemon use microsoft/windowsservercore regardless. This is *JUST* for the tests.
620
+    if ($env:WINDOWS_BASE_IMAGE -eq $Null) {
621
+        $env:WINDOWS_BASE_IMAGE="microsoft/windowsservercore"
622
+    }
623
+
624
+    # Lowercase and make sure it has a microsoft/ prefix
625
+    $env:WINDOWS_BASE_IMAGE = $env:WINDOWS_BASE_IMAGE.ToLower()
626
+    if ($($env:WINDOWS_BASE_IMAGE -Split "/")[0] -ne "microsoft") {
627
+        Throw "ERROR: WINDOWS_BASE_IMAGE should start microsoft/"
628
+    }
629
+
630
+    Write-Host -ForegroundColor Green "INFO: Base image for tests is $env:WINDOWS_BASE_IMAGE"
631
+
632
+    $ErrorActionPreference = "SilentlyContinue"
633
+    if ($((& "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" images --format "{{.Repository}}:{{.Tag}}" | Select-String $($env:WINDOWS_BASE_IMAGE+":latest") | Measure-Object -Line).Lines) -eq 0) {
634
+        # Try the internal azure CI image version or Microsoft internal corpnet where the base image is already pre-prepared on the disk,
635
+        # either through Invoke-DockerCI or, in the case of Azure CI servers, baked into the VHD at the same location.
636
+        if (Test-Path $("c:\baseimages\"+$($env:WINDOWS_BASE_IMAGE -Split "/")[1]+".tar")) {
637
+            Write-Host  -ForegroundColor Green "INFO: Loading"$($env:WINDOWS_BASE_IMAGE -Split "/")[1]".tar from disk into the daemon under test. This may take some time..."
638
+            $ErrorActionPreference = "SilentlyContinue"
639
+            & "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" load -i $("$readBaseFrom`:\baseimages\"+$($env:WINDOWS_BASE_IMAGE -Split "/")[1]+".tar")
640
+            $ErrorActionPreference = "Stop"
641
+            if (-not $LastExitCode -eq 0) {
642
+                Throw $("ERROR: Failed to load $readBaseFrom`:\baseimages\"+$($env:WINDOWS_BASE_IMAGE -Split "/")[1]+".tar into daemon under test")
643
+            }
644
+            Write-Host -ForegroundColor Green "INFO: docker load of"$($env:WINDOWS_BASE_IMAGE -Split "/")[1]" into daemon under test completed successfully"
645
+        } else {
646
+            # We need to docker pull it instead. It will come in directly as microsoft/imagename:latest
647
+            Write-Host -ForegroundColor Green $("INFO: Pulling "+$env:WINDOWS_BASE_IMAGE+":latest from docker hub into daemon under test. This may take some time...")
648
+            $ErrorActionPreference = "SilentlyContinue"
649
+            & "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" pull $($env:WINDOWS_BASE_IMAGE)
650
+            $ErrorActionPreference = "Stop"
651
+            if (-not $LastExitCode -eq 0) {
652
+                Throw $("ERROR: Failed to docker pull "+$env:WINDOWS_BASE_IMAGE+":latest into daemon under test.")
653
+            }
654
+            Write-Host -ForegroundColor Green $("INFO: docker pull of "+$env:WINDOWS_BASE_IMAGE+":latest into daemon under test completed successfully")
655
+        }
656
+    } else {
657
+        Write-Host -ForegroundColor Green "INFO: Image"$($env:WINDOWS_BASE_IMAGE+":latest")"is already loaded in the daemon under test"
658
+    }
659
+
660
+    # Inspect the pulled or loaded image to get the version directly
661
+    $ErrorActionPreference = "SilentlyContinue"
662
+    $dutimgVersion = $(&"$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" inspect  $($env:WINDOWS_BASE_IMAGE) --format "{{.OsVersion}}")
663
+    $ErrorActionPreference = "Stop"
664
+    Write-Host -ForegroundColor Green $("INFO: Version of "+$env:WINDOWS_BASE_IMAGE+":latest is '"+$dutimgVersion+"'")
665
+
666
+    # Run the validation tests unless SKIP_VALIDATION_TESTS is defined.
667
+    if ($env:SKIP_VALIDATION_TESTS -eq $null) {
668
+        Write-Host -ForegroundColor Cyan "INFO: Running validation tests at $(Get-Date)..."
669
+        $ErrorActionPreference = "SilentlyContinue"
670
+        $Duration=$(Measure-Command { hack\make.ps1 -DCO -GoFormat -PkgImports | Out-Host })
671
+        $ErrorActionPreference = "Stop"
672
+        if (-not($LastExitCode -eq 0)) {
673
+            Throw "ERROR: Validation tests failed"
674
+        }
675
+        Write-Host  -ForegroundColor Green "INFO: Validation tests ended at $(Get-Date). Duration`:$Duration"
676
+    } else {
677
+        Write-Host -ForegroundColor Magenta "WARN: Skipping validation tests"
678
+    }
679
+
680
+    # Run the unit tests inside a container unless SKIP_UNIT_TESTS is defined
681
+    if ($env:SKIP_UNIT_TESTS -eq $null) {
682
+        Write-Host -ForegroundColor Cyan "INFO: Running unit tests at $(Get-Date)..."
683
+        $ErrorActionPreference = "SilentlyContinue"
684
+        $Duration=$(Measure-Command {docker run -e DOCKER_GITCOMMIT=$COMMITHASH$CommitUnsupported docker hack\make.ps1 -TestUnit | Out-Host })
685
+        $ErrorActionPreference = "Stop"
686
+        if (-not($LastExitCode -eq 0)) {
687
+            Throw "ERROR: Unit tests failed"
688
+        }
689
+        Write-Host  -ForegroundColor Green "INFO: Unit tests ended at $(Get-Date). Duration`:$Duration"
690
+    } else {
691
+        Write-Host -ForegroundColor Magenta "WARN: Skipping unit tests"
692
+    }
693
+
694
+    # Add the busybox image. Needed for integration tests
695
+    if ($env:SKIP_INTEGRATION_TESTS -eq $null) {
696
+        $ErrorActionPreference = "SilentlyContinue"
697
+        # Build it regardless while switching between nanoserver and windowsservercore
698
+        #$bbCount = $(& "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" images | Select-String "busybox" | Measure-Object -line).Lines
699
+        #$ErrorActionPreference = "Stop"
700
+        #if (-not($LastExitCode -eq 0)) {
701
+        #    Throw "ERROR: Could not determine if busybox image is present"
702
+        #}
703
+        #if ($bbCount -eq 0) {
704
+            Write-Host -ForegroundColor Green "INFO: Building busybox"
705
+            $ErrorActionPreference = "SilentlyContinue"
706
+
707
+            # This is a temporary hack for nanoserver
708
+            if ($env:WINDOWS_BASE_IMAGE -ne "microsoft/windowsservercore") {
709
+                Write-Host -ForegroundColor Red "HACK HACK HACK - Building 64-bit nanoserver busybox image"
710
+                $(& "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" build -t busybox https://raw.githubusercontent.com/jhowardmsft/busybox64/master/Dockerfile | Out-Host)
711
+            } else {
712
+                $(& "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" build -t busybox https://raw.githubusercontent.com/jhowardmsft/busybox/master/Dockerfile | Out-Host)
713
+            }
714
+            $ErrorActionPreference = "Stop"
715
+            if (-not($LastExitCode -eq 0)) {
716
+                Throw "ERROR: Failed to build busybox image"
717
+            }
718
+        #}
719
+
720
+
721
+        Write-Host -ForegroundColor Green "INFO: Docker images of the daemon under test"
722
+        Write-Host
723
+        $ErrorActionPreference = "SilentlyContinue"
724
+        & "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" images
725
+        $ErrorActionPreference = "Stop"
726
+        if ($LastExitCode -ne 0) {
727
+            Throw "ERROR: The daemon under test does not appear to be running."
728
+            $DumpDaemonLog=1
729
+        }
730
+        Write-Host
731
+    }
732
+
733
+    # Run the integration tests unless SKIP_INTEGRATION_TESTS is defined
734
+    if ($env:SKIP_INTEGRATION_TESTS -eq $null) {
735
+        Write-Host -ForegroundColor Cyan "INFO: Running integration tests at $(Get-Date)..."
736
+        $ErrorActionPreference = "SilentlyContinue"
737
+
738
+        # Location of the daemon under test.
739
+        $env:OrigDOCKER_HOST="$env:DOCKER_HOST"
740
+
741
+        #https://blogs.technet.microsoft.com/heyscriptingguy/2011/09/20/solve-problems-with-external-command-lines-in-powershell/ is useful to see tokenising
742
+        $c = "go test "
743
+        $c += "`"-tags`" " + "`"autogen`" "
744
+        $c += "./integration/..."
745
+
746
+        if ($env:INTEGRATION_IN_CONTAINER -ne $null) {
747
+            Write-Host -ForegroundColor Green "INFO: Integration tests being run inside a container"
748
+            # Note we talk back through the containers gateway address
749
+            # And the ridiculous lengths we have to go to to get the default gateway address... (GetNetIPConfiguration doesn't work in nanoserver)
750
+            # I just could not get the escaping to work in a single command, so output $c to a file and run that in the container instead...
751
+            # Not the prettiest, but it works.
752
+            $c | Out-File -Force "$env:TEMP\binary\runIntegration.ps1"
753
+            $Duration= $(Measure-Command { & docker run `
754
+                                                    --rm `
755
+                                                    -e c=$c `
756
+                                                    --workdir "c`:\go\src\github.com\docker\docker\" `
757
+                                                    -v "$env:TEMP\binary`:c:\target" `
758
+                                                    docker `
759
+                                                    "`$env`:PATH`='c`:\target;'+`$env:PATH`;  `$env:DOCKER_HOST`='tcp`://'+(ipconfig | select -last 1).Substring(39)+'`:2357'; c:\target\runIntegrationCLI.ps1" | Out-Host } )
760
+        } else  {
761
+            Write-Host -ForegroundColor Green "INFO: Integration tests being run from the host:"
762
+            #cd "$env:SOURCES_DRIVE`:\$env:SOURCES_SUBDIR\src\github.com\docker\docker\integration"
763
+            $env:DOCKER_HOST=$DASHH_CUT
764
+            $env:PATH="$env:TEMP\binary;$env:PATH;"  # Force to use the test binaries, not the host ones.
765
+            Write-Host -ForegroundColor Green "INFO: $c"
766
+            Write-Host -ForegroundColor Green "INFO: DOCKER_HOST at $DASHH_CUT"
767
+            # Explicit to not use measure-command otherwise don't get output as it goes
768
+            $start=(Get-Date); Invoke-Expression $c; $Duration=New-Timespan -Start $start -End (Get-Date)
769
+        }
770
+        $ErrorActionPreference = "Stop"
771
+        if (-not($LastExitCode -eq 0)) {
772
+            Throw "ERROR: Integration tests failed at $(Get-Date). Duration`:$Duration"
773
+        }
774
+        Write-Host  -ForegroundColor Green "INFO: Integration tests ended at $(Get-Date). Duration`:$Duration"
775
+    }else {
776
+        Write-Host -ForegroundColor Magenta "WARN: Skipping integration tests"
777
+    }
778
+
779
+    # Run the integration tests unless SKIP_INTEGRATION_TESTS is defined
780
+    if ($env:SKIP_INTEGRATION_TESTS -eq $null) {
781
+        Write-Host -ForegroundColor Cyan "INFO: Running integration cli tests at $(Get-Date)..."
782
+        $ErrorActionPreference = "SilentlyContinue"
783
+
784
+        # Location of the daemon under test.
785
+        $env:OrigDOCKER_HOST="$env:DOCKER_HOST"
786
+
787
+        #https://blogs.technet.microsoft.com/heyscriptingguy/2011/09/20/solve-problems-with-external-command-lines-in-powershell/ is useful to see tokenising
788
+        $c = "go test "
789
+        $c += "`"-check.v`" "
790
+        if ($env:INTEGRATION_TEST_NAME -ne $null) { # Makes is quicker for debugging to be able to run only a subset of the integration tests
791
+            $c += "`"-check.f`" "
792
+            $c += "`"$env:INTEGRATION_TEST_NAME`" "
793
+            Write-Host -ForegroundColor Magenta "WARN: Only running integration tests matching $env:INTEGRATION_TEST_NAME"
794
+        }
795
+        $c += "`"-tags`" " + "`"autogen`" "
796
+        $c += "`"-check.timeout`" " + "`"10m`" "
797
+        $c += "`"-test.timeout`" " + "`"200m`" "
798
+
799
+        if ($env:INTEGRATION_IN_CONTAINER -ne $null) {
800
+            Write-Host -ForegroundColor Green "INFO: Integration tests being run inside a container"
801
+            # Note we talk back through the containers gateway address
802
+            # And the ridiculous lengths we have to go to to get the default gateway address... (GetNetIPConfiguration doesn't work in nanoserver)
803
+            # I just could not get the escaping to work in a single command, so output $c to a file and run that in the container instead...
804
+            # Not the prettiest, but it works.
805
+            $c | Out-File -Force "$env:TEMP\binary\runIntegrationCLI.ps1"
806
+            $Duration= $(Measure-Command { & docker run `
807
+                                                    --rm `
808
+                                                    -e c=$c `
809
+                                                    --workdir "c`:\go\src\github.com\docker\docker\integration-cli" `
810
+                                                    -v "$env:TEMP\binary`:c:\target" `
811
+                                                    docker `
812
+                                                    "`$env`:PATH`='c`:\target;'+`$env:PATH`;  `$env:DOCKER_HOST`='tcp`://'+(ipconfig | select -last 1).Substring(39)+'`:2357'; c:\target\runIntegrationCLI.ps1" | Out-Host } )
813
+        } else  {
814
+            Write-Host -ForegroundColor Green "INFO: Integration tests being run from the host:"
815
+            cd "$env:SOURCES_DRIVE`:\$env:SOURCES_SUBDIR\src\github.com\docker\docker\integration-cli"
816
+            $env:DOCKER_HOST=$DASHH_CUT
817
+            $env:PATH="$env:TEMP\binary;$env:PATH;"  # Force to use the test binaries, not the host ones.
818
+            Write-Host -ForegroundColor Green "INFO: $c"
819
+            Write-Host -ForegroundColor Green "INFO: DOCKER_HOST at $DASHH_CUT"
820
+            # Explicit to not use measure-command otherwise don't get output as it goes
821
+            $start=(Get-Date); Invoke-Expression $c; $Duration=New-Timespan -Start $start -End (Get-Date)
822
+        }
823
+        $ErrorActionPreference = "Stop"
824
+        if (-not($LastExitCode -eq 0)) {
825
+            Throw "ERROR: Integration tests failed at $(Get-Date). Duration`:$Duration"
826
+        }
827
+        Write-Host  -ForegroundColor Green "INFO: Integration tests ended at $(Get-Date). Duration`:$Duration"
828
+    }else {
829
+        Write-Host -ForegroundColor Magenta "WARN: Skipping integration tests"
830
+    }
831
+
832
+    # Docker info now to get counts (after or if jjh/containercounts is merged)
833
+    if ($daemonStarted -eq 1) {
834
+        Write-Host -ForegroundColor Green "INFO: Docker info of the daemon under test at end of run"
835
+        Write-Host
836
+        $ErrorActionPreference = "SilentlyContinue"
837
+        & "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" info
838
+        $ErrorActionPreference = "Stop"
839
+        if ($LastExitCode -ne 0) {
840
+            Throw "ERROR: The daemon under test does not appear to be running."
841
+            $DumpDaemonLog=1
842
+        }
843
+        Write-Host
844
+    }
845
+
846
+    # Stop the daemon under test
847
+    if ($daemonStarted -eq 1) {
848
+        if (Test-Path "$env:TEMP\docker.pid") {
849
+            $p=Get-Content "$env:TEMP\docker.pid" -raw
850
+            if ($p -ne $null) {
851
+                Write-Host -ForegroundColor green "INFO: Stopping daemon under test"
852
+                taskkill -f -t -pid $p
853
+                Remove-Item "$env:TEMP\docker.pid" -force -ErrorAction SilentlyContinue
854
+                #sleep 5
855
+            }
856
+        }
857
+    }
858
+
859
+    Write-Host -ForegroundColor Green "INFO: executeCI.ps1 Completed successfully at $(Get-Date)."
860
+}
861
+Catch [Exception] {
862
+    $FinallyColour="Red"
863
+    Write-Host -ForegroundColor Red ("`r`n`r`nERROR: Failed '$_' at $(Get-Date)")
864
+    Write-Host "`n`n"
865
+
866
+    # Exit to ensure Jenkins captures it. Don't do this in the ISE or interactive Powershell - they will catch the Throw onwards.
867
+    if ( ([bool]([Environment]::GetCommandLineArgs() -Like '*-NonInteractive*')) -and `
868
+        ([bool]([Environment]::GetCommandLineArgs() -NotLike "*Powershell_ISE.exe*"))) {
869
+        exit 1
870
+    }
871
+    Throw $_
872
+}
873
+Finally {
874
+    $ErrorActionPreference="SilentlyContinue"
875
+    $global:ProgressPreference=$origProgressPreference
876
+    Write-Host  -ForegroundColor Green "INFO: Tidying up at end of run"
877
+
878
+    # Restore the path
879
+    if ($origPath -ne $null) { $env:PATH=$origPath }
880
+
881
+    # Restore the DOCKER_HOST
882
+    if ($origDOCKER_HOST -ne $null) { $env:DOCKER_HOST=$origDOCKER_HOST }
883
+
884
+    # Restore the GOROOT and GOPATH variables
885
+    if ($origGOROOT -ne $null) { $env:GOROOT=$origGOROOT }
886
+    if ($origGOPATH -ne $null) { $env:GOPATH=$origGOPATH }
887
+
888
+    # Dump the daemon log if asked to
889
+    if ($daemonStarted -eq 1) {
890
+        if ($dumpDaemonLog -eq 1) {
891
+            Write-Host -ForegroundColor Cyan "----------- DAEMON LOG ------------"
892
+            Get-Content "$env:TEMP\dut.err" -ErrorAction SilentlyContinue | Write-Host -ForegroundColor Cyan
893
+            Write-Host -ForegroundColor Cyan "----------- END DAEMON LOG --------"
894
+        }
895
+    }
896
+
897
+    # Save the daemon under test log
898
+    if ($daemonStarted -eq 1) {
899
+        Write-Host -ForegroundColor Green "INFO: Saving daemon under test log ($env:TEMP\dut.err) to $TEMPORIG\CIDUT.log"
900
+        Copy-Item  "$env:TEMP\dut.err" "$TEMPORIG\CIDUT.log" -Force -ErrorAction SilentlyContinue
901
+    }
902
+
903
+    cd "$env:SOURCES_DRIVE\$env:SOURCES_SUBDIR" -ErrorAction SilentlyContinue
904
+    Nuke-Everything
905
+    $Dur=New-TimeSpan -Start $StartTime -End $(Get-Date)
906
+    Write-Host -ForegroundColor $FinallyColour "`nINFO: executeCI.ps1 exiting at $(date). Duration $dur`n"
907
+}
908
+
... ...
@@ -9,6 +9,7 @@ import (
9 9
 
10 10
 	"github.com/docker/docker/api/types"
11 11
 	dclient "github.com/docker/docker/client"
12
+	"github.com/docker/docker/internal/test/daemon"
12 13
 	"github.com/docker/docker/internal/test/fakecontext"
13 14
 	"github.com/docker/docker/internal/test/request"
14 15
 	"github.com/moby/buildkit/session"
... ...
@@ -20,7 +21,11 @@ import (
20 20
 )
21 21
 
22 22
 func TestBuildWithSession(t *testing.T) {
23
-	skip.If(t, !testEnv.DaemonInfo.ExperimentalBuild)
23
+	skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
24
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
25
+	d := daemon.New(t, daemon.WithExperimental)
26
+	d.StartWithBusybox(t)
27
+	defer d.Stop(t)
24 28
 
25 29
 	client := testEnv.APIClient()
26 30
 
... ...
@@ -10,6 +10,7 @@ import (
10 10
 
11 11
 	"github.com/docker/docker/api/types"
12 12
 	"github.com/docker/docker/integration/internal/container"
13
+	"github.com/docker/docker/internal/test/daemon"
13 14
 	"github.com/docker/docker/internal/test/fakecontext"
14 15
 	"github.com/docker/docker/pkg/stdcopy"
15 16
 	"gotest.tools/assert"
... ...
@@ -18,7 +19,11 @@ import (
18 18
 )
19 19
 
20 20
 func TestBuildSquashParent(t *testing.T) {
21
-	skip.If(t, !testEnv.DaemonInfo.ExperimentalBuild)
21
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
22
+	skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
23
+	d := daemon.New(t, daemon.WithExperimental)
24
+	d.StartWithBusybox(t)
25
+	defer d.Stop(t)
22 26
 
23 27
 	client := testEnv.APIClient()
24 28
 
... ...
@@ -9,6 +9,7 @@ import (
9 9
 	"io/ioutil"
10 10
 	"strings"
11 11
 	"testing"
12
+	"time"
12 13
 
13 14
 	"github.com/docker/docker/api/types"
14 15
 	"github.com/docker/docker/api/types/filters"
... ...
@@ -22,6 +23,7 @@ import (
22 22
 )
23 23
 
24 24
 func TestBuildWithRemoveAndForceRemove(t *testing.T) {
25
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows", "FIXME")
25 26
 	defer setupTest(t)()
26 27
 	t.Parallel()
27 28
 	cases := []struct {
... ...
@@ -137,6 +139,7 @@ func buildContainerIdsFilter(buildOutput io.Reader) (filters.Args, error) {
137 137
 
138 138
 func TestBuildMultiStageParentConfig(t *testing.T) {
139 139
 	skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.35"), "broken in earlier versions")
140
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows", "FIXME")
140 141
 	dockerfile := `
141 142
 		FROM busybox AS stage0
142 143
 		ENV WHO=parent
... ...
@@ -166,10 +169,20 @@ func TestBuildMultiStageParentConfig(t *testing.T) {
166 166
 	resp.Body.Close()
167 167
 	assert.NilError(t, err)
168 168
 
169
+	time.Sleep(30 * time.Second)
170
+
171
+	imgs, err := apiclient.ImageList(ctx, types.ImageListOptions{})
172
+	assert.NilError(t, err)
173
+	t.Log(imgs)
174
+
169 175
 	image, _, err := apiclient.ImageInspectWithRaw(ctx, "build1")
170 176
 	assert.NilError(t, err)
171 177
 
172
-	assert.Check(t, is.Equal("/foo/sub2", image.Config.WorkingDir))
178
+	expected := "/foo/sub2"
179
+	if testEnv.DaemonInfo.OSType == "windows" {
180
+		expected = `C:\foo\sub2`
181
+	}
182
+	assert.Check(t, is.Equal(expected, image.Config.WorkingDir))
173 183
 	assert.Check(t, is.Contains(image.Config.Env, "WHO=parent"))
174 184
 }
175 185
 
... ...
@@ -282,6 +295,7 @@ func TestBuildWithEmptyLayers(t *testing.T) {
282 282
 // #35652
283 283
 func TestBuildMultiStageOnBuild(t *testing.T) {
284 284
 	skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.33"), "broken in earlier versions")
285
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows", "FIXME")
285 286
 	defer setupTest(t)()
286 287
 	// test both metadata and layer based commands as they may be implemented differently
287 288
 	dockerfile := `FROM busybox AS stage1
... ...
@@ -289,7 +303,8 @@ ONBUILD RUN echo 'foo' >somefile
289 289
 ONBUILD ENV bar=baz
290 290
 
291 291
 FROM stage1
292
-RUN cat somefile # fails if ONBUILD RUN fails
292
+# fails if ONBUILD RUN fails
293
+RUN cat somefile
293 294
 
294 295
 FROM stage1
295 296
 RUN cat somefile`
... ...
@@ -327,6 +342,8 @@ RUN cat somefile`
327 327
 // #35403 #36122
328 328
 func TestBuildUncleanTarFilenames(t *testing.T) {
329 329
 	skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.37"), "broken in earlier versions")
330
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows", "FIXME")
331
+
330 332
 	ctx := context.TODO()
331 333
 	defer setupTest(t)()
332 334
 
... ...
@@ -385,6 +402,7 @@ COPY bar /`
385 385
 // docker/for-linux#135
386 386
 // #35641
387 387
 func TestBuildMultiStageLayerLeak(t *testing.T) {
388
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows", "FIXME")
388 389
 	skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.37"), "broken in earlier versions")
389 390
 	ctx := context.TODO()
390 391
 	defer setupTest(t)()
... ...
@@ -20,7 +20,7 @@ import (
20 20
 )
21 21
 
22 22
 func TestConfigList(t *testing.T) {
23
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
23
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
24 24
 
25 25
 	defer setupTest(t)()
26 26
 	d := swarm.NewSwarm(t, testEnv)
... ...
@@ -102,7 +102,7 @@ func createConfig(ctx context.Context, t *testing.T, client client.APIClient, na
102 102
 }
103 103
 
104 104
 func TestConfigsCreateAndDelete(t *testing.T) {
105
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
105
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
106 106
 
107 107
 	defer setupTest(t)()
108 108
 	d := swarm.NewSwarm(t, testEnv)
... ...
@@ -130,7 +130,7 @@ func TestConfigsCreateAndDelete(t *testing.T) {
130 130
 }
131 131
 
132 132
 func TestConfigsUpdate(t *testing.T) {
133
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
133
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
134 134
 
135 135
 	defer setupTest(t)()
136 136
 	d := swarm.NewSwarm(t, testEnv)
... ...
@@ -184,6 +184,7 @@ func TestConfigsUpdate(t *testing.T) {
184 184
 }
185 185
 
186 186
 func TestTemplatedConfig(t *testing.T) {
187
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
187 188
 	d := swarm.NewSwarm(t, testEnv)
188 189
 	defer d.Stop(t)
189 190
 	client := d.NewClientT(t)
... ...
@@ -323,7 +324,7 @@ func waitAndAssert(t *testing.T, timeout time.Duration, f func(*testing.T) bool)
323 323
 }
324 324
 
325 325
 func TestConfigInspect(t *testing.T) {
326
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
326
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
327 327
 
328 328
 	defer setupTest(t)()
329 329
 	d := swarm.NewSwarm(t, testEnv)
... ...
@@ -15,6 +15,7 @@ import (
15 15
 
16 16
 func TestCopyFromContainerPathDoesNotExist(t *testing.T) {
17 17
 	defer setupTest(t)()
18
+	skip.If(t, testEnv.OSType == "windows")
18 19
 
19 20
 	ctx := context.Background()
20 21
 	apiclient := testEnv.APIClient()
... ...
@@ -105,7 +105,7 @@ func TestCreateWithInvalidEnv(t *testing.T) {
105 105
 
106 106
 // Test case for #30166 (target was not validated)
107 107
 func TestCreateTmpfsMountsTarget(t *testing.T) {
108
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
108
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
109 109
 
110 110
 	defer setupTest(t)()
111 111
 	client := request.NewAPIClient(t)
... ...
@@ -28,6 +28,8 @@ import (
28 28
 // container again.
29 29
 func TestContainerStartOnDaemonRestart(t *testing.T) {
30 30
 	skip.If(t, testEnv.IsRemoteDaemon, "cannot start daemon on remote test run")
31
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
32
+	skip.If(t, testEnv.IsRemoteDaemon(), "cannot start daemon on remote test run")
31 33
 	t.Parallel()
32 34
 
33 35
 	d := daemon.New(t)
... ...
@@ -11,9 +11,11 @@ import (
11 11
 	"github.com/docker/docker/pkg/archive"
12 12
 	"gotest.tools/assert"
13 13
 	"gotest.tools/poll"
14
+	"gotest.tools/skip"
14 15
 )
15 16
 
16 17
 func TestDiff(t *testing.T) {
18
+	skip.If(t, testEnv.OSType == "windows", "FIXME")
17 19
 	defer setupTest(t)()
18 20
 	client := request.NewAPIClient(t)
19 21
 	ctx := context.Background()
... ...
@@ -17,6 +17,7 @@ import (
17 17
 
18 18
 func TestExec(t *testing.T) {
19 19
 	skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.35"), "broken in earlier versions")
20
+	skip.If(t, testEnv.OSType == "windows", "FIXME. Probably needs to wait for container to be in running state.")
20 21
 	defer setupTest(t)()
21 22
 	ctx := context.Background()
22 23
 	client := request.NewAPIClient(t)
... ...
@@ -20,7 +20,7 @@ import (
20 20
 
21 21
 // export an image and try to import it into a new one
22 22
 func TestExportContainerAndImportImage(t *testing.T) {
23
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
23
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
24 24
 
25 25
 	defer setupTest(t)()
26 26
 	client := request.NewAPIClient(t)
... ...
@@ -58,7 +58,7 @@ func TestExportContainerAndImportImage(t *testing.T) {
58 58
 // can be exported (as reported in #36561). To satisfy this
59 59
 // condition, daemon restart is needed after container creation.
60 60
 func TestExportContainerAfterDaemonRestart(t *testing.T) {
61
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
61
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
62 62
 	skip.If(t, testEnv.IsRemoteDaemon())
63 63
 
64 64
 	d := daemon.New(t)
... ...
@@ -11,11 +11,13 @@ import (
11 11
 	"github.com/docker/docker/integration/internal/container"
12 12
 	"github.com/docker/docker/internal/test/request"
13 13
 	"gotest.tools/poll"
14
+	"gotest.tools/skip"
14 15
 )
15 16
 
16 17
 // TestHealthCheckWorkdir verifies that health-checks inherit the containers'
17 18
 // working-dir.
18 19
 func TestHealthCheckWorkdir(t *testing.T) {
20
+	skip.If(t, testEnv.OSType == "windows", "FIXME")
19 21
 	defer setupTest(t)()
20 22
 	ctx := context.Background()
21 23
 	client := request.NewAPIClient(t)
... ...
@@ -16,7 +16,7 @@ import (
16 16
 )
17 17
 
18 18
 func TestInspectCpusetInConfigPre120(t *testing.T) {
19
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux" || !testEnv.DaemonInfo.CPUSet)
19
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows" || !testEnv.DaemonInfo.CPUSet)
20 20
 
21 21
 	defer setupTest(t)()
22 22
 	client := request.NewAPIClient(t, client.WithVersion("1.19"))
... ...
@@ -31,6 +31,7 @@ func TestKillContainerInvalidSignal(t *testing.T) {
31 31
 }
32 32
 
33 33
 func TestKillContainer(t *testing.T) {
34
+	skip.If(t, testEnv.OSType == "windows", "TODO Windows: FIXME. No SIGWINCH")
34 35
 	defer setupTest(t)()
35 36
 	client := request.NewAPIClient(t)
36 37
 
... ...
@@ -70,7 +71,7 @@ func TestKillContainer(t *testing.T) {
70 70
 }
71 71
 
72 72
 func TestKillWithStopSignalAndRestartPolicies(t *testing.T) {
73
-	skip.If(t, testEnv.OSType != "linux", "Windows only supports 1.25 or later")
73
+	skip.If(t, testEnv.OSType == "windows", "Windows only supports 1.25 or later")
74 74
 	defer setupTest(t)()
75 75
 	client := request.NewAPIClient(t)
76 76
 
... ...
@@ -110,7 +111,7 @@ func TestKillWithStopSignalAndRestartPolicies(t *testing.T) {
110 110
 }
111 111
 
112 112
 func TestKillStoppedContainer(t *testing.T) {
113
-	skip.If(t, testEnv.OSType != "linux") // Windows only supports 1.25 or later
113
+	skip.If(t, testEnv.OSType == "windows", "Windows only supports 1.25 or later")
114 114
 	defer setupTest(t)()
115 115
 	ctx := context.Background()
116 116
 	client := request.NewAPIClient(t)
... ...
@@ -121,7 +122,7 @@ func TestKillStoppedContainer(t *testing.T) {
121 121
 }
122 122
 
123 123
 func TestKillStoppedContainerAPIPre120(t *testing.T) {
124
-	skip.If(t, testEnv.OSType != "linux") // Windows only supports 1.25 or later
124
+	skip.If(t, testEnv.OSType == "windows", "Windows only supports 1.25 or later")
125 125
 	defer setupTest(t)()
126 126
 	ctx := context.Background()
127 127
 	client := request.NewAPIClient(t, client.WithVersion("1.19"))
... ...
@@ -132,7 +133,7 @@ func TestKillStoppedContainerAPIPre120(t *testing.T) {
132 132
 
133 133
 func TestKillDifferentUserContainer(t *testing.T) {
134 134
 	// TODO Windows: Windows does not yet support -u (Feb 2016).
135
-	skip.If(t, testEnv.OSType != "linux", "User containers (container.Config.User) are not yet supported on %q platform", testEnv.OSType)
135
+	skip.If(t, testEnv.OSType == "windows", "User containers (container.Config.User) are not yet supported on %q platform", testEnv.OSType)
136 136
 
137 137
 	defer setupTest(t)()
138 138
 	ctx := context.Background()
... ...
@@ -149,7 +150,7 @@ func TestKillDifferentUserContainer(t *testing.T) {
149 149
 }
150 150
 
151 151
 func TestInspectOomKilledTrue(t *testing.T) {
152
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux" || !testEnv.DaemonInfo.MemoryLimit || !testEnv.DaemonInfo.SwapLimit)
152
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows" || !testEnv.DaemonInfo.MemoryLimit || !testEnv.DaemonInfo.SwapLimit)
153 153
 
154 154
 	defer setupTest(t)()
155 155
 	ctx := context.Background()
... ...
@@ -167,7 +168,7 @@ func TestInspectOomKilledTrue(t *testing.T) {
167 167
 }
168 168
 
169 169
 func TestInspectOomKilledFalse(t *testing.T) {
170
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux" || !testEnv.DaemonInfo.MemoryLimit || !testEnv.DaemonInfo.SwapLimit)
170
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows" || !testEnv.DaemonInfo.MemoryLimit || !testEnv.DaemonInfo.SwapLimit)
171 171
 
172 172
 	defer setupTest(t)()
173 173
 	ctx := context.Background()
... ...
@@ -35,7 +35,7 @@ func TestLinksEtcHostsContentMatch(t *testing.T) {
35 35
 }
36 36
 
37 37
 func TestLinksContainerNames(t *testing.T) {
38
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
38
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
39 39
 
40 40
 	defer setupTest(t)()
41 41
 	client := request.NewAPIClient(t)
... ...
@@ -21,7 +21,7 @@ import (
21 21
 
22 22
 func TestContainerNetworkMountsNoChown(t *testing.T) {
23 23
 	// chown only applies to Linux bind mounted volumes; must be same host to verify
24
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux" || testEnv.IsRemoteDaemon())
24
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows" || testEnv.IsRemoteDaemon())
25 25
 
26 26
 	defer setupTest(t)()
27 27
 
... ...
@@ -81,7 +81,7 @@ func TestContainerNetworkMountsNoChown(t *testing.T) {
81 81
 }
82 82
 
83 83
 func TestMountDaemonRoot(t *testing.T) {
84
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux" || testEnv.IsRemoteDaemon())
84
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows" || testEnv.IsRemoteDaemon())
85 85
 	t.Parallel()
86 86
 
87 87
 	client := request.NewAPIClient(t)
... ...
@@ -40,6 +40,7 @@ func TestNetworkNat(t *testing.T) {
40 40
 }
41 41
 
42 42
 func TestNetworkLocalhostTCPNat(t *testing.T) {
43
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows", "FIXME")
43 44
 	skip.If(t, testEnv.IsRemoteDaemon())
44 45
 
45 46
 	defer setupTest(t)()
... ...
@@ -106,6 +107,7 @@ func startServerContainer(t *testing.T, msg string, port int) string {
106 106
 }
107 107
 
108 108
 func getExternalAddress(t *testing.T) net.IP {
109
+	skip.If(t, testEnv.OSType == "windows", "FIXME")
109 110
 	iface, err := net.InterfaceByName("eth0")
110 111
 	skip.If(t, err != nil, "Test not running with `make test-integration`. Interface eth0 not found: %s", err)
111 112
 
... ...
@@ -65,9 +65,8 @@ func TestPauseFailsOnWindowsServerContainers(t *testing.T) {
65 65
 }
66 66
 
67 67
 func TestPauseStopPausedContainer(t *testing.T) {
68
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
68
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
69 69
 	skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.31"), "broken in earlier versions")
70
-
71 70
 	defer setupTest(t)()
72 71
 	client := request.NewAPIClient(t)
73 72
 	ctx := context.Background()
... ...
@@ -24,6 +24,7 @@ import (
24 24
 // This checks that "rename" updates source container correctly and doesn't set it to null.
25 25
 func TestRenameLinkedContainer(t *testing.T) {
26 26
 	skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.32"), "broken in earlier versions")
27
+	skip.If(t, testEnv.OSType == "windows", "FIXME")
27 28
 	defer setupTest(t)()
28 29
 	ctx := context.Background()
29 30
 	client := request.NewAPIClient(t)
... ...
@@ -123,6 +124,7 @@ func TestRenameInvalidName(t *testing.T) {
123 123
 // This test is to make sure once the container has been renamed,
124 124
 // the service discovery for the (re)named container works.
125 125
 func TestRenameAnonymousContainer(t *testing.T) {
126
+	skip.If(t, testEnv.OSType == "windows", "FIXME")
126 127
 	defer setupTest(t)()
127 128
 	ctx := context.Background()
128 129
 	client := request.NewAPIClient(t)
... ...
@@ -190,6 +192,7 @@ func TestRenameContainerWithSameName(t *testing.T) {
190 190
 // container could still reference to the container that is renamed.
191 191
 func TestRenameContainerWithLinkedContainer(t *testing.T) {
192 192
 	skip.If(t, testEnv.IsRemoteDaemon())
193
+	skip.If(t, testEnv.OSType == "windows", "FIXME")
193 194
 
194 195
 	defer setupTest(t)()
195 196
 	ctx := context.Background()
... ...
@@ -18,6 +18,7 @@ import (
18 18
 )
19 19
 
20 20
 func TestResize(t *testing.T) {
21
+	skip.If(t, testEnv.OSType == "windows", "FIXME")
21 22
 	defer setupTest(t)()
22 23
 	client := request.NewAPIClient(t)
23 24
 	ctx := context.Background()
... ...
@@ -35,6 +36,7 @@ func TestResize(t *testing.T) {
35 35
 
36 36
 func TestResizeWithInvalidSize(t *testing.T) {
37 37
 	skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.32"), "broken in earlier versions")
38
+	skip.If(t, testEnv.OSType == "windows", "FIXME")
38 39
 	defer setupTest(t)()
39 40
 	client := request.NewAPIClient(t)
40 41
 	ctx := context.Background()
... ...
@@ -15,6 +15,7 @@ import (
15 15
 
16 16
 func TestDaemonRestartKillContainers(t *testing.T) {
17 17
 	skip.If(t, testEnv.IsRemoteDaemon, "cannot start daemon on remote test run")
18
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
18 19
 	type testCase struct {
19 20
 		desc       string
20 21
 		config     *container.Config
... ...
@@ -17,7 +17,7 @@ import (
17 17
 )
18 18
 
19 19
 func TestUpdateMemory(t *testing.T) {
20
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
20
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
21 21
 	skip.If(t, !testEnv.DaemonInfo.MemoryLimit)
22 22
 	skip.If(t, !testEnv.DaemonInfo.SwapLimit)
23 23
 
... ...
@@ -15,6 +15,7 @@ import (
15 15
 
16 16
 func TestCommitInheritsEnv(t *testing.T) {
17 17
 	skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.36"), "broken in earlier versions")
18
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows", "FIXME")
18 19
 	defer setupTest(t)()
19 20
 	client := request.NewAPIClient(t)
20 21
 	ctx := context.Background()
... ...
@@ -11,13 +11,13 @@ import (
11 11
 	"github.com/docker/docker/api/types"
12 12
 	"github.com/docker/docker/internal/test/request"
13 13
 	"github.com/docker/docker/internal/testutil"
14
+	"github.com/gotestyourself/gotestyourself/skip"
14 15
 )
15 16
 
16 17
 // Ensure we don't regress on CVE-2017-14992.
17 18
 func TestImportExtremelyLargeImageWorks(t *testing.T) {
18
-	if runtime.GOARCH == "arm64" {
19
-		t.Skip("effective test will be time out")
20
-	}
19
+	skip.If(t, runtime.GOARCH == "arm64", "effective test will be time out")
20
+	skip.If(t, testEnv.OSType == "windows", "TODO enable on windows")
21 21
 
22 22
 	client := request.NewAPIClient(t)
23 23
 
... ...
@@ -9,9 +9,11 @@ import (
9 9
 	"github.com/docker/docker/internal/test/request"
10 10
 	"gotest.tools/assert"
11 11
 	is "gotest.tools/assert/cmp"
12
+	"gotest.tools/skip"
12 13
 )
13 14
 
14 15
 func TestRemoveImageOrphaning(t *testing.T) {
16
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows", "FIXME")
15 17
 	defer setupTest(t)()
16 18
 	ctx := context.Background()
17 19
 	client := request.NewAPIClient(t)
... ...
@@ -51,6 +51,7 @@ func ContainerPoll(config *poll.Settings) {
51 51
 func NewSwarm(t *testing.T, testEnv *environment.Execution, ops ...func(*daemon.Daemon)) *daemon.Daemon {
52 52
 	t.Helper()
53 53
 	skip.If(t, testEnv.IsRemoteDaemon)
54
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
54 55
 	if testEnv.DaemonInfo.ExperimentalBuild {
55 56
 		ops = append(ops, daemon.WithExperimental)
56 57
 	}
... ...
@@ -67,6 +67,8 @@ func TestNetworkCreateDelete(t *testing.T) {
67 67
 // ID is removed, and not the network with the given name.
68 68
 func TestDockerNetworkDeletePreferID(t *testing.T) {
69 69
 	skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.34"), "broken in earlier versions")
70
+	skip.If(t, testEnv.OSType == "windows",
71
+		"FIXME. Windows doesn't run DinD and uses networks shared between control daemon and daemon under test")
70 72
 	defer setupTest(t)()
71 73
 	client := request.NewAPIClient(t)
72 74
 	ctx := context.Background()
... ...
@@ -1,3 +1,5 @@
1
+// +build !windows
2
+
1 3
 package network
2 4
 
3 5
 import (
... ...
@@ -13,11 +13,13 @@ import (
13 13
 	"github.com/docker/docker/integration/internal/swarm"
14 14
 	"gotest.tools/assert"
15 15
 	"gotest.tools/poll"
16
+	"gotest.tools/skip"
16 17
 )
17 18
 
18 19
 const defaultSwarmPort = 2477
19 20
 
20 21
 func TestInspectNetwork(t *testing.T) {
22
+	skip.If(t, testEnv.OSType == "windows", "FIXME")
21 23
 	defer setupTest(t)()
22 24
 	d := swarm.NewSwarm(t, testEnv)
23 25
 	defer d.Stop(t)
... ...
@@ -1,3 +1,5 @@
1
+// +build !windows
2
+
1 3
 package ipvlan
2 4
 
3 5
 import (
... ...
@@ -17,7 +19,7 @@ import (
17 17
 
18 18
 func TestDockerNetworkIpvlanPersistance(t *testing.T) {
19 19
 	// verify the driver automatically provisions the 802.1q link (di-dummy0.70)
20
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
20
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
21 21
 	skip.If(t, testEnv.IsRemoteDaemon())
22 22
 	skip.If(t, !ipvlanKernelSupport(), "Kernel doesn't support ipvlan")
23 23
 
... ...
@@ -46,7 +48,7 @@ func TestDockerNetworkIpvlanPersistance(t *testing.T) {
46 46
 }
47 47
 
48 48
 func TestDockerNetworkIpvlan(t *testing.T) {
49
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
49
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
50 50
 	skip.If(t, testEnv.IsRemoteDaemon())
51 51
 	skip.If(t, !ipvlanKernelSupport(), "Kernel doesn't support ipvlan")
52 52
 
... ...
@@ -1,3 +1,5 @@
1
+// +build !windows
2
+
1 3
 package macvlan
2 4
 
3 5
 import (
... ...
@@ -17,7 +19,7 @@ import (
17 17
 
18 18
 func TestDockerNetworkMacvlanPersistance(t *testing.T) {
19 19
 	// verify the driver automatically provisions the 802.1q link (dm-dummy0.60)
20
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
20
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
21 21
 	skip.If(t, testEnv.IsRemoteDaemon())
22 22
 	skip.If(t, !macvlanKernelSupport(), "Kernel doesn't support macvlan")
23 23
 
... ...
@@ -42,7 +44,7 @@ func TestDockerNetworkMacvlanPersistance(t *testing.T) {
42 42
 }
43 43
 
44 44
 func TestDockerNetworkMacvlan(t *testing.T) {
45
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
45
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
46 46
 	skip.If(t, testEnv.IsRemoteDaemon())
47 47
 	skip.If(t, !macvlanKernelSupport(), "Kernel doesn't support macvlan")
48 48
 
... ...
@@ -188,6 +188,7 @@ func TestDaemonWithBipAndDefaultNetworkPool(t *testing.T) {
188 188
 }
189 189
 
190 190
 func TestServiceWithPredefinedNetwork(t *testing.T) {
191
+	skip.If(t, testEnv.OSType == "windows")
191 192
 	defer setupTest(t)()
192 193
 	d := swarm.NewSwarm(t, testEnv)
193 194
 	defer d.Stop(t)
... ...
@@ -216,6 +217,7 @@ func TestServiceWithPredefinedNetwork(t *testing.T) {
216 216
 const ingressNet = "ingress"
217 217
 
218 218
 func TestServiceRemoveKeepsIngressNetwork(t *testing.T) {
219
+	skip.If(t, testEnv.OSType == "windows")
219 220
 	defer setupTest(t)()
220 221
 	d := swarm.NewSwarm(t, testEnv)
221 222
 	defer d.Stop(t)
... ...
@@ -212,6 +212,7 @@ func TestAuthZPluginDenyResponse(t *testing.T) {
212 212
 // correctly after request pass through by the authorization plugin
213 213
 func TestAuthZPluginAllowEventStream(t *testing.T) {
214 214
 	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
215
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
215 216
 
216 217
 	defer setupTestV1(t)()
217 218
 	ctrl.reqRes.Allow = true
... ...
@@ -29,7 +29,7 @@ var (
29 29
 )
30 30
 
31 31
 func setupTestV2(t *testing.T) func() {
32
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
32
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
33 33
 	skip.If(t, !requirement.HasHubConnectivity(t))
34 34
 
35 35
 	teardown := setupTest(t)
... ...
@@ -48,6 +48,7 @@ func TestMain(m *testing.M) {
48 48
 
49 49
 func setupTest(t *testing.T) func() {
50 50
 	skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
51
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
51 52
 	environment.ProtectAll(t, testEnv)
52 53
 
53 54
 	d = daemon.New(t, daemon.WithExperimental)
54 55
new file mode 100644
... ...
@@ -0,0 +1 @@
0
+package authz // import "github.com/docker/docker/integration/plugin/authz"
... ...
@@ -1,3 +1,5 @@
1
+// +build !windows
2
+
1 3
 package logging
2 4
 
3 5
 import (
... ...
@@ -15,6 +17,7 @@ import (
15 15
 // does not keep the daemon from starting.
16 16
 func TestDaemonStartWithLogOpt(t *testing.T) {
17 17
 	skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
18
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
18 19
 	t.Parallel()
19 20
 
20 21
 	d := daemon.New(t)
... ...
@@ -17,6 +17,7 @@ import (
17 17
 // (sorted in the daemon). See #36698
18 18
 func TestPluginWithDevMounts(t *testing.T) {
19 19
 	skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
20
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
20 21
 	t.Parallel()
21 22
 
22 23
 	d := daemon.New(t)
... ...
@@ -19,7 +19,7 @@ import (
19 19
 )
20 20
 
21 21
 func TestSecretInspect(t *testing.T) {
22
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
22
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
23 23
 
24 24
 	defer setupTest(t)()
25 25
 	d := swarm.NewSwarm(t, testEnv)
... ...
@@ -42,7 +42,7 @@ func TestSecretInspect(t *testing.T) {
42 42
 }
43 43
 
44 44
 func TestSecretList(t *testing.T) {
45
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
45
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
46 46
 
47 47
 	defer setupTest(t)()
48 48
 	d := swarm.NewSwarm(t, testEnv)
... ...
@@ -119,7 +119,7 @@ func createSecret(ctx context.Context, t *testing.T, client client.APIClient, na
119 119
 }
120 120
 
121 121
 func TestSecretsCreateAndDelete(t *testing.T) {
122
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
122
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
123 123
 
124 124
 	defer setupTest(t)()
125 125
 	d := swarm.NewSwarm(t, testEnv)
... ...
@@ -166,7 +166,7 @@ func TestSecretsCreateAndDelete(t *testing.T) {
166 166
 }
167 167
 
168 168
 func TestSecretsUpdate(t *testing.T) {
169
-	skip.If(t, testEnv.DaemonInfo.OSType != "linux")
169
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
170 170
 
171 171
 	defer setupTest(t)()
172 172
 	d := swarm.NewSwarm(t, testEnv)
... ...
@@ -217,6 +217,7 @@ func TestSecretsUpdate(t *testing.T) {
217 217
 }
218 218
 
219 219
 func TestTemplatedSecret(t *testing.T) {
220
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
220 221
 	d := swarm.NewSwarm(t, testEnv)
221 222
 	defer d.Stop(t)
222 223
 	client := d.NewClientT(t)
... ...
@@ -74,6 +74,7 @@ func inspectServiceContainer(t *testing.T, client client.APIClient, serviceID st
74 74
 }
75 75
 
76 76
 func TestCreateServiceMultipleTimes(t *testing.T) {
77
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
77 78
 	defer setupTest(t)()
78 79
 	d := swarm.NewSwarm(t, testEnv)
79 80
 	defer d.Stop(t)
... ...
@@ -123,6 +124,7 @@ func TestCreateServiceMultipleTimes(t *testing.T) {
123 123
 }
124 124
 
125 125
 func TestCreateWithDuplicateNetworkNames(t *testing.T) {
126
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
126 127
 	defer setupTest(t)()
127 128
 	d := swarm.NewSwarm(t, testEnv)
128 129
 	defer d.Stop(t)
... ...
@@ -182,6 +184,7 @@ func TestCreateWithDuplicateNetworkNames(t *testing.T) {
182 182
 }
183 183
 
184 184
 func TestCreateServiceSecretFileMode(t *testing.T) {
185
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
185 186
 	defer setupTest(t)()
186 187
 	d := swarm.NewSwarm(t, testEnv)
187 188
 	defer d.Stop(t)
... ...
@@ -247,6 +250,7 @@ func TestCreateServiceSecretFileMode(t *testing.T) {
247 247
 }
248 248
 
249 249
 func TestCreateServiceConfigFileMode(t *testing.T) {
250
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
250 251
 	defer setupTest(t)()
251 252
 	d := swarm.NewSwarm(t, testEnv)
252 253
 	defer d.Stop(t)
... ...
@@ -20,6 +20,7 @@ import (
20 20
 
21 21
 func TestInspect(t *testing.T) {
22 22
 	skip.If(t, testEnv.IsRemoteDaemon())
23
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
23 24
 	defer setupTest(t)()
24 25
 	d := swarm.NewSwarm(t, testEnv)
25 26
 	defer d.Stop(t)
... ...
@@ -11,9 +11,11 @@ import (
11 11
 	"github.com/docker/docker/integration/internal/swarm"
12 12
 	"gotest.tools/assert"
13 13
 	is "gotest.tools/assert/cmp"
14
+	"gotest.tools/skip"
14 15
 )
15 16
 
16 17
 func TestDockerNetworkConnectAlias(t *testing.T) {
18
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
17 19
 	defer setupTest(t)()
18 20
 	d := swarm.NewSwarm(t, testEnv)
19 21
 	defer d.Stop(t)
... ...
@@ -12,6 +12,7 @@ import (
12 12
 
13 13
 func TestSessionCreate(t *testing.T) {
14 14
 	skip.If(t, !testEnv.DaemonInfo.ExperimentalBuild)
15
+	skip.If(t, testEnv.OSType == "windows", "FIXME")
15 16
 
16 17
 	defer setupTest(t)()
17 18
 
... ...
@@ -28,6 +29,7 @@ func TestSessionCreate(t *testing.T) {
28 28
 
29 29
 func TestSessionCreateWithBadUpgrade(t *testing.T) {
30 30
 	skip.If(t, !testEnv.DaemonInfo.ExperimentalBuild)
31
+	skip.If(t, testEnv.OSType == "windows", "FIXME")
31 32
 
32 33
 	res, body, err := req.Post("/session")
33 34
 	assert.NilError(t, err)
... ...
@@ -10,6 +10,7 @@ import (
10 10
 	"github.com/docker/docker/internal/test/daemon"
11 11
 
12 12
 	"gotest.tools/assert"
13
+	"gotest.tools/skip"
13 14
 )
14 15
 
15 16
 // hasSystemd checks whether the host was booted with systemd as its init
... ...
@@ -27,6 +28,7 @@ func hasSystemd() bool {
27 27
 // memory limit can be set when using systemd cgroupdriver.
28 28
 //  https://github.com/moby/moby/issues/35123
29 29
 func TestCgroupDriverSystemdMemoryLimit(t *testing.T) {
30
+	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
30 31
 	t.Parallel()
31 32
 
32 33
 	if !hasSystemd() {
... ...
@@ -25,6 +25,7 @@ import (
25 25
 
26 26
 func TestEventsExecDie(t *testing.T) {
27 27
 	skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.36"), "broken in earlier versions")
28
+	skip.If(t, testEnv.OSType == "windows", "FIXME. Suspect may need to wait until container is running before exec")
28 29
 	defer setupTest(t)()
29 30
 	ctx := context.Background()
30 31
 	client := request.NewAPIClient(t)
... ...
@@ -74,6 +75,7 @@ func TestEventsExecDie(t *testing.T) {
74 74
 // backward compatibility so old `JSONMessage` could still be used.
75 75
 // This test verifies that backward compatibility maintains.
76 76
 func TestEventsBackwardsCompatible(t *testing.T) {
77
+	skip.If(t, testEnv.OSType == "windows", "Windows doesn't support back-compat messages")
77 78
 	defer setupTest(t)()
78 79
 	ctx := context.Background()
79 80
 	client := request.NewAPIClient(t)
... ...
@@ -20,6 +20,7 @@ import (
20 20
 
21 21
 func TestVolumesCreateAndList(t *testing.T) {
22 22
 	skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
23
+	skip.If(t, testEnv.OSType == "windows", "FIXME")
23 24
 	defer setupTest(t)()
24 25
 	client := request.NewAPIClient(t)
25 26
 	ctx := context.Background()
... ...
@@ -49,6 +50,7 @@ func TestVolumesCreateAndList(t *testing.T) {
49 49
 }
50 50
 
51 51
 func TestVolumesRemove(t *testing.T) {
52
+	skip.If(t, testEnv.OSType == "windows", "FIXME")
52 53
 	defer setupTest(t)()
53 54
 	client := request.NewAPIClient(t)
54 55
 	ctx := context.Background()
... ...
@@ -75,6 +77,7 @@ func TestVolumesRemove(t *testing.T) {
75 75
 
76 76
 func TestVolumesInspect(t *testing.T) {
77 77
 	skip.If(t, testEnv.IsRemoteDaemon, "cannot run daemon when remote daemon")
78
+	skip.If(t, testEnv.OSType == "windows", "FIXME")
78 79
 	defer setupTest(t)()
79 80
 	client := request.NewAPIClient(t)
80 81
 	ctx := context.Background()