mirror of
https://github.com/moby/moby.git
synced 2025-07-30 18:23:29 +03:00
integration-cli: remove deprecated daemonHost() utility
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@ -26,7 +26,7 @@ func (s *DockerSuite) TestGetContainersAttachWebsocket(c *check.C) {
|
|||||||
testRequires(c, DaemonIsLinux)
|
testRequires(c, DaemonIsLinux)
|
||||||
out, _ := dockerCmd(c, "run", "-dit", "busybox", "cat")
|
out, _ := dockerCmd(c, "run", "-dit", "busybox", "cat")
|
||||||
|
|
||||||
rwc, err := request.SockConn(time.Duration(10*time.Second), daemonHost())
|
rwc, err := request.SockConn(time.Duration(10*time.Second), request.DaemonHost())
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
|
||||||
cleanedContainerID := strings.TrimSpace(out)
|
cleanedContainerID := strings.TrimSpace(out)
|
||||||
@ -141,12 +141,12 @@ func (s *DockerSuite) TestPostContainersAttach(c *check.C) {
|
|||||||
cid, _ := dockerCmd(c, "run", "-di", "busybox", "cat")
|
cid, _ := dockerCmd(c, "run", "-di", "busybox", "cat")
|
||||||
cid = strings.TrimSpace(cid)
|
cid = strings.TrimSpace(cid)
|
||||||
// Attach to the container's stdout stream.
|
// Attach to the container's stdout stream.
|
||||||
conn, br, err := sockRequestHijack("POST", "/containers/"+cid+"/attach?stream=1&stdin=1&stdout=1", nil, "text/plain", daemonHost())
|
conn, br, err := sockRequestHijack("POST", "/containers/"+cid+"/attach?stream=1&stdin=1&stdout=1", nil, "text/plain", request.DaemonHost())
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
// Check if the data from stdout can be received.
|
// Check if the data from stdout can be received.
|
||||||
expectSuccess(conn, br, "stdout", false)
|
expectSuccess(conn, br, "stdout", false)
|
||||||
// Attach to the container's stderr stream.
|
// Attach to the container's stderr stream.
|
||||||
conn, br, err = sockRequestHijack("POST", "/containers/"+cid+"/attach?stream=1&stdin=1&stderr=1", nil, "text/plain", daemonHost())
|
conn, br, err = sockRequestHijack("POST", "/containers/"+cid+"/attach?stream=1&stdin=1&stderr=1", nil, "text/plain", request.DaemonHost())
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
// Since the container only emits stdout, attaching to stderr should return nothing.
|
// Since the container only emits stdout, attaching to stderr should return nothing.
|
||||||
expectTimeout(conn, br, "stdout")
|
expectTimeout(conn, br, "stdout")
|
||||||
@ -154,10 +154,10 @@ func (s *DockerSuite) TestPostContainersAttach(c *check.C) {
|
|||||||
// Test the similar functions of the stderr stream.
|
// Test the similar functions of the stderr stream.
|
||||||
cid, _ = dockerCmd(c, "run", "-di", "busybox", "/bin/sh", "-c", "cat >&2")
|
cid, _ = dockerCmd(c, "run", "-di", "busybox", "/bin/sh", "-c", "cat >&2")
|
||||||
cid = strings.TrimSpace(cid)
|
cid = strings.TrimSpace(cid)
|
||||||
conn, br, err = sockRequestHijack("POST", "/containers/"+cid+"/attach?stream=1&stdin=1&stderr=1", nil, "text/plain", daemonHost())
|
conn, br, err = sockRequestHijack("POST", "/containers/"+cid+"/attach?stream=1&stdin=1&stderr=1", nil, "text/plain", request.DaemonHost())
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
expectSuccess(conn, br, "stderr", false)
|
expectSuccess(conn, br, "stderr", false)
|
||||||
conn, br, err = sockRequestHijack("POST", "/containers/"+cid+"/attach?stream=1&stdin=1&stdout=1", nil, "text/plain", daemonHost())
|
conn, br, err = sockRequestHijack("POST", "/containers/"+cid+"/attach?stream=1&stdin=1&stdout=1", nil, "text/plain", request.DaemonHost())
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
expectTimeout(conn, br, "stderr")
|
expectTimeout(conn, br, "stderr")
|
||||||
|
|
||||||
@ -165,12 +165,12 @@ func (s *DockerSuite) TestPostContainersAttach(c *check.C) {
|
|||||||
cid, _ = dockerCmd(c, "run", "-dit", "busybox", "/bin/sh", "-c", "cat >&2")
|
cid, _ = dockerCmd(c, "run", "-dit", "busybox", "/bin/sh", "-c", "cat >&2")
|
||||||
cid = strings.TrimSpace(cid)
|
cid = strings.TrimSpace(cid)
|
||||||
// Attach to stdout only.
|
// Attach to stdout only.
|
||||||
conn, br, err = sockRequestHijack("POST", "/containers/"+cid+"/attach?stream=1&stdin=1&stdout=1", nil, "text/plain", daemonHost())
|
conn, br, err = sockRequestHijack("POST", "/containers/"+cid+"/attach?stream=1&stdin=1&stdout=1", nil, "text/plain", request.DaemonHost())
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
expectSuccess(conn, br, "stdout", true)
|
expectSuccess(conn, br, "stdout", true)
|
||||||
|
|
||||||
// Attach without stdout stream.
|
// Attach without stdout stream.
|
||||||
conn, br, err = sockRequestHijack("POST", "/containers/"+cid+"/attach?stream=1&stdin=1&stderr=1", nil, "text/plain", daemonHost())
|
conn, br, err = sockRequestHijack("POST", "/containers/"+cid+"/attach?stream=1&stdin=1&stderr=1", nil, "text/plain", request.DaemonHost())
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
// Nothing should be received because both the stdout and stderr of the container will be
|
// Nothing should be received because both the stdout and stderr of the container will be
|
||||||
// sent to the client as stdout when tty is enabled.
|
// sent to the client as stdout when tty is enabled.
|
||||||
|
@ -1442,7 +1442,7 @@ func (s *DockerSuite) TestPutContainerArchiveErrSymlinkInVolumeToReadOnlyRootfs(
|
|||||||
// directory outside the volume. This should cause an error because the
|
// directory outside the volume. This should cause an error because the
|
||||||
// rootfs is read-only.
|
// rootfs is read-only.
|
||||||
var httpClient *http.Client
|
var httpClient *http.Client
|
||||||
cli, err := client.NewClient(daemonHost(), "v1.20", httpClient, map[string]string{})
|
cli, err := client.NewClient(request.DaemonHost(), "v1.20", httpClient, map[string]string{})
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
|
|
||||||
err = cli.CopyToContainer(context.Background(), cID, "/vol2/symlinkToAbsDir", nil, types.CopyToContainerOptions{})
|
err = cli.CopyToContainer(context.Background(), cID, "/vol2/symlinkToAbsDir", nil, types.CopyToContainerOptions{})
|
||||||
|
@ -64,7 +64,7 @@ func (s *DockerSuite) TestExecResizeImmediatelyAfterExecStart(c *check.C) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
payload := bytes.NewBufferString(`{"Tty":true}`)
|
payload := bytes.NewBufferString(`{"Tty":true}`)
|
||||||
conn, _, err := sockRequestHijack("POST", fmt.Sprintf("/exec/%s/start", execID), payload, "application/json", daemonHost())
|
conn, _, err := sockRequestHijack("POST", fmt.Sprintf("/exec/%s/start", execID), payload, "application/json", request.DaemonHost())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Failed to start the exec: %q", err.Error())
|
return fmt.Errorf("Failed to start the exec: %q", err.Error())
|
||||||
}
|
}
|
||||||
|
@ -19,16 +19,10 @@ import (
|
|||||||
"github.com/docker/docker/integration-cli/checker"
|
"github.com/docker/docker/integration-cli/checker"
|
||||||
"github.com/docker/docker/integration-cli/cli"
|
"github.com/docker/docker/integration-cli/cli"
|
||||||
"github.com/docker/docker/integration-cli/daemon"
|
"github.com/docker/docker/integration-cli/daemon"
|
||||||
"github.com/docker/docker/internal/test/request"
|
|
||||||
"github.com/go-check/check"
|
"github.com/go-check/check"
|
||||||
"gotest.tools/icmd"
|
"gotest.tools/icmd"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Deprecated
|
|
||||||
func daemonHost() string {
|
|
||||||
return request.DaemonHost()
|
|
||||||
}
|
|
||||||
|
|
||||||
func deleteImages(images ...string) error {
|
func deleteImages(images ...string) error {
|
||||||
args := []string{dockerBinary, "rmi", "-f"}
|
args := []string{dockerBinary, "rmi", "-f"}
|
||||||
return icmd.RunCmd(icmd.Cmd{Command: append(args, images...)}).Error
|
return icmd.RunCmd(icmd.Cmd{Command: append(args, images...)}).Error
|
||||||
|
Reference in New Issue
Block a user