Browse code

integration-cli: update TestCreateWithWorkdir for Hyper-V isolation

Hyper-V isolated containers do not allow file-operations on a
running container. This test currently uses `docker cp` to verify
that the WORKDIR was automatically created, which cannot be done
while the container is running.

```
FAIL: docker_cli_create_test.go:302: DockerSuite.TestCreateWithWorkdir

assertion failed:
Command: d:\CI-7\CI-f3768a669\binary\docker.exe cp foo:c:\home\foo\bar c:\tmp
ExitCode: 1
Error: exit status 1
Stdout:
Stderr: Error response from daemon: filesystem operations against a running Hyper-V container are not supported

Failures:
ExitCode was 1 expected 0
Expected no error
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2019/09/04 19:55:47
Showing 1 changed files
... ...
@@ -307,7 +307,15 @@ func (s *DockerSuite) TestCreateWithWorkdir(c *testing.T) {
307 307
 	// Windows does not create the workdir until the container is started
308 308
 	if testEnv.OSType == "windows" {
309 309
 		dockerCmd(c, "start", name)
310
+		if IsolationIsHyperv() {
311
+			// Hyper-V isolated containers do not allow file-operations on a
312
+			// running container. This test currently uses `docker cp` to verify
313
+			// that the WORKDIR was automatically created, which cannot be done
314
+			// while the container is running.
315
+			dockerCmd(c, "stop", name)
316
+		}
310 317
 	}
318
+	// TODO: rewrite this test to not use `docker cp` for verifying that the WORKDIR was created
311 319
 	dockerCmd(c, "cp", fmt.Sprintf("%s:%s", name, dir), prefix+slash+"tmp")
312 320
 }
313 321