mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #13493 from jlhawn/volume_unmount_fix
Fix container unmount networkMounts
This commit is contained in:
commit
2029257e3c
3 changed files with 59 additions and 21 deletions
|
@ -595,3 +595,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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue