integration-cli: DockerCLINetmodeSuite: replace dockerCmd and waitRun

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2023-07-27 13:00:39 +02:00
parent dbb2bd727d
commit 02fd8485fa

View File

@@ -5,6 +5,7 @@ import (
"strings"
"testing"
"github.com/docker/docker/integration-cli/cli"
"github.com/docker/docker/runconfig"
"gotest.tools/v3/assert"
)
@@ -39,18 +40,18 @@ func dockerCmdWithFail(c *testing.T, args ...string) (string, int) {
func (s *DockerCLINetmodeSuite) TestNetHostnameWithNetHost(c *testing.T) {
testRequires(c, DaemonIsLinux, NotUserNamespace)
out, _ := dockerCmd(c, "run", "--net=host", "busybox", "ps")
out := cli.DockerCmd(c, "run", "--net=host", "busybox", "ps").Stdout()
assert.Assert(c, strings.Contains(out, stringCheckPS))
}
func (s *DockerCLINetmodeSuite) TestNetHostname(c *testing.T) {
testRequires(c, DaemonIsLinux)
out, _ := dockerCmd(c, "run", "-h=name", "busybox", "ps")
out := cli.DockerCmd(c, "run", "-h=name", "busybox", "ps").Stdout()
assert.Assert(c, strings.Contains(out, stringCheckPS))
out, _ = dockerCmd(c, "run", "-h=name", "--net=bridge", "busybox", "ps")
out = cli.DockerCmd(c, "run", "-h=name", "--net=bridge", "busybox", "ps").Stdout()
assert.Assert(c, strings.Contains(out, stringCheckPS))
out, _ = dockerCmd(c, "run", "-h=name", "--net=none", "busybox", "ps")
out = cli.DockerCmd(c, "run", "-h=name", "--net=none", "busybox", "ps").Stdout()
assert.Assert(c, strings.Contains(out, stringCheckPS))
out, _ = dockerCmdWithFail(c, "run", "-h=name", "--net=container:other", "busybox", "ps")
assert.Assert(c, strings.Contains(out, runconfig.ErrConflictNetworkHostname.Error()))