diff options
author | Chen Hanxiao <chenhanxiao@cn.fujitsu.com> | 2015-04-10 00:08:05 -0400 |
---|---|---|
committer | Chen Hanxiao <chenhanxiao@cn.fujitsu.com> | 2015-04-10 00:08:05 -0400 |
commit | 50372973884d96ee115094336ed1952b1e71250a (patch) | |
tree | 632159a76513012888705c74ab0423971d162a35 /integration-cli/docker_cli_cp_test.go | |
parent | e690ad92925a045344bde8d2d59d7a7f602dded6 (diff) | |
download | docker-50372973884d96ee115094336ed1952b1e71250a.tar.gz |
cp: add support for copy filename with ":"
We use ":" as separator CONTAINER:PATH.
This patch enables copy filename with ":"
to host.
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
Diffstat (limited to 'integration-cli/docker_cli_cp_test.go')
-rw-r--r-- | integration-cli/docker_cli_cp_test.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/integration-cli/docker_cli_cp_test.go b/integration-cli/docker_cli_cp_test.go index 37e4659e91..12da76abca 100644 --- a/integration-cli/docker_cli_cp_test.go +++ b/integration-cli/docker_cli_cp_test.go @@ -620,3 +620,35 @@ func TestCpToStdout(t *testing.T) { } logDone("cp - to stdout") } + +func TestCpNameHasColon(t *testing.T) { + testRequires(t, SameHostDaemon) + + out, exitCode, err := dockerCmd(t, "run", "-d", "busybox", "/bin/sh", "-c", "echo lololol > /te:s:t") + if err != nil || exitCode != 0 { + t.Fatal("failed to create a container", out, err) + } + + cleanedContainerID := strings.TrimSpace(out) + defer deleteContainer(cleanedContainerID) + + out, _, err = dockerCmd(t, "wait", cleanedContainerID) + if err != nil || strings.TrimSpace(out) != "0" { + t.Fatal("failed to set up container", out, err) + } + + tmpdir, err := ioutil.TempDir("", "docker-integration") + if err != nil { + t.Fatal(err) + } + defer os.RemoveAll(tmpdir) + _, _, err = dockerCmd(t, "cp", cleanedContainerID+":/te:s:t", tmpdir) + if err != nil { + t.Fatalf("couldn't docker cp to %s: %s", tmpdir, err) + } + content, err := ioutil.ReadFile(tmpdir + "/te:s:t") + if string(content) != "lololol\n" { + t.Fatalf("Wrong content in copied file %q, should be %q", content, "lololol\n") + } + logDone("cp - copy filename has ':'") +} |