summaryrefslogtreecommitdiff
path: root/integration-cli/docker_cli_cp_test.go
diff options
context:
space:
mode:
authorJosh Hawn <josh.hawn@docker.com>2015-05-26 14:20:55 -0700
committerJosh Hawn <josh.hawn@docker.com>2015-05-26 17:38:26 -0700
commit04f99a6ca8232e43169b9a0706e435c551c798a3 (patch)
tree1c9b8cc8234a4a9f09cff9ae6a253b0d7ff9e124 /integration-cli/docker_cli_cp_test.go
parentfc679bebb9546a10c0f0a5b134f63cd58cd38b26 (diff)
downloaddocker-04f99a6ca8232e43169b9a0706e435c551c798a3.tar.gz
Fix container unmount networkMounts
UnmountVolumes used to also unmount 'specialMounts' but it no longer does after a recent refactor of volumes. This patch corrects this behavior to include unmounting of `networkMounts` which replaces `specialMounts` (now dead code). Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Diffstat (limited to 'integration-cli/docker_cli_cp_test.go')
-rw-r--r--integration-cli/docker_cli_cp_test.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/integration-cli/docker_cli_cp_test.go b/integration-cli/docker_cli_cp_test.go
index 26e778e4f2..6d07cff6f8 100644
--- a/integration-cli/docker_cli_cp_test.go
+++ b/integration-cli/docker_cli_cp_test.go
@@ -596,3 +596,40 @@ func (s *DockerSuite) TestCpNameHasColon(c *check.C) {
c.Fatalf("Wrong content in copied file %q, should be %q", content, "lololol\n")
}
}
+
+func (s *DockerSuite) TestCopyAndRestart(c *check.C) {
+ expectedMsg := "hello"
+ out, err := exec.Command(dockerBinary, "run", "-d", "busybox", "echo", expectedMsg).CombinedOutput()
+ if err != nil {
+ c.Fatal(string(out), err)
+ }
+ id := strings.TrimSpace(string(out))
+
+ if out, err = exec.Command(dockerBinary, "wait", id).CombinedOutput(); err != nil {
+ c.Fatalf("unable to wait for container: %s", err)
+ }
+
+ status := strings.TrimSpace(string(out))
+ if status != "0" {
+ c.Fatalf("container exited with status %s", status)
+ }
+
+ tmpDir, err := ioutil.TempDir("", "test-docker-restart-after-copy-")
+ if err != nil {
+ c.Fatalf("unable to make temporary directory: %s", err)
+ }
+ defer os.RemoveAll(tmpDir)
+
+ if _, err = exec.Command(dockerBinary, "cp", fmt.Sprintf("%s:/etc/issue", id), tmpDir).CombinedOutput(); err != nil {
+ c.Fatalf("unable to copy from busybox container: %s", err)
+ }
+
+ if out, err = exec.Command(dockerBinary, "start", "-a", id).CombinedOutput(); err != nil {
+ c.Fatalf("unable to start busybox container after copy: %s - %s", err, out)
+ }
+
+ msg := strings.TrimSpace(string(out))
+ if msg != expectedMsg {
+ c.Fatalf("expected %q but got %q", expectedMsg, msg)
+ }
+}