Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit a131d80

Browse files
authored
Upstream-commit: dc4a600a78b2116187c037690cdf78f52c4ed6d2
Component: engine
2 parents 158808d + eea7e95 commit a131d80

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

components/engine/integration-cli/cli/cli.go

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ type CmdOperator func(*icmd.Cmd) func()
2626

2727
// DockerCmd executes the specified docker command and expect a success
2828
func DockerCmd(t testing.TB, args ...string) *icmd.Result {
29+
t.Helper()
2930
return Docker(Args(args...)).Assert(t, icmd.Success)
3031
}
3132

components/engine/integration-cli/docker_cli_push_test.go

+10-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"testing"
1313

1414
"github.com/docker/distribution/reference"
15+
"github.com/docker/docker/api/types/versions"
1516
"github.com/docker/docker/integration-cli/cli/build"
1617
"gotest.tools/v3/assert"
1718
"gotest.tools/v3/icmd"
@@ -81,7 +82,15 @@ func testPushMultipleTags(c *testing.T) {
8182
// tag the image and upload it to the private registry
8283
dockerCmd(c, "tag", "busybox", repoTag1)
8384
dockerCmd(c, "tag", "busybox", repoTag2)
84-
dockerCmd(c, "push", repoName)
85+
86+
args := []string{"push"}
87+
if versions.GreaterThanOrEqualTo(DockerCLIVersion(c), "20.10.0") {
88+
// 20.10 CLI removed implicit push all tags and requires the "--all" flag
89+
args = append(args, "--all-tags")
90+
}
91+
args = append(args, repoName)
92+
93+
dockerCmd(c, args...)
8594

8695
imageAlreadyExists := ": Image already exists"
8796

components/engine/integration-cli/docker_utils_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ func dockerCmdWithError(args ...string) (string, int, error) {
4141

4242
// Deprecated: use cli.Docker or cli.DockerCmd
4343
func dockerCmd(c testing.TB, args ...string) (string, int) {
44+
c.Helper()
4445
result := cli.DockerCmd(c, args...)
4546
return result.Combined(), result.ExitCode
4647
}

components/engine/integration-cli/requirements_test.go

+9
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,15 @@ func TODOBuildkit() bool {
189189
return os.Getenv("DOCKER_BUILDKIT") == ""
190190
}
191191

192+
func DockerCLIVersion(t testing.TB) string {
193+
out, _ := dockerCmd(t, "--version")
194+
version := strings.Fields(out)
195+
if len(version) < 3 {
196+
t.Fatal("unknown version output", version)
197+
}
198+
return version[2]
199+
}
200+
192201
// testRequires checks if the environment satisfies the requirements
193202
// for the test to run or skips the tests.
194203
func testRequires(t *testing.T, requirements ...requirement.Test) {

0 commit comments

Comments
 (0)