зеркало из https://github.com/microsoft/docker.git
Move TestRunWorkdirExistsAndIsFile to integration-cli
Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com>
This commit is contained in:
Родитель
01995ebebb
Коммит
a44f065f17
|
@ -1481,3 +1481,14 @@ func TestRunCleanupCmdOnEntrypoint(t *testing.T) {
|
||||||
}
|
}
|
||||||
logDone("run - cleanup cmd on --entrypoint")
|
logDone("run - cleanup cmd on --entrypoint")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TestRunWorkdirExistsAndIsFile checks that if 'docker run -w' with existing file can be detected
|
||||||
|
func TestRunWorkdirExistsAndIsFile(t *testing.T) {
|
||||||
|
defer deleteAllContainers()
|
||||||
|
runCmd := exec.Command(dockerBinary, "run", "-w", "/bin/cat", "busybox")
|
||||||
|
out, exit, err := runCommandWithOutput(runCmd)
|
||||||
|
if !(err != nil && exit == 1 && strings.Contains(out, "Cannot mkdir: /bin/cat is not a directory")) {
|
||||||
|
t.Fatalf("Docker must complains about making dir, but we got out: %s, exit: %d, err: %s", out, exit, err)
|
||||||
|
}
|
||||||
|
logDone("run - error on existing file for workdir")
|
||||||
|
}
|
||||||
|
|
|
@ -113,25 +113,6 @@ func assertPipe(input, output string, r io.Reader, w io.Writer, count int) error
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestRunWorkdirExistsAndIsFile checks that if 'docker run -w' with existing file can be detected
|
|
||||||
func TestRunWorkdirExistsAndIsFile(t *testing.T) {
|
|
||||||
|
|
||||||
cli := client.NewDockerCli(nil, nil, ioutil.Discard, testDaemonProto, testDaemonAddr, nil)
|
|
||||||
defer cleanup(globalEngine, t)
|
|
||||||
|
|
||||||
c := make(chan struct{})
|
|
||||||
go func() {
|
|
||||||
defer close(c)
|
|
||||||
if err := cli.CmdRun("-w", "/bin/cat", unitTestImageID, "pwd"); err == nil {
|
|
||||||
t.Fatal("should have failed to run when using /bin/cat as working dir.")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
setTimeout(t, "CmdRun timed out", 5*time.Second, func() {
|
|
||||||
<-c
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestRunExit(t *testing.T) {
|
func TestRunExit(t *testing.T) {
|
||||||
stdin, stdinPipe := io.Pipe()
|
stdin, stdinPipe := io.Pipe()
|
||||||
stdout, stdoutPipe := io.Pipe()
|
stdout, stdoutPipe := io.Pipe()
|
||||||
|
|
Загрузка…
Ссылка в новой задаче