integration-cli: DockerAPISuite: replace dockerCmd and waitRun
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
908821d48a
commit
1baec48367
10 changed files with 174 additions and 191 deletions
|
@ -13,6 +13,7 @@ import (
|
|||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/client"
|
||||
"github.com/docker/docker/integration-cli/cli"
|
||||
"github.com/docker/docker/pkg/stdcopy"
|
||||
"github.com/docker/docker/testutil"
|
||||
"github.com/docker/docker/testutil/request"
|
||||
|
@ -24,14 +25,14 @@ import (
|
|||
)
|
||||
|
||||
func (s *DockerAPISuite) TestGetContainersAttachWebsocket(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "run", "-di", "busybox", "cat")
|
||||
cid := cli.DockerCmd(c, "run", "-di", "busybox", "cat").Stdout()
|
||||
cid = strings.TrimSpace(cid)
|
||||
|
||||
rwc, err := request.SockConn(10*time.Second, request.DaemonHost())
|
||||
assert.NilError(c, err)
|
||||
|
||||
cleanedContainerID := strings.TrimSpace(out)
|
||||
config, err := websocket.NewConfig(
|
||||
"/containers/"+cleanedContainerID+"/attach/ws?stream=1&stdin=1&stdout=1&stderr=1",
|
||||
"/containers/"+cid+"/attach/ws?stream=1&stdin=1&stdout=1&stderr=1",
|
||||
"http://localhost",
|
||||
)
|
||||
assert.NilError(c, err)
|
||||
|
@ -136,7 +137,7 @@ func (s *DockerAPISuite) TestPostContainersAttach(c *testing.T) {
|
|||
}
|
||||
|
||||
// Create a container that only emits stdout.
|
||||
cid, _ := dockerCmd(c, "run", "-di", "busybox", "cat")
|
||||
cid := cli.DockerCmd(c, "run", "-di", "busybox", "cat").Stdout()
|
||||
cid = strings.TrimSpace(cid)
|
||||
|
||||
// Attach to the container's stdout stream.
|
||||
|
@ -152,7 +153,7 @@ func (s *DockerAPISuite) TestPostContainersAttach(c *testing.T) {
|
|||
expectTimeout(wc, br, "stdout")
|
||||
|
||||
// Test the similar functions of the stderr stream.
|
||||
cid, _ = dockerCmd(c, "run", "-di", "busybox", "/bin/sh", "-c", "cat >&2")
|
||||
cid = cli.DockerCmd(c, "run", "-di", "busybox", "/bin/sh", "-c", "cat >&2").Stdout()
|
||||
cid = strings.TrimSpace(cid)
|
||||
wc, br, err = requestHijack(http.MethodPost, "/containers/"+cid+"/attach?stream=1&stdin=1&stderr=1", nil, "text/plain", request.DaemonHost())
|
||||
assert.NilError(c, err)
|
||||
|
@ -162,7 +163,7 @@ func (s *DockerAPISuite) TestPostContainersAttach(c *testing.T) {
|
|||
expectTimeout(wc, br, "stderr")
|
||||
|
||||
// Test with tty.
|
||||
cid, _ = dockerCmd(c, "run", "-dit", "busybox", "/bin/sh", "-c", "cat >&2")
|
||||
cid = cli.DockerCmd(c, "run", "-dit", "busybox", "/bin/sh", "-c", "cat >&2").Stdout()
|
||||
cid = strings.TrimSpace(cid)
|
||||
// Attach to stdout only.
|
||||
wc, br, err = requestHijack(http.MethodPost, "/containers/"+cid+"/attach?stream=1&stdin=1&stdout=1", nil, "text/plain", request.DaemonHost())
|
||||
|
@ -181,7 +182,7 @@ func (s *DockerAPISuite) TestPostContainersAttach(c *testing.T) {
|
|||
assert.NilError(c, err)
|
||||
defer apiClient.Close()
|
||||
|
||||
cid, _ = dockerCmd(c, "run", "-di", "busybox", "/bin/sh", "-c", "echo hello; cat")
|
||||
cid = cli.DockerCmd(c, "run", "-di", "busybox", "/bin/sh", "-c", "echo hello; cat").Stdout()
|
||||
cid = strings.TrimSpace(cid)
|
||||
|
||||
// Make sure we don't see "hello" if Logs is false
|
||||
|
|
|
@ -38,18 +38,17 @@ import (
|
|||
|
||||
func (s *DockerAPISuite) TestContainerAPIGetAll(c *testing.T) {
|
||||
startCount := getContainerCount(c)
|
||||
name := "getall"
|
||||
dockerCmd(c, "run", "--name", name, "busybox", "true")
|
||||
const name = "getall"
|
||||
cli.DockerCmd(c, "run", "--name", name, "busybox", "true")
|
||||
|
||||
apiClient, err := client.NewClientWithOpts(client.FromEnv)
|
||||
assert.NilError(c, err)
|
||||
defer apiClient.Close()
|
||||
|
||||
options := container.ListOptions{
|
||||
All: true,
|
||||
}
|
||||
ctx := testutil.GetContext(c)
|
||||
containers, err := apiClient.ContainerList(ctx, options)
|
||||
containers, err := apiClient.ContainerList(ctx, container.ListOptions{
|
||||
All: true,
|
||||
})
|
||||
assert.NilError(c, err)
|
||||
assert.Equal(c, len(containers), startCount+1)
|
||||
actual := containers[0].Names[0]
|
||||
|
@ -59,7 +58,7 @@ func (s *DockerAPISuite) TestContainerAPIGetAll(c *testing.T) {
|
|||
// regression test for empty json field being omitted #13691
|
||||
func (s *DockerAPISuite) TestContainerAPIGetJSONNoFieldsOmitted(c *testing.T) {
|
||||
startCount := getContainerCount(c)
|
||||
dockerCmd(c, "run", "busybox", "true")
|
||||
cli.DockerCmd(c, "run", "busybox", "true")
|
||||
|
||||
apiClient, err := client.NewClientWithOpts(client.FromEnv)
|
||||
assert.NilError(c, err)
|
||||
|
@ -101,8 +100,8 @@ func (s *DockerAPISuite) TestContainerAPIGetJSONNoFieldsOmitted(c *testing.T) {
|
|||
func (s *DockerAPISuite) TestContainerAPIGetExport(c *testing.T) {
|
||||
// Not supported on Windows as Windows does not support docker export
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "exportcontainer"
|
||||
dockerCmd(c, "run", "--name", name, "busybox", "touch", "/test")
|
||||
const name = "exportcontainer"
|
||||
cli.DockerCmd(c, "run", "--name", name, "busybox", "touch", "/test")
|
||||
|
||||
apiClient, err := client.NewClientWithOpts(client.FromEnv)
|
||||
assert.NilError(c, err)
|
||||
|
@ -128,8 +127,8 @@ func (s *DockerAPISuite) TestContainerAPIGetExport(c *testing.T) {
|
|||
func (s *DockerAPISuite) TestContainerAPIGetChanges(c *testing.T) {
|
||||
// Not supported on Windows as Windows does not support docker diff (/containers/name/changes)
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "changescontainer"
|
||||
dockerCmd(c, "run", "--name", name, "busybox", "rm", "/etc/passwd")
|
||||
const name = "changescontainer"
|
||||
cli.DockerCmd(c, "run", "--name", name, "busybox", "rm", "/etc/passwd")
|
||||
|
||||
apiClient, err := client.NewClientWithOpts(client.FromEnv)
|
||||
assert.NilError(c, err)
|
||||
|
@ -170,7 +169,7 @@ func (s *DockerAPISuite) TestGetContainerStats(c *testing.T) {
|
|||
|
||||
// allow some time to stream the stats from the container
|
||||
time.Sleep(4 * time.Second)
|
||||
dockerCmd(c, "rm", "-f", name)
|
||||
cli.DockerCmd(c, "rm", "-f", name)
|
||||
|
||||
// collect the results from the stats stream or timeout and fail
|
||||
// if the stream was not disconnected.
|
||||
|
@ -187,8 +186,7 @@ func (s *DockerAPISuite) TestGetContainerStats(c *testing.T) {
|
|||
}
|
||||
|
||||
func (s *DockerAPISuite) TestGetContainerStatsRmRunning(c *testing.T) {
|
||||
out := runSleepingContainer(c)
|
||||
id := strings.TrimSpace(out)
|
||||
id := runSleepingContainer(c)
|
||||
|
||||
buf := &ChannelBuffer{C: make(chan []byte, 1)}
|
||||
defer buf.Close()
|
||||
|
@ -218,7 +216,7 @@ func (s *DockerAPISuite) TestGetContainerStatsRmRunning(c *testing.T) {
|
|||
_, err = buf.ReadTimeout(b, 2*time.Second)
|
||||
assert.NilError(c, err)
|
||||
|
||||
dockerCmd(c, "rm", "-f", id)
|
||||
cli.DockerCmd(c, "rm", "-f", id)
|
||||
assert.Assert(c, <-chErr == nil)
|
||||
}
|
||||
|
||||
|
@ -254,7 +252,7 @@ func (c *ChannelBuffer) ReadTimeout(p []byte, n time.Duration) (int, error) {
|
|||
// previous test was just checking one stat entry so it didn't fail (stats with
|
||||
// stream false always return one stat)
|
||||
func (s *DockerAPISuite) TestGetContainerStatsStream(c *testing.T) {
|
||||
name := "statscontainer"
|
||||
const name = "statscontainer"
|
||||
runSleepingContainer(c, "--name", name)
|
||||
|
||||
type b struct {
|
||||
|
@ -275,7 +273,7 @@ func (s *DockerAPISuite) TestGetContainerStatsStream(c *testing.T) {
|
|||
|
||||
// allow some time to stream the stats from the container
|
||||
time.Sleep(4 * time.Second)
|
||||
dockerCmd(c, "rm", "-f", name)
|
||||
cli.DockerCmd(c, "rm", "-f", name)
|
||||
|
||||
// collect the results from the stats stream or timeout and fail
|
||||
// if the stream was not disconnected.
|
||||
|
@ -295,7 +293,7 @@ func (s *DockerAPISuite) TestGetContainerStatsStream(c *testing.T) {
|
|||
}
|
||||
|
||||
func (s *DockerAPISuite) TestGetContainerStatsNoStream(c *testing.T) {
|
||||
name := "statscontainer"
|
||||
const name = "statscontainer2"
|
||||
runSleepingContainer(c, "--name", name)
|
||||
|
||||
type b struct {
|
||||
|
@ -317,7 +315,7 @@ func (s *DockerAPISuite) TestGetContainerStatsNoStream(c *testing.T) {
|
|||
|
||||
// allow some time to stream the stats from the container
|
||||
time.Sleep(4 * time.Second)
|
||||
dockerCmd(c, "rm", "-f", name)
|
||||
cli.DockerCmd(c, "rm", "-f", name)
|
||||
|
||||
// collect the results from the stats stream or timeout and fail
|
||||
// if the stream was not disconnected.
|
||||
|
@ -335,8 +333,8 @@ func (s *DockerAPISuite) TestGetContainerStatsNoStream(c *testing.T) {
|
|||
}
|
||||
|
||||
func (s *DockerAPISuite) TestGetStoppedContainerStats(c *testing.T) {
|
||||
name := "statscontainer"
|
||||
dockerCmd(c, "create", "--name", name, "busybox", "ps")
|
||||
const name = "statscontainer3"
|
||||
cli.DockerCmd(c, "create", "--name", name, "busybox", "ps")
|
||||
|
||||
chResp := make(chan error, 1)
|
||||
|
||||
|
@ -394,9 +392,9 @@ func (s *DockerAPISuite) TestContainerAPIPause(c *testing.T) {
|
|||
|
||||
func (s *DockerAPISuite) TestContainerAPITop(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "top && true")
|
||||
out := cli.DockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "top && true").Stdout()
|
||||
id := strings.TrimSpace(out)
|
||||
assert.NilError(c, waitRun(id))
|
||||
cli.WaitRun(c, id)
|
||||
|
||||
apiClient, err := client.NewClientWithOpts(client.FromEnv)
|
||||
assert.NilError(c, err)
|
||||
|
@ -417,9 +415,8 @@ func (s *DockerAPISuite) TestContainerAPITop(c *testing.T) {
|
|||
|
||||
func (s *DockerAPISuite) TestContainerAPITopWindows(c *testing.T) {
|
||||
testRequires(c, DaemonIsWindows)
|
||||
out := runSleepingContainer(c, "-d")
|
||||
id := strings.TrimSpace(out)
|
||||
assert.NilError(c, waitRun(id))
|
||||
id := runSleepingContainer(c, "-d")
|
||||
cli.WaitRun(c, id)
|
||||
|
||||
apiClient, err := client.NewClientWithOpts(client.FromEnv)
|
||||
assert.NilError(c, err)
|
||||
|
@ -447,8 +444,8 @@ func (s *DockerAPISuite) TestContainerAPITopWindows(c *testing.T) {
|
|||
}
|
||||
|
||||
func (s *DockerAPISuite) TestContainerAPICommit(c *testing.T) {
|
||||
cName := "testapicommit"
|
||||
dockerCmd(c, "run", "--name="+cName, "busybox", "/bin/sh", "-c", "touch /test")
|
||||
const cName = "testapicommit"
|
||||
cli.DockerCmd(c, "run", "--name="+cName, "busybox", "/bin/sh", "-c", "touch /test")
|
||||
|
||||
apiClient, err := client.NewClientWithOpts(client.FromEnv)
|
||||
assert.NilError(c, err)
|
||||
|
@ -465,12 +462,12 @@ func (s *DockerAPISuite) TestContainerAPICommit(c *testing.T) {
|
|||
assert.Equal(c, cmd, "[/bin/sh -c touch /test]", fmt.Sprintf("got wrong Cmd from commit: %q", cmd))
|
||||
|
||||
// sanity check, make sure the image is what we think it is
|
||||
dockerCmd(c, "run", img.ID, "ls", "/test")
|
||||
cli.DockerCmd(c, "run", img.ID, "ls", "/test")
|
||||
}
|
||||
|
||||
func (s *DockerAPISuite) TestContainerAPICommitWithLabelInConfig(c *testing.T) {
|
||||
cName := "testapicommitwithconfig"
|
||||
dockerCmd(c, "run", "--name="+cName, "busybox", "/bin/sh", "-c", "touch /test")
|
||||
const cName = "testapicommitwithconfig"
|
||||
cli.DockerCmd(c, "run", "--name="+cName, "busybox", "/bin/sh", "-c", "touch /test")
|
||||
|
||||
apiClient, err := client.NewClientWithOpts(client.FromEnv)
|
||||
assert.NilError(c, err)
|
||||
|
@ -498,7 +495,7 @@ func (s *DockerAPISuite) TestContainerAPICommitWithLabelInConfig(c *testing.T) {
|
|||
assert.Equal(c, cmd, "[/bin/sh -c touch /test]", fmt.Sprintf("got wrong Cmd from commit: %q", cmd))
|
||||
|
||||
// sanity check, make sure the image is what we think it is
|
||||
dockerCmd(c, "run", img.ID, "ls", "/test")
|
||||
cli.DockerCmd(c, "run", img.ID, "ls", "/test")
|
||||
}
|
||||
|
||||
func (s *DockerAPISuite) TestContainerAPIBadPort(c *testing.T) {
|
||||
|
@ -542,7 +539,7 @@ func (s *DockerAPISuite) TestContainerAPICreate(c *testing.T) {
|
|||
ctr, err := apiClient.ContainerCreate(testutil.GetContext(c), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, "")
|
||||
assert.NilError(c, err)
|
||||
|
||||
out, _ := dockerCmd(c, "start", "-a", ctr.ID)
|
||||
out := cli.DockerCmd(c, "start", "-a", ctr.ID).Stdout()
|
||||
assert.Equal(c, strings.TrimSpace(out), "/test")
|
||||
}
|
||||
|
||||
|
@ -848,10 +845,9 @@ func (s *DockerAPISuite) TestCreateWithTooLowMemoryLimit(c *testing.T) {
|
|||
}
|
||||
|
||||
func (s *DockerAPISuite) TestContainerAPIRename(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "run", "--name", "TestContainerAPIRename", "-d", "busybox", "sh")
|
||||
|
||||
out := cli.DockerCmd(c, "run", "--name", "TestContainerAPIRename", "-d", "busybox", "sh").Stdout()
|
||||
containerID := strings.TrimSpace(out)
|
||||
newName := "TestContainerAPIRenameNew"
|
||||
const newName = "TestContainerAPIRenameNew"
|
||||
|
||||
apiClient, err := client.NewClientWithOpts(client.FromEnv)
|
||||
assert.NilError(c, err)
|
||||
|
@ -865,7 +861,7 @@ func (s *DockerAPISuite) TestContainerAPIRename(c *testing.T) {
|
|||
}
|
||||
|
||||
func (s *DockerAPISuite) TestContainerAPIKill(c *testing.T) {
|
||||
name := "test-api-kill"
|
||||
const name = "test-api-kill"
|
||||
runSleepingContainer(c, "-i", "--name", name)
|
||||
|
||||
apiClient, err := client.NewClientWithOpts(client.FromEnv)
|
||||
|
@ -880,7 +876,7 @@ func (s *DockerAPISuite) TestContainerAPIKill(c *testing.T) {
|
|||
}
|
||||
|
||||
func (s *DockerAPISuite) TestContainerAPIRestart(c *testing.T) {
|
||||
name := "test-api-restart"
|
||||
const name = "test-api-restart"
|
||||
runSleepingContainer(c, "-di", "--name", name)
|
||||
apiClient, err := client.NewClientWithOpts(client.FromEnv)
|
||||
assert.NilError(c, err)
|
||||
|
@ -894,10 +890,9 @@ func (s *DockerAPISuite) TestContainerAPIRestart(c *testing.T) {
|
|||
}
|
||||
|
||||
func (s *DockerAPISuite) TestContainerAPIRestartNotimeoutParam(c *testing.T) {
|
||||
name := "test-api-restart-no-timeout-param"
|
||||
out := runSleepingContainer(c, "-di", "--name", name)
|
||||
id := strings.TrimSpace(out)
|
||||
assert.NilError(c, waitRun(id))
|
||||
const name = "test-api-restart-no-timeout-param"
|
||||
id := runSleepingContainer(c, "-di", "--name", name)
|
||||
cli.WaitRun(c, id)
|
||||
|
||||
apiClient, err := client.NewClientWithOpts(client.FromEnv)
|
||||
assert.NilError(c, err)
|
||||
|
@ -910,7 +905,7 @@ func (s *DockerAPISuite) TestContainerAPIRestartNotimeoutParam(c *testing.T) {
|
|||
}
|
||||
|
||||
func (s *DockerAPISuite) TestContainerAPIStart(c *testing.T) {
|
||||
name := "testing-start"
|
||||
const name = "testing-start"
|
||||
config := container.Config{
|
||||
Image: "busybox",
|
||||
Cmd: append([]string{"/bin/sh", "-c"}, sleepCommandForDaemonPlatform()...),
|
||||
|
@ -936,7 +931,7 @@ func (s *DockerAPISuite) TestContainerAPIStart(c *testing.T) {
|
|||
}
|
||||
|
||||
func (s *DockerAPISuite) TestContainerAPIStop(c *testing.T) {
|
||||
name := "test-api-stop"
|
||||
const name = "test-api-stop"
|
||||
runSleepingContainer(c, "-i", "--name", name)
|
||||
timeout := 30
|
||||
|
||||
|
@ -959,13 +954,13 @@ func (s *DockerAPISuite) TestContainerAPIStop(c *testing.T) {
|
|||
}
|
||||
|
||||
func (s *DockerAPISuite) TestContainerAPIWait(c *testing.T) {
|
||||
name := "test-api-wait"
|
||||
const name = "test-api-wait"
|
||||
|
||||
sleepCmd := "/bin/sleep"
|
||||
if testEnv.DaemonInfo.OSType == "windows" {
|
||||
sleepCmd = "sleep"
|
||||
}
|
||||
dockerCmd(c, "run", "--name", name, "busybox", sleepCmd, "2")
|
||||
cli.DockerCmd(c, "run", "--name", name, "busybox", sleepCmd, "2")
|
||||
|
||||
apiClient, err := client.NewClientWithOpts(client.FromEnv)
|
||||
assert.NilError(c, err)
|
||||
|
@ -982,8 +977,8 @@ func (s *DockerAPISuite) TestContainerAPIWait(c *testing.T) {
|
|||
}
|
||||
|
||||
func (s *DockerAPISuite) TestContainerAPICopyNotExistsAnyMore(c *testing.T) {
|
||||
name := "test-container-api-copy"
|
||||
dockerCmd(c, "run", "--name", name, "busybox", "touch", "/test.txt")
|
||||
const name = "test-container-api-copy"
|
||||
cli.DockerCmd(c, "run", "--name", name, "busybox", "touch", "/test.txt")
|
||||
|
||||
postData := types.CopyConfig{
|
||||
Resource: "/test.txt",
|
||||
|
@ -996,8 +991,8 @@ func (s *DockerAPISuite) TestContainerAPICopyNotExistsAnyMore(c *testing.T) {
|
|||
|
||||
func (s *DockerAPISuite) TestContainerAPICopyPre124(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux) // Windows only supports 1.25 or later
|
||||
name := "test-container-api-copy"
|
||||
dockerCmd(c, "run", "--name", name, "busybox", "touch", "/test.txt")
|
||||
const name = "test-container-api-copy"
|
||||
cli.DockerCmd(c, "run", "--name", name, "busybox", "touch", "/test.txt")
|
||||
|
||||
postData := types.CopyConfig{
|
||||
Resource: "/test.txt",
|
||||
|
@ -1026,8 +1021,8 @@ func (s *DockerAPISuite) TestContainerAPICopyPre124(c *testing.T) {
|
|||
|
||||
func (s *DockerAPISuite) TestContainerAPICopyResourcePathEmptyPre124(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux) // Windows only supports 1.25 or later
|
||||
name := "test-container-api-copy-resource-empty"
|
||||
dockerCmd(c, "run", "--name", name, "busybox", "touch", "/test.txt")
|
||||
const name = "test-container-api-copy-resource-empty"
|
||||
cli.DockerCmd(c, "run", "--name", name, "busybox", "touch", "/test.txt")
|
||||
|
||||
postData := types.CopyConfig{
|
||||
Resource: "",
|
||||
|
@ -1047,8 +1042,8 @@ func (s *DockerAPISuite) TestContainerAPICopyResourcePathEmptyPre124(c *testing.
|
|||
|
||||
func (s *DockerAPISuite) TestContainerAPICopyResourcePathNotFoundPre124(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux) // Windows only supports 1.25 or later
|
||||
name := "test-container-api-copy-resource-not-found"
|
||||
dockerCmd(c, "run", "--name", name, "busybox")
|
||||
const name = "test-container-api-copy-resource-not-found"
|
||||
cli.DockerCmd(c, "run", "--name", name, "busybox")
|
||||
|
||||
postData := types.CopyConfig{
|
||||
Resource: "/notexist",
|
||||
|
@ -1078,12 +1073,9 @@ func (s *DockerAPISuite) TestContainerAPICopyContainerNotFoundPr124(c *testing.T
|
|||
}
|
||||
|
||||
func (s *DockerAPISuite) TestContainerAPIDelete(c *testing.T) {
|
||||
out := runSleepingContainer(c)
|
||||
|
||||
id := strings.TrimSpace(out)
|
||||
assert.NilError(c, waitRun(id))
|
||||
|
||||
dockerCmd(c, "stop", id)
|
||||
id := runSleepingContainer(c)
|
||||
cli.WaitRun(c, id)
|
||||
cli.DockerCmd(c, "stop", id)
|
||||
|
||||
apiClient, err := client.NewClientWithOpts(client.FromEnv)
|
||||
assert.NilError(c, err)
|
||||
|
@ -1103,9 +1095,8 @@ func (s *DockerAPISuite) TestContainerAPIDeleteNotExist(c *testing.T) {
|
|||
}
|
||||
|
||||
func (s *DockerAPISuite) TestContainerAPIDeleteForce(c *testing.T) {
|
||||
out := runSleepingContainer(c)
|
||||
id := strings.TrimSpace(out)
|
||||
assert.NilError(c, waitRun(id))
|
||||
id := runSleepingContainer(c)
|
||||
cli.WaitRun(c, id)
|
||||
|
||||
removeOptions := container.RemoveOptions{
|
||||
Force: true,
|
||||
|
@ -1122,15 +1113,13 @@ func (s *DockerAPISuite) TestContainerAPIDeleteForce(c *testing.T) {
|
|||
func (s *DockerAPISuite) TestContainerAPIDeleteRemoveLinks(c *testing.T) {
|
||||
// Windows does not support links
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "--name", "tlink1", "busybox", "top")
|
||||
|
||||
out := cli.DockerCmd(c, "run", "-d", "--name", "tlink1", "busybox", "top").Stdout()
|
||||
id := strings.TrimSpace(out)
|
||||
assert.NilError(c, waitRun(id))
|
||||
|
||||
out, _ = dockerCmd(c, "run", "--link", "tlink1:tlink1", "--name", "tlink2", "-d", "busybox", "top")
|
||||
cli.WaitRun(c, id)
|
||||
|
||||
out = cli.DockerCmd(c, "run", "--link", "tlink1:tlink1", "--name", "tlink2", "-d", "busybox", "top").Stdout()
|
||||
id2 := strings.TrimSpace(out)
|
||||
assert.Assert(c, waitRun(id2) == nil)
|
||||
cli.WaitRun(c, id2)
|
||||
|
||||
links := inspectFieldJSON(c, id2, "HostConfig.Links")
|
||||
assert.Equal(c, links, `["/tlink1:/tlink2/tlink1"]`, "expected to have links between containers")
|
||||
|
@ -1158,10 +1147,8 @@ func (s *DockerAPISuite) TestContainerAPIDeleteRemoveVolume(c *testing.T) {
|
|||
vol = `c:\testvolume`
|
||||
}
|
||||
|
||||
out := runSleepingContainer(c, "-v", vol)
|
||||
|
||||
id := strings.TrimSpace(out)
|
||||
assert.NilError(c, waitRun(id))
|
||||
id := runSleepingContainer(c, "-v", vol)
|
||||
cli.WaitRun(c, id)
|
||||
|
||||
source, err := inspectMountSourceField(id, vol)
|
||||
assert.NilError(c, err)
|
||||
|
@ -1205,10 +1192,8 @@ func (s *DockerAPISuite) TestContainerAPIChunkedEncoding(c *testing.T) {
|
|||
}
|
||||
|
||||
func (s *DockerAPISuite) TestContainerAPIPostContainerStop(c *testing.T) {
|
||||
out := runSleepingContainer(c)
|
||||
|
||||
containerID := strings.TrimSpace(out)
|
||||
assert.Assert(c, waitRun(containerID) == nil)
|
||||
containerID := runSleepingContainer(c)
|
||||
cli.WaitRun(c, containerID)
|
||||
|
||||
apiClient, err := client.NewClientWithOpts(client.FromEnv)
|
||||
assert.NilError(c, err)
|
||||
|
@ -1233,7 +1218,7 @@ func (s *DockerAPISuite) TestPostContainerAPICreateWithStringOrSliceEntrypoint(c
|
|||
|
||||
_, err = apiClient.ContainerCreate(testutil.GetContext(c), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, "echotest")
|
||||
assert.NilError(c, err)
|
||||
out, _ := dockerCmd(c, "start", "-a", "echotest")
|
||||
out := cli.DockerCmd(c, "start", "-a", "echotest").Combined()
|
||||
assert.Equal(c, strings.TrimSpace(out), "hello world")
|
||||
|
||||
config2 := struct {
|
||||
|
@ -1243,7 +1228,7 @@ func (s *DockerAPISuite) TestPostContainerAPICreateWithStringOrSliceEntrypoint(c
|
|||
}{"busybox", "echo", []string{"hello", "world"}}
|
||||
_, _, err = request.Post(testutil.GetContext(c), "/containers/create?name=echotest2", request.JSONBody(config2))
|
||||
assert.NilError(c, err)
|
||||
out, _ = dockerCmd(c, "start", "-a", "echotest2")
|
||||
out = cli.DockerCmd(c, "start", "-a", "echotest2").Combined()
|
||||
assert.Equal(c, strings.TrimSpace(out), "hello world")
|
||||
}
|
||||
|
||||
|
@ -1260,7 +1245,7 @@ func (s *DockerAPISuite) TestPostContainersCreateWithStringOrSliceCmd(c *testing
|
|||
|
||||
_, err = apiClient.ContainerCreate(testutil.GetContext(c), &config, &container.HostConfig{}, &network.NetworkingConfig{}, nil, "echotest")
|
||||
assert.NilError(c, err)
|
||||
out, _ := dockerCmd(c, "start", "-a", "echotest")
|
||||
out := cli.DockerCmd(c, "start", "-a", "echotest").Combined()
|
||||
assert.Equal(c, strings.TrimSpace(out), "hello world")
|
||||
|
||||
config2 := struct {
|
||||
|
@ -1270,7 +1255,7 @@ func (s *DockerAPISuite) TestPostContainersCreateWithStringOrSliceCmd(c *testing
|
|||
}{"busybox", "echo", "hello world"}
|
||||
_, _, err = request.Post(testutil.GetContext(c), "/containers/create?name=echotest2", request.JSONBody(config2))
|
||||
assert.NilError(c, err)
|
||||
out, _ = dockerCmd(c, "start", "-a", "echotest2")
|
||||
out = cli.DockerCmd(c, "start", "-a", "echotest2").Combined()
|
||||
assert.Equal(c, strings.TrimSpace(out), "hello world")
|
||||
}
|
||||
|
||||
|
@ -1364,7 +1349,7 @@ func (s *DockerAPISuite) TestPostContainersCreateWithWrongCpusetValues(c *testin
|
|||
CpusetCpus: "1-42,,",
|
||||
},
|
||||
}
|
||||
name := "wrong-cpuset-cpus"
|
||||
const name = "wrong-cpuset-cpus"
|
||||
|
||||
_, err = apiClient.ContainerCreate(testutil.GetContext(c), &config, &hostConfig1, &network.NetworkingConfig{}, nil, name)
|
||||
expected := "Invalid value 1-42,, for cpuset cpus"
|
||||
|
@ -1375,8 +1360,8 @@ func (s *DockerAPISuite) TestPostContainersCreateWithWrongCpusetValues(c *testin
|
|||
CpusetMems: "42-3,1--",
|
||||
},
|
||||
}
|
||||
name = "wrong-cpuset-mems"
|
||||
_, err = apiClient.ContainerCreate(testutil.GetContext(c), &config, &hostConfig2, &network.NetworkingConfig{}, nil, name)
|
||||
const name2 = "wrong-cpuset-mems"
|
||||
_, err = apiClient.ContainerCreate(testutil.GetContext(c), &config, &hostConfig2, &network.NetworkingConfig{}, nil, name2)
|
||||
expected = "Invalid value 42-3,1-- for cpuset mems"
|
||||
assert.ErrorContains(c, err, expected)
|
||||
}
|
||||
|
@ -1420,7 +1405,7 @@ func (s *DockerAPISuite) TestPostContainersCreateShmSizeHostConfigOmitted(c *tes
|
|||
|
||||
assert.Equal(c, containerJSON.HostConfig.ShmSize, dconfig.DefaultShmSize)
|
||||
|
||||
out, _ := dockerCmd(c, "start", "-i", containerJSON.ID)
|
||||
out := cli.DockerCmd(c, "start", "-i", containerJSON.ID).Combined()
|
||||
shmRegexp := regexp.MustCompile(`shm on /dev/shm type tmpfs(.*)size=65536k`)
|
||||
if !shmRegexp.MatchString(out) {
|
||||
c.Fatalf("Expected shm of 64MB in mount command, got %v", out)
|
||||
|
@ -1447,7 +1432,7 @@ func (s *DockerAPISuite) TestPostContainersCreateShmSizeOmitted(c *testing.T) {
|
|||
|
||||
assert.Equal(c, containerJSON.HostConfig.ShmSize, int64(67108864))
|
||||
|
||||
out, _ := dockerCmd(c, "start", "-i", containerJSON.ID)
|
||||
out := cli.DockerCmd(c, "start", "-i", containerJSON.ID).Combined()
|
||||
shmRegexp := regexp.MustCompile(`shm on /dev/shm type tmpfs(.*)size=65536k`)
|
||||
if !shmRegexp.MatchString(out) {
|
||||
c.Fatalf("Expected shm of 64MB in mount command, got %v", out)
|
||||
|
@ -1478,7 +1463,7 @@ func (s *DockerAPISuite) TestPostContainersCreateWithShmSize(c *testing.T) {
|
|||
|
||||
assert.Equal(c, containerJSON.HostConfig.ShmSize, int64(1073741824))
|
||||
|
||||
out, _ := dockerCmd(c, "start", "-i", containerJSON.ID)
|
||||
out := cli.DockerCmd(c, "start", "-i", containerJSON.ID).Combined()
|
||||
shmRegex := regexp.MustCompile(`shm on /dev/shm type tmpfs(.*)size=1048576k`)
|
||||
if !shmRegex.MatchString(out) {
|
||||
c.Fatalf("Expected shm of 1GB in mount command, got %v", out)
|
||||
|
@ -1526,7 +1511,7 @@ func (s *DockerAPISuite) TestPostContainersCreateWithOomScoreAdjInvalidRange(c *
|
|||
assert.NilError(c, err)
|
||||
defer apiClient.Close()
|
||||
|
||||
name := "oomscoreadj-over"
|
||||
const name = "oomscoreadj-over"
|
||||
_, err = apiClient.ContainerCreate(testutil.GetContext(c), &config, &hostConfig, &network.NetworkingConfig{}, nil, name)
|
||||
|
||||
expected := "Invalid value 1001, range for oom score adj is [-1000, 1000]"
|
||||
|
@ -1536,8 +1521,8 @@ func (s *DockerAPISuite) TestPostContainersCreateWithOomScoreAdjInvalidRange(c *
|
|||
OomScoreAdj: -1001,
|
||||
}
|
||||
|
||||
name = "oomscoreadj-low"
|
||||
_, err = apiClient.ContainerCreate(testutil.GetContext(c), &config, &hostConfig, &network.NetworkingConfig{}, nil, name)
|
||||
const name2 = "oomscoreadj-low"
|
||||
_, err = apiClient.ContainerCreate(testutil.GetContext(c), &config, &hostConfig, &network.NetworkingConfig{}, nil, name2)
|
||||
|
||||
expected = "Invalid value -1001, range for oom score adj is [-1000, 1000]"
|
||||
assert.ErrorContains(c, err, expected)
|
||||
|
@ -1557,7 +1542,7 @@ func (s *DockerAPISuite) TestContainerAPIStatsWithNetworkDisabled(c *testing.T)
|
|||
// Problematic on Windows as Windows does not support stats
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
name := "testing-network-disabled"
|
||||
const name = "testing-network-disabled"
|
||||
|
||||
config := container.Config{
|
||||
Image: "busybox",
|
||||
|
@ -1574,8 +1559,7 @@ func (s *DockerAPISuite) TestContainerAPIStatsWithNetworkDisabled(c *testing.T)
|
|||
|
||||
err = apiClient.ContainerStart(testutil.GetContext(c), name, container.StartOptions{})
|
||||
assert.NilError(c, err)
|
||||
|
||||
assert.Assert(c, waitRun(name) == nil)
|
||||
cli.WaitRun(c, name)
|
||||
|
||||
type b struct {
|
||||
stats types.ContainerStats
|
||||
|
@ -1589,7 +1573,7 @@ func (s *DockerAPISuite) TestContainerAPIStatsWithNetworkDisabled(c *testing.T)
|
|||
|
||||
// allow some time to stream the stats from the container
|
||||
time.Sleep(4 * time.Second)
|
||||
dockerCmd(c, "rm", "-f", name)
|
||||
cli.DockerCmd(c, "rm", "-f", name)
|
||||
|
||||
// collect the results from the stats stream or timeout and fail
|
||||
// if the stream was not disconnected.
|
||||
|
@ -1943,7 +1927,7 @@ func (s *DockerAPISuite) TestContainerAPICreateMountsBindRead(c *testing.T) {
|
|||
_, err = apiClient.ContainerCreate(testutil.GetContext(c), &config, &hostConfig, &network.NetworkingConfig{}, nil, "test")
|
||||
assert.NilError(c, err)
|
||||
|
||||
out, _ := dockerCmd(c, "start", "-a", "test")
|
||||
out := cli.DockerCmd(c, "start", "-a", "test").Combined()
|
||||
assert.Equal(c, out, "hello")
|
||||
}
|
||||
|
||||
|
@ -2197,7 +2181,7 @@ func (s *DockerAPISuite) TestContainersAPICreateMountsTmpfs(c *testing.T) {
|
|||
|
||||
_, err = apiClient.ContainerCreate(testutil.GetContext(c), &config, &hostConfig, &network.NetworkingConfig{}, nil, cName)
|
||||
assert.NilError(c, err)
|
||||
out, _ := dockerCmd(c, "start", "-a", cName)
|
||||
out := cli.DockerCmd(c, "start", "-a", cName).Combined()
|
||||
for _, option := range x.expectedOptions {
|
||||
assert.Assert(c, strings.Contains(out, option))
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/docker/docker/api/types/versions"
|
||||
"github.com/docker/docker/integration-cli/cli"
|
||||
"github.com/docker/docker/testutil"
|
||||
"github.com/docker/docker/testutil/request"
|
||||
"github.com/pkg/errors"
|
||||
|
@ -19,7 +20,7 @@ import (
|
|||
|
||||
func (s *DockerAPISuite) TestExecResizeAPIHeightWidthNoInt(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
|
||||
out := cli.DockerCmd(c, "run", "-d", "busybox", "top").Stdout()
|
||||
cleanedContainerID := strings.TrimSpace(out)
|
||||
|
||||
endpoint := "/exec/" + cleanedContainerID + "/resize?h=foo&w=bar"
|
||||
|
@ -35,7 +36,7 @@ func (s *DockerAPISuite) TestExecResizeAPIHeightWidthNoInt(c *testing.T) {
|
|||
// Part of #14845
|
||||
func (s *DockerAPISuite) TestExecResizeImmediatelyAfterExecStart(c *testing.T) {
|
||||
name := "exec_resize_test"
|
||||
dockerCmd(c, "run", "-d", "-i", "-t", "--name", name, "--restart", "always", "busybox", "/bin/sh")
|
||||
cli.DockerCmd(c, "run", "-d", "-i", "-t", "--name", name, "--restart", "always", "busybox", "/bin/sh")
|
||||
|
||||
testExecResize := func() error {
|
||||
data := map[string]interface{}{
|
||||
|
|
|
@ -16,6 +16,7 @@ import (
|
|||
"github.com/docker/docker/api/types/versions"
|
||||
"github.com/docker/docker/client"
|
||||
"github.com/docker/docker/integration-cli/checker"
|
||||
"github.com/docker/docker/integration-cli/cli"
|
||||
"github.com/docker/docker/testutil"
|
||||
"github.com/docker/docker/testutil/request"
|
||||
"gotest.tools/v3/assert"
|
||||
|
@ -26,7 +27,7 @@ import (
|
|||
// Regression test for #9414
|
||||
func (s *DockerAPISuite) TestExecAPICreateNoCmd(c *testing.T) {
|
||||
name := "exec_test"
|
||||
dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
|
||||
cli.DockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
|
||||
|
||||
res, body, err := request.Post(testutil.GetContext(c), fmt.Sprintf("/containers/%s/exec", name), request.JSONBody(map[string]interface{}{"Cmd": nil}))
|
||||
assert.NilError(c, err)
|
||||
|
@ -42,7 +43,7 @@ func (s *DockerAPISuite) TestExecAPICreateNoCmd(c *testing.T) {
|
|||
|
||||
func (s *DockerAPISuite) TestExecAPICreateNoValidContentType(c *testing.T) {
|
||||
name := "exec_test"
|
||||
dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
|
||||
cli.DockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
|
||||
|
||||
jsonData := bytes.NewBuffer(nil)
|
||||
if err := json.NewEncoder(jsonData).Encode(map[string]interface{}{"Cmd": nil}); err != nil {
|
||||
|
@ -65,9 +66,9 @@ func (s *DockerAPISuite) TestExecAPICreateContainerPaused(c *testing.T) {
|
|||
// Not relevant on Windows as Windows containers cannot be paused
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "exec_create_test"
|
||||
dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
|
||||
cli.DockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
|
||||
|
||||
dockerCmd(c, "pause", name)
|
||||
cli.DockerCmd(c, "pause", name)
|
||||
|
||||
apiClient, err := client.NewClientWithOpts(client.FromEnv)
|
||||
assert.NilError(c, err)
|
||||
|
@ -82,7 +83,7 @@ func (s *DockerAPISuite) TestExecAPICreateContainerPaused(c *testing.T) {
|
|||
|
||||
func (s *DockerAPISuite) TestExecAPIStart(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux) // Uses pause/unpause but bits may be salvageable to Windows to Windows CI
|
||||
dockerCmd(c, "run", "-d", "--name", "test", "busybox", "top")
|
||||
cli.DockerCmd(c, "run", "-d", "--name", "test", "busybox", "top")
|
||||
|
||||
id := createExec(c, "test")
|
||||
startExec(c, id, http.StatusOK)
|
||||
|
@ -92,24 +93,24 @@ func (s *DockerAPISuite) TestExecAPIStart(c *testing.T) {
|
|||
assert.Assert(c, execJSON.PID > 1)
|
||||
|
||||
id = createExec(c, "test")
|
||||
dockerCmd(c, "stop", "test")
|
||||
cli.DockerCmd(c, "stop", "test")
|
||||
|
||||
startExec(c, id, http.StatusNotFound)
|
||||
|
||||
dockerCmd(c, "start", "test")
|
||||
cli.DockerCmd(c, "start", "test")
|
||||
startExec(c, id, http.StatusNotFound)
|
||||
|
||||
// make sure exec is created before pausing
|
||||
id = createExec(c, "test")
|
||||
dockerCmd(c, "pause", "test")
|
||||
cli.DockerCmd(c, "pause", "test")
|
||||
startExec(c, id, http.StatusConflict)
|
||||
dockerCmd(c, "unpause", "test")
|
||||
cli.DockerCmd(c, "unpause", "test")
|
||||
startExec(c, id, http.StatusOK)
|
||||
}
|
||||
|
||||
func (s *DockerAPISuite) TestExecAPIStartEnsureHeaders(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
dockerCmd(c, "run", "-d", "--name", "test", "busybox", "top")
|
||||
cli.DockerCmd(c, "run", "-d", "--name", "test", "busybox", "top")
|
||||
|
||||
id := createExec(c, "test")
|
||||
resp, _, err := request.Post(testutil.GetContext(c), fmt.Sprintf("/exec/%s/start", id), request.RawString(`{"Detach": true}`), request.JSON)
|
||||
|
@ -177,7 +178,7 @@ func (s *DockerAPISuite) TestExecAPIStartWithDetach(c *testing.T) {
|
|||
// #30311
|
||||
func (s *DockerAPISuite) TestExecAPIStartValidCommand(c *testing.T) {
|
||||
name := "exec_test"
|
||||
dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
|
||||
cli.DockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
|
||||
|
||||
id := createExecCmd(c, name, "true")
|
||||
startExec(c, id, http.StatusOK)
|
||||
|
@ -194,7 +195,7 @@ func (s *DockerAPISuite) TestExecAPIStartValidCommand(c *testing.T) {
|
|||
// #30311
|
||||
func (s *DockerAPISuite) TestExecAPIStartInvalidCommand(c *testing.T) {
|
||||
name := "exec_test"
|
||||
dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
|
||||
cli.DockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
|
||||
|
||||
id := createExecCmd(c, name, "invalid")
|
||||
if versions.LessThan(testEnv.DaemonAPIVersion(), "1.32") {
|
||||
|
@ -217,7 +218,7 @@ func (s *DockerAPISuite) TestExecStateCleanup(c *testing.T) {
|
|||
// This test checks accidental regressions. Not part of stable API.
|
||||
|
||||
name := "exec_cleanup"
|
||||
cid, _ := dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
|
||||
cid := cli.DockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh").Stdout()
|
||||
cid = strings.TrimSpace(cid)
|
||||
|
||||
stateDir := "/var/run/docker/containerd/" + cid
|
||||
|
@ -246,7 +247,7 @@ func (s *DockerAPISuite) TestExecStateCleanup(c *testing.T) {
|
|||
|
||||
poll.WaitOn(c, pollCheck(c, checkReadDir, checker.Equals(len(fi))), poll.WithTimeout(5*time.Second))
|
||||
|
||||
dockerCmd(c, "stop", name)
|
||||
cli.DockerCmd(c, "stop", name)
|
||||
_, err = os.Stat(stateDir)
|
||||
assert.ErrorContains(c, err, "")
|
||||
assert.Assert(c, os.IsNotExist(err))
|
||||
|
|
|
@ -26,7 +26,7 @@ func (s *DockerAPISuite) TestAPIImagesSaveAndLoad(c *testing.T) {
|
|||
defer body.Close()
|
||||
assert.Equal(c, res.StatusCode, http.StatusOK)
|
||||
|
||||
dockerCmd(c, "rmi", id)
|
||||
cli.DockerCmd(c, "rmi", id)
|
||||
|
||||
res, loadBody, err := request.Post(ctx, "/images/load", request.RawContent(body), request.ContentType("application/x-tar"))
|
||||
assert.NilError(c, err)
|
||||
|
@ -49,7 +49,7 @@ func (s *DockerAPISuite) TestAPIImagesDelete(c *testing.T) {
|
|||
buildImageSuccessfully(c, name, build.WithDockerfile("FROM busybox\nENV FOO bar"))
|
||||
id := getIDByName(c, name)
|
||||
|
||||
dockerCmd(c, "tag", name, "test:tag1")
|
||||
cli.DockerCmd(c, "tag", name, "test:tag1")
|
||||
|
||||
_, err = apiClient.ImageRemove(testutil.GetContext(c), id, types.ImageRemoveOptions{})
|
||||
assert.ErrorContains(c, err, "unable to delete")
|
||||
|
|
|
@ -8,15 +8,16 @@ import (
|
|||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/versions/v1p20"
|
||||
"github.com/docker/docker/client"
|
||||
"github.com/docker/docker/integration-cli/cli"
|
||||
"github.com/docker/docker/testutil"
|
||||
"gotest.tools/v3/assert"
|
||||
is "gotest.tools/v3/assert/cmp"
|
||||
)
|
||||
|
||||
func (s *DockerAPISuite) TestInspectAPIContainerResponse(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
|
||||
|
||||
out := cli.DockerCmd(c, "run", "-d", "busybox", "true").Stdout()
|
||||
cleanedContainerID := strings.TrimSpace(out)
|
||||
|
||||
keysBase := []string{
|
||||
"Id", "State", "Created", "Path", "Args", "Config", "Image", "NetworkSettings",
|
||||
"ResolvConfPath", "HostnamePath", "HostsPath", "LogPath", "Name", "Driver", "MountLabel", "ProcessLabel", "GraphDriver",
|
||||
|
@ -61,8 +62,7 @@ func (s *DockerAPISuite) TestInspectAPIContainerResponse(c *testing.T) {
|
|||
func (s *DockerAPISuite) TestInspectAPIContainerVolumeDriverLegacy(c *testing.T) {
|
||||
// No legacy implications for Windows
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
|
||||
|
||||
out := cli.DockerCmd(c, "run", "-d", "busybox", "true").Stdout()
|
||||
cleanedContainerID := strings.TrimSpace(out)
|
||||
|
||||
cases := []string{"v1.19", "v1.20"}
|
||||
|
@ -82,8 +82,7 @@ func (s *DockerAPISuite) TestInspectAPIContainerVolumeDriverLegacy(c *testing.T)
|
|||
}
|
||||
|
||||
func (s *DockerAPISuite) TestInspectAPIContainerVolumeDriver(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "run", "-d", "--volume-driver", "local", "busybox", "true")
|
||||
|
||||
out := cli.DockerCmd(c, "run", "-d", "--volume-driver", "local", "busybox", "true").Stdout()
|
||||
cleanedContainerID := strings.TrimSpace(out)
|
||||
|
||||
body := getInspectBody(c, "v1.25", cleanedContainerID)
|
||||
|
@ -106,7 +105,7 @@ func (s *DockerAPISuite) TestInspectAPIContainerVolumeDriver(c *testing.T) {
|
|||
}
|
||||
|
||||
func (s *DockerAPISuite) TestInspectAPIImageResponse(c *testing.T) {
|
||||
dockerCmd(c, "tag", "busybox:latest", "busybox:mytag")
|
||||
cli.DockerCmd(c, "tag", "busybox:latest", "busybox:mytag")
|
||||
apiClient, err := client.NewClientWithOpts(client.FromEnv)
|
||||
assert.NilError(c, err)
|
||||
defer apiClient.Close()
|
||||
|
@ -123,8 +122,7 @@ func (s *DockerAPISuite) TestInspectAPIImageResponse(c *testing.T) {
|
|||
func (s *DockerAPISuite) TestInspectAPIEmptyFieldsInConfigPre121(c *testing.T) {
|
||||
// Not relevant on Windows
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
|
||||
|
||||
out := cli.DockerCmd(c, "run", "-d", "busybox", "true").Stdout()
|
||||
cleanedContainerID := strings.TrimSpace(out)
|
||||
|
||||
cases := []string{"v1.19", "v1.20"}
|
||||
|
@ -147,9 +145,9 @@ func (s *DockerAPISuite) TestInspectAPIEmptyFieldsInConfigPre121(c *testing.T) {
|
|||
func (s *DockerAPISuite) TestInspectAPIBridgeNetworkSettings120(c *testing.T) {
|
||||
// Not relevant on Windows, and besides it doesn't have any bridge network settings
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
|
||||
out := cli.DockerCmd(c, "run", "-d", "busybox", "top").Stdout()
|
||||
containerID := strings.TrimSpace(out)
|
||||
waitRun(containerID)
|
||||
cli.WaitRun(c, containerID)
|
||||
|
||||
body := getInspectBody(c, "v1.20", containerID)
|
||||
|
||||
|
@ -164,9 +162,9 @@ func (s *DockerAPISuite) TestInspectAPIBridgeNetworkSettings120(c *testing.T) {
|
|||
func (s *DockerAPISuite) TestInspectAPIBridgeNetworkSettings121(c *testing.T) {
|
||||
// Windows doesn't have any bridge network settings
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
|
||||
out := cli.DockerCmd(c, "run", "-d", "busybox", "top").Stdout()
|
||||
containerID := strings.TrimSpace(out)
|
||||
waitRun(containerID)
|
||||
cli.WaitRun(c, containerID)
|
||||
|
||||
body := getInspectBody(c, "v1.21", containerID)
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import (
|
|||
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/client"
|
||||
"github.com/docker/docker/integration-cli/cli"
|
||||
"github.com/docker/docker/pkg/stdcopy"
|
||||
"github.com/docker/docker/testutil"
|
||||
"github.com/docker/docker/testutil/request"
|
||||
|
@ -20,9 +21,9 @@ import (
|
|||
)
|
||||
|
||||
func (s *DockerAPISuite) TestLogsAPIWithStdout(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "run", "-d", "-t", "busybox", "/bin/sh", "-c", "while true; do echo hello; sleep 1; done")
|
||||
out := cli.DockerCmd(c, "run", "-d", "-t", "busybox", "/bin/sh", "-c", "while true; do echo hello; sleep 1; done").Stdout()
|
||||
id := strings.TrimSpace(out)
|
||||
assert.NilError(c, waitRun(id))
|
||||
cli.WaitRun(c, id)
|
||||
|
||||
type logOut struct {
|
||||
out string
|
||||
|
@ -56,8 +57,8 @@ func (s *DockerAPISuite) TestLogsAPIWithStdout(c *testing.T) {
|
|||
}
|
||||
|
||||
func (s *DockerAPISuite) TestLogsAPINoStdoutNorStderr(c *testing.T) {
|
||||
name := "logs_test"
|
||||
dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
|
||||
const name = "logs_test"
|
||||
cli.DockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
|
||||
apiClient, err := client.NewClientWithOpts(client.FromEnv)
|
||||
assert.NilError(c, err)
|
||||
defer apiClient.Close()
|
||||
|
@ -68,9 +69,9 @@ func (s *DockerAPISuite) TestLogsAPINoStdoutNorStderr(c *testing.T) {
|
|||
|
||||
// Regression test for #12704
|
||||
func (s *DockerAPISuite) TestLogsAPIFollowEmptyOutput(c *testing.T) {
|
||||
name := "logs_test"
|
||||
const name = "logs_test"
|
||||
t0 := time.Now()
|
||||
dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "sleep", "10")
|
||||
cli.DockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "sleep", "10")
|
||||
|
||||
_, body, err := request.Get(testutil.GetContext(c), fmt.Sprintf("/containers/%s/logs?follow=1&stdout=1&stderr=1&tail=all", name))
|
||||
t1 := time.Now()
|
||||
|
@ -91,21 +92,21 @@ func (s *DockerAPISuite) TestLogsAPIContainerNotFound(c *testing.T) {
|
|||
|
||||
func (s *DockerAPISuite) TestLogsAPIUntilFutureFollow(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "logsuntilfuturefollow"
|
||||
dockerCmd(c, "run", "-d", "--name", name, "busybox", "/bin/sh", "-c", "while true; do date +%s; sleep 1; done")
|
||||
assert.NilError(c, waitRun(name))
|
||||
const name = "logsuntilfuturefollow"
|
||||
cli.DockerCmd(c, "run", "-d", "--name", name, "busybox", "/bin/sh", "-c", "while true; do date +%s; sleep 1; done")
|
||||
cli.WaitRun(c, name)
|
||||
|
||||
untilSecs := 5
|
||||
untilDur, err := time.ParseDuration(fmt.Sprintf("%ds", untilSecs))
|
||||
assert.NilError(c, err)
|
||||
until := daemonTime(c).Add(untilDur)
|
||||
|
||||
client, err := client.NewClientWithOpts(client.FromEnv)
|
||||
apiClient, err := client.NewClientWithOpts(client.FromEnv)
|
||||
if err != nil {
|
||||
c.Fatal(err)
|
||||
}
|
||||
|
||||
reader, err := client.ContainerLogs(testutil.GetContext(c), name, container.LogsOptions{
|
||||
reader, err := apiClient.ContainerLogs(testutil.GetContext(c), name, container.LogsOptions{
|
||||
Until: until.Format(time.RFC3339Nano),
|
||||
Follow: true,
|
||||
ShowStdout: true,
|
||||
|
@ -163,16 +164,16 @@ func (s *DockerAPISuite) TestLogsAPIUntilFutureFollow(c *testing.T) {
|
|||
|
||||
func (s *DockerAPISuite) TestLogsAPIUntil(c *testing.T) {
|
||||
testRequires(c, MinimumAPIVersion("1.34"))
|
||||
name := "logsuntil"
|
||||
dockerCmd(c, "run", "--name", name, "busybox", "/bin/sh", "-c", "for i in $(seq 1 3); do echo log$i; sleep 1; done")
|
||||
const name = "logsuntil"
|
||||
cli.DockerCmd(c, "run", "--name", name, "busybox", "/bin/sh", "-c", "for i in $(seq 1 3); do echo log$i; sleep 1; done")
|
||||
|
||||
client, err := client.NewClientWithOpts(client.FromEnv)
|
||||
apiClient, err := client.NewClientWithOpts(client.FromEnv)
|
||||
if err != nil {
|
||||
c.Fatal(err)
|
||||
}
|
||||
|
||||
extractBody := func(c *testing.T, cfg container.LogsOptions) []string {
|
||||
reader, err := client.ContainerLogs(testutil.GetContext(c), name, cfg)
|
||||
reader, err := apiClient.ContainerLogs(testutil.GetContext(c), name, cfg)
|
||||
assert.NilError(c, err)
|
||||
|
||||
actualStdout := new(bytes.Buffer)
|
||||
|
@ -200,16 +201,16 @@ func (s *DockerAPISuite) TestLogsAPIUntil(c *testing.T) {
|
|||
}
|
||||
|
||||
func (s *DockerAPISuite) TestLogsAPIUntilDefaultValue(c *testing.T) {
|
||||
name := "logsuntildefaultval"
|
||||
dockerCmd(c, "run", "--name", name, "busybox", "/bin/sh", "-c", "for i in $(seq 1 3); do echo log$i; done")
|
||||
const name = "logsuntildefaultval"
|
||||
cli.DockerCmd(c, "run", "--name", name, "busybox", "/bin/sh", "-c", "for i in $(seq 1 3); do echo log$i; done")
|
||||
|
||||
client, err := client.NewClientWithOpts(client.FromEnv)
|
||||
apiClient, err := client.NewClientWithOpts(client.FromEnv)
|
||||
if err != nil {
|
||||
c.Fatal(err)
|
||||
}
|
||||
|
||||
extractBody := func(c *testing.T, cfg container.LogsOptions) []string {
|
||||
reader, err := client.ContainerLogs(testutil.GetContext(c), name, cfg)
|
||||
reader, err := apiClient.ContainerLogs(testutil.GetContext(c), name, cfg)
|
||||
assert.NilError(c, err)
|
||||
|
||||
actualStdout := new(bytes.Buffer)
|
||||
|
|
|
@ -13,6 +13,7 @@ import (
|
|||
"github.com/docker/docker/api/types/filters"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
"github.com/docker/docker/api/types/versions"
|
||||
"github.com/docker/docker/integration-cli/cli"
|
||||
"github.com/docker/docker/testutil"
|
||||
"github.com/docker/docker/testutil/request"
|
||||
"gotest.tools/v3/assert"
|
||||
|
@ -40,7 +41,7 @@ func (s *DockerAPISuite) TestAPINetworkInspectBridge(c *testing.T) {
|
|||
assert.Equal(c, nr.Name, "bridge")
|
||||
|
||||
// run a container and attach it to the default bridge network
|
||||
out, _ := dockerCmd(c, "run", "-d", "--name", "test", "busybox", "top")
|
||||
out := cli.DockerCmd(c, "run", "-d", "--name", "test", "busybox", "top").Stdout()
|
||||
containerID := strings.TrimSpace(out)
|
||||
containerIP := findContainerIP(c, "test", "bridge")
|
||||
|
||||
|
@ -104,7 +105,7 @@ func (s *DockerAPISuite) TestAPINetworkConnectDisconnect(c *testing.T) {
|
|||
assert.Equal(c, len(nr.Containers), 0)
|
||||
|
||||
// run a container
|
||||
out, _ := dockerCmd(c, "run", "-d", "--name", "test", "busybox", "top")
|
||||
out := cli.DockerCmd(c, "run", "-d", "--name", "test", "busybox", "top").Stdout()
|
||||
containerID := strings.TrimSpace(out)
|
||||
|
||||
// connect the container to the test network
|
||||
|
|
|
@ -16,6 +16,7 @@ import (
|
|||
"github.com/docker/docker/api/types/system"
|
||||
"github.com/docker/docker/api/types/versions"
|
||||
"github.com/docker/docker/client"
|
||||
"github.com/docker/docker/integration-cli/cli"
|
||||
"github.com/docker/docker/testutil"
|
||||
"github.com/docker/docker/testutil/request"
|
||||
"gotest.tools/v3/assert"
|
||||
|
@ -26,10 +27,9 @@ var expectedNetworkInterfaceStats = strings.Split("rx_bytes rx_dropped rx_errors
|
|||
|
||||
func (s *DockerAPISuite) TestAPIStatsNoStreamGetCpu(c *testing.T) {
|
||||
skip.If(c, RuntimeIsWindowsContainerd(), "FIXME: Broken on Windows + containerd combination")
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "while true;usleep 100; do echo 'Hello'; done")
|
||||
|
||||
out := cli.DockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "while true;usleep 100; do echo 'Hello'; done").Stdout()
|
||||
id := strings.TrimSpace(out)
|
||||
assert.NilError(c, waitRun(id))
|
||||
cli.WaitRun(c, id)
|
||||
resp, body, err := request.Get(testutil.GetContext(c), fmt.Sprintf("/containers/%s/stats?stream=false", id))
|
||||
assert.NilError(c, err)
|
||||
assert.Equal(c, resp.StatusCode, http.StatusOK)
|
||||
|
@ -66,7 +66,7 @@ func (s *DockerAPISuite) TestAPIStatsNoStreamGetCpu(c *testing.T) {
|
|||
}
|
||||
|
||||
func (s *DockerAPISuite) TestAPIStatsStoppedContainerInGoroutines(c *testing.T) {
|
||||
out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "echo 1")
|
||||
out := cli.DockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "echo 1").Stdout()
|
||||
id := strings.TrimSpace(out)
|
||||
|
||||
getGoRoutines := func() int {
|
||||
|
@ -104,9 +104,8 @@ func (s *DockerAPISuite) TestAPIStatsNetworkStats(c *testing.T) {
|
|||
skip.If(c, RuntimeIsWindowsContainerd(), "FIXME: Broken on Windows + containerd combination")
|
||||
testRequires(c, testEnv.IsLocalDaemon)
|
||||
|
||||
out := runSleepingContainer(c)
|
||||
id := strings.TrimSpace(out)
|
||||
assert.NilError(c, waitRun(id))
|
||||
id := runSleepingContainer(c)
|
||||
cli.WaitRun(c, id)
|
||||
|
||||
// Retrieve the container address
|
||||
net := "bridge"
|
||||
|
@ -170,9 +169,8 @@ func (s *DockerAPISuite) TestAPIStatsNetworkStatsVersioning(c *testing.T) {
|
|||
// Windows doesn't support API versions less than 1.25, so no point testing 1.17 .. 1.21
|
||||
testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux)
|
||||
|
||||
out := runSleepingContainer(c)
|
||||
id := strings.TrimSpace(out)
|
||||
assert.NilError(c, waitRun(id))
|
||||
id := runSleepingContainer(c)
|
||||
cli.WaitRun(c, id)
|
||||
wg := sync.WaitGroup{}
|
||||
|
||||
for i := 17; i <= 21; i++ {
|
||||
|
@ -278,13 +276,11 @@ func (s *DockerAPISuite) TestAPIStatsContainerNotFound(c *testing.T) {
|
|||
func (s *DockerAPISuite) TestAPIStatsNoStreamConnectedContainers(c *testing.T) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
out1 := runSleepingContainer(c)
|
||||
id1 := strings.TrimSpace(out1)
|
||||
assert.NilError(c, waitRun(id1))
|
||||
id1 := runSleepingContainer(c)
|
||||
cli.WaitRun(c, id1)
|
||||
|
||||
out2 := runSleepingContainer(c, "--net", "container:"+id1)
|
||||
id2 := strings.TrimSpace(out2)
|
||||
assert.NilError(c, waitRun(id2))
|
||||
id2 := runSleepingContainer(c, "--net", "container:"+id1)
|
||||
cli.WaitRun(c, id2)
|
||||
|
||||
ch := make(chan error, 1)
|
||||
go func() {
|
||||
|
|
|
@ -9,6 +9,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/docker/docker/api/types/versions"
|
||||
"github.com/docker/docker/integration-cli/cli"
|
||||
"github.com/docker/docker/testutil"
|
||||
"github.com/docker/docker/testutil/request"
|
||||
"gotest.tools/v3/assert"
|
||||
|
@ -21,7 +22,7 @@ func formatV123StartAPIURL(url string) string {
|
|||
|
||||
func (s *DockerAPISuite) TestDeprecatedContainerAPIStartHostConfig(c *testing.T) {
|
||||
name := "test-deprecated-api-124"
|
||||
dockerCmd(c, "create", "--name", name, "busybox")
|
||||
cli.DockerCmd(c, "create", "--name", name, "busybox")
|
||||
config := map[string]interface{}{
|
||||
"Binds": []string{"/aa:/bb"},
|
||||
}
|
||||
|
@ -108,7 +109,7 @@ func (s *DockerAPISuite) TestDeprecatedContainerAPIStartVolumesFrom(c *testing.T
|
|||
volName := "voltst"
|
||||
volPath := "/tmp"
|
||||
|
||||
dockerCmd(c, "run", "--name", volName, "-v", volPath, "busybox")
|
||||
cli.DockerCmd(c, "run", "--name", volName, "-v", volPath, "busybox")
|
||||
|
||||
name := "TestContainerAPIStartVolumesFrom"
|
||||
config := map[string]interface{}{
|
||||
|
@ -138,12 +139,12 @@ func (s *DockerAPISuite) TestDeprecatedContainerAPIStartVolumesFrom(c *testing.T
|
|||
func (s *DockerAPISuite) TestDeprecatedPostContainerBindNormalVolume(c *testing.T) {
|
||||
// TODO Windows to Windows CI - Port this
|
||||
testRequires(c, DaemonIsLinux)
|
||||
dockerCmd(c, "create", "-v", "/foo", "--name=one", "busybox")
|
||||
cli.DockerCmd(c, "create", "-v", "/foo", "--name=one", "busybox")
|
||||
|
||||
fooDir, err := inspectMountSourceField("one", "/foo")
|
||||
assert.NilError(c, err)
|
||||
|
||||
dockerCmd(c, "create", "-v", "/foo", "--name=two", "busybox")
|
||||
cli.DockerCmd(c, "create", "-v", "/foo", "--name=two", "busybox")
|
||||
|
||||
bindSpec := map[string][]string{"Binds": {fooDir + ":/foo"}}
|
||||
res, _, err := request.Post(testutil.GetContext(c), formatV123StartAPIURL("/containers/two/start"), request.JSONBody(bindSpec))
|
||||
|
@ -158,11 +159,10 @@ func (s *DockerAPISuite) TestDeprecatedPostContainerBindNormalVolume(c *testing.
|
|||
func (s *DockerAPISuite) TestDeprecatedStartWithTooLowMemoryLimit(c *testing.T) {
|
||||
// TODO Windows: Port once memory is supported
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "create", "busybox")
|
||||
containerID := cli.DockerCmd(c, "create", "busybox").Stdout()
|
||||
containerID = strings.TrimSpace(containerID)
|
||||
|
||||
containerID := strings.TrimSpace(out)
|
||||
|
||||
config := `{
|
||||
const config = `{
|
||||
"CpuShares": 100,
|
||||
"Memory": 524287
|
||||
}`
|
||||
|
@ -185,7 +185,7 @@ func (s *DockerAPISuite) TestDeprecatedPostContainersStartWithoutLinksInHostConf
|
|||
// An alternate test could be written to validate the negative testing aspect of this
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "test-host-config-links"
|
||||
dockerCmd(c, append([]string{"create", "--name", name, "busybox"}, sleepCommandForDaemonPlatform()...)...)
|
||||
cli.DockerCmd(c, append([]string{"create", "--name", name, "busybox"}, sleepCommandForDaemonPlatform()...)...)
|
||||
|
||||
hc := inspectFieldJSON(c, name, "HostConfig")
|
||||
config := `{"HostConfig":` + hc + `}`
|
||||
|
@ -202,8 +202,8 @@ func (s *DockerAPISuite) TestDeprecatedPostContainersStartWithLinksInHostConfig(
|
|||
// An alternate test could be written to validate the negative testing aspect of this
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "test-host-config-links"
|
||||
dockerCmd(c, "run", "--name", "foo", "-d", "busybox", "top")
|
||||
dockerCmd(c, "create", "--name", name, "--link", "foo:bar", "busybox", "top")
|
||||
cli.DockerCmd(c, "run", "--name", "foo", "-d", "busybox", "top")
|
||||
cli.DockerCmd(c, "create", "--name", name, "--link", "foo:bar", "busybox", "top")
|
||||
|
||||
hc := inspectFieldJSON(c, name, "HostConfig")
|
||||
config := `{"HostConfig":` + hc + `}`
|
||||
|
@ -218,12 +218,12 @@ func (s *DockerAPISuite) TestDeprecatedPostContainersStartWithLinksInHostConfig(
|
|||
func (s *DockerAPISuite) TestDeprecatedPostContainersStartWithLinksInHostConfigIdLinked(c *testing.T) {
|
||||
// Windows does not support links
|
||||
testRequires(c, DaemonIsLinux)
|
||||
name := "test-host-config-links"
|
||||
out, _ := dockerCmd(c, "run", "--name", "link0", "-d", "busybox", "top")
|
||||
defer dockerCmd(c, "stop", "link0")
|
||||
id := strings.TrimSpace(out)
|
||||
dockerCmd(c, "create", "--name", name, "--link", id, "busybox", "top")
|
||||
defer dockerCmd(c, "stop", name)
|
||||
const name = "test-host-config-links"
|
||||
containerID := cli.DockerCmd(c, "run", "--name", "link0", "-d", "busybox", "top").Combined()
|
||||
containerID = strings.TrimSpace(containerID)
|
||||
defer cli.DockerCmd(c, "stop", "link0")
|
||||
cli.DockerCmd(c, "create", "--name", name, "--link", containerID, "busybox", "top")
|
||||
defer cli.DockerCmd(c, "stop", name)
|
||||
|
||||
hc := inspectFieldJSON(c, name, "HostConfig")
|
||||
config := `{"HostConfig":` + hc + `}`
|
||||
|
@ -237,10 +237,10 @@ func (s *DockerAPISuite) TestDeprecatedPostContainersStartWithLinksInHostConfigI
|
|||
func (s *DockerAPISuite) TestDeprecatedStartWithNilDNS(c *testing.T) {
|
||||
// TODO Windows: Add once DNS is supported
|
||||
testRequires(c, DaemonIsLinux)
|
||||
out, _ := dockerCmd(c, "create", "busybox")
|
||||
containerID := strings.TrimSpace(out)
|
||||
containerID := cli.DockerCmd(c, "create", "busybox").Stdout()
|
||||
containerID = strings.TrimSpace(containerID)
|
||||
|
||||
config := `{"HostConfig": {"Dns": null}}`
|
||||
const config = `{"HostConfig": {"Dns": null}}`
|
||||
|
||||
res, b, err := request.Post(testutil.GetContext(c), formatV123StartAPIURL("/containers/"+containerID+"/start"), request.RawString(config), request.JSON)
|
||||
assert.NilError(c, err)
|
||||
|
|
Loading…
Reference in a new issue