mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
dc944ea7e4
It prints test name and duration for each test. Also performs deleteAllContainers after each test. Signed-off-by: Alexander Morozov <lk4d4@docker.com>
25 lines
684 B
Go
25 lines
684 B
Go
// +build !test_no_exec
|
|
|
|
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"fmt"
|
|
"os/exec"
|
|
|
|
"github.com/go-check/check"
|
|
)
|
|
|
|
// Regression test for #9414
|
|
func (s *DockerSuite) TestExecApiCreateNoCmd(c *check.C) {
|
|
name := "exec_test"
|
|
runCmd := exec.Command(dockerBinary, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
|
|
if out, _, err := runCommandWithOutput(runCmd); err != nil {
|
|
c.Fatal(out, err)
|
|
}
|
|
|
|
_, body, err := sockRequest("POST", fmt.Sprintf("/containers/%s/exec", name), map[string]interface{}{"Cmd": nil})
|
|
if err == nil || !bytes.Contains(body, []byte("No exec command specified")) {
|
|
c.Fatalf("Expected error when creating exec command with no Cmd specified: %q", err)
|
|
}
|
|
}
|