integration-cli: DockerCLIPluginLogDriverSuite: replace dockerCmd

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2023-07-28 10:38:51 +02:00
parent a837cb444c
commit e28da7686e
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -6,6 +6,7 @@ import (
"testing" "testing"
"github.com/docker/docker/client" "github.com/docker/docker/client"
"github.com/docker/docker/integration-cli/cli"
"github.com/docker/docker/testutil" "github.com/docker/docker/testutil"
"gotest.tools/v3/assert" "gotest.tools/v3/assert"
) )
@ -25,28 +26,28 @@ func (s *DockerCLIPluginLogDriverSuite) OnTimeout(c *testing.T) {
func (s *DockerCLIPluginLogDriverSuite) TestPluginLogDriver(c *testing.T) { func (s *DockerCLIPluginLogDriverSuite) TestPluginLogDriver(c *testing.T) {
testRequires(c, IsAmd64, DaemonIsLinux) testRequires(c, IsAmd64, DaemonIsLinux)
pluginName := "cpuguy83/docker-logdriver-test:latest" const pluginName = "cpuguy83/docker-logdriver-test:latest"
dockerCmd(c, "plugin", "install", pluginName) cli.DockerCmd(c, "plugin", "install", pluginName)
dockerCmd(c, "run", "--log-driver", pluginName, "--name=test", "busybox", "echo", "hello") cli.DockerCmd(c, "run", "--log-driver", pluginName, "--name=test", "busybox", "echo", "hello")
out, _ := dockerCmd(c, "logs", "test") out := cli.DockerCmd(c, "logs", "test").Combined()
assert.Equal(c, strings.TrimSpace(out), "hello") assert.Equal(c, strings.TrimSpace(out), "hello")
dockerCmd(c, "start", "-a", "test") cli.DockerCmd(c, "start", "-a", "test")
out, _ = dockerCmd(c, "logs", "test") out = cli.DockerCmd(c, "logs", "test").Combined()
assert.Equal(c, strings.TrimSpace(out), "hello\nhello") assert.Equal(c, strings.TrimSpace(out), "hello\nhello")
dockerCmd(c, "rm", "test") cli.DockerCmd(c, "rm", "test")
dockerCmd(c, "plugin", "disable", pluginName) cli.DockerCmd(c, "plugin", "disable", pluginName)
dockerCmd(c, "plugin", "rm", pluginName) cli.DockerCmd(c, "plugin", "rm", pluginName)
} }
// Make sure log drivers are listed in info, and v2 plugins are not. // Make sure log drivers are listed in info, and v2 plugins are not.
func (s *DockerCLIPluginLogDriverSuite) TestPluginLogDriverInfoList(c *testing.T) { func (s *DockerCLIPluginLogDriverSuite) TestPluginLogDriverInfoList(c *testing.T) {
testRequires(c, IsAmd64, DaemonIsLinux) testRequires(c, IsAmd64, DaemonIsLinux)
pluginName := "cpuguy83/docker-logdriver-test" const pluginName = "cpuguy83/docker-logdriver-test"
dockerCmd(c, "plugin", "install", pluginName) cli.DockerCmd(c, "plugin", "install", pluginName)
apiClient, err := client.NewClientWithOpts(client.FromEnv) apiClient, err := client.NewClientWithOpts(client.FromEnv)
assert.NilError(c, err) assert.NilError(c, err)