integration-cli: remove deprecated dockerCmd and waitRun utilities
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
06115bf82c
commit
5a72ed3406
5 changed files with 12 additions and 23 deletions
|
@ -39,13 +39,6 @@ func dockerCmdWithError(args ...string) (string, int, error) {
|
||||||
return result.Combined(), result.ExitCode, result.Error
|
return result.Combined(), result.ExitCode, result.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: use cli.Docker or cli.DockerCmd
|
|
||||||
func dockerCmd(c testing.TB, args ...string) (string, int) {
|
|
||||||
c.Helper()
|
|
||||||
result := cli.DockerCmd(c, args...)
|
|
||||||
return result.Combined(), result.ExitCode
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: use cli.Docker or cli.DockerCmd
|
// Deprecated: use cli.Docker or cli.DockerCmd
|
||||||
func dockerCmdWithResult(args ...string) *icmd.Result {
|
func dockerCmdWithResult(args ...string) *icmd.Result {
|
||||||
return cli.Docker(cli.Args(args...))
|
return cli.Docker(cli.Args(args...))
|
||||||
|
@ -216,9 +209,7 @@ func runCommandAndReadContainerFile(c *testing.T, filename string, command strin
|
||||||
result := icmd.RunCommand(command, args...)
|
result := icmd.RunCommand(command, args...)
|
||||||
result.Assert(c, icmd.Success)
|
result.Assert(c, icmd.Success)
|
||||||
contID := strings.TrimSpace(result.Combined())
|
contID := strings.TrimSpace(result.Combined())
|
||||||
if err := waitRun(contID); err != nil {
|
cli.WaitRun(c, contID)
|
||||||
c.Fatalf("%v: %q", contID, err)
|
|
||||||
}
|
|
||||||
return readContainerFile(c, contID, filename)
|
return readContainerFile(c, contID, filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,12 +300,6 @@ func createTmpFile(c *testing.T, content string) string {
|
||||||
return filename
|
return filename
|
||||||
}
|
}
|
||||||
|
|
||||||
// waitRun will wait for the specified container to be running, maximum 5 seconds.
|
|
||||||
// Deprecated: use cli.WaitFor
|
|
||||||
func waitRun(contID string) error {
|
|
||||||
return daemon.WaitInspectWithArgs(dockerBinary, contID, "{{.State.Running}}", "true", 5*time.Second)
|
|
||||||
}
|
|
||||||
|
|
||||||
// waitInspect will wait for the specified container to have the specified string
|
// waitInspect will wait for the specified container to have the specified string
|
||||||
// in the inspect output. It will wait until the specified timeout (in seconds)
|
// in the inspect output. It will wait until the specified timeout (in seconds)
|
||||||
// is reached.
|
// is reached.
|
||||||
|
|
|
@ -13,6 +13,7 @@ import (
|
||||||
|
|
||||||
"github.com/containerd/log"
|
"github.com/containerd/log"
|
||||||
eventstestutils "github.com/docker/docker/daemon/events/testutils"
|
eventstestutils "github.com/docker/docker/daemon/events/testutils"
|
||||||
|
"github.com/docker/docker/integration-cli/cli"
|
||||||
"gotest.tools/v3/assert"
|
"gotest.tools/v3/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -100,7 +101,7 @@ func (e *eventObserver) CheckEventError(c *testing.T, id, event string, match ev
|
||||||
|
|
||||||
if e.disconnectionError != nil {
|
if e.disconnectionError != nil {
|
||||||
until := daemonUnixTime(c)
|
until := daemonUnixTime(c)
|
||||||
out, _ := dockerCmd(c, "events", "--since", e.startTime, "--until", until)
|
out := cli.DockerCmd(c, "events", "--since", e.startTime, "--until", until).Stdout()
|
||||||
events := strings.Split(strings.TrimSpace(out), "\n")
|
events := strings.Split(strings.TrimSpace(out), "\n")
|
||||||
for _, e := range events {
|
for _, e := range events {
|
||||||
if _, ok := match(e); ok {
|
if _, ok := match(e); ok {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/docker/docker/integration-cli/cli"
|
||||||
"github.com/docker/docker/testutil/fixtures/load"
|
"github.com/docker/docker/testutil/fixtures/load"
|
||||||
"gotest.tools/v3/assert"
|
"gotest.tools/v3/assert"
|
||||||
)
|
)
|
||||||
|
@ -61,7 +62,7 @@ func ensureSyscallTest(ctx context.Context, c *testing.T) {
|
||||||
}
|
}
|
||||||
buildArgs = append(buildArgs, []string{"-q", "-t", "syscall-test", tmp}...)
|
buildArgs = append(buildArgs, []string{"-q", "-t", "syscall-test", tmp}...)
|
||||||
buildArgs = append([]string{"build"}, buildArgs...)
|
buildArgs = append([]string{"build"}, buildArgs...)
|
||||||
dockerCmd(c, buildArgs...)
|
cli.DockerCmd(c, buildArgs...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ensureSyscallTestBuild(ctx context.Context, c *testing.T) {
|
func ensureSyscallTestBuild(ctx context.Context, c *testing.T) {
|
||||||
|
@ -74,7 +75,7 @@ func ensureSyscallTestBuild(ctx context.Context, c *testing.T) {
|
||||||
}
|
}
|
||||||
buildArgs = append(buildArgs, []string{"-q", "-t", "syscall-test", "../contrib/syscall-test"}...)
|
buildArgs = append(buildArgs, []string{"-q", "-t", "syscall-test", "../contrib/syscall-test"}...)
|
||||||
buildArgs = append([]string{"build"}, buildArgs...)
|
buildArgs = append([]string{"build"}, buildArgs...)
|
||||||
dockerCmd(c, buildArgs...)
|
cli.DockerCmd(c, buildArgs...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ensureNNPTest(ctx context.Context, c *testing.T) {
|
func ensureNNPTest(ctx context.Context, c *testing.T) {
|
||||||
|
@ -116,7 +117,7 @@ func ensureNNPTest(ctx context.Context, c *testing.T) {
|
||||||
}
|
}
|
||||||
buildArgs = append(buildArgs, []string{"-q", "-t", "nnp-test", tmp}...)
|
buildArgs = append(buildArgs, []string{"-q", "-t", "nnp-test", tmp}...)
|
||||||
buildArgs = append([]string{"build"}, buildArgs...)
|
buildArgs = append([]string{"build"}, buildArgs...)
|
||||||
dockerCmd(c, buildArgs...)
|
cli.DockerCmd(c, buildArgs...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ensureNNPTestBuild(ctx context.Context, c *testing.T) {
|
func ensureNNPTestBuild(ctx context.Context, c *testing.T) {
|
||||||
|
@ -129,5 +130,5 @@ func ensureNNPTestBuild(ctx context.Context, c *testing.T) {
|
||||||
}
|
}
|
||||||
buildArgs = append(buildArgs, []string{"-q", "-t", "npp-test", "../contrib/nnp-test"}...)
|
buildArgs = append(buildArgs, []string{"-q", "-t", "npp-test", "../contrib/nnp-test"}...)
|
||||||
buildArgs = append([]string{"build"}, buildArgs...)
|
buildArgs = append([]string{"build"}, buildArgs...)
|
||||||
dockerCmd(c, buildArgs...)
|
cli.DockerCmd(c, buildArgs...)
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import (
|
||||||
"github.com/docker/docker/api/types/swarm"
|
"github.com/docker/docker/api/types/swarm"
|
||||||
"github.com/docker/docker/api/types/versions"
|
"github.com/docker/docker/api/types/versions"
|
||||||
"github.com/docker/docker/client"
|
"github.com/docker/docker/client"
|
||||||
|
"github.com/docker/docker/integration-cli/cli"
|
||||||
"github.com/docker/docker/integration-cli/requirement"
|
"github.com/docker/docker/integration-cli/requirement"
|
||||||
"github.com/docker/docker/testutil/registry"
|
"github.com/docker/docker/testutil/registry"
|
||||||
)
|
)
|
||||||
|
@ -173,7 +174,7 @@ func TODOBuildkit() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func DockerCLIVersion(t testing.TB) string {
|
func DockerCLIVersion(t testing.TB) string {
|
||||||
out, _ := dockerCmd(t, "--version")
|
out := cli.DockerCmd(t, "--version").Stdout()
|
||||||
version := strings.Fields(out)
|
version := strings.Fields(out)
|
||||||
if len(version) < 3 {
|
if len(version) < 3 {
|
||||||
t.Fatal("unknown version output", version)
|
t.Fatal("unknown version output", version)
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/docker/docker/integration-cli/cli"
|
||||||
"github.com/docker/docker/testutil"
|
"github.com/docker/docker/testutil"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"gotest.tools/v3/icmd"
|
"gotest.tools/v3/icmd"
|
||||||
|
@ -130,7 +131,7 @@ func existingElements(c *testing.T, opts elementListOptions) []string {
|
||||||
if opts.format != "" {
|
if opts.format != "" {
|
||||||
args = append(args, "--format", opts.format)
|
args = append(args, "--format", opts.format)
|
||||||
}
|
}
|
||||||
out, _ := dockerCmd(c, args...)
|
out := cli.DockerCmd(c, args...).Combined()
|
||||||
var lines []string
|
var lines []string
|
||||||
for _, l := range strings.Split(out, "\n") {
|
for _, l := range strings.Split(out, "\n") {
|
||||||
if l != "" {
|
if l != "" {
|
||||||
|
|
Loading…
Reference in a new issue