sed -E -i 's#\bassert\.Assert\(c, (.*), checker\.Contains, (.*)\)$#assert.Assert(c, eg_contains(\1, \2))#g' \
-- "integration-cli/docker_api_containers_test.go" "integration-cli/docker_cli_build_test.go" "integration-cli/docker_cli_by_digest_test.go" "integration-cli/docker_cli_commit_test.go" "integration-cli/docker_cli_create_test.go" "integration-cli/docker_cli_daemon_test.go" "integration-cli/docker_cli_external_volume_driver_unix_test.go" "integration-cli/docker_cli_history_test.go" "integration-cli/docker_cli_images_test.go" "integration-cli/docker_cli_info_test.go" "integration-cli/docker_cli_info_unix_test.go" "integration-cli/docker_cli_inspect_test.go" "integration-cli/docker_cli_links_test.go" "integration-cli/docker_cli_netmode_test.go" "integration-cli/docker_cli_network_unix_test.go" "integration-cli/docker_cli_plugins_test.go" "integration-cli/docker_cli_port_test.go" "integration-cli/docker_cli_prune_unix_test.go" "integration-cli/docker_cli_ps_test.go" "integration-cli/docker_cli_pull_local_test.go" "integration-cli/docker_cli_rmi_test.go" "integration-cli/docker_cli_run_test.go" "integration-cli/docker_cli_run_unix_test.go" "integration-cli/docker_cli_save_load_test.go" "integration-cli/docker_cli_service_create_test.go" "integration-cli/docker_cli_start_test.go" "integration-cli/docker_cli_swarm_test.go" "integration-cli/docker_cli_volume_test.go" \
&& \
go get -d golang.org/x/tools/cmd/eg && dir=$(go env GOPATH)/src/golang.org/x/tools && git -C "$dir" fetch https://github.com/tiborvass/tools handle-variadic && git -C "$dir" checkout 61a94b82347c29b3289e83190aa3dda74d47abbb && go install golang.org/x/tools/cmd/eg \
&& \
/bin/echo -e 'package main\nvar eg_contains func(arg1, arg2 string, extra ...interface{}) bool' > ./integration-cli/eg_helper.go \
&& \
goimports -w ./integration-cli \
&& \
eg -w -t template.contains.go -- ./integration-cli \
&& \
rm -f ./integration-cli/eg_helper.go \
&& \
go run rm-gocheck.go redress '\bassert\.Assert\b.*(\(|,)\s*$' \
"integration-cli/docker_api_containers_test.go" "integration-cli/docker_cli_build_test.go" "integration-cli/docker_cli_by_digest_test.go" "integration-cli/docker_cli_commit_test.go" "integration-cli/docker_cli_create_test.go" "integration-cli/docker_cli_daemon_test.go" "integration-cli/docker_cli_external_volume_driver_unix_test.go" "integration-cli/docker_cli_history_test.go" "integration-cli/docker_cli_images_test.go" "integration-cli/docker_cli_info_test.go" "integration-cli/docker_cli_info_unix_test.go" "integration-cli/docker_cli_inspect_test.go" "integration-cli/docker_cli_links_test.go" "integration-cli/docker_cli_netmode_test.go" "integration-cli/docker_cli_network_unix_test.go" "integration-cli/docker_cli_plugins_test.go" "integration-cli/docker_cli_port_test.go" "integration-cli/docker_cli_prune_unix_test.go" "integration-cli/docker_cli_ps_test.go" "integration-cli/docker_cli_pull_local_test.go" "integration-cli/docker_cli_rmi_test.go" "integration-cli/docker_cli_run_test.go" "integration-cli/docker_cli_run_unix_test.go" "integration-cli/docker_cli_save_load_test.go" "integration-cli/docker_cli_service_create_test.go" "integration-cli/docker_cli_start_test.go" "integration-cli/docker_cli_swarm_test.go" "integration-cli/docker_cli_volume_test.go"
Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 98f2638fe5f963203e359c0f2b6387d70285fbe3)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -23,7 +23,6 @@ import ( |
| 23 | 23 |
networktypes "github.com/docker/docker/api/types/network" |
| 24 | 24 |
"github.com/docker/docker/api/types/versions" |
| 25 | 25 |
"github.com/docker/docker/client" |
| 26 |
- "github.com/docker/docker/integration-cli/checker" |
|
| 27 | 26 |
"github.com/docker/docker/integration-cli/cli" |
| 28 | 27 |
"github.com/docker/docker/integration-cli/cli/build" |
| 29 | 28 |
"github.com/docker/docker/internal/test/request" |
| ... | ... |
@@ -578,10 +577,10 @@ func (s *DockerSuite) TestContainerAPICreateMultipleNetworksConfig(c *testing.T) |
| 578 | 578 |
_, err = cli.ContainerCreate(context.Background(), &config, &containertypes.HostConfig{}, &networkingConfig, "")
|
| 579 | 579 |
msg := err.Error() |
| 580 | 580 |
// network name order in error message is not deterministic |
| 581 |
- assert.Assert(c, msg, checker.Contains, "Container cannot be connected to network endpoints") |
|
| 582 |
- assert.Assert(c, msg, checker.Contains, "net1") |
|
| 583 |
- assert.Assert(c, msg, checker.Contains, "net2") |
|
| 584 |
- assert.Assert(c, msg, checker.Contains, "net3") |
|
| 581 |
+ assert.Assert(c, strings.Contains(msg, "Container cannot be connected to network endpoints")) |
|
| 582 |
+ assert.Assert(c, strings.Contains(msg, "net1")) |
|
| 583 |
+ assert.Assert(c, strings.Contains(msg, "net2")) |
|
| 584 |
+ assert.Assert(c, strings.Contains(msg, "net3")) |
|
| 585 | 585 |
} |
| 586 | 586 |
|
| 587 | 587 |
func (s *DockerSuite) TestContainerAPICreateBridgeNetworkMode(c *testing.T) {
|
| ... | ... |
@@ -714,7 +713,7 @@ func (s *DockerSuite) TestContainerAPIInvalidPortSyntax(c *testing.T) {
|
| 714 | 714 |
|
| 715 | 715 |
b, err := request.ReadBody(body) |
| 716 | 716 |
assert.NilError(c, err) |
| 717 |
- assert.Assert(c, string(b[:]), checker.Contains, "invalid port") |
|
| 717 |
+ assert.Assert(c, strings.Contains(string(b[:]), "invalid port")) |
|
| 718 | 718 |
} |
| 719 | 719 |
|
| 720 | 720 |
func (s *DockerSuite) TestContainerAPIRestartPolicyInvalidPolicyName(c *testing.T) {
|
| ... | ... |
@@ -738,7 +737,7 @@ func (s *DockerSuite) TestContainerAPIRestartPolicyInvalidPolicyName(c *testing. |
| 738 | 738 |
|
| 739 | 739 |
b, err := request.ReadBody(body) |
| 740 | 740 |
assert.NilError(c, err) |
| 741 |
- assert.Assert(c, string(b[:]), checker.Contains, "invalid restart policy") |
|
| 741 |
+ assert.Assert(c, strings.Contains(string(b[:]), "invalid restart policy")) |
|
| 742 | 742 |
} |
| 743 | 743 |
|
| 744 | 744 |
func (s *DockerSuite) TestContainerAPIRestartPolicyRetryMismatch(c *testing.T) {
|
| ... | ... |
@@ -762,7 +761,7 @@ func (s *DockerSuite) TestContainerAPIRestartPolicyRetryMismatch(c *testing.T) {
|
| 762 | 762 |
|
| 763 | 763 |
b, err := request.ReadBody(body) |
| 764 | 764 |
assert.NilError(c, err) |
| 765 |
- assert.Assert(c, string(b[:]), checker.Contains, "maximum retry count cannot be used with restart policy") |
|
| 765 |
+ assert.Assert(c, strings.Contains(string(b[:]), "maximum retry count cannot be used with restart policy")) |
|
| 766 | 766 |
} |
| 767 | 767 |
|
| 768 | 768 |
func (s *DockerSuite) TestContainerAPIRestartPolicyNegativeRetryCount(c *testing.T) {
|
| ... | ... |
@@ -786,7 +785,7 @@ func (s *DockerSuite) TestContainerAPIRestartPolicyNegativeRetryCount(c *testing |
| 786 | 786 |
|
| 787 | 787 |
b, err := request.ReadBody(body) |
| 788 | 788 |
assert.NilError(c, err) |
| 789 |
- assert.Assert(c, string(b[:]), checker.Contains, "maximum retry count cannot be negative") |
|
| 789 |
+ assert.Assert(c, strings.Contains(string(b[:]), "maximum retry count cannot be negative")) |
|
| 790 | 790 |
} |
| 791 | 791 |
|
| 792 | 792 |
func (s *DockerSuite) TestContainerAPIRestartPolicyDefaultRetryCount(c *testing.T) {
|
| ... | ... |
@@ -872,7 +871,7 @@ func (s *DockerSuite) TestCreateWithTooLowMemoryLimit(c *testing.T) {
|
| 872 | 872 |
} else {
|
| 873 | 873 |
assert.Assert(c, res.StatusCode != http.StatusOK) |
| 874 | 874 |
} |
| 875 |
- assert.Assert(c, string(b), checker.Contains, "Minimum memory limit allowed is 4MB") |
|
| 875 |
+ assert.Assert(c, strings.Contains(string(b), "Minimum memory limit allowed is 4MB")) |
|
| 876 | 876 |
} |
| 877 | 877 |
|
| 878 | 878 |
func (s *DockerSuite) TestContainerAPIRename(c *testing.T) {
|
| ... | ... |
@@ -2232,7 +2231,7 @@ func (s *DockerSuite) TestContainersAPICreateMountsTmpfs(c *testing.T) {
|
| 2232 | 2232 |
assert.NilError(c, err) |
| 2233 | 2233 |
out, _ := dockerCmd(c, "start", "-a", cName) |
| 2234 | 2234 |
for _, option := range x.expectedOptions {
|
| 2235 |
- assert.Assert(c, out, checker.Contains, option) |
|
| 2235 |
+ assert.Assert(c, strings.Contains(out, option)) |
|
| 2236 | 2236 |
} |
| 2237 | 2237 |
} |
| 2238 | 2238 |
} |
| ... | ... |
@@ -17,7 +17,6 @@ import ( |
| 17 | 17 |
"text/template" |
| 18 | 18 |
"time" |
| 19 | 19 |
|
| 20 |
- "github.com/docker/docker/integration-cli/checker" |
|
| 21 | 20 |
"github.com/docker/docker/integration-cli/cli" |
| 22 | 21 |
"github.com/docker/docker/integration-cli/cli/build" |
| 23 | 22 |
"github.com/docker/docker/internal/test/fakecontext" |
| ... | ... |
@@ -4581,9 +4580,9 @@ func (s *DockerSuite) TestBuildBuildTimeArgEnv(c *testing.T) {
|
| 4581 | 4581 |
out := result.Combined()[i:] // "out" should contain just the warning message now |
| 4582 | 4582 |
|
| 4583 | 4583 |
// These were specified on a --build-arg but no ARG was in the Dockerfile |
| 4584 |
- assert.Assert(c, out, checker.Contains, "FOO7") |
|
| 4585 |
- assert.Assert(c, out, checker.Contains, "FOO8") |
|
| 4586 |
- assert.Assert(c, out, checker.Contains, "FOO9") |
|
| 4584 |
+ assert.Assert(c, strings.Contains(out, "FOO7")) |
|
| 4585 |
+ assert.Assert(c, strings.Contains(out, "FOO8")) |
|
| 4586 |
+ assert.Assert(c, strings.Contains(out, "FOO9")) |
|
| 4587 | 4587 |
} |
| 4588 | 4588 |
|
| 4589 | 4589 |
func (s *DockerSuite) TestBuildBuildTimeArgQuotedValVariants(c *testing.T) {
|
| ... | ... |
@@ -4654,11 +4653,10 @@ func (s *DockerSuite) TestBuildMultiStageArg(c *testing.T) {
|
| 4654 | 4654 |
parentID := strings.TrimSpace(result.Stdout()) |
| 4655 | 4655 |
|
| 4656 | 4656 |
result = cli.DockerCmd(c, "run", "--rm", parentID, "cat", "/out") |
| 4657 |
- assert.Assert(c, result.Stdout(), checker.Contains, "foo=abc") |
|
| 4658 |
- |
|
| 4657 |
+ assert.Assert(c, strings.Contains(result.Stdout(), "foo=abc")) |
|
| 4659 | 4658 |
result = cli.DockerCmd(c, "run", "--rm", imgName, "cat", "/out") |
| 4660 | 4659 |
assert.Assert(c, !strings.Contains(result.Stdout(), "foo")) |
| 4661 |
- assert.Assert(c, result.Stdout(), checker.Contains, "bar=def") |
|
| 4660 |
+ assert.Assert(c, strings.Contains(result.Stdout(), "bar=def")) |
|
| 4662 | 4661 |
} |
| 4663 | 4662 |
|
| 4664 | 4663 |
func (s *DockerSuite) TestBuildMultiStageGlobalArg(c *testing.T) {
|
| ... | ... |
@@ -4682,7 +4680,7 @@ func (s *DockerSuite) TestBuildMultiStageGlobalArg(c *testing.T) {
|
| 4682 | 4682 |
result = cli.DockerCmd(c, "run", "--rm", parentID, "cat", "/out") |
| 4683 | 4683 |
assert.Assert(c, !strings.Contains(result.Stdout(), "tag")) |
| 4684 | 4684 |
result = cli.DockerCmd(c, "run", "--rm", imgName, "cat", "/out") |
| 4685 |
- assert.Assert(c, result.Stdout(), checker.Contains, "tag=latest") |
|
| 4685 |
+ assert.Assert(c, strings.Contains(result.Stdout(), "tag=latest")) |
|
| 4686 | 4686 |
} |
| 4687 | 4687 |
|
| 4688 | 4688 |
func (s *DockerSuite) TestBuildMultiStageUnusedArg(c *testing.T) {
|
| ... | ... |
@@ -4697,9 +4695,8 @@ func (s *DockerSuite) TestBuildMultiStageUnusedArg(c *testing.T) {
|
| 4697 | 4697 |
build.WithDockerfile(dockerfile), |
| 4698 | 4698 |
cli.WithFlags("--build-arg", fmt.Sprintf("baz=abc")))
|
| 4699 | 4699 |
result.Assert(c, icmd.Success) |
| 4700 |
- assert.Assert(c, result.Combined(), checker.Contains, "[Warning]") |
|
| 4701 |
- assert.Assert(c, result.Combined(), checker.Contains, "[baz] were not consumed") |
|
| 4702 |
- |
|
| 4700 |
+ assert.Assert(c, strings.Contains(result.Combined(), "[Warning]")) |
|
| 4701 |
+ assert.Assert(c, strings.Contains(result.Combined(), "[baz] were not consumed")) |
|
| 4703 | 4702 |
result = cli.DockerCmd(c, "run", "--rm", imgName, "cat", "/out") |
| 4704 | 4703 |
assert.Assert(c, !strings.Contains(result.Stdout(), "bar")) |
| 4705 | 4704 |
assert.Assert(c, !strings.Contains(result.Stdout(), "baz")) |
| ... | ... |
@@ -5408,9 +5405,9 @@ func (s *DockerSuite) TestBuildStepsWithProgress(c *testing.T) {
|
| 5408 | 5408 |
totalRun := 5 |
| 5409 | 5409 |
result := buildImage(name, build.WithDockerfile("FROM busybox\n"+strings.Repeat("RUN echo foo\n", totalRun)))
|
| 5410 | 5410 |
result.Assert(c, icmd.Success) |
| 5411 |
- assert.Assert(c, result.Combined(), checker.Contains, fmt.Sprintf("Step 1/%d : FROM busybox", 1+totalRun))
|
|
| 5411 |
+ assert.Assert(c, strings.Contains(result.Combined(), fmt.Sprintf("Step 1/%d : FROM busybox", 1+totalRun)))
|
|
| 5412 | 5412 |
for i := 2; i <= 1+totalRun; i++ {
|
| 5413 |
- assert.Assert(c, result.Combined(), checker.Contains, fmt.Sprintf("Step %d/%d : RUN echo foo", i, 1+totalRun))
|
|
| 5413 |
+ assert.Assert(c, strings.Contains(result.Combined(), fmt.Sprintf("Step %d/%d : RUN echo foo", i, 1+totalRun)))
|
|
| 5414 | 5414 |
} |
| 5415 | 5415 |
} |
| 5416 | 5416 |
|
| ... | ... |
@@ -5421,9 +5418,8 @@ func (s *DockerSuite) TestBuildWithFailure(c *testing.T) {
|
| 5421 | 5421 |
dockerfile := "FROM busybox\nRUN nobody" |
| 5422 | 5422 |
result := buildImage(name, build.WithDockerfile(dockerfile)) |
| 5423 | 5423 |
assert.Assert(c, result.Error != nil) |
| 5424 |
- assert.Assert(c, result.Stdout(), checker.Contains, "Step 1/2 : FROM busybox") |
|
| 5425 |
- assert.Assert(c, result.Stdout(), checker.Contains, "Step 2/2 : RUN nobody") |
|
| 5426 |
- |
|
| 5424 |
+ assert.Assert(c, strings.Contains(result.Stdout(), "Step 1/2 : FROM busybox")) |
|
| 5425 |
+ assert.Assert(c, strings.Contains(result.Stdout(), "Step 2/2 : RUN nobody")) |
|
| 5427 | 5426 |
// Second test case `FFOM` should have been detected before build runs so no steps |
| 5428 | 5427 |
dockerfile = "FFOM nobody\nRUN nobody" |
| 5429 | 5428 |
result = buildImage(name, build.WithDockerfile(dockerfile)) |
| ... | ... |
@@ -5653,20 +5649,18 @@ func (s *DockerSuite) TestBuildContChar(c *testing.T) {
|
| 5653 | 5653 |
result := buildImage(name, build.WithDockerfile(`FROM busybox |
| 5654 | 5654 |
RUN echo hi \`)) |
| 5655 | 5655 |
result.Assert(c, icmd.Success) |
| 5656 |
- assert.Assert(c, result.Combined(), checker.Contains, "Step 1/2 : FROM busybox") |
|
| 5657 |
- assert.Assert(c, result.Combined(), checker.Contains, "Step 2/2 : RUN echo hi\n") |
|
| 5658 |
- |
|
| 5656 |
+ assert.Assert(c, strings.Contains(result.Combined(), "Step 1/2 : FROM busybox")) |
|
| 5657 |
+ assert.Assert(c, strings.Contains(result.Combined(), "Step 2/2 : RUN echo hi\n")) |
|
| 5659 | 5658 |
result = buildImage(name, build.WithDockerfile(`FROM busybox |
| 5660 | 5659 |
RUN echo hi \\`)) |
| 5661 | 5660 |
result.Assert(c, icmd.Success) |
| 5662 |
- assert.Assert(c, result.Combined(), checker.Contains, "Step 1/2 : FROM busybox") |
|
| 5663 |
- assert.Assert(c, result.Combined(), checker.Contains, "Step 2/2 : RUN echo hi \\\n") |
|
| 5664 |
- |
|
| 5661 |
+ assert.Assert(c, strings.Contains(result.Combined(), "Step 1/2 : FROM busybox")) |
|
| 5662 |
+ assert.Assert(c, strings.Contains(result.Combined(), "Step 2/2 : RUN echo hi \\\n")) |
|
| 5665 | 5663 |
result = buildImage(name, build.WithDockerfile(`FROM busybox |
| 5666 | 5664 |
RUN echo hi \\\`)) |
| 5667 | 5665 |
result.Assert(c, icmd.Success) |
| 5668 |
- assert.Assert(c, result.Combined(), checker.Contains, "Step 1/2 : FROM busybox") |
|
| 5669 |
- assert.Assert(c, result.Combined(), checker.Contains, "Step 2/2 : RUN echo hi \\\\\n") |
|
| 5666 |
+ assert.Assert(c, strings.Contains(result.Combined(), "Step 1/2 : FROM busybox")) |
|
| 5667 |
+ assert.Assert(c, strings.Contains(result.Combined(), "Step 2/2 : RUN echo hi \\\\\n")) |
|
| 5670 | 5668 |
} |
| 5671 | 5669 |
|
| 5672 | 5670 |
func (s *DockerSuite) TestBuildMultiStageCopyFromSyntax(c *testing.T) {
|
| ... | ... |
@@ -12,7 +12,6 @@ import ( |
| 12 | 12 |
"github.com/docker/distribution/manifest/schema1" |
| 13 | 13 |
"github.com/docker/distribution/manifest/schema2" |
| 14 | 14 |
"github.com/docker/docker/api/types" |
| 15 |
- "github.com/docker/docker/integration-cli/checker" |
|
| 16 | 15 |
"github.com/docker/docker/integration-cli/cli" |
| 17 | 16 |
"github.com/docker/docker/integration-cli/cli/build" |
| 18 | 17 |
"github.com/go-check/check" |
| ... | ... |
@@ -117,7 +116,7 @@ func testPullByDigestNoFallback(c *testing.T) {
|
| 117 | 117 |
imageReference := fmt.Sprintf("%s@sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", repoName)
|
| 118 | 118 |
out, _, err := dockerCmdWithError("pull", imageReference)
|
| 119 | 119 |
assert.Assert(c, err != nil, check.Commentf("expected non-zero exit status and correct error message when pulling non-existing image"))
|
| 120 |
- assert.Assert(c, out, checker.Contains, fmt.Sprintf("manifest for %s not found", imageReference), check.Commentf("expected non-zero exit status and correct error message when pulling non-existing image"))
|
|
| 120 |
+ assert.Assert(c, strings.Contains(out, fmt.Sprintf("manifest for %s not found", imageReference)), check.Commentf("expected non-zero exit status and correct error message when pulling non-existing image"))
|
|
| 121 | 121 |
} |
| 122 | 122 |
|
| 123 | 123 |
func (s *DockerRegistrySuite) TestPullByDigestNoFallback(c *testing.T) {
|
| ... | ... |
@@ -602,7 +601,7 @@ func (s *DockerSchema1RegistrySuite) TestPullFailsWithAlteredManifest(c *testing |
| 602 | 602 |
assert.Assert(c, exitStatus != 0) |
| 603 | 603 |
|
| 604 | 604 |
expectedErrorMsg := fmt.Sprintf("image verification failed for digest %s", manifestDigest)
|
| 605 |
- assert.Assert(c, out, checker.Contains, expectedErrorMsg) |
|
| 605 |
+ assert.Assert(c, strings.Contains(out, expectedErrorMsg)) |
|
| 606 | 606 |
} |
| 607 | 607 |
|
| 608 | 608 |
// TestPullFailsWithAlteredLayer tests that a `docker pull` fails when |
| ... | ... |
@@ -645,7 +644,7 @@ func (s *DockerRegistrySuite) TestPullFailsWithAlteredLayer(c *testing.T) {
|
| 645 | 645 |
assert.Assert(c, exitStatus != 0, check.Commentf("expected a non-zero exit status"))
|
| 646 | 646 |
|
| 647 | 647 |
expectedErrorMsg := fmt.Sprintf("filesystem layer verification failed for digest %s", targetLayerDigest)
|
| 648 |
- assert.Assert(c, out, checker.Contains, expectedErrorMsg, check.Commentf("expected error message in output: %s", out))
|
|
| 648 |
+ assert.Assert(c, strings.Contains(out, expectedErrorMsg), check.Commentf("expected error message in output: %s", out))
|
|
| 649 | 649 |
} |
| 650 | 650 |
|
| 651 | 651 |
// TestPullFailsWithAlteredLayer tests that a `docker pull` fails when |
| ... | ... |
@@ -688,5 +687,5 @@ func (s *DockerSchema1RegistrySuite) TestPullFailsWithAlteredLayer(c *testing.T) |
| 688 | 688 |
assert.Assert(c, exitStatus != 0, check.Commentf("expected a non-zero exit status"))
|
| 689 | 689 |
|
| 690 | 690 |
expectedErrorMsg := fmt.Sprintf("filesystem layer verification failed for digest %s", targetLayerDigest)
|
| 691 |
- assert.Assert(c, out, checker.Contains, expectedErrorMsg, check.Commentf("expected error message in output: %s", out))
|
|
| 691 |
+ assert.Assert(c, strings.Contains(out, expectedErrorMsg), check.Commentf("expected error message in output: %s", out))
|
|
| 692 | 692 |
} |
| ... | ... |
@@ -5,7 +5,6 @@ import ( |
| 5 | 5 |
"testing" |
| 6 | 6 |
|
| 7 | 7 |
"github.com/docker/docker/api/types/versions" |
| 8 |
- "github.com/docker/docker/integration-cli/checker" |
|
| 9 | 8 |
"github.com/docker/docker/integration-cli/cli" |
| 10 | 9 |
"github.com/go-check/check" |
| 11 | 10 |
"gotest.tools/assert" |
| ... | ... |
@@ -52,7 +51,7 @@ func (s *DockerSuite) TestCommitPausedContainer(c *testing.T) {
|
| 52 | 52 |
|
| 53 | 53 |
out = inspectField(c, cleanedContainerID, "State.Paused") |
| 54 | 54 |
// commit should not unpause a paused container |
| 55 |
- assert.Assert(c, out, checker.Contains, "true") |
|
| 55 |
+ assert.Assert(c, strings.Contains(out, "true")) |
|
| 56 | 56 |
} |
| 57 | 57 |
|
| 58 | 58 |
func (s *DockerSuite) TestCommitNewFile(c *testing.T) {
|
| ... | ... |
@@ -73,8 +72,7 @@ func (s *DockerSuite) TestCommitHardlink(c *testing.T) {
|
| 73 | 73 |
chunks := strings.Split(strings.TrimSpace(firstOutput), " ") |
| 74 | 74 |
inode := chunks[0] |
| 75 | 75 |
chunks = strings.SplitAfterN(strings.TrimSpace(firstOutput), " ", 2) |
| 76 |
- assert.Assert(c, chunks[1], checker.Contains, chunks[0], check.Commentf("Failed to create hardlink in a container. Expected to find %q in %q", inode, chunks[1:]))
|
|
| 77 |
- |
|
| 76 |
+ assert.Assert(c, strings.Contains(chunks[1], chunks[0]), check.Commentf("Failed to create hardlink in a container. Expected to find %q in %q", inode, chunks[1:]))
|
|
| 78 | 77 |
imageID, _ := dockerCmd(c, "commit", "hardlinks", "hardlinks") |
| 79 | 78 |
imageID = strings.TrimSpace(imageID) |
| 80 | 79 |
|
| ... | ... |
@@ -83,7 +81,7 @@ func (s *DockerSuite) TestCommitHardlink(c *testing.T) {
|
| 83 | 83 |
chunks = strings.Split(strings.TrimSpace(secondOutput), " ") |
| 84 | 84 |
inode = chunks[0] |
| 85 | 85 |
chunks = strings.SplitAfterN(strings.TrimSpace(secondOutput), " ", 2) |
| 86 |
- assert.Assert(c, chunks[1], checker.Contains, chunks[0], check.Commentf("Failed to create hardlink in a container. Expected to find %q in %q", inode, chunks[1:]))
|
|
| 86 |
+ assert.Assert(c, strings.Contains(chunks[1], chunks[0]), check.Commentf("Failed to create hardlink in a container. Expected to find %q in %q", inode, chunks[1:]))
|
|
| 87 | 87 |
} |
| 88 | 88 |
|
| 89 | 89 |
func (s *DockerSuite) TestCommitTTY(c *testing.T) {
|
| ... | ... |
@@ -9,7 +9,6 @@ import ( |
| 9 | 9 |
"testing" |
| 10 | 10 |
"time" |
| 11 | 11 |
|
| 12 |
- "github.com/docker/docker/integration-cli/checker" |
|
| 13 | 12 |
"github.com/docker/docker/integration-cli/cli" |
| 14 | 13 |
"github.com/docker/docker/integration-cli/cli/build" |
| 15 | 14 |
"github.com/docker/docker/internal/test/fakecontext" |
| ... | ... |
@@ -79,7 +78,7 @@ func (s *DockerSuite) TestCreateShrinkRootfs(c *testing.T) {
|
| 79 | 79 |
// Ensure this fails because of the defaultBaseFsSize is 10G |
| 80 | 80 |
out, _, err := dockerCmdWithError("create", "--storage-opt", "size=5G", "busybox")
|
| 81 | 81 |
assert.ErrorContains(c, err, "", out) |
| 82 |
- assert.Assert(c, out, checker.Contains, "Container size cannot be smaller than") |
|
| 82 |
+ assert.Assert(c, strings.Contains(out, "Container size cannot be smaller than")) |
|
| 83 | 83 |
} |
| 84 | 84 |
|
| 85 | 85 |
// Make sure we can set hostconfig options too |
| ... | ... |
@@ -296,8 +295,7 @@ func (s *DockerSuite) TestCreateStopSignal(c *testing.T) {
|
| 296 | 296 |
dockerCmd(c, "create", "--name", name, "--stop-signal", "9", "busybox") |
| 297 | 297 |
|
| 298 | 298 |
res := inspectFieldJSON(c, name, "Config.StopSignal") |
| 299 |
- assert.Assert(c, res, checker.Contains, "9") |
|
| 300 |
- |
|
| 299 |
+ assert.Assert(c, strings.Contains(res, "9")) |
|
| 301 | 300 |
} |
| 302 | 301 |
|
| 303 | 302 |
func (s *DockerSuite) TestCreateWithWorkdir(c *testing.T) {
|
| ... | ... |
@@ -326,7 +324,7 @@ func (s *DockerSuite) TestCreateWithInvalidLogOpts(c *testing.T) {
|
| 326 | 326 |
name := "test-invalidate-log-opts" |
| 327 | 327 |
out, _, err := dockerCmdWithError("create", "--name", name, "--log-opt", "invalid=true", "busybox")
|
| 328 | 328 |
assert.ErrorContains(c, err, "") |
| 329 |
- assert.Assert(c, out, checker.Contains, "unknown log opt") |
|
| 329 |
+ assert.Assert(c, strings.Contains(out, "unknown log opt")) |
|
| 330 | 330 |
assert.Assert(c, is.Contains(out, "unknown log opt")) |
| 331 | 331 |
|
| 332 | 332 |
out, _ = dockerCmd(c, "ps", "-a") |
| ... | ... |
@@ -374,11 +372,10 @@ func (s *DockerSuite) TestCreateStopTimeout(c *testing.T) {
|
| 374 | 374 |
dockerCmd(c, "create", "--name", name1, "--stop-timeout", "15", "busybox") |
| 375 | 375 |
|
| 376 | 376 |
res := inspectFieldJSON(c, name1, "Config.StopTimeout") |
| 377 |
- assert.Assert(c, res, checker.Contains, "15") |
|
| 378 |
- |
|
| 377 |
+ assert.Assert(c, strings.Contains(res, "15")) |
|
| 379 | 378 |
name2 := "test_create_stop_timeout_2" |
| 380 | 379 |
dockerCmd(c, "create", "--name", name2, "busybox") |
| 381 | 380 |
|
| 382 | 381 |
res = inspectFieldJSON(c, name2, "Config.StopTimeout") |
| 383 |
- assert.Assert(c, res, checker.Contains, "null") |
|
| 382 |
+ assert.Assert(c, strings.Contains(res, "null")) |
|
| 384 | 383 |
} |
| ... | ... |
@@ -474,7 +474,7 @@ func (s *DockerDaemonSuite) TestDaemonIPv6HostMode(c *testing.T) {
|
| 474 | 474 |
|
| 475 | 475 |
out, err = s.d.Cmd("exec", "hostcnt", "ip", "-6", "addr", "show", "docker0")
|
| 476 | 476 |
assert.NilError(c, err, out) |
| 477 |
- assert.Assert(c, strings.Trim(out, " \r\n'"), checker.Contains, "2001:db8:2::1") |
|
| 477 |
+ assert.Assert(c, strings.Contains(strings.Trim(out, " \r\n'"), "2001:db8:2::1")) |
|
| 478 | 478 |
} |
| 479 | 479 |
|
| 480 | 480 |
func (s *DockerDaemonSuite) TestDaemonLogLevelWrong(c *testing.T) {
|
| ... | ... |
@@ -1154,7 +1154,7 @@ func (s *DockerDaemonSuite) TestDaemonLoggingDriverShouldBeIgnoredForBuild(c *te |
| 1154 | 1154 |
comment := check.Commentf("Failed to build image. output %s, exitCode %d, err %v", result.Combined(), result.ExitCode, result.Error)
|
| 1155 | 1155 |
assert.Assert(c, result.Error == nil, comment) |
| 1156 | 1156 |
assert.Equal(c, result.ExitCode, 0, comment) |
| 1157 |
- assert.Assert(c, result.Combined(), checker.Contains, "foo", comment) |
|
| 1157 |
+ assert.Assert(c, strings.Contains(result.Combined(), "foo"), comment) |
|
| 1158 | 1158 |
} |
| 1159 | 1159 |
|
| 1160 | 1160 |
func (s *DockerDaemonSuite) TestDaemonUnixSockCleanedUp(c *testing.T) {
|
| ... | ... |
@@ -1632,7 +1632,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartRmVolumeInUse(c *testing.T) {
|
| 1632 | 1632 |
|
| 1633 | 1633 |
out, err = s.d.Cmd("volume", "rm", "test")
|
| 1634 | 1634 |
assert.Assert(c, err != nil, check.Commentf("should not be able to remove in use volume after daemon restart"))
|
| 1635 |
- assert.Assert(c, out, checker.Contains, "in use") |
|
| 1635 |
+ assert.Assert(c, strings.Contains(out, "in use")) |
|
| 1636 | 1636 |
} |
| 1637 | 1637 |
|
| 1638 | 1638 |
func (s *DockerDaemonSuite) TestDaemonRestartLocalVolumes(c *testing.T) {
|
| ... | ... |
@@ -1781,7 +1781,7 @@ func (s *DockerDaemonSuite) TestDaemonNoSpaceLeftOnDeviceError(c *testing.T) {
|
| 1781 | 1781 |
// pull a repository large enough to overfill the mounted filesystem |
| 1782 | 1782 |
pullOut, err := s.d.Cmd("pull", "debian:stretch")
|
| 1783 | 1783 |
assert.Assert(c, err != nil, check.Commentf("%s", pullOut))
|
| 1784 |
- assert.Assert(c, pullOut, checker.Contains, "no space left on device") |
|
| 1784 |
+ assert.Assert(c, strings.Contains(pullOut, "no space left on device")) |
|
| 1785 | 1785 |
} |
| 1786 | 1786 |
|
| 1787 | 1787 |
// Test daemon restart with container links + auto restart |
| ... | ... |
@@ -2104,8 +2104,7 @@ func (s *DockerDaemonSuite) TestRunLinksChanged(c *testing.T) {
|
| 2104 | 2104 |
|
| 2105 | 2105 |
out, err = s.d.Cmd("run", "--name=test2", "--link=test:abc", "busybox", "sh", "-c", "ping -c 1 abc")
|
| 2106 | 2106 |
assert.NilError(c, err, out) |
| 2107 |
- assert.Assert(c, out, checker.Contains, "1 packets transmitted, 1 packets received") |
|
| 2108 |
- |
|
| 2107 |
+ assert.Assert(c, strings.Contains(out, "1 packets transmitted, 1 packets received")) |
|
| 2109 | 2108 |
out, err = s.d.Cmd("rm", "-f", "test")
|
| 2110 | 2109 |
assert.NilError(c, err, out) |
| 2111 | 2110 |
|
| ... | ... |
@@ -2145,8 +2144,7 @@ func (s *DockerDaemonSuite) TestDaemonStartWithoutColors(c *testing.T) {
|
| 2145 | 2145 |
s.d.Stop(c) |
| 2146 | 2146 |
// Wait for io.Copy() before checking output |
| 2147 | 2147 |
<-done |
| 2148 |
- assert.Assert(c, b.String(), checker.Contains, infoLog) |
|
| 2149 |
- |
|
| 2148 |
+ assert.Assert(c, strings.Contains(b.String(), infoLog)) |
|
| 2150 | 2149 |
b.Reset() |
| 2151 | 2150 |
|
| 2152 | 2151 |
// "tty" is already closed in prev s.d.Stop(), |
| ... | ... |
@@ -2187,7 +2185,7 @@ func (s *DockerDaemonSuite) TestDaemonDebugLog(c *testing.T) {
|
| 2187 | 2187 |
|
| 2188 | 2188 |
s.d.StartWithLogFile(tty, "--debug") |
| 2189 | 2189 |
s.d.Stop(c) |
| 2190 |
- assert.Assert(c, b.String(), checker.Contains, debugLog) |
|
| 2190 |
+ assert.Assert(c, strings.Contains(b.String(), debugLog)) |
|
| 2191 | 2191 |
} |
| 2192 | 2192 |
|
| 2193 | 2193 |
func (s *DockerDaemonSuite) TestDaemonDiscoveryBackendConfigReload(c *testing.T) {
|
| ... | ... |
@@ -2231,8 +2229,8 @@ func (s *DockerDaemonSuite) TestDaemonDiscoveryBackendConfigReload(c *testing.T) |
| 2231 | 2231 |
out, err := s.d.Cmd("info")
|
| 2232 | 2232 |
assert.NilError(c, err) |
| 2233 | 2233 |
|
| 2234 |
- assert.Assert(c, out, checker.Contains, fmt.Sprintf("Cluster Store: consul://consuladdr:consulport/some/path"))
|
|
| 2235 |
- assert.Assert(c, out, checker.Contains, fmt.Sprintf("Cluster Advertise: 192.168.56.100:0"))
|
|
| 2234 |
+ assert.Assert(c, strings.Contains(out, fmt.Sprintf("Cluster Store: consul://consuladdr:consulport/some/path")))
|
|
| 2235 |
+ assert.Assert(c, strings.Contains(out, fmt.Sprintf("Cluster Advertise: 192.168.56.100:0")))
|
|
| 2236 | 2236 |
} |
| 2237 | 2237 |
|
| 2238 | 2238 |
// Test for #21956 |
| ... | ... |
@@ -2245,7 +2243,7 @@ func (s *DockerDaemonSuite) TestDaemonLogOptions(c *testing.T) {
|
| 2245 | 2245 |
|
| 2246 | 2246 |
out, err = s.d.Cmd("inspect", "--format='{{.HostConfig.LogConfig}}'", id)
|
| 2247 | 2247 |
assert.NilError(c, err, out) |
| 2248 |
- assert.Assert(c, out, checker.Contains, "{json-file map[]}")
|
|
| 2248 |
+ assert.Assert(c, strings.Contains(out, "{json-file map[]}"))
|
|
| 2249 | 2249 |
} |
| 2250 | 2250 |
|
| 2251 | 2251 |
// Test case for #20936, #22443 |
| ... | ... |
@@ -2256,8 +2254,8 @@ func (s *DockerDaemonSuite) TestDaemonMaxConcurrency(c *testing.T) {
|
| 2256 | 2256 |
expectedMaxConcurrentDownloads := `level=debug msg="Max Concurrent Downloads: 8"` |
| 2257 | 2257 |
content, err := s.d.ReadLogFile() |
| 2258 | 2258 |
assert.NilError(c, err) |
| 2259 |
- assert.Assert(c, string(content), checker.Contains, expectedMaxConcurrentUploads) |
|
| 2260 |
- assert.Assert(c, string(content), checker.Contains, expectedMaxConcurrentDownloads) |
|
| 2259 |
+ assert.Assert(c, strings.Contains(string(content), expectedMaxConcurrentUploads)) |
|
| 2260 |
+ assert.Assert(c, strings.Contains(string(content), expectedMaxConcurrentDownloads)) |
|
| 2261 | 2261 |
} |
| 2262 | 2262 |
|
| 2263 | 2263 |
// Test case for #20936, #22443 |
| ... | ... |
@@ -2279,9 +2277,8 @@ func (s *DockerDaemonSuite) TestDaemonMaxConcurrencyWithConfigFile(c *testing.T) |
| 2279 | 2279 |
expectedMaxConcurrentDownloads := `level=debug msg="Max Concurrent Downloads: 8"` |
| 2280 | 2280 |
content, err := s.d.ReadLogFile() |
| 2281 | 2281 |
assert.NilError(c, err) |
| 2282 |
- assert.Assert(c, string(content), checker.Contains, expectedMaxConcurrentUploads) |
|
| 2283 |
- assert.Assert(c, string(content), checker.Contains, expectedMaxConcurrentDownloads) |
|
| 2284 |
- |
|
| 2282 |
+ assert.Assert(c, strings.Contains(string(content), expectedMaxConcurrentUploads)) |
|
| 2283 |
+ assert.Assert(c, strings.Contains(string(content), expectedMaxConcurrentDownloads)) |
|
| 2285 | 2284 |
configFile, err = os.Create(configFilePath) |
| 2286 | 2285 |
assert.NilError(c, err) |
| 2287 | 2286 |
daemonConfig = `{ "max-concurrent-uploads" : 7, "max-concurrent-downloads" : 9 }`
|
| ... | ... |
@@ -2297,8 +2294,8 @@ func (s *DockerDaemonSuite) TestDaemonMaxConcurrencyWithConfigFile(c *testing.T) |
| 2297 | 2297 |
expectedMaxConcurrentDownloads = `level=debug msg="Reset Max Concurrent Downloads: 9"` |
| 2298 | 2298 |
content, err = s.d.ReadLogFile() |
| 2299 | 2299 |
assert.NilError(c, err) |
| 2300 |
- assert.Assert(c, string(content), checker.Contains, expectedMaxConcurrentUploads) |
|
| 2301 |
- assert.Assert(c, string(content), checker.Contains, expectedMaxConcurrentDownloads) |
|
| 2300 |
+ assert.Assert(c, strings.Contains(string(content), expectedMaxConcurrentUploads)) |
|
| 2301 |
+ assert.Assert(c, strings.Contains(string(content), expectedMaxConcurrentDownloads)) |
|
| 2302 | 2302 |
} |
| 2303 | 2303 |
|
| 2304 | 2304 |
// Test case for #20936, #22443 |
| ... | ... |
@@ -2320,9 +2317,8 @@ func (s *DockerDaemonSuite) TestDaemonMaxConcurrencyWithConfigFileReload(c *test |
| 2320 | 2320 |
expectedMaxConcurrentDownloads := `level=debug msg="Max Concurrent Downloads: 3"` |
| 2321 | 2321 |
content, err := s.d.ReadLogFile() |
| 2322 | 2322 |
assert.NilError(c, err) |
| 2323 |
- assert.Assert(c, string(content), checker.Contains, expectedMaxConcurrentUploads) |
|
| 2324 |
- assert.Assert(c, string(content), checker.Contains, expectedMaxConcurrentDownloads) |
|
| 2325 |
- |
|
| 2323 |
+ assert.Assert(c, strings.Contains(string(content), expectedMaxConcurrentUploads)) |
|
| 2324 |
+ assert.Assert(c, strings.Contains(string(content), expectedMaxConcurrentDownloads)) |
|
| 2326 | 2325 |
configFile, err = os.Create(configFilePath) |
| 2327 | 2326 |
assert.NilError(c, err) |
| 2328 | 2327 |
daemonConfig = `{ "max-concurrent-uploads" : 1, "max-concurrent-downloads" : null }`
|
| ... | ... |
@@ -2338,9 +2334,8 @@ func (s *DockerDaemonSuite) TestDaemonMaxConcurrencyWithConfigFileReload(c *test |
| 2338 | 2338 |
expectedMaxConcurrentDownloads = `level=debug msg="Reset Max Concurrent Downloads: 3"` |
| 2339 | 2339 |
content, err = s.d.ReadLogFile() |
| 2340 | 2340 |
assert.NilError(c, err) |
| 2341 |
- assert.Assert(c, string(content), checker.Contains, expectedMaxConcurrentUploads) |
|
| 2342 |
- assert.Assert(c, string(content), checker.Contains, expectedMaxConcurrentDownloads) |
|
| 2343 |
- |
|
| 2341 |
+ assert.Assert(c, strings.Contains(string(content), expectedMaxConcurrentUploads)) |
|
| 2342 |
+ assert.Assert(c, strings.Contains(string(content), expectedMaxConcurrentDownloads)) |
|
| 2344 | 2343 |
configFile, err = os.Create(configFilePath) |
| 2345 | 2344 |
assert.NilError(c, err) |
| 2346 | 2345 |
daemonConfig = `{ "labels":["foo=bar"] }`
|
| ... | ... |
@@ -2355,8 +2350,8 @@ func (s *DockerDaemonSuite) TestDaemonMaxConcurrencyWithConfigFileReload(c *test |
| 2355 | 2355 |
expectedMaxConcurrentDownloads = `level=debug msg="Reset Max Concurrent Downloads: 3"` |
| 2356 | 2356 |
content, err = s.d.ReadLogFile() |
| 2357 | 2357 |
assert.NilError(c, err) |
| 2358 |
- assert.Assert(c, string(content), checker.Contains, expectedMaxConcurrentUploads) |
|
| 2359 |
- assert.Assert(c, string(content), checker.Contains, expectedMaxConcurrentDownloads) |
|
| 2358 |
+ assert.Assert(c, strings.Contains(string(content), expectedMaxConcurrentUploads)) |
|
| 2359 |
+ assert.Assert(c, strings.Contains(string(content), expectedMaxConcurrentDownloads)) |
|
| 2360 | 2360 |
} |
| 2361 | 2361 |
|
| 2362 | 2362 |
func (s *DockerDaemonSuite) TestBuildOnDisabledBridgeNetworkDaemon(c *testing.T) {
|
| ... | ... |
@@ -2381,11 +2376,11 @@ func (s *DockerDaemonSuite) TestDaemonDNSFlagsInHostMode(c *testing.T) {
|
| 2381 | 2381 |
|
| 2382 | 2382 |
expectedOutput := "nameserver 1.2.3.4" |
| 2383 | 2383 |
out, _ := s.d.Cmd("run", "--net=host", "busybox", "cat", "/etc/resolv.conf")
|
| 2384 |
- assert.Assert(c, out, checker.Contains, expectedOutput, check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 2384 |
+ assert.Assert(c, strings.Contains(out, expectedOutput), check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 2385 | 2385 |
expectedOutput = "search example.com" |
| 2386 |
- assert.Assert(c, out, checker.Contains, expectedOutput, check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 2386 |
+ assert.Assert(c, strings.Contains(out, expectedOutput), check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 2387 | 2387 |
expectedOutput = "options timeout:3" |
| 2388 |
- assert.Assert(c, out, checker.Contains, expectedOutput, check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 2388 |
+ assert.Assert(c, strings.Contains(out, expectedOutput), check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 2389 | 2389 |
} |
| 2390 | 2390 |
|
| 2391 | 2391 |
func (s *DockerDaemonSuite) TestRunWithRuntimeFromConfigFile(c *testing.T) {
|
| ... | ... |
@@ -2428,8 +2423,7 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromConfigFile(c *testing.T) {
|
| 2428 | 2428 |
// Run with "vm" |
| 2429 | 2429 |
out, err = s.d.Cmd("run", "--rm", "--runtime=vm", "busybox", "ls")
|
| 2430 | 2430 |
assert.ErrorContains(c, err, "", out) |
| 2431 |
- assert.Assert(c, out, checker.Contains, "/usr/local/bin/vm-manager: no such file or directory") |
|
| 2432 |
- |
|
| 2431 |
+ assert.Assert(c, strings.Contains(out, "/usr/local/bin/vm-manager: no such file or directory")) |
|
| 2433 | 2432 |
// Reset config to only have the default |
| 2434 | 2433 |
config = ` |
| 2435 | 2434 |
{
|
| ... | ... |
@@ -2449,13 +2443,11 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromConfigFile(c *testing.T) {
|
| 2449 | 2449 |
// Run with "oci" |
| 2450 | 2450 |
out, err = s.d.Cmd("run", "--rm", "--runtime=oci", "busybox", "ls")
|
| 2451 | 2451 |
assert.ErrorContains(c, err, "", out) |
| 2452 |
- assert.Assert(c, out, checker.Contains, "Unknown runtime specified oci") |
|
| 2453 |
- |
|
| 2452 |
+ assert.Assert(c, strings.Contains(out, "Unknown runtime specified oci")) |
|
| 2454 | 2453 |
// Start previously created container with oci |
| 2455 | 2454 |
out, err = s.d.Cmd("start", "oci-runtime-ls")
|
| 2456 | 2455 |
assert.ErrorContains(c, err, "", out) |
| 2457 |
- assert.Assert(c, out, checker.Contains, "Unknown runtime specified oci") |
|
| 2458 |
- |
|
| 2456 |
+ assert.Assert(c, strings.Contains(out, "Unknown runtime specified oci")) |
|
| 2459 | 2457 |
// Check that we can't override the default runtime |
| 2460 | 2458 |
config = ` |
| 2461 | 2459 |
{
|
| ... | ... |
@@ -2473,8 +2465,7 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromConfigFile(c *testing.T) {
|
| 2473 | 2473 |
|
| 2474 | 2474 |
content, err := s.d.ReadLogFile() |
| 2475 | 2475 |
assert.NilError(c, err) |
| 2476 |
- assert.Assert(c, string(content), checker.Contains, `file configuration validation failed: runtime name 'runc' is reserved`) |
|
| 2477 |
- |
|
| 2476 |
+ assert.Assert(c, strings.Contains(string(content), `file configuration validation failed: runtime name 'runc' is reserved`)) |
|
| 2478 | 2477 |
// Check that we can select a default runtime |
| 2479 | 2478 |
config = ` |
| 2480 | 2479 |
{
|
| ... | ... |
@@ -2499,8 +2490,7 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromConfigFile(c *testing.T) {
|
| 2499 | 2499 |
|
| 2500 | 2500 |
out, err = s.d.Cmd("run", "--rm", "busybox", "ls")
|
| 2501 | 2501 |
assert.ErrorContains(c, err, "", out) |
| 2502 |
- assert.Assert(c, out, checker.Contains, "/usr/local/bin/vm-manager: no such file or directory") |
|
| 2503 |
- |
|
| 2502 |
+ assert.Assert(c, strings.Contains(out, "/usr/local/bin/vm-manager: no such file or directory")) |
|
| 2504 | 2503 |
// Run with default runtime explicitly |
| 2505 | 2504 |
out, err = s.d.Cmd("run", "--rm", "--runtime=runc", "busybox", "ls")
|
| 2506 | 2505 |
assert.NilError(c, err, out) |
| ... | ... |
@@ -2524,8 +2514,7 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromCommandLine(c *testing.T) {
|
| 2524 | 2524 |
// Run with "vm" |
| 2525 | 2525 |
out, err = s.d.Cmd("run", "--rm", "--runtime=vm", "busybox", "ls")
|
| 2526 | 2526 |
assert.ErrorContains(c, err, "", out) |
| 2527 |
- assert.Assert(c, out, checker.Contains, "/usr/local/bin/vm-manager: no such file or directory") |
|
| 2528 |
- |
|
| 2527 |
+ assert.Assert(c, strings.Contains(out, "/usr/local/bin/vm-manager: no such file or directory")) |
|
| 2529 | 2528 |
// Start a daemon without any extra runtimes |
| 2530 | 2529 |
s.d.Stop(c) |
| 2531 | 2530 |
s.d.StartWithBusybox(c) |
| ... | ... |
@@ -2537,29 +2526,25 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromCommandLine(c *testing.T) {
|
| 2537 | 2537 |
// Run with "oci" |
| 2538 | 2538 |
out, err = s.d.Cmd("run", "--rm", "--runtime=oci", "busybox", "ls")
|
| 2539 | 2539 |
assert.ErrorContains(c, err, "", out) |
| 2540 |
- assert.Assert(c, out, checker.Contains, "Unknown runtime specified oci") |
|
| 2541 |
- |
|
| 2540 |
+ assert.Assert(c, strings.Contains(out, "Unknown runtime specified oci")) |
|
| 2542 | 2541 |
// Start previously created container with oci |
| 2543 | 2542 |
out, err = s.d.Cmd("start", "oci-runtime-ls")
|
| 2544 | 2543 |
assert.ErrorContains(c, err, "", out) |
| 2545 |
- assert.Assert(c, out, checker.Contains, "Unknown runtime specified oci") |
|
| 2546 |
- |
|
| 2544 |
+ assert.Assert(c, strings.Contains(out, "Unknown runtime specified oci")) |
|
| 2547 | 2545 |
// Check that we can't override the default runtime |
| 2548 | 2546 |
s.d.Stop(c) |
| 2549 | 2547 |
assert.Assert(c, s.d.StartWithError("--add-runtime", "runc=my-runc") != nil)
|
| 2550 | 2548 |
|
| 2551 | 2549 |
content, err := s.d.ReadLogFile() |
| 2552 | 2550 |
assert.NilError(c, err) |
| 2553 |
- assert.Assert(c, string(content), checker.Contains, `runtime name 'runc' is reserved`) |
|
| 2554 |
- |
|
| 2551 |
+ assert.Assert(c, strings.Contains(string(content), `runtime name 'runc' is reserved`)) |
|
| 2555 | 2552 |
// Check that we can select a default runtime |
| 2556 | 2553 |
s.d.Stop(c) |
| 2557 | 2554 |
s.d.StartWithBusybox(c, "--default-runtime=vm", "--add-runtime", "oci=runc", "--add-runtime", "vm=/usr/local/bin/vm-manager") |
| 2558 | 2555 |
|
| 2559 | 2556 |
out, err = s.d.Cmd("run", "--rm", "busybox", "ls")
|
| 2560 | 2557 |
assert.ErrorContains(c, err, "", out) |
| 2561 |
- assert.Assert(c, out, checker.Contains, "/usr/local/bin/vm-manager: no such file or directory") |
|
| 2562 |
- |
|
| 2558 |
+ assert.Assert(c, strings.Contains(out, "/usr/local/bin/vm-manager: no such file or directory")) |
|
| 2563 | 2559 |
// Run with default runtime explicitly |
| 2564 | 2560 |
out, err = s.d.Cmd("run", "--rm", "--runtime=runc", "busybox", "ls")
|
| 2565 | 2561 |
assert.NilError(c, err, out) |
| ... | ... |
@@ -2577,15 +2562,14 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithAutoRemoveContainer(c *testing. |
| 2577 | 2577 |
|
| 2578 | 2578 |
out, err = s.d.Cmd("ps")
|
| 2579 | 2579 |
assert.NilError(c, err) |
| 2580 |
- assert.Assert(c, out, checker.Contains, "top1", check.Commentf("top1 should be running"))
|
|
| 2581 |
- assert.Assert(c, out, checker.Contains, "top2", check.Commentf("top2 should be running"))
|
|
| 2582 |
- |
|
| 2580 |
+ assert.Assert(c, strings.Contains(out, "top1"), check.Commentf("top1 should be running"))
|
|
| 2581 |
+ assert.Assert(c, strings.Contains(out, "top2"), check.Commentf("top2 should be running"))
|
|
| 2583 | 2582 |
// now restart daemon gracefully |
| 2584 | 2583 |
s.d.Restart(c) |
| 2585 | 2584 |
|
| 2586 | 2585 |
out, err = s.d.Cmd("ps", "-a")
|
| 2587 | 2586 |
assert.NilError(c, err, "out: %v", out) |
| 2588 |
- assert.Assert(c, out, checker.Contains, "top1", check.Commentf("top1 should exist after daemon restarts"))
|
|
| 2587 |
+ assert.Assert(c, strings.Contains(out, "top1"), check.Commentf("top1 should exist after daemon restarts"))
|
|
| 2589 | 2588 |
assert.Assert(c, !strings.Contains(out, "top2"), check.Commentf("top2 should be removed after daemon restarts"))
|
| 2590 | 2589 |
} |
| 2591 | 2590 |
|
| ... | ... |
@@ -2613,8 +2597,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartSaveContainerExitCode(c *testing.T) |
| 2613 | 2613 |
errMsg1, err := s.d.Cmd("inspect", "-f", "{{.State.Error}}", containerName)
|
| 2614 | 2614 |
errMsg1 = strings.TrimSpace(errMsg1) |
| 2615 | 2615 |
assert.NilError(c, err) |
| 2616 |
- assert.Assert(c, errMsg1, checker.Contains, "executable file not found") |
|
| 2617 |
- |
|
| 2616 |
+ assert.Assert(c, strings.Contains(errMsg1, "executable file not found")) |
|
| 2618 | 2617 |
// now restart daemon |
| 2619 | 2618 |
s.d.Restart(c) |
| 2620 | 2619 |
|
| ... | ... |
@@ -2656,8 +2639,8 @@ func (s *DockerDaemonSuite) TestDaemonWithUserlandProxyPath(c *testing.T) {
|
| 2656 | 2656 |
s.d.Restart(c, "--userland-proxy-path", "/does/not/exist") |
| 2657 | 2657 |
out, err = s.d.Cmd("run", "-p", "5000:5000", "busybox:latest", "true")
|
| 2658 | 2658 |
assert.ErrorContains(c, err, "", out) |
| 2659 |
- assert.Assert(c, out, checker.Contains, "driver failed programming external connectivity on endpoint") |
|
| 2660 |
- assert.Assert(c, out, checker.Contains, "/does/not/exist: no such file or directory") |
|
| 2659 |
+ assert.Assert(c, strings.Contains(out, "driver failed programming external connectivity on endpoint")) |
|
| 2660 |
+ assert.Assert(c, strings.Contains(out, "/does/not/exist: no such file or directory")) |
|
| 2661 | 2661 |
} |
| 2662 | 2662 |
|
| 2663 | 2663 |
// Test case for #22471 |
| ... | ... |
@@ -2678,7 +2661,7 @@ func (s *DockerDaemonSuite) TestDaemonShutdownTimeout(c *testing.T) {
|
| 2678 | 2678 |
expectedMessage := `level=debug msg="daemon configured with a 3 seconds minimum shutdown timeout"` |
| 2679 | 2679 |
content, err := s.d.ReadLogFile() |
| 2680 | 2680 |
assert.NilError(c, err) |
| 2681 |
- assert.Assert(c, string(content), checker.Contains, expectedMessage) |
|
| 2681 |
+ assert.Assert(c, strings.Contains(string(content), expectedMessage)) |
|
| 2682 | 2682 |
} |
| 2683 | 2683 |
|
| 2684 | 2684 |
// Test case for #22471 |
| ... | ... |
@@ -2712,7 +2695,7 @@ func (s *DockerDaemonSuite) TestDaemonShutdownTimeoutWithConfigFile(c *testing.T |
| 2712 | 2712 |
expectedMessage := `level=debug msg="Reset Shutdown Timeout: 5"` |
| 2713 | 2713 |
content, err := s.d.ReadLogFile() |
| 2714 | 2714 |
assert.NilError(c, err) |
| 2715 |
- assert.Assert(c, string(content), checker.Contains, expectedMessage) |
|
| 2715 |
+ assert.Assert(c, strings.Contains(string(content), expectedMessage)) |
|
| 2716 | 2716 |
} |
| 2717 | 2717 |
|
| 2718 | 2718 |
// Test case for 29342 |
| ... | ... |
@@ -17,7 +17,6 @@ import ( |
| 17 | 17 |
"time" |
| 18 | 18 |
|
| 19 | 19 |
"github.com/docker/docker/api/types" |
| 20 |
- "github.com/docker/docker/integration-cli/checker" |
|
| 21 | 20 |
"github.com/docker/docker/integration-cli/daemon" |
| 22 | 21 |
testdaemon "github.com/docker/docker/internal/test/daemon" |
| 23 | 22 |
"github.com/docker/docker/pkg/stringid" |
| ... | ... |
@@ -287,8 +286,7 @@ func (s *DockerExternalVolumeSuite) TestVolumeCLICreateOptionConflict(c *testing |
| 287 | 287 |
|
| 288 | 288 |
out, _, err := dockerCmdWithError("volume", "create", "test", "--driver", volumePluginName)
|
| 289 | 289 |
assert.Assert(c, err != nil, check.Commentf("volume create exception name already in use with another driver"))
|
| 290 |
- assert.Assert(c, out, checker.Contains, "must be unique") |
|
| 291 |
- |
|
| 290 |
+ assert.Assert(c, strings.Contains(out, "must be unique")) |
|
| 292 | 291 |
out, _ = dockerCmd(c, "volume", "inspect", "--format={{ .Driver }}", "test")
|
| 293 | 292 |
_, _, err = dockerCmdWithError("volume", "create", "test", "--driver", strings.TrimSpace(out))
|
| 294 | 293 |
assert.NilError(c, err) |
| ... | ... |
@@ -299,8 +297,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverNamed(c *testing.T) |
| 299 | 299 |
|
| 300 | 300 |
out, err := s.d.Cmd("run", "--rm", "--name", "test-data", "-v", "external-volume-test:/tmp/external-volume-test", "--volume-driver", volumePluginName, "busybox:latest", "cat", "/tmp/external-volume-test/test")
|
| 301 | 301 |
assert.NilError(c, err, out) |
| 302 |
- assert.Assert(c, out, checker.Contains, s.Server.URL) |
|
| 303 |
- |
|
| 302 |
+ assert.Assert(c, strings.Contains(out, s.Server.URL)) |
|
| 304 | 303 |
_, err = s.d.Cmd("volume", "rm", "external-volume-test")
|
| 305 | 304 |
assert.NilError(c, err) |
| 306 | 305 |
|
| ... | ... |
@@ -321,8 +318,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnnamed(c *testing.T |
| 321 | 321 |
|
| 322 | 322 |
out, err := s.d.Cmd("run", "--rm", "--name", "test-data", "-v", "/tmp/external-volume-test", "--volume-driver", volumePluginName, "busybox:latest", "cat", "/tmp/external-volume-test/test")
|
| 323 | 323 |
assert.NilError(c, err, out) |
| 324 |
- assert.Assert(c, out, checker.Contains, s.Server.URL) |
|
| 325 |
- |
|
| 324 |
+ assert.Assert(c, strings.Contains(out, s.Server.URL)) |
|
| 326 | 325 |
assert.Equal(c, s.ec.activations, 1) |
| 327 | 326 |
assert.Equal(c, s.ec.creations, 1) |
| 328 | 327 |
assert.Equal(c, s.ec.removals, 1) |
| ... | ... |
@@ -475,7 +471,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverList(c *testing.T) {
|
| 475 | 475 |
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverGet(c *testing.T) {
|
| 476 | 476 |
out, _, err := dockerCmdWithError("volume", "inspect", "dummy")
|
| 477 | 477 |
assert.ErrorContains(c, err, "", out) |
| 478 |
- assert.Assert(c, out, checker.Contains, "No such volume") |
|
| 478 |
+ assert.Assert(c, strings.Contains(out, "No such volume")) |
|
| 479 | 479 |
assert.Equal(c, s.ec.gets, 1) |
| 480 | 480 |
|
| 481 | 481 |
dockerCmd(c, "volume", "create", "test", "-d", volumePluginName) |
| ... | ... |
@@ -513,7 +509,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverGetEmptyResponse(c * |
| 513 | 513 |
|
| 514 | 514 |
out, err = s.d.Cmd("volume", "inspect", "abc2")
|
| 515 | 515 |
assert.ErrorContains(c, err, "", out) |
| 516 |
- assert.Assert(c, out, checker.Contains, "No such volume") |
|
| 516 |
+ assert.Assert(c, strings.Contains(out, "No such volume")) |
|
| 517 | 517 |
} |
| 518 | 518 |
|
| 519 | 519 |
// Ensure only cached paths are used in volume list to prevent N+1 calls to `VolumeDriver.Path` |
| ... | ... |
@@ -568,8 +564,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverOutOfBandDelete(c *t |
| 568 | 568 |
|
| 569 | 569 |
out, err = s.d.Cmd("volume", "create", "-d", "local", "--name", "test")
|
| 570 | 570 |
assert.ErrorContains(c, err, "", out) |
| 571 |
- assert.Assert(c, out, checker.Contains, "must be unique") |
|
| 572 |
- |
|
| 571 |
+ assert.Assert(c, strings.Contains(out, "must be unique")) |
|
| 573 | 572 |
// simulate out of band volume deletion on plugin level |
| 574 | 573 |
delete(p.vols, "test") |
| 575 | 574 |
|
| ... | ... |
@@ -7,7 +7,6 @@ import ( |
| 7 | 7 |
"strings" |
| 8 | 8 |
"testing" |
| 9 | 9 |
|
| 10 |
- "github.com/docker/docker/integration-cli/checker" |
|
| 11 | 10 |
"github.com/docker/docker/integration-cli/cli/build" |
| 12 | 11 |
"github.com/go-check/check" |
| 13 | 12 |
"gotest.tools/assert" |
| ... | ... |
@@ -53,7 +52,7 @@ LABEL label.Z="Z"`)) |
| 53 | 53 |
for i := 0; i < 26; i++ {
|
| 54 | 54 |
echoValue := fmt.Sprintf("LABEL label.%s=%s", expectedValues[i], expectedValues[i])
|
| 55 | 55 |
actualValue := actualValues[i] |
| 56 |
- assert.Assert(c, actualValue, checker.Contains, echoValue) |
|
| 56 |
+ assert.Assert(c, strings.Contains(actualValue, echoValue)) |
|
| 57 | 57 |
} |
| 58 | 58 |
|
| 59 | 59 |
} |
| ... | ... |
@@ -83,7 +82,7 @@ func (s *DockerSuite) TestHistoryImageWithComment(c *testing.T) {
|
| 83 | 83 |
out, _ := dockerCmd(c, "history", name) |
| 84 | 84 |
outputTabs := strings.Fields(strings.Split(out, "\n")[1]) |
| 85 | 85 |
actualValue := outputTabs[len(outputTabs)-1] |
| 86 |
- assert.Assert(c, actualValue, checker.Contains, comment) |
|
| 86 |
+ assert.Assert(c, strings.Contains(actualValue, comment)) |
|
| 87 | 87 |
} |
| 88 | 88 |
|
| 89 | 89 |
func (s *DockerSuite) TestHistoryHumanOptionFalse(c *testing.T) {
|
| ... | ... |
@@ -11,7 +11,6 @@ import ( |
| 11 | 11 |
"testing" |
| 12 | 12 |
"time" |
| 13 | 13 |
|
| 14 |
- "github.com/docker/docker/integration-cli/checker" |
|
| 15 | 14 |
"github.com/docker/docker/integration-cli/cli/build" |
| 16 | 15 |
"github.com/docker/docker/pkg/stringid" |
| 17 | 16 |
"github.com/go-check/check" |
| ... | ... |
@@ -22,7 +21,7 @@ import ( |
| 22 | 22 |
|
| 23 | 23 |
func (s *DockerSuite) TestImagesEnsureImageIsListed(c *testing.T) {
|
| 24 | 24 |
imagesOut, _ := dockerCmd(c, "images") |
| 25 |
- assert.Assert(c, imagesOut, checker.Contains, "busybox") |
|
| 25 |
+ assert.Assert(c, strings.Contains(imagesOut, "busybox")) |
|
| 26 | 26 |
} |
| 27 | 27 |
|
| 28 | 28 |
func (s *DockerSuite) TestImagesEnsureImageWithTagIsListed(c *testing.T) {
|
| ... | ... |
@@ -32,15 +31,15 @@ func (s *DockerSuite) TestImagesEnsureImageWithTagIsListed(c *testing.T) {
|
| 32 | 32 |
dockerCmd(c, "tag", "busybox", name+":v2") |
| 33 | 33 |
|
| 34 | 34 |
imagesOut, _ := dockerCmd(c, "images", name+":v1") |
| 35 |
- assert.Assert(c, imagesOut, checker.Contains, name) |
|
| 36 |
- assert.Assert(c, imagesOut, checker.Contains, "v1") |
|
| 35 |
+ assert.Assert(c, strings.Contains(imagesOut, name)) |
|
| 36 |
+ assert.Assert(c, strings.Contains(imagesOut, "v1")) |
|
| 37 | 37 |
assert.Assert(c, !strings.Contains(imagesOut, "v2")) |
| 38 | 38 |
assert.Assert(c, !strings.Contains(imagesOut, "v1v1")) |
| 39 | 39 |
imagesOut, _ = dockerCmd(c, "images", name) |
| 40 |
- assert.Assert(c, imagesOut, checker.Contains, name) |
|
| 41 |
- assert.Assert(c, imagesOut, checker.Contains, "v1") |
|
| 42 |
- assert.Assert(c, imagesOut, checker.Contains, "v1v1") |
|
| 43 |
- assert.Assert(c, imagesOut, checker.Contains, "v2") |
|
| 40 |
+ assert.Assert(c, strings.Contains(imagesOut, name)) |
|
| 41 |
+ assert.Assert(c, strings.Contains(imagesOut, "v1")) |
|
| 42 |
+ assert.Assert(c, strings.Contains(imagesOut, "v1v1")) |
|
| 43 |
+ assert.Assert(c, strings.Contains(imagesOut, "v2")) |
|
| 44 | 44 |
} |
| 45 | 45 |
|
| 46 | 46 |
func (s *DockerSuite) TestImagesEnsureImageWithBadTagIsNotListed(c *testing.T) {
|
| ... | ... |
@@ -71,7 +70,7 @@ func (s *DockerSuite) TestImagesOrderedByCreationDate(c *testing.T) {
|
| 71 | 71 |
func (s *DockerSuite) TestImagesErrorWithInvalidFilterNameTest(c *testing.T) {
|
| 72 | 72 |
out, _, err := dockerCmdWithError("images", "-f", "FOO=123")
|
| 73 | 73 |
assert.ErrorContains(c, err, "") |
| 74 |
- assert.Assert(c, out, checker.Contains, "Invalid filter") |
|
| 74 |
+ assert.Assert(c, strings.Contains(out, "Invalid filter")) |
|
| 75 | 75 |
} |
| 76 | 76 |
|
| 77 | 77 |
func (s *DockerSuite) TestImagesFilterLabelMatch(c *testing.T) {
|
| ... | ... |
@@ -258,15 +257,14 @@ func (s *DockerSuite) TestImagesEnsureDanglingImageOnlyListedOnce(c *testing.T) |
| 258 | 258 |
assert.Assert(c, !strings.Contains(out, imageID)) |
| 259 | 259 |
out, _ = dockerCmd(c, "images") |
| 260 | 260 |
//docker images still include dangling images |
| 261 |
- assert.Assert(c, out, checker.Contains, imageID) |
|
| 262 |
- |
|
| 261 |
+ assert.Assert(c, strings.Contains(out, imageID)) |
|
| 263 | 262 |
} |
| 264 | 263 |
|
| 265 | 264 |
// FIXME(vdemeester) should be a unit test for `docker image ls` |
| 266 | 265 |
func (s *DockerSuite) TestImagesWithIncorrectFilter(c *testing.T) {
|
| 267 | 266 |
out, _, err := dockerCmdWithError("images", "-f", "dangling=invalid")
|
| 268 | 267 |
assert.ErrorContains(c, err, "") |
| 269 |
- assert.Assert(c, out, checker.Contains, "Invalid filter") |
|
| 268 |
+ assert.Assert(c, strings.Contains(out, "Invalid filter")) |
|
| 270 | 269 |
} |
| 271 | 270 |
|
| 272 | 271 |
func (s *DockerSuite) TestImagesEnsureOnlyHeadsImagesShown(c *testing.T) {
|
| ... | ... |
@@ -289,7 +287,7 @@ func (s *DockerSuite) TestImagesEnsureOnlyHeadsImagesShown(c *testing.T) {
|
| 289 | 289 |
// images shouldn't show non-heads images |
| 290 | 290 |
assert.Assert(c, !strings.Contains(out, intermediate)) |
| 291 | 291 |
// images should contain final built images |
| 292 |
- assert.Assert(c, out, checker.Contains, stringid.TruncateID(id)) |
|
| 292 |
+ assert.Assert(c, strings.Contains(out, stringid.TruncateID(id))) |
|
| 293 | 293 |
} |
| 294 | 294 |
|
| 295 | 295 |
func (s *DockerSuite) TestImagesEnsureImagesFromScratchShown(c *testing.T) {
|
| ... | ... |
@@ -304,7 +302,7 @@ func (s *DockerSuite) TestImagesEnsureImagesFromScratchShown(c *testing.T) {
|
| 304 | 304 |
|
| 305 | 305 |
out, _ := dockerCmd(c, "images") |
| 306 | 306 |
// images should contain images built from scratch |
| 307 |
- assert.Assert(c, out, checker.Contains, stringid.TruncateID(id)) |
|
| 307 |
+ assert.Assert(c, strings.Contains(out, stringid.TruncateID(id))) |
|
| 308 | 308 |
} |
| 309 | 309 |
|
| 310 | 310 |
// For W2W - equivalent to TestImagesEnsureImagesFromScratchShown but Windows |
| ... | ... |
@@ -320,7 +318,7 @@ func (s *DockerSuite) TestImagesEnsureImagesFromBusyboxShown(c *testing.T) {
|
| 320 | 320 |
|
| 321 | 321 |
out, _ := dockerCmd(c, "images") |
| 322 | 322 |
// images should contain images built from busybox |
| 323 |
- assert.Assert(c, out, checker.Contains, stringid.TruncateID(id)) |
|
| 323 |
+ assert.Assert(c, strings.Contains(out, stringid.TruncateID(id))) |
|
| 324 | 324 |
} |
| 325 | 325 |
|
| 326 | 326 |
// #18181 |
| ... | ... |
@@ -328,11 +326,9 @@ func (s *DockerSuite) TestImagesFilterNameWithPort(c *testing.T) {
|
| 328 | 328 |
tag := "a.b.c.d:5000/hello" |
| 329 | 329 |
dockerCmd(c, "tag", "busybox", tag) |
| 330 | 330 |
out, _ := dockerCmd(c, "images", tag) |
| 331 |
- assert.Assert(c, out, checker.Contains, tag) |
|
| 332 |
- |
|
| 331 |
+ assert.Assert(c, strings.Contains(out, tag)) |
|
| 333 | 332 |
out, _ = dockerCmd(c, "images", tag+":latest") |
| 334 |
- assert.Assert(c, out, checker.Contains, tag) |
|
| 335 |
- |
|
| 333 |
+ assert.Assert(c, strings.Contains(out, tag)) |
|
| 336 | 334 |
out, _ = dockerCmd(c, "images", tag+":no-such-tag") |
| 337 | 335 |
assert.Assert(c, !strings.Contains(out, tag)) |
| 338 | 336 |
} |
| ... | ... |
@@ -7,7 +7,6 @@ import ( |
| 7 | 7 |
"strings" |
| 8 | 8 |
"testing" |
| 9 | 9 |
|
| 10 |
- "github.com/docker/docker/integration-cli/checker" |
|
| 11 | 10 |
"github.com/docker/docker/integration-cli/daemon" |
| 12 | 11 |
testdaemon "github.com/docker/docker/internal/test/daemon" |
| 13 | 12 |
"github.com/go-check/check" |
| ... | ... |
@@ -54,7 +53,7 @@ func (s *DockerSuite) TestInfoEnsureSucceeds(c *testing.T) {
|
| 54 | 54 |
} |
| 55 | 55 |
|
| 56 | 56 |
for _, linePrefix := range stringsToCheck {
|
| 57 |
- assert.Assert(c, out, checker.Contains, linePrefix, check.Commentf("couldn't find string %v in output", linePrefix))
|
|
| 57 |
+ assert.Assert(c, strings.Contains(out, linePrefix), check.Commentf("couldn't find string %v in output", linePrefix))
|
|
| 58 | 58 |
} |
| 59 | 59 |
} |
| 60 | 60 |
|
| ... | ... |
@@ -82,8 +81,8 @@ func (s *DockerSuite) TestInfoDiscoveryBackend(c *testing.T) {
|
| 82 | 82 |
|
| 83 | 83 |
out, err := d.Cmd("info")
|
| 84 | 84 |
assert.NilError(c, err) |
| 85 |
- assert.Assert(c, out, checker.Contains, fmt.Sprintf("Cluster Store: %s\n", discoveryBackend))
|
|
| 86 |
- assert.Assert(c, out, checker.Contains, fmt.Sprintf("Cluster Advertise: %s\n", discoveryAdvertise))
|
|
| 85 |
+ assert.Assert(c, strings.Contains(out, fmt.Sprintf("Cluster Store: %s\n", discoveryBackend)))
|
|
| 86 |
+ assert.Assert(c, strings.Contains(out, fmt.Sprintf("Cluster Advertise: %s\n", discoveryAdvertise)))
|
|
| 87 | 87 |
} |
| 88 | 88 |
|
| 89 | 89 |
// TestInfoDiscoveryInvalidAdvertise verifies that a daemon run with |
| ... | ... |
@@ -125,8 +124,8 @@ func (s *DockerSuite) TestInfoDiscoveryAdvertiseInterfaceName(c *testing.T) {
|
| 125 | 125 |
|
| 126 | 126 |
out, err := d.Cmd("info")
|
| 127 | 127 |
assert.NilError(c, err) |
| 128 |
- assert.Assert(c, out, checker.Contains, fmt.Sprintf("Cluster Store: %s\n", discoveryBackend))
|
|
| 129 |
- assert.Assert(c, out, checker.Contains, fmt.Sprintf("Cluster Advertise: %s:2375\n", ip.String()))
|
|
| 128 |
+ assert.Assert(c, strings.Contains(out, fmt.Sprintf("Cluster Store: %s\n", discoveryBackend)))
|
|
| 129 |
+ assert.Assert(c, strings.Contains(out, fmt.Sprintf("Cluster Advertise: %s:2375\n", ip.String())))
|
|
| 130 | 130 |
} |
| 131 | 131 |
|
| 132 | 132 |
func (s *DockerSuite) TestInfoDisplaysRunningContainers(c *testing.T) {
|
| ... | ... |
@@ -136,10 +135,10 @@ func (s *DockerSuite) TestInfoDisplaysRunningContainers(c *testing.T) {
|
| 136 | 136 |
|
| 137 | 137 |
dockerCmd(c, "run", "-d", "busybox", "top") |
| 138 | 138 |
out, _ := dockerCmd(c, "info") |
| 139 |
- assert.Assert(c, out, checker.Contains, fmt.Sprintf("Containers: %d\n", existing["Containers"]+1))
|
|
| 140 |
- assert.Assert(c, out, checker.Contains, fmt.Sprintf(" Running: %d\n", existing["ContainersRunning"]+1))
|
|
| 141 |
- assert.Assert(c, out, checker.Contains, fmt.Sprintf(" Paused: %d\n", existing["ContainersPaused"]))
|
|
| 142 |
- assert.Assert(c, out, checker.Contains, fmt.Sprintf(" Stopped: %d\n", existing["ContainersStopped"]))
|
|
| 139 |
+ assert.Assert(c, strings.Contains(out, fmt.Sprintf("Containers: %d\n", existing["Containers"]+1)))
|
|
| 140 |
+ assert.Assert(c, strings.Contains(out, fmt.Sprintf(" Running: %d\n", existing["ContainersRunning"]+1)))
|
|
| 141 |
+ assert.Assert(c, strings.Contains(out, fmt.Sprintf(" Paused: %d\n", existing["ContainersPaused"])))
|
|
| 142 |
+ assert.Assert(c, strings.Contains(out, fmt.Sprintf(" Stopped: %d\n", existing["ContainersStopped"])))
|
|
| 143 | 143 |
} |
| 144 | 144 |
|
| 145 | 145 |
func (s *DockerSuite) TestInfoDisplaysPausedContainers(c *testing.T) {
|
| ... | ... |
@@ -153,10 +152,10 @@ func (s *DockerSuite) TestInfoDisplaysPausedContainers(c *testing.T) {
|
| 153 | 153 |
dockerCmd(c, "pause", cleanedContainerID) |
| 154 | 154 |
|
| 155 | 155 |
out, _ = dockerCmd(c, "info") |
| 156 |
- assert.Assert(c, out, checker.Contains, fmt.Sprintf("Containers: %d\n", existing["Containers"]+1))
|
|
| 157 |
- assert.Assert(c, out, checker.Contains, fmt.Sprintf(" Running: %d\n", existing["ContainersRunning"]))
|
|
| 158 |
- assert.Assert(c, out, checker.Contains, fmt.Sprintf(" Paused: %d\n", existing["ContainersPaused"]+1))
|
|
| 159 |
- assert.Assert(c, out, checker.Contains, fmt.Sprintf(" Stopped: %d\n", existing["ContainersStopped"]))
|
|
| 156 |
+ assert.Assert(c, strings.Contains(out, fmt.Sprintf("Containers: %d\n", existing["Containers"]+1)))
|
|
| 157 |
+ assert.Assert(c, strings.Contains(out, fmt.Sprintf(" Running: %d\n", existing["ContainersRunning"])))
|
|
| 158 |
+ assert.Assert(c, strings.Contains(out, fmt.Sprintf(" Paused: %d\n", existing["ContainersPaused"]+1)))
|
|
| 159 |
+ assert.Assert(c, strings.Contains(out, fmt.Sprintf(" Stopped: %d\n", existing["ContainersStopped"])))
|
|
| 160 | 160 |
} |
| 161 | 161 |
|
| 162 | 162 |
func (s *DockerSuite) TestInfoDisplaysStoppedContainers(c *testing.T) {
|
| ... | ... |
@@ -170,10 +169,10 @@ func (s *DockerSuite) TestInfoDisplaysStoppedContainers(c *testing.T) {
|
| 170 | 170 |
dockerCmd(c, "stop", cleanedContainerID) |
| 171 | 171 |
|
| 172 | 172 |
out, _ = dockerCmd(c, "info") |
| 173 |
- assert.Assert(c, out, checker.Contains, fmt.Sprintf("Containers: %d\n", existing["Containers"]+1))
|
|
| 174 |
- assert.Assert(c, out, checker.Contains, fmt.Sprintf(" Running: %d\n", existing["ContainersRunning"]))
|
|
| 175 |
- assert.Assert(c, out, checker.Contains, fmt.Sprintf(" Paused: %d\n", existing["ContainersPaused"]))
|
|
| 176 |
- assert.Assert(c, out, checker.Contains, fmt.Sprintf(" Stopped: %d\n", existing["ContainersStopped"]+1))
|
|
| 173 |
+ assert.Assert(c, strings.Contains(out, fmt.Sprintf("Containers: %d\n", existing["Containers"]+1)))
|
|
| 174 |
+ assert.Assert(c, strings.Contains(out, fmt.Sprintf(" Running: %d\n", existing["ContainersRunning"])))
|
|
| 175 |
+ assert.Assert(c, strings.Contains(out, fmt.Sprintf(" Paused: %d\n", existing["ContainersPaused"])))
|
|
| 176 |
+ assert.Assert(c, strings.Contains(out, fmt.Sprintf(" Stopped: %d\n", existing["ContainersStopped"]+1)))
|
|
| 177 | 177 |
} |
| 178 | 178 |
|
| 179 | 179 |
func (s *DockerSuite) TestInfoDebug(c *testing.T) {
|
| ... | ... |
@@ -185,13 +184,13 @@ func (s *DockerSuite) TestInfoDebug(c *testing.T) {
|
| 185 | 185 |
|
| 186 | 186 |
out, err := d.Cmd("--debug", "info")
|
| 187 | 187 |
assert.NilError(c, err) |
| 188 |
- assert.Assert(c, out, checker.Contains, "Debug Mode (client): true\n") |
|
| 189 |
- assert.Assert(c, out, checker.Contains, "Debug Mode (server): true\n") |
|
| 190 |
- assert.Assert(c, out, checker.Contains, "File Descriptors") |
|
| 191 |
- assert.Assert(c, out, checker.Contains, "Goroutines") |
|
| 192 |
- assert.Assert(c, out, checker.Contains, "System Time") |
|
| 193 |
- assert.Assert(c, out, checker.Contains, "EventsListeners") |
|
| 194 |
- assert.Assert(c, out, checker.Contains, "Docker Root Dir") |
|
| 188 |
+ assert.Assert(c, strings.Contains(out, "Debug Mode (client): true\n")) |
|
| 189 |
+ assert.Assert(c, strings.Contains(out, "Debug Mode (server): true\n")) |
|
| 190 |
+ assert.Assert(c, strings.Contains(out, "File Descriptors")) |
|
| 191 |
+ assert.Assert(c, strings.Contains(out, "Goroutines")) |
|
| 192 |
+ assert.Assert(c, strings.Contains(out, "System Time")) |
|
| 193 |
+ assert.Assert(c, strings.Contains(out, "EventsListeners")) |
|
| 194 |
+ assert.Assert(c, strings.Contains(out, "Docker Root Dir")) |
|
| 195 | 195 |
} |
| 196 | 196 |
|
| 197 | 197 |
func (s *DockerSuite) TestInsecureRegistries(c *testing.T) {
|
| ... | ... |
@@ -206,9 +205,9 @@ func (s *DockerSuite) TestInsecureRegistries(c *testing.T) {
|
| 206 | 206 |
|
| 207 | 207 |
out, err := d.Cmd("info")
|
| 208 | 208 |
assert.NilError(c, err) |
| 209 |
- assert.Assert(c, out, checker.Contains, "Insecure Registries:\n") |
|
| 210 |
- assert.Assert(c, out, checker.Contains, fmt.Sprintf(" %s\n", registryHost))
|
|
| 211 |
- assert.Assert(c, out, checker.Contains, fmt.Sprintf(" %s\n", registryCIDR))
|
|
| 209 |
+ assert.Assert(c, strings.Contains(out, "Insecure Registries:\n")) |
|
| 210 |
+ assert.Assert(c, strings.Contains(out, fmt.Sprintf(" %s\n", registryHost)))
|
|
| 211 |
+ assert.Assert(c, strings.Contains(out, fmt.Sprintf(" %s\n", registryCIDR)))
|
|
| 212 | 212 |
} |
| 213 | 213 |
|
| 214 | 214 |
func (s *DockerDaemonSuite) TestRegistryMirrors(c *testing.T) {
|
| ... | ... |
@@ -220,9 +219,9 @@ func (s *DockerDaemonSuite) TestRegistryMirrors(c *testing.T) {
|
| 220 | 220 |
|
| 221 | 221 |
out, err := s.d.Cmd("info")
|
| 222 | 222 |
assert.NilError(c, err) |
| 223 |
- assert.Assert(c, out, checker.Contains, "Registry Mirrors:\n") |
|
| 224 |
- assert.Assert(c, out, checker.Contains, fmt.Sprintf(" %s", registryMirror1))
|
|
| 225 |
- assert.Assert(c, out, checker.Contains, fmt.Sprintf(" %s", registryMirror2))
|
|
| 223 |
+ assert.Assert(c, strings.Contains(out, "Registry Mirrors:\n")) |
|
| 224 |
+ assert.Assert(c, strings.Contains(out, fmt.Sprintf(" %s", registryMirror1)))
|
|
| 225 |
+ assert.Assert(c, strings.Contains(out, fmt.Sprintf(" %s", registryMirror2)))
|
|
| 226 | 226 |
} |
| 227 | 227 |
|
| 228 | 228 |
func existingContainerStates(c *testing.T) map[string]int {
|
| ... | ... |
@@ -3,9 +3,9 @@ |
| 3 | 3 |
package main |
| 4 | 4 |
|
| 5 | 5 |
import ( |
| 6 |
+ "strings" |
|
| 6 | 7 |
"testing" |
| 7 | 8 |
|
| 8 |
- "github.com/docker/docker/integration-cli/checker" |
|
| 9 | 9 |
"gotest.tools/assert" |
| 10 | 10 |
) |
| 11 | 11 |
|
| ... | ... |
@@ -13,5 +13,5 @@ func (s *DockerSuite) TestInfoSecurityOptions(c *testing.T) {
|
| 13 | 13 |
testRequires(c, testEnv.IsLocalDaemon, seccompEnabled, Apparmor, DaemonIsLinux) |
| 14 | 14 |
|
| 15 | 15 |
out, _ := dockerCmd(c, "info") |
| 16 |
- assert.Assert(c, out, checker.Contains, "Security Options:\n apparmor\n seccomp\n Profile: default\n") |
|
| 16 |
+ assert.Assert(c, strings.Contains(out, "Security Options:\n apparmor\n seccomp\n Profile: default\n")) |
|
| 17 | 17 |
} |
| ... | ... |
@@ -11,7 +11,6 @@ import ( |
| 11 | 11 |
|
| 12 | 12 |
"github.com/docker/docker/api/types" |
| 13 | 13 |
"github.com/docker/docker/api/types/container" |
| 14 |
- "github.com/docker/docker/integration-cli/checker" |
|
| 15 | 14 |
"github.com/go-check/check" |
| 16 | 15 |
"gotest.tools/assert" |
| 17 | 16 |
"gotest.tools/icmd" |
| ... | ... |
@@ -122,7 +121,7 @@ func (s *DockerSuite) TestInspectTypeFlagWithInvalidValue(c *testing.T) {
|
| 122 | 122 |
out, exitCode, err := dockerCmdWithError("inspect", "--type=foobar", "busybox")
|
| 123 | 123 |
assert.Assert(c, err != nil, check.Commentf("%d", exitCode))
|
| 124 | 124 |
assert.Equal(c, exitCode, 1, check.Commentf("%s", err))
|
| 125 |
- assert.Assert(c, out, checker.Contains, "not a valid value for --type") |
|
| 125 |
+ assert.Assert(c, strings.Contains(out, "not a valid value for --type")) |
|
| 126 | 126 |
} |
| 127 | 127 |
|
| 128 | 128 |
func (s *DockerSuite) TestInspectImageFilterInt(c *testing.T) {
|
| ... | ... |
@@ -326,11 +325,10 @@ func (s *DockerSuite) TestInspectTemplateError(c *testing.T) {
|
| 326 | 326 |
|
| 327 | 327 |
out, _, err := dockerCmdWithError("inspect", "--type=container", "--format='Format container: {{.ThisDoesNotExist}}'", "container1")
|
| 328 | 328 |
assert.Assert(c, err != nil) |
| 329 |
- assert.Assert(c, out, checker.Contains, "Template parsing error") |
|
| 330 |
- |
|
| 329 |
+ assert.Assert(c, strings.Contains(out, "Template parsing error")) |
|
| 331 | 330 |
out, _, err = dockerCmdWithError("inspect", "--type=image", "--format='Format container: {{.ThisDoesNotExist}}'", "busybox")
|
| 332 | 331 |
assert.Assert(c, err != nil) |
| 333 |
- assert.Assert(c, out, checker.Contains, "Template parsing error") |
|
| 332 |
+ assert.Assert(c, strings.Contains(out, "Template parsing error")) |
|
| 334 | 333 |
} |
| 335 | 334 |
|
| 336 | 335 |
func (s *DockerSuite) TestInspectJSONFields(c *testing.T) {
|
| ... | ... |
@@ -358,17 +356,16 @@ func (s *DockerSuite) TestInspectStopWhenNotFound(c *testing.T) {
|
| 358 | 358 |
result := dockerCmdWithResult("inspect", "--type=container", "--format='{{.Name}}'", "busybox1", "busybox2", "missing")
|
| 359 | 359 |
|
| 360 | 360 |
assert.Assert(c, result.Error != nil) |
| 361 |
- assert.Assert(c, result.Stdout(), checker.Contains, "busybox1") |
|
| 362 |
- assert.Assert(c, result.Stdout(), checker.Contains, "busybox2") |
|
| 363 |
- assert.Assert(c, result.Stderr(), checker.Contains, "Error: No such container: missing") |
|
| 364 |
- |
|
| 361 |
+ assert.Assert(c, strings.Contains(result.Stdout(), "busybox1")) |
|
| 362 |
+ assert.Assert(c, strings.Contains(result.Stdout(), "busybox2")) |
|
| 363 |
+ assert.Assert(c, strings.Contains(result.Stderr(), "Error: No such container: missing")) |
|
| 365 | 364 |
// test inspect would not fast fail |
| 366 | 365 |
result = dockerCmdWithResult("inspect", "--type=container", "--format='{{.Name}}'", "missing", "busybox1", "busybox2")
|
| 367 | 366 |
|
| 368 | 367 |
assert.Assert(c, result.Error != nil) |
| 369 |
- assert.Assert(c, result.Stdout(), checker.Contains, "busybox1") |
|
| 370 |
- assert.Assert(c, result.Stdout(), checker.Contains, "busybox2") |
|
| 371 |
- assert.Assert(c, result.Stderr(), checker.Contains, "Error: No such container: missing") |
|
| 368 |
+ assert.Assert(c, strings.Contains(result.Stdout(), "busybox1")) |
|
| 369 |
+ assert.Assert(c, strings.Contains(result.Stdout(), "busybox2")) |
|
| 370 |
+ assert.Assert(c, strings.Contains(result.Stderr(), "Error: No such container: missing")) |
|
| 372 | 371 |
} |
| 373 | 372 |
|
| 374 | 373 |
func (s *DockerSuite) TestInspectHistory(c *testing.T) {
|
| ... | ... |
@@ -376,7 +373,7 @@ func (s *DockerSuite) TestInspectHistory(c *testing.T) {
|
| 376 | 376 |
dockerCmd(c, "commit", "-m", "test comment", "testcont", "testimg") |
| 377 | 377 |
out, _, err := dockerCmdWithError("inspect", "--format='{{.Comment}}'", "testimg")
|
| 378 | 378 |
assert.NilError(c, err) |
| 379 |
- assert.Assert(c, out, checker.Contains, "test comment") |
|
| 379 |
+ assert.Assert(c, strings.Contains(out, "test comment")) |
|
| 380 | 380 |
} |
| 381 | 381 |
|
| 382 | 382 |
func (s *DockerSuite) TestInspectContainerNetworkDefault(c *testing.T) {
|
| ... | ... |
@@ -386,7 +383,7 @@ func (s *DockerSuite) TestInspectContainerNetworkDefault(c *testing.T) {
|
| 386 | 386 |
dockerCmd(c, "run", "--name", contName, "-d", "busybox", "top") |
| 387 | 387 |
netOut, _ := dockerCmd(c, "network", "inspect", "--format={{.ID}}", "bridge")
|
| 388 | 388 |
out := inspectField(c, contName, "NetworkSettings.Networks") |
| 389 |
- assert.Assert(c, out, checker.Contains, "bridge") |
|
| 389 |
+ assert.Assert(c, strings.Contains(out, "bridge")) |
|
| 390 | 390 |
out = inspectField(c, contName, "NetworkSettings.Networks.bridge.NetworkID") |
| 391 | 391 |
assert.Equal(c, strings.TrimSpace(out), strings.TrimSpace(netOut)) |
| 392 | 392 |
} |
| ... | ... |
@@ -397,7 +394,7 @@ func (s *DockerSuite) TestInspectContainerNetworkCustom(c *testing.T) {
|
| 397 | 397 |
netOut, _ := dockerCmd(c, "network", "create", "net1") |
| 398 | 398 |
dockerCmd(c, "run", "--name=container1", "--net=net1", "-d", "busybox", "top") |
| 399 | 399 |
out := inspectField(c, "container1", "NetworkSettings.Networks") |
| 400 |
- assert.Assert(c, out, checker.Contains, "net1") |
|
| 400 |
+ assert.Assert(c, strings.Contains(out, "net1")) |
|
| 401 | 401 |
out = inspectField(c, "container1", "NetworkSettings.Networks.net1.NetworkID") |
| 402 | 402 |
assert.Equal(c, strings.TrimSpace(out), strings.TrimSpace(netOut)) |
| 403 | 403 |
} |
| ... | ... |
@@ -417,9 +414,9 @@ func (s *DockerSuite) TestInspectAmpersand(c *testing.T) {
|
| 417 | 417 |
|
| 418 | 418 |
name := "test" |
| 419 | 419 |
out, _ := dockerCmd(c, "run", "--name", name, "--env", `TEST_ENV="soanni&rtr"`, "busybox", "env") |
| 420 |
- assert.Assert(c, out, checker.Contains, `soanni&rtr`) |
|
| 420 |
+ assert.Assert(c, strings.Contains(out, `soanni&rtr`)) |
|
| 421 | 421 |
out, _ = dockerCmd(c, "inspect", name) |
| 422 |
- assert.Assert(c, out, checker.Contains, `soanni&rtr`) |
|
| 422 |
+ assert.Assert(c, strings.Contains(out, `soanni&rtr`)) |
|
| 423 | 423 |
} |
| 424 | 424 |
|
| 425 | 425 |
func (s *DockerSuite) TestInspectPlugin(c *testing.T) {
|
| ... | ... |
@@ -449,7 +446,7 @@ func (s *DockerSuite) TestInspectPlugin(c *testing.T) {
|
| 449 | 449 |
|
| 450 | 450 |
out, _, err = dockerCmdWithError("plugin", "remove", pNameWithTag)
|
| 451 | 451 |
assert.NilError(c, err) |
| 452 |
- assert.Assert(c, out, checker.Contains, pNameWithTag) |
|
| 452 |
+ assert.Assert(c, strings.Contains(out, pNameWithTag)) |
|
| 453 | 453 |
} |
| 454 | 454 |
|
| 455 | 455 |
// Test case for 29185 |
| ... | ... |
@@ -457,6 +454,6 @@ func (s *DockerSuite) TestInspectUnknownObject(c *testing.T) {
|
| 457 | 457 |
// This test should work on both Windows and Linux |
| 458 | 458 |
out, _, err := dockerCmdWithError("inspect", "foobar")
|
| 459 | 459 |
assert.ErrorContains(c, err, "") |
| 460 |
- assert.Assert(c, out, checker.Contains, "Error: No such object: foobar") |
|
| 460 |
+ assert.Assert(c, strings.Contains(out, "Error: No such object: foobar")) |
|
| 461 | 461 |
assert.ErrorContains(c, err, "Error: No such object: foobar") |
| 462 | 462 |
} |
| ... | ... |
@@ -8,7 +8,6 @@ import ( |
| 8 | 8 |
"strings" |
| 9 | 9 |
"testing" |
| 10 | 10 |
|
| 11 |
- "github.com/docker/docker/integration-cli/checker" |
|
| 12 | 11 |
"github.com/docker/docker/runconfig" |
| 13 | 12 |
"github.com/go-check/check" |
| 14 | 13 |
"gotest.tools/assert" |
| ... | ... |
@@ -33,7 +32,7 @@ func (s *DockerSuite) TestLinksInvalidContainerTarget(c *testing.T) {
|
| 33 | 33 |
// an invalid container target should produce an error |
| 34 | 34 |
// note: convert the output to lowercase first as the error string |
| 35 | 35 |
// capitalization was changed after API version 1.32 |
| 36 |
- assert.Assert(c, strings.ToLower(out), checker.Contains, "could not get container") |
|
| 36 |
+ assert.Assert(c, strings.Contains(strings.ToLower(out), "could not get container")) |
|
| 37 | 37 |
} |
| 38 | 38 |
|
| 39 | 39 |
func (s *DockerSuite) TestLinksPingLinkedContainers(c *testing.T) {
|
| ... | ... |
@@ -155,7 +154,7 @@ func (s *DockerSuite) TestLinksHostsFilesInject(c *testing.T) {
|
| 155 | 155 |
readContainerFileWithExec(c, idOne, "/etc/hosts") |
| 156 | 156 |
contentTwo := readContainerFileWithExec(c, idTwo, "/etc/hosts") |
| 157 | 157 |
// Host is not present in updated hosts file |
| 158 |
- assert.Assert(c, string(contentTwo), checker.Contains, "onetwo") |
|
| 158 |
+ assert.Assert(c, strings.Contains(string(contentTwo), "onetwo")) |
|
| 159 | 159 |
} |
| 160 | 160 |
|
| 161 | 161 |
func (s *DockerSuite) TestLinksUpdateOnRestart(c *testing.T) {
|
| ... | ... |
@@ -195,9 +194,9 @@ func (s *DockerSuite) TestLinksEnvs(c *testing.T) {
|
| 195 | 195 |
testRequires(c, DaemonIsLinux) |
| 196 | 196 |
dockerCmd(c, "run", "-d", "-e", "e1=", "-e", "e2=v2", "-e", "e3=v3=v3", "--name=first", "busybox", "top") |
| 197 | 197 |
out, _ := dockerCmd(c, "run", "--name=second", "--link=first:first", "busybox", "env") |
| 198 |
- assert.Assert(c, out, checker.Contains, "FIRST_ENV_e1=\n") |
|
| 199 |
- assert.Assert(c, out, checker.Contains, "FIRST_ENV_e2=v2") |
|
| 200 |
- assert.Assert(c, out, checker.Contains, "FIRST_ENV_e3=v3=v3") |
|
| 198 |
+ assert.Assert(c, strings.Contains(out, "FIRST_ENV_e1=\n")) |
|
| 199 |
+ assert.Assert(c, strings.Contains(out, "FIRST_ENV_e2=v2")) |
|
| 200 |
+ assert.Assert(c, strings.Contains(out, "FIRST_ENV_e3=v3=v3")) |
|
| 201 | 201 |
} |
| 202 | 202 |
|
| 203 | 203 |
func (s *DockerSuite) TestLinkShortDefinition(c *testing.T) {
|
| ... | ... |
@@ -224,7 +223,7 @@ func (s *DockerSuite) TestLinksNetworkHostContainer(c *testing.T) {
|
| 224 | 224 |
// Running container linking to a container with --net host should have failed |
| 225 | 225 |
assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
| 226 | 226 |
// Running container linking to a container with --net host should have failed |
| 227 |
- assert.Assert(c, out, checker.Contains, runconfig.ErrConflictHostNetworkAndLinks.Error()) |
|
| 227 |
+ assert.Assert(c, strings.Contains(out, runconfig.ErrConflictHostNetworkAndLinks.Error())) |
|
| 228 | 228 |
} |
| 229 | 229 |
|
| 230 | 230 |
func (s *DockerSuite) TestLinksEtcHostsRegularFile(c *testing.T) {
|
| ... | ... |
@@ -4,7 +4,6 @@ import ( |
| 4 | 4 |
"strings" |
| 5 | 5 |
"testing" |
| 6 | 6 |
|
| 7 |
- "github.com/docker/docker/integration-cli/checker" |
|
| 8 | 7 |
"github.com/docker/docker/runconfig" |
| 9 | 8 |
"github.com/go-check/check" |
| 10 | 9 |
"gotest.tools/assert" |
| ... | ... |
@@ -29,70 +28,60 @@ func (s *DockerSuite) TestNetHostnameWithNetHost(c *testing.T) {
|
| 29 | 29 |
testRequires(c, DaemonIsLinux, NotUserNamespace) |
| 30 | 30 |
|
| 31 | 31 |
out, _ := dockerCmd(c, "run", "--net=host", "busybox", "ps") |
| 32 |
- assert.Assert(c, out, checker.Contains, stringCheckPS) |
|
| 32 |
+ assert.Assert(c, strings.Contains(out, stringCheckPS)) |
|
| 33 | 33 |
} |
| 34 | 34 |
|
| 35 | 35 |
func (s *DockerSuite) TestNetHostname(c *testing.T) {
|
| 36 | 36 |
testRequires(c, DaemonIsLinux) |
| 37 | 37 |
|
| 38 | 38 |
out, _ := dockerCmd(c, "run", "-h=name", "busybox", "ps") |
| 39 |
- assert.Assert(c, out, checker.Contains, stringCheckPS) |
|
| 40 |
- |
|
| 39 |
+ assert.Assert(c, strings.Contains(out, stringCheckPS)) |
|
| 41 | 40 |
out, _ = dockerCmd(c, "run", "-h=name", "--net=bridge", "busybox", "ps") |
| 42 |
- assert.Assert(c, out, checker.Contains, stringCheckPS) |
|
| 43 |
- |
|
| 41 |
+ assert.Assert(c, strings.Contains(out, stringCheckPS)) |
|
| 44 | 42 |
out, _ = dockerCmd(c, "run", "-h=name", "--net=none", "busybox", "ps") |
| 45 |
- assert.Assert(c, out, checker.Contains, stringCheckPS) |
|
| 46 |
- |
|
| 43 |
+ assert.Assert(c, strings.Contains(out, stringCheckPS)) |
|
| 47 | 44 |
out, _ = dockerCmdWithFail(c, "run", "-h=name", "--net=container:other", "busybox", "ps") |
| 48 |
- assert.Assert(c, out, checker.Contains, runconfig.ErrConflictNetworkHostname.Error()) |
|
| 49 |
- |
|
| 45 |
+ assert.Assert(c, strings.Contains(out, runconfig.ErrConflictNetworkHostname.Error())) |
|
| 50 | 46 |
out, _ = dockerCmdWithFail(c, "run", "--net=container", "busybox", "ps") |
| 51 |
- assert.Assert(c, out, checker.Contains, "invalid container format container:<name|id>") |
|
| 52 |
- |
|
| 47 |
+ assert.Assert(c, strings.Contains(out, "invalid container format container:<name|id>")) |
|
| 53 | 48 |
out, _ = dockerCmdWithFail(c, "run", "--net=weird", "busybox", "ps") |
| 54 |
- assert.Assert(c, strings.ToLower(out), checker.Contains, "not found") |
|
| 49 |
+ assert.Assert(c, strings.Contains(strings.ToLower(out), "not found")) |
|
| 55 | 50 |
} |
| 56 | 51 |
|
| 57 | 52 |
func (s *DockerSuite) TestConflictContainerNetworkAndLinks(c *testing.T) {
|
| 58 | 53 |
testRequires(c, DaemonIsLinux) |
| 59 | 54 |
|
| 60 | 55 |
out, _ := dockerCmdWithFail(c, "run", "--net=container:other", "--link=zip:zap", "busybox", "ps") |
| 61 |
- assert.Assert(c, out, checker.Contains, runconfig.ErrConflictContainerNetworkAndLinks.Error()) |
|
| 56 |
+ assert.Assert(c, strings.Contains(out, runconfig.ErrConflictContainerNetworkAndLinks.Error())) |
|
| 62 | 57 |
} |
| 63 | 58 |
|
| 64 | 59 |
func (s *DockerSuite) TestConflictContainerNetworkHostAndLinks(c *testing.T) {
|
| 65 | 60 |
testRequires(c, DaemonIsLinux, NotUserNamespace) |
| 66 | 61 |
|
| 67 | 62 |
out, _ := dockerCmdWithFail(c, "run", "--net=host", "--link=zip:zap", "busybox", "ps") |
| 68 |
- assert.Assert(c, out, checker.Contains, runconfig.ErrConflictHostNetworkAndLinks.Error()) |
|
| 63 |
+ assert.Assert(c, strings.Contains(out, runconfig.ErrConflictHostNetworkAndLinks.Error())) |
|
| 69 | 64 |
} |
| 70 | 65 |
|
| 71 | 66 |
func (s *DockerSuite) TestConflictNetworkModeNetHostAndOptions(c *testing.T) {
|
| 72 | 67 |
testRequires(c, DaemonIsLinux, NotUserNamespace) |
| 73 | 68 |
|
| 74 | 69 |
out, _ := dockerCmdWithFail(c, "run", "--net=host", "--mac-address=92:d0:c6:0a:29:33", "busybox", "ps") |
| 75 |
- assert.Assert(c, out, checker.Contains, runconfig.ErrConflictContainerNetworkAndMac.Error()) |
|
| 70 |
+ assert.Assert(c, strings.Contains(out, runconfig.ErrConflictContainerNetworkAndMac.Error())) |
|
| 76 | 71 |
} |
| 77 | 72 |
|
| 78 | 73 |
func (s *DockerSuite) TestConflictNetworkModeAndOptions(c *testing.T) {
|
| 79 | 74 |
testRequires(c, DaemonIsLinux) |
| 80 | 75 |
|
| 81 | 76 |
out, _ := dockerCmdWithFail(c, "run", "--net=container:other", "--dns=8.8.8.8", "busybox", "ps") |
| 82 |
- assert.Assert(c, out, checker.Contains, runconfig.ErrConflictNetworkAndDNS.Error()) |
|
| 83 |
- |
|
| 77 |
+ assert.Assert(c, strings.Contains(out, runconfig.ErrConflictNetworkAndDNS.Error())) |
|
| 84 | 78 |
out, _ = dockerCmdWithFail(c, "run", "--net=container:other", "--add-host=name:8.8.8.8", "busybox", "ps") |
| 85 |
- assert.Assert(c, out, checker.Contains, runconfig.ErrConflictNetworkHosts.Error()) |
|
| 86 |
- |
|
| 79 |
+ assert.Assert(c, strings.Contains(out, runconfig.ErrConflictNetworkHosts.Error())) |
|
| 87 | 80 |
out, _ = dockerCmdWithFail(c, "run", "--net=container:other", "--mac-address=92:d0:c6:0a:29:33", "busybox", "ps") |
| 88 |
- assert.Assert(c, out, checker.Contains, runconfig.ErrConflictContainerNetworkAndMac.Error()) |
|
| 89 |
- |
|
| 81 |
+ assert.Assert(c, strings.Contains(out, runconfig.ErrConflictContainerNetworkAndMac.Error())) |
|
| 90 | 82 |
out, _ = dockerCmdWithFail(c, "run", "--net=container:other", "-P", "busybox", "ps") |
| 91 |
- assert.Assert(c, out, checker.Contains, runconfig.ErrConflictNetworkPublishPorts.Error()) |
|
| 92 |
- |
|
| 83 |
+ assert.Assert(c, strings.Contains(out, runconfig.ErrConflictNetworkPublishPorts.Error())) |
|
| 93 | 84 |
out, _ = dockerCmdWithFail(c, "run", "--net=container:other", "-p", "8080", "busybox", "ps") |
| 94 |
- assert.Assert(c, out, checker.Contains, runconfig.ErrConflictNetworkPublishPorts.Error()) |
|
| 95 |
- |
|
| 85 |
+ assert.Assert(c, strings.Contains(out, runconfig.ErrConflictNetworkPublishPorts.Error())) |
|
| 96 | 86 |
out, _ = dockerCmdWithFail(c, "run", "--net=container:other", "--expose", "8000-9000", "busybox", "ps") |
| 97 |
- assert.Assert(c, out, checker.Contains, runconfig.ErrConflictNetworkExposePorts.Error()) |
|
| 87 |
+ assert.Assert(c, strings.Contains(out, runconfig.ErrConflictNetworkExposePorts.Error())) |
|
| 98 | 88 |
} |
| ... | ... |
@@ -16,7 +16,6 @@ import ( |
| 16 | 16 |
|
| 17 | 17 |
"github.com/docker/docker/api/types" |
| 18 | 18 |
"github.com/docker/docker/api/types/versions/v1p20" |
| 19 |
- "github.com/docker/docker/integration-cli/checker" |
|
| 20 | 19 |
"github.com/docker/docker/integration-cli/cli" |
| 21 | 20 |
"github.com/docker/docker/integration-cli/daemon" |
| 22 | 21 |
testdaemon "github.com/docker/docker/internal/test/daemon" |
| ... | ... |
@@ -303,7 +302,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkCreateHostBind(c *testing.T) {
|
| 303 | 303 |
id := strings.TrimSpace(out) |
| 304 | 304 |
assert.NilError(c, waitRun(id)) |
| 305 | 305 |
out, _ = dockerCmd(c, "ps") |
| 306 |
- assert.Assert(c, out, checker.Contains, "192.168.10.1:5000->5000/tcp") |
|
| 306 |
+ assert.Assert(c, strings.Contains(out, "192.168.10.1:5000->5000/tcp")) |
|
| 307 | 307 |
} |
| 308 | 308 |
|
| 309 | 309 |
func (s *DockerNetworkSuite) TestDockerNetworkRmPredefined(c *testing.T) {
|
| ... | ... |
@@ -417,7 +416,7 @@ func (s *DockerSuite) TestDockerNetworkDeleteMultiple(c *testing.T) {
|
| 417 | 417 |
// err should not be nil due to deleting testDelMulti2 failed. |
| 418 | 418 |
assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
| 419 | 419 |
// testDelMulti2 should fail due to network has active endpoints |
| 420 |
- assert.Assert(c, out, checker.Contains, "has active endpoints") |
|
| 420 |
+ assert.Assert(c, strings.Contains(out, "has active endpoints")) |
|
| 421 | 421 |
assertNwNotAvailable(c, "testDelMulti0") |
| 422 | 422 |
assertNwNotAvailable(c, "testDelMulti1") |
| 423 | 423 |
// testDelMulti2 can't be deleted, so it should exist |
| ... | ... |
@@ -787,10 +786,9 @@ func (s *DockerNetworkSuite) TestDockerPluginV2NetworkDriver(c *testing.T) {
|
| 787 | 787 |
|
| 788 | 788 |
out, _, err := dockerCmdWithError("plugin", "ls")
|
| 789 | 789 |
assert.NilError(c, err) |
| 790 |
- assert.Assert(c, out, checker.Contains, npName) |
|
| 791 |
- assert.Assert(c, out, checker.Contains, npTag) |
|
| 792 |
- assert.Assert(c, out, checker.Contains, "true") |
|
| 793 |
- |
|
| 790 |
+ assert.Assert(c, strings.Contains(out, npName)) |
|
| 791 |
+ assert.Assert(c, strings.Contains(out, npTag)) |
|
| 792 |
+ assert.Assert(c, strings.Contains(out, "true")) |
|
| 794 | 793 |
dockerCmd(c, "network", "create", "-d", npNameWithTag, "v2net") |
| 795 | 794 |
assertNwIsAvailable(c, "v2net") |
| 796 | 795 |
dockerCmd(c, "network", "rm", "v2net") |
| ... | ... |
@@ -951,9 +949,9 @@ func (s *DockerNetworkSuite) TestDockerNetworkOverlayPortMapping(c *testing.T) {
|
| 951 | 951 |
unpPort2 := fmt.Sprintf("%d/tcp", port2)
|
| 952 | 952 |
out, _ := dockerCmd(c, "ps", "-n=1") |
| 953 | 953 |
// Missing unpublished ports in docker ps output |
| 954 |
- assert.Assert(c, out, checker.Contains, unpPort1) |
|
| 954 |
+ assert.Assert(c, strings.Contains(out, unpPort1)) |
|
| 955 | 955 |
// Missing unpublished ports in docker ps output |
| 956 |
- assert.Assert(c, out, checker.Contains, unpPort2) |
|
| 956 |
+ assert.Assert(c, strings.Contains(out, unpPort2)) |
|
| 957 | 957 |
} |
| 958 | 958 |
|
| 959 | 959 |
func (s *DockerNetworkSuite) TestDockerNetworkDriverUngracefulRestart(c *testing.T) {
|
| ... | ... |
@@ -1141,7 +1139,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectToHostFromOtherNetwork(c *t |
| 1141 | 1141 |
dockerCmd(c, "network", "disconnect", "bridge", "container1") |
| 1142 | 1142 |
out, _, err := dockerCmdWithError("network", "connect", "host", "container1")
|
| 1143 | 1143 |
assert.ErrorContains(c, err, "", out) |
| 1144 |
- assert.Assert(c, out, checker.Contains, runconfig.ErrConflictHostNetwork.Error()) |
|
| 1144 |
+ assert.Assert(c, strings.Contains(out, runconfig.ErrConflictHostNetwork.Error())) |
|
| 1145 | 1145 |
} |
| 1146 | 1146 |
|
| 1147 | 1147 |
func (s *DockerNetworkSuite) TestDockerNetworkDisconnectFromHost(c *testing.T) {
|
| ... | ... |
@@ -1149,7 +1147,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkDisconnectFromHost(c *testing.T) {
|
| 1149 | 1149 |
assert.Assert(c, waitRun("container1") == nil)
|
| 1150 | 1150 |
out, _, err := dockerCmdWithError("network", "disconnect", "host", "container1")
|
| 1151 | 1151 |
assert.Assert(c, err != nil, check.Commentf("Should err out disconnect from host"))
|
| 1152 |
- assert.Assert(c, out, checker.Contains, runconfig.ErrConflictHostNetwork.Error()) |
|
| 1152 |
+ assert.Assert(c, strings.Contains(out, runconfig.ErrConflictHostNetwork.Error())) |
|
| 1153 | 1153 |
} |
| 1154 | 1154 |
|
| 1155 | 1155 |
func (s *DockerNetworkSuite) TestDockerNetworkConnectWithPortMapping(c *testing.T) {
|
| ... | ... |
@@ -1221,7 +1219,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectWithMac(c *testing.T) {
|
| 1221 | 1221 |
func (s *DockerNetworkSuite) TestDockerNetworkInspectCreatedContainer(c *testing.T) {
|
| 1222 | 1222 |
dockerCmd(c, "create", "--name", "test", "busybox") |
| 1223 | 1223 |
networks := inspectField(c, "test", "NetworkSettings.Networks") |
| 1224 |
- assert.Assert(c, networks, checker.Contains, "bridge", check.Commentf("Should return 'bridge' network"))
|
|
| 1224 |
+ assert.Assert(c, strings.Contains(networks, "bridge"), check.Commentf("Should return 'bridge' network"))
|
|
| 1225 | 1225 |
} |
| 1226 | 1226 |
|
| 1227 | 1227 |
func (s *DockerNetworkSuite) TestDockerNetworkRestartWithMultipleNetworks(c *testing.T) {
|
| ... | ... |
@@ -1231,8 +1229,8 @@ func (s *DockerNetworkSuite) TestDockerNetworkRestartWithMultipleNetworks(c *tes |
| 1231 | 1231 |
dockerCmd(c, "network", "connect", "test", "foo") |
| 1232 | 1232 |
dockerCmd(c, "restart", "foo") |
| 1233 | 1233 |
networks := inspectField(c, "foo", "NetworkSettings.Networks") |
| 1234 |
- assert.Assert(c, networks, checker.Contains, "bridge", check.Commentf("Should contain 'bridge' network"))
|
|
| 1235 |
- assert.Assert(c, networks, checker.Contains, "test", check.Commentf("Should contain 'test' network"))
|
|
| 1234 |
+ assert.Assert(c, strings.Contains(networks, "bridge"), check.Commentf("Should contain 'bridge' network"))
|
|
| 1235 |
+ assert.Assert(c, strings.Contains(networks, "test"), check.Commentf("Should contain 'test' network"))
|
|
| 1236 | 1236 |
} |
| 1237 | 1237 |
|
| 1238 | 1238 |
func (s *DockerNetworkSuite) TestDockerNetworkConnectDisconnectToStoppedContainer(c *testing.T) {
|
| ... | ... |
@@ -1241,13 +1239,11 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectDisconnectToStoppedContaine |
| 1241 | 1241 |
dockerCmd(c, "create", "--name=foo", "busybox", "top") |
| 1242 | 1242 |
dockerCmd(c, "network", "connect", "test", "foo") |
| 1243 | 1243 |
networks := inspectField(c, "foo", "NetworkSettings.Networks") |
| 1244 |
- assert.Assert(c, networks, checker.Contains, "test", check.Commentf("Should contain 'test' network"))
|
|
| 1245 |
- |
|
| 1244 |
+ assert.Assert(c, strings.Contains(networks, "test"), check.Commentf("Should contain 'test' network"))
|
|
| 1246 | 1245 |
// Restart docker daemon to test the config has persisted to disk |
| 1247 | 1246 |
s.d.Restart(c) |
| 1248 | 1247 |
networks = inspectField(c, "foo", "NetworkSettings.Networks") |
| 1249 |
- assert.Assert(c, networks, checker.Contains, "test", check.Commentf("Should contain 'test' network"))
|
|
| 1250 |
- |
|
| 1248 |
+ assert.Assert(c, strings.Contains(networks, "test"), check.Commentf("Should contain 'test' network"))
|
|
| 1251 | 1249 |
// start the container and test if we can ping it from another container in the same network |
| 1252 | 1250 |
dockerCmd(c, "start", "foo") |
| 1253 | 1251 |
assert.Assert(c, waitRun("foo") == nil)
|
| ... | ... |
@@ -1271,8 +1267,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkDisconnectContainerNonexistingNetw |
| 1271 | 1271 |
dockerCmd(c, "network", "create", "test") |
| 1272 | 1272 |
dockerCmd(c, "run", "--net=test", "-d", "--name=foo", "busybox", "top") |
| 1273 | 1273 |
networks := inspectField(c, "foo", "NetworkSettings.Networks") |
| 1274 |
- assert.Assert(c, networks, checker.Contains, "test", check.Commentf("Should contain 'test' network"))
|
|
| 1275 |
- |
|
| 1274 |
+ assert.Assert(c, strings.Contains(networks, "test"), check.Commentf("Should contain 'test' network"))
|
|
| 1276 | 1275 |
// Stop container and remove network |
| 1277 | 1276 |
dockerCmd(c, "stop", "foo") |
| 1278 | 1277 |
dockerCmd(c, "network", "rm", "test") |
| ... | ... |
@@ -1315,8 +1310,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectPreferredIP(c *testing.T) {
|
| 1315 | 1315 |
// Still it should fail to connect to the default network with a specified IP (whatever ip) |
| 1316 | 1316 |
out, _, err := dockerCmdWithError("network", "connect", "--ip", "172.21.55.44", "bridge", "c0")
|
| 1317 | 1317 |
assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
| 1318 |
- assert.Assert(c, out, checker.Contains, runconfig.ErrUnsupportedNetworkAndIP.Error()) |
|
| 1319 |
- |
|
| 1318 |
+ assert.Assert(c, strings.Contains(out, runconfig.ErrUnsupportedNetworkAndIP.Error())) |
|
| 1320 | 1319 |
} |
| 1321 | 1320 |
|
| 1322 | 1321 |
func (s *DockerNetworkSuite) TestDockerNetworkConnectPreferredIPStoppedContainer(c *testing.T) {
|
| ... | ... |
@@ -1354,12 +1348,10 @@ func (s *DockerNetworkSuite) TestDockerNetworkUnsupportedRequiredIP(c *testing.T |
| 1354 | 1354 |
|
| 1355 | 1355 |
out, _, err := dockerCmdWithError("run", "-d", "--ip", "172.28.99.88", "--net", "n0", "busybox", "top")
|
| 1356 | 1356 |
assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
| 1357 |
- assert.Assert(c, out, checker.Contains, runconfig.ErrUnsupportedNetworkNoSubnetAndIP.Error()) |
|
| 1358 |
- |
|
| 1357 |
+ assert.Assert(c, strings.Contains(out, runconfig.ErrUnsupportedNetworkNoSubnetAndIP.Error())) |
|
| 1359 | 1358 |
out, _, err = dockerCmdWithError("run", "-d", "--ip6", "2001:db8:1234::9988", "--net", "n0", "busybox", "top")
|
| 1360 | 1359 |
assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
| 1361 |
- assert.Assert(c, out, checker.Contains, runconfig.ErrUnsupportedNetworkNoSubnetAndIP.Error()) |
|
| 1362 |
- |
|
| 1360 |
+ assert.Assert(c, strings.Contains(out, runconfig.ErrUnsupportedNetworkNoSubnetAndIP.Error())) |
|
| 1363 | 1361 |
dockerCmd(c, "network", "rm", "n0") |
| 1364 | 1362 |
assertNwNotAvailable(c, "n0") |
| 1365 | 1363 |
} |
| ... | ... |
@@ -1367,7 +1359,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkUnsupportedRequiredIP(c *testing.T |
| 1367 | 1367 |
func checkUnsupportedNetworkAndIP(c *testing.T, nwMode string) {
|
| 1368 | 1368 |
out, _, err := dockerCmdWithError("run", "-d", "--net", nwMode, "--ip", "172.28.99.88", "--ip6", "2001:db8:1234::9988", "busybox", "top")
|
| 1369 | 1369 |
assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
| 1370 |
- assert.Assert(c, out, checker.Contains, runconfig.ErrUnsupportedNetworkAndIP.Error()) |
|
| 1370 |
+ assert.Assert(c, strings.Contains(out, runconfig.ErrUnsupportedNetworkAndIP.Error())) |
|
| 1371 | 1371 |
} |
| 1372 | 1372 |
|
| 1373 | 1373 |
func verifyIPAddressConfig(c *testing.T, cName, nwname, ipv4, ipv6 string) {
|
| ... | ... |
@@ -1493,8 +1485,8 @@ func (s *DockerNetworkSuite) TestDockerNetworkDisconnectDefault(c *testing.T) {
|
| 1493 | 1493 |
dockerCmd(c, "start", containerName) |
| 1494 | 1494 |
assert.Assert(c, waitRun(containerName) == nil) |
| 1495 | 1495 |
networks := inspectField(c, containerName, "NetworkSettings.Networks") |
| 1496 |
- assert.Assert(c, networks, checker.Contains, netWorkName1, check.Commentf(fmt.Sprintf("Should contain '%s' network", netWorkName1)))
|
|
| 1497 |
- assert.Assert(c, networks, checker.Contains, netWorkName2, check.Commentf(fmt.Sprintf("Should contain '%s' network", netWorkName2)))
|
|
| 1496 |
+ assert.Assert(c, strings.Contains(networks, netWorkName1), check.Commentf(fmt.Sprintf("Should contain '%s' network", netWorkName1)))
|
|
| 1497 |
+ assert.Assert(c, strings.Contains(networks, netWorkName2), check.Commentf(fmt.Sprintf("Should contain '%s' network", netWorkName2)))
|
|
| 1498 | 1498 |
assert.Assert(c, !strings.Contains(networks, "bridge"), check.Commentf("Should not contain 'bridge' network"))
|
| 1499 | 1499 |
} |
| 1500 | 1500 |
|
| ... | ... |
@@ -1507,7 +1499,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectWithAliasOnDefaultNetworks( |
| 1507 | 1507 |
for _, net := range defaults {
|
| 1508 | 1508 |
res, _, err := dockerCmdWithError("network", "connect", "--alias", "alias"+net, net, containerID)
|
| 1509 | 1509 |
assert.ErrorContains(c, err, "") |
| 1510 |
- assert.Assert(c, res, checker.Contains, runconfig.ErrUnsupportedNetworkAndAlias.Error()) |
|
| 1510 |
+ assert.Assert(c, strings.Contains(res, runconfig.ErrUnsupportedNetworkAndAlias.Error())) |
|
| 1511 | 1511 |
} |
| 1512 | 1512 |
} |
| 1513 | 1513 |
|
| ... | ... |
@@ -1558,12 +1550,11 @@ func (s *DockerSuite) TestUserDefinedNetworkConnectDisconnectAlias(c *testing.T) |
| 1558 | 1558 |
// verify the alias option is rejected when running on predefined network |
| 1559 | 1559 |
out, _, err := dockerCmdWithError("run", "--rm", "--name=any", "--net-alias=any", "busybox:glibc", "top")
|
| 1560 | 1560 |
assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
| 1561 |
- assert.Assert(c, out, checker.Contains, runconfig.ErrUnsupportedNetworkAndAlias.Error()) |
|
| 1562 |
- |
|
| 1561 |
+ assert.Assert(c, strings.Contains(out, runconfig.ErrUnsupportedNetworkAndAlias.Error())) |
|
| 1563 | 1562 |
// verify the alias option is rejected when connecting to predefined network |
| 1564 | 1563 |
out, _, err = dockerCmdWithError("network", "connect", "--alias=any", "bridge", "first")
|
| 1565 | 1564 |
assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
| 1566 |
- assert.Assert(c, out, checker.Contains, runconfig.ErrUnsupportedNetworkAndAlias.Error()) |
|
| 1565 |
+ assert.Assert(c, strings.Contains(out, runconfig.ErrUnsupportedNetworkAndAlias.Error())) |
|
| 1567 | 1566 |
} |
| 1568 | 1567 |
|
| 1569 | 1568 |
func (s *DockerSuite) TestUserDefinedNetworkConnectivity(c *testing.T) {
|
| ... | ... |
@@ -1624,7 +1615,7 @@ func (s *DockerSuite) TestDockerNetworkInternalMode(c *testing.T) {
|
| 1624 | 1624 |
assert.Assert(c, waitRun("second") == nil)
|
| 1625 | 1625 |
out, _, err := dockerCmdWithError("exec", "first", "ping", "-W", "4", "-c", "1", "8.8.8.8")
|
| 1626 | 1626 |
assert.ErrorContains(c, err, "") |
| 1627 |
- assert.Assert(c, out, checker.Contains, "100% packet loss") |
|
| 1627 |
+ assert.Assert(c, strings.Contains(out, "100% packet loss")) |
|
| 1628 | 1628 |
_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
|
| 1629 | 1629 |
assert.NilError(c, err) |
| 1630 | 1630 |
} |
| ... | ... |
@@ -13,7 +13,6 @@ import ( |
| 13 | 13 |
"time" |
| 14 | 14 |
|
| 15 | 15 |
"github.com/docker/docker/api/types" |
| 16 |
- "github.com/docker/docker/integration-cli/checker" |
|
| 17 | 16 |
"github.com/docker/docker/integration-cli/cli" |
| 18 | 17 |
"github.com/docker/docker/integration-cli/daemon" |
| 19 | 18 |
"github.com/docker/docker/internal/test/fixtures/plugin" |
| ... | ... |
@@ -37,24 +36,21 @@ func (ps *DockerPluginSuite) TestPluginBasicOps(c *testing.T) {
|
| 37 | 37 |
|
| 38 | 38 |
out, _, err := dockerCmdWithError("plugin", "ls")
|
| 39 | 39 |
assert.NilError(c, err) |
| 40 |
- assert.Assert(c, out, checker.Contains, plugin) |
|
| 41 |
- assert.Assert(c, out, checker.Contains, "true") |
|
| 42 |
- |
|
| 40 |
+ assert.Assert(c, strings.Contains(out, plugin)) |
|
| 41 |
+ assert.Assert(c, strings.Contains(out, "true")) |
|
| 43 | 42 |
id, _, err := dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", plugin)
|
| 44 | 43 |
id = strings.TrimSpace(id) |
| 45 | 44 |
assert.NilError(c, err) |
| 46 | 45 |
|
| 47 | 46 |
out, _, err = dockerCmdWithError("plugin", "remove", plugin)
|
| 48 | 47 |
assert.ErrorContains(c, err, "") |
| 49 |
- assert.Assert(c, out, checker.Contains, "is enabled") |
|
| 50 |
- |
|
| 48 |
+ assert.Assert(c, strings.Contains(out, "is enabled")) |
|
| 51 | 49 |
_, _, err = dockerCmdWithError("plugin", "disable", plugin)
|
| 52 | 50 |
assert.NilError(c, err) |
| 53 | 51 |
|
| 54 | 52 |
out, _, err = dockerCmdWithError("plugin", "remove", plugin)
|
| 55 | 53 |
assert.NilError(c, err) |
| 56 |
- assert.Assert(c, out, checker.Contains, plugin) |
|
| 57 |
- |
|
| 54 |
+ assert.Assert(c, strings.Contains(out, plugin)) |
|
| 58 | 55 |
_, err = os.Stat(filepath.Join(testEnv.DaemonInfo.DockerRootDir, "plugins", id)) |
| 59 | 56 |
if !os.IsNotExist(err) {
|
| 60 | 57 |
c.Fatal(err) |
| ... | ... |
@@ -68,11 +64,10 @@ func (ps *DockerPluginSuite) TestPluginForceRemove(c *testing.T) {
|
| 68 | 68 |
assert.NilError(c, err) |
| 69 | 69 |
|
| 70 | 70 |
out, _, _ := dockerCmdWithError("plugin", "remove", pNameWithTag)
|
| 71 |
- assert.Assert(c, out, checker.Contains, "is enabled") |
|
| 72 |
- |
|
| 71 |
+ assert.Assert(c, strings.Contains(out, "is enabled")) |
|
| 73 | 72 |
out, _, err = dockerCmdWithError("plugin", "remove", "--force", pNameWithTag)
|
| 74 | 73 |
assert.NilError(c, err) |
| 75 |
- assert.Assert(c, out, checker.Contains, pNameWithTag) |
|
| 74 |
+ assert.Assert(c, strings.Contains(out, pNameWithTag)) |
|
| 76 | 75 |
} |
| 77 | 76 |
|
| 78 | 77 |
func (s *DockerSuite) TestPluginActive(c *testing.T) {
|
| ... | ... |
@@ -85,8 +80,7 @@ func (s *DockerSuite) TestPluginActive(c *testing.T) {
|
| 85 | 85 |
assert.NilError(c, err) |
| 86 | 86 |
|
| 87 | 87 |
out, _, _ := dockerCmdWithError("plugin", "disable", pNameWithTag)
|
| 88 |
- assert.Assert(c, out, checker.Contains, "in use") |
|
| 89 |
- |
|
| 88 |
+ assert.Assert(c, strings.Contains(out, "in use")) |
|
| 90 | 89 |
_, _, err = dockerCmdWithError("volume", "rm", "testvol1")
|
| 91 | 90 |
assert.NilError(c, err) |
| 92 | 91 |
|
| ... | ... |
@@ -95,7 +89,7 @@ func (s *DockerSuite) TestPluginActive(c *testing.T) {
|
| 95 | 95 |
|
| 96 | 96 |
out, _, err = dockerCmdWithError("plugin", "remove", pNameWithTag)
|
| 97 | 97 |
assert.NilError(c, err) |
| 98 |
- assert.Assert(c, out, checker.Contains, pNameWithTag) |
|
| 98 |
+ assert.Assert(c, strings.Contains(out, pNameWithTag)) |
|
| 99 | 99 |
} |
| 100 | 100 |
|
| 101 | 101 |
func (s *DockerSuite) TestPluginActiveNetwork(c *testing.T) {
|
| ... | ... |
@@ -109,20 +103,18 @@ func (s *DockerSuite) TestPluginActiveNetwork(c *testing.T) {
|
| 109 | 109 |
nID := strings.TrimSpace(out) |
| 110 | 110 |
|
| 111 | 111 |
out, _, _ = dockerCmdWithError("plugin", "remove", npNameWithTag)
|
| 112 |
- assert.Assert(c, out, checker.Contains, "is in use") |
|
| 113 |
- |
|
| 112 |
+ assert.Assert(c, strings.Contains(out, "is in use")) |
|
| 114 | 113 |
_, _, err = dockerCmdWithError("network", "rm", nID)
|
| 115 | 114 |
assert.NilError(c, err) |
| 116 | 115 |
|
| 117 | 116 |
out, _, _ = dockerCmdWithError("plugin", "remove", npNameWithTag)
|
| 118 |
- assert.Assert(c, out, checker.Contains, "is enabled") |
|
| 119 |
- |
|
| 117 |
+ assert.Assert(c, strings.Contains(out, "is enabled")) |
|
| 120 | 118 |
_, _, err = dockerCmdWithError("plugin", "disable", npNameWithTag)
|
| 121 | 119 |
assert.NilError(c, err) |
| 122 | 120 |
|
| 123 | 121 |
out, _, err = dockerCmdWithError("plugin", "remove", npNameWithTag)
|
| 124 | 122 |
assert.NilError(c, err) |
| 125 |
- assert.Assert(c, out, checker.Contains, npNameWithTag) |
|
| 123 |
+ assert.Assert(c, strings.Contains(out, npNameWithTag)) |
|
| 126 | 124 |
} |
| 127 | 125 |
|
| 128 | 126 |
func (ps *DockerPluginSuite) TestPluginInstallDisable(c *testing.T) {
|
| ... | ... |
@@ -130,31 +122,26 @@ func (ps *DockerPluginSuite) TestPluginInstallDisable(c *testing.T) {
|
| 130 | 130 |
|
| 131 | 131 |
out, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", "--disable", pName)
|
| 132 | 132 |
assert.NilError(c, err) |
| 133 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, pName) |
|
| 134 |
- |
|
| 133 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), pName)) |
|
| 135 | 134 |
out, _, err = dockerCmdWithError("plugin", "ls")
|
| 136 | 135 |
assert.NilError(c, err) |
| 137 |
- assert.Assert(c, out, checker.Contains, "false") |
|
| 138 |
- |
|
| 136 |
+ assert.Assert(c, strings.Contains(out, "false")) |
|
| 139 | 137 |
out, _, err = dockerCmdWithError("plugin", "enable", pName)
|
| 140 | 138 |
assert.NilError(c, err) |
| 141 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, pName) |
|
| 142 |
- |
|
| 139 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), pName)) |
|
| 143 | 140 |
out, _, err = dockerCmdWithError("plugin", "disable", pName)
|
| 144 | 141 |
assert.NilError(c, err) |
| 145 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, pName) |
|
| 146 |
- |
|
| 142 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), pName)) |
|
| 147 | 143 |
out, _, err = dockerCmdWithError("plugin", "remove", pName)
|
| 148 | 144 |
assert.NilError(c, err) |
| 149 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, pName) |
|
| 145 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), pName)) |
|
| 150 | 146 |
} |
| 151 | 147 |
|
| 152 | 148 |
func (s *DockerSuite) TestPluginInstallDisableVolumeLs(c *testing.T) {
|
| 153 | 149 |
testRequires(c, DaemonIsLinux, IsAmd64, Network) |
| 154 | 150 |
out, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", "--disable", pName)
|
| 155 | 151 |
assert.NilError(c, err) |
| 156 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, pName) |
|
| 157 |
- |
|
| 152 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), pName)) |
|
| 158 | 153 |
dockerCmd(c, "volume", "ls") |
| 159 | 154 |
} |
| 160 | 155 |
|
| ... | ... |
@@ -192,21 +179,17 @@ func (ps *DockerPluginSuite) TestPluginSet(c *testing.T) {
|
| 192 | 192 |
assert.Equal(c, strings.TrimSpace(env), "[DEBUG=1]") |
| 193 | 193 |
|
| 194 | 194 |
env, _ = dockerCmd(c, "plugin", "inspect", "-f", "{{with $mount := index .Settings.Mounts 0}}{{$mount.Source}}{{end}}", name)
|
| 195 |
- assert.Assert(c, strings.TrimSpace(env), checker.Contains, mntSrc) |
|
| 196 |
- |
|
| 195 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(env), mntSrc)) |
|
| 197 | 196 |
dockerCmd(c, "plugin", "set", name, "pmount1.source=bar") |
| 198 | 197 |
|
| 199 | 198 |
env, _ = dockerCmd(c, "plugin", "inspect", "-f", "{{with $mount := index .Settings.Mounts 0}}{{$mount.Source}}{{end}}", name)
|
| 200 |
- assert.Assert(c, strings.TrimSpace(env), checker.Contains, "bar") |
|
| 201 |
- |
|
| 199 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(env), "bar")) |
|
| 202 | 200 |
out, _, err := dockerCmdWithError("plugin", "set", name, "pmount2.source=bar2")
|
| 203 | 201 |
assert.ErrorContains(c, err, "") |
| 204 |
- assert.Assert(c, out, checker.Contains, "Plugin config has no mount source") |
|
| 205 |
- |
|
| 202 |
+ assert.Assert(c, strings.Contains(out, "Plugin config has no mount source")) |
|
| 206 | 203 |
out, _, err = dockerCmdWithError("plugin", "set", name, "pdev2.path=/dev/bar2")
|
| 207 | 204 |
assert.ErrorContains(c, err, "") |
| 208 |
- assert.Assert(c, out, checker.Contains, "Plugin config has no device path") |
|
| 209 |
- |
|
| 205 |
+ assert.Assert(c, strings.Contains(out, "Plugin config has no device path")) |
|
| 210 | 206 |
} |
| 211 | 207 |
|
| 212 | 208 |
func (ps *DockerPluginSuite) TestPluginInstallArgs(c *testing.T) {
|
| ... | ... |
@@ -219,8 +202,7 @@ func (ps *DockerPluginSuite) TestPluginInstallArgs(c *testing.T) {
|
| 219 | 219 |
}) |
| 220 | 220 |
|
| 221 | 221 |
out, _ := dockerCmd(c, "plugin", "install", "--grant-all-permissions", "--disable", pName, "DEBUG=1") |
| 222 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, pName) |
|
| 223 |
- |
|
| 222 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), pName)) |
|
| 224 | 223 |
env, _ := dockerCmd(c, "plugin", "inspect", "-f", "{{.Settings.Env}}", pName)
|
| 225 | 224 |
assert.Equal(c, strings.TrimSpace(env), "[DEBUG=1]") |
| 226 | 225 |
} |
| ... | ... |
@@ -236,7 +218,7 @@ func (ps *DockerPluginSuite) TestPluginInstallImage(c *testing.T) {
|
| 236 | 236 |
|
| 237 | 237 |
out, _, err := dockerCmdWithError("plugin", "install", repoName)
|
| 238 | 238 |
assert.ErrorContains(c, err, "") |
| 239 |
- assert.Assert(c, out, checker.Contains, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) |
|
| 239 |
+ assert.Assert(c, strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`)) |
|
| 240 | 240 |
} |
| 241 | 241 |
|
| 242 | 242 |
func (ps *DockerPluginSuite) TestPluginEnableDisableNegative(c *testing.T) {
|
| ... | ... |
@@ -244,19 +226,16 @@ func (ps *DockerPluginSuite) TestPluginEnableDisableNegative(c *testing.T) {
|
| 244 | 244 |
|
| 245 | 245 |
out, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", pName)
|
| 246 | 246 |
assert.NilError(c, err) |
| 247 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, pName) |
|
| 248 |
- |
|
| 247 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), pName)) |
|
| 249 | 248 |
out, _, err = dockerCmdWithError("plugin", "enable", pName)
|
| 250 | 249 |
assert.ErrorContains(c, err, "") |
| 251 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, "already enabled") |
|
| 252 |
- |
|
| 250 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), "already enabled")) |
|
| 253 | 251 |
_, _, err = dockerCmdWithError("plugin", "disable", pName)
|
| 254 | 252 |
assert.NilError(c, err) |
| 255 | 253 |
|
| 256 | 254 |
out, _, err = dockerCmdWithError("plugin", "disable", pName)
|
| 257 | 255 |
assert.ErrorContains(c, err, "") |
| 258 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, "already disabled") |
|
| 259 |
- |
|
| 256 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), "already disabled")) |
|
| 260 | 257 |
_, _, err = dockerCmdWithError("plugin", "remove", pName)
|
| 261 | 258 |
assert.NilError(c, err) |
| 262 | 259 |
} |
| ... | ... |
@@ -276,19 +255,16 @@ func (ps *DockerPluginSuite) TestPluginCreate(c *testing.T) {
|
| 276 | 276 |
|
| 277 | 277 |
out, _, err := dockerCmdWithError("plugin", "create", name, temp)
|
| 278 | 278 |
assert.NilError(c, err) |
| 279 |
- assert.Assert(c, out, checker.Contains, name) |
|
| 280 |
- |
|
| 279 |
+ assert.Assert(c, strings.Contains(out, name)) |
|
| 281 | 280 |
out, _, err = dockerCmdWithError("plugin", "ls")
|
| 282 | 281 |
assert.NilError(c, err) |
| 283 |
- assert.Assert(c, out, checker.Contains, name) |
|
| 284 |
- |
|
| 282 |
+ assert.Assert(c, strings.Contains(out, name)) |
|
| 285 | 283 |
out, _, err = dockerCmdWithError("plugin", "create", name, temp)
|
| 286 | 284 |
assert.ErrorContains(c, err, "") |
| 287 |
- assert.Assert(c, out, checker.Contains, "already exist") |
|
| 288 |
- |
|
| 285 |
+ assert.Assert(c, strings.Contains(out, "already exist")) |
|
| 289 | 286 |
out, _, err = dockerCmdWithError("plugin", "ls")
|
| 290 | 287 |
assert.NilError(c, err) |
| 291 |
- assert.Assert(c, out, checker.Contains, name) |
|
| 288 |
+ assert.Assert(c, strings.Contains(out, name)) |
|
| 292 | 289 |
// The output will consists of one HEADER line and one line of foo/bar-driver |
| 293 | 290 |
assert.Equal(c, len(strings.Split(strings.TrimSpace(out), "\n")), 2) |
| 294 | 291 |
} |
| ... | ... |
@@ -301,9 +277,8 @@ func (ps *DockerPluginSuite) TestPluginInspect(c *testing.T) {
|
| 301 | 301 |
|
| 302 | 302 |
out, _, err := dockerCmdWithError("plugin", "ls")
|
| 303 | 303 |
assert.NilError(c, err) |
| 304 |
- assert.Assert(c, out, checker.Contains, pNameWithTag) |
|
| 305 |
- assert.Assert(c, out, checker.Contains, "true") |
|
| 306 |
- |
|
| 304 |
+ assert.Assert(c, strings.Contains(out, pNameWithTag)) |
|
| 305 |
+ assert.Assert(c, strings.Contains(out, "true")) |
|
| 307 | 306 |
// Find the ID first |
| 308 | 307 |
out, _, err = dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", pNameWithTag)
|
| 309 | 308 |
assert.NilError(c, err) |
| ... | ... |
@@ -335,8 +310,7 @@ func (ps *DockerPluginSuite) TestPluginInspect(c *testing.T) {
|
| 335 | 335 |
|
| 336 | 336 |
out, _, err = dockerCmdWithError("plugin", "remove", pNameWithTag)
|
| 337 | 337 |
assert.NilError(c, err) |
| 338 |
- assert.Assert(c, out, checker.Contains, pNameWithTag) |
|
| 339 |
- |
|
| 338 |
+ assert.Assert(c, strings.Contains(out, pNameWithTag)) |
|
| 340 | 339 |
// After remove nothing should be found |
| 341 | 340 |
_, _, err = dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", id[:5])
|
| 342 | 341 |
assert.ErrorContains(c, err, "") |
| ... | ... |
@@ -349,7 +323,7 @@ func (s *DockerSuite) TestPluginInspectOnWindows(c *testing.T) {
|
| 349 | 349 |
|
| 350 | 350 |
out, _, err := dockerCmdWithError("plugin", "inspect", "foobar")
|
| 351 | 351 |
assert.ErrorContains(c, err, "") |
| 352 |
- assert.Assert(c, out, checker.Contains, "plugins are not supported on this platform") |
|
| 352 |
+ assert.Assert(c, strings.Contains(out, "plugins are not supported on this platform")) |
|
| 353 | 353 |
assert.ErrorContains(c, err, "plugins are not supported on this platform") |
| 354 | 354 |
} |
| 355 | 355 |
|
| ... | ... |
@@ -374,9 +348,8 @@ func (ps *DockerPluginSuite) TestPluginIDPrefix(c *testing.T) {
|
| 374 | 374 |
// List current state |
| 375 | 375 |
out, _, err := dockerCmdWithError("plugin", "ls")
|
| 376 | 376 |
assert.NilError(c, err) |
| 377 |
- assert.Assert(c, out, checker.Contains, name) |
|
| 378 |
- assert.Assert(c, out, checker.Contains, "false") |
|
| 379 |
- |
|
| 377 |
+ assert.Assert(c, strings.Contains(out, name)) |
|
| 378 |
+ assert.Assert(c, strings.Contains(out, "false")) |
|
| 380 | 379 |
env, _ := dockerCmd(c, "plugin", "inspect", "-f", "{{.Settings.Env}}", id[:5])
|
| 381 | 380 |
assert.Equal(c, strings.TrimSpace(env), "[DEBUG=0]") |
| 382 | 381 |
|
| ... | ... |
@@ -390,17 +363,15 @@ func (ps *DockerPluginSuite) TestPluginIDPrefix(c *testing.T) {
|
| 390 | 390 |
assert.NilError(c, err) |
| 391 | 391 |
out, _, err = dockerCmdWithError("plugin", "ls")
|
| 392 | 392 |
assert.NilError(c, err) |
| 393 |
- assert.Assert(c, out, checker.Contains, name) |
|
| 394 |
- assert.Assert(c, out, checker.Contains, "true") |
|
| 395 |
- |
|
| 393 |
+ assert.Assert(c, strings.Contains(out, name)) |
|
| 394 |
+ assert.Assert(c, strings.Contains(out, "true")) |
|
| 396 | 395 |
// Disable |
| 397 | 396 |
_, _, err = dockerCmdWithError("plugin", "disable", id[:5])
|
| 398 | 397 |
assert.NilError(c, err) |
| 399 | 398 |
out, _, err = dockerCmdWithError("plugin", "ls")
|
| 400 | 399 |
assert.NilError(c, err) |
| 401 |
- assert.Assert(c, out, checker.Contains, name) |
|
| 402 |
- assert.Assert(c, out, checker.Contains, "false") |
|
| 403 |
- |
|
| 400 |
+ assert.Assert(c, strings.Contains(out, name)) |
|
| 401 |
+ assert.Assert(c, strings.Contains(out, "false")) |
|
| 404 | 402 |
// Remove |
| 405 | 403 |
_, _, err = dockerCmdWithError("plugin", "remove", id[:5])
|
| 406 | 404 |
assert.NilError(c, err) |
| ... | ... |
@@ -438,7 +409,7 @@ description: test plugin |
| 438 | 438 |
enabled: false`, id, name) |
| 439 | 439 |
|
| 440 | 440 |
out, _ = dockerCmd(c, "--config", config, "plugin", "ls", "--no-trunc") |
| 441 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, expectedOutput) |
|
| 441 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), expectedOutput)) |
|
| 442 | 442 |
} |
| 443 | 443 |
|
| 444 | 444 |
func (s *DockerSuite) TestPluginUpgrade(c *testing.T) {
|
| ... | ... |
@@ -452,8 +423,7 @@ func (s *DockerSuite) TestPluginUpgrade(c *testing.T) {
|
| 452 | 452 |
|
| 453 | 453 |
out, _, err := dockerCmdWithError("plugin", "upgrade", "--grant-all-permissions", plugin, pluginV2)
|
| 454 | 454 |
assert.ErrorContains(c, err, "", out) |
| 455 |
- assert.Assert(c, out, checker.Contains, "disabled before upgrading") |
|
| 456 |
- |
|
| 455 |
+ assert.Assert(c, strings.Contains(out, "disabled before upgrading")) |
|
| 457 | 456 |
out, _ = dockerCmd(c, "plugin", "inspect", "--format={{.ID}}", plugin)
|
| 458 | 457 |
id := strings.TrimSpace(out) |
| 459 | 458 |
|
| ... | ... |
@@ -491,5 +461,5 @@ func (s *DockerSuite) TestPluginMetricsCollector(c *testing.T) {
|
| 491 | 491 |
b, err := ioutil.ReadAll(resp.Body) |
| 492 | 492 |
assert.NilError(c, err) |
| 493 | 493 |
// check that a known metric is there... don't expect this metric to change over time.. probably safe |
| 494 |
- assert.Assert(c, string(b), checker.Contains, "container_actions") |
|
| 494 |
+ assert.Assert(c, strings.Contains(string(b), "container_actions")) |
|
| 495 | 495 |
} |
| ... | ... |
@@ -9,7 +9,6 @@ import ( |
| 9 | 9 |
"strings" |
| 10 | 10 |
"testing" |
| 11 | 11 |
|
| 12 |
- "github.com/docker/docker/integration-cli/checker" |
|
| 13 | 12 |
"github.com/go-check/check" |
| 14 | 13 |
"gotest.tools/assert" |
| 15 | 14 |
) |
| ... | ... |
@@ -225,10 +224,9 @@ func (s *DockerSuite) TestUnpublishedPortsInPsOutput(c *testing.T) {
|
| 225 | 225 |
unpPort2 := fmt.Sprintf("%d/tcp", port2)
|
| 226 | 226 |
out, _ := dockerCmd(c, "ps", "-n=1") |
| 227 | 227 |
// Missing unpublished ports in docker ps output |
| 228 |
- assert.Assert(c, out, checker.Contains, unpPort1) |
|
| 228 |
+ assert.Assert(c, strings.Contains(out, unpPort1)) |
|
| 229 | 229 |
// Missing unpublished ports in docker ps output |
| 230 |
- assert.Assert(c, out, checker.Contains, unpPort2) |
|
| 231 |
- |
|
| 230 |
+ assert.Assert(c, strings.Contains(out, unpPort2)) |
|
| 232 | 231 |
// Run the container forcing to publish the exposed ports |
| 233 | 232 |
dockerCmd(c, "run", "-d", "-P", expose1, expose2, "busybox", "sleep", "5") |
| 234 | 233 |
|
| ... | ... |
@@ -253,10 +251,9 @@ func (s *DockerSuite) TestUnpublishedPortsInPsOutput(c *testing.T) {
|
| 253 | 253 |
expBnd2 := fmt.Sprintf("0.0.0.0:%d->%s", offset+port2, unpPort2)
|
| 254 | 254 |
out, _ = dockerCmd(c, "ps", "-n=1") |
| 255 | 255 |
// Cannot find expected port binding (expBnd1) in docker ps output |
| 256 |
- assert.Assert(c, out, checker.Contains, expBnd1) |
|
| 256 |
+ assert.Assert(c, strings.Contains(out, expBnd1)) |
|
| 257 | 257 |
// Cannot find expected port binding (expBnd2) in docker ps output |
| 258 |
- assert.Assert(c, out, checker.Contains, expBnd2) |
|
| 259 |
- |
|
| 258 |
+ assert.Assert(c, strings.Contains(out, expBnd2)) |
|
| 260 | 259 |
// Remove container now otherwise it will interfere with next test |
| 261 | 260 |
stopRemoveContainer(id, c) |
| 262 | 261 |
|
| ... | ... |
@@ -267,9 +264,9 @@ func (s *DockerSuite) TestUnpublishedPortsInPsOutput(c *testing.T) {
|
| 267 | 267 |
// Check docker ps o/p for last created container reports the specified port mappings |
| 268 | 268 |
out, _ = dockerCmd(c, "ps", "-n=1") |
| 269 | 269 |
// Cannot find expected port binding (expBnd1) in docker ps output |
| 270 |
- assert.Assert(c, out, checker.Contains, expBnd1) |
|
| 270 |
+ assert.Assert(c, strings.Contains(out, expBnd1)) |
|
| 271 | 271 |
// Cannot find expected port binding (expBnd2) in docker ps output |
| 272 |
- assert.Assert(c, out, checker.Contains, expBnd2) |
|
| 272 |
+ assert.Assert(c, strings.Contains(out, expBnd2)) |
|
| 273 | 273 |
// Remove container now otherwise it will interfere with next test |
| 274 | 274 |
stopRemoveContainer(id, c) |
| 275 | 275 |
|
| ... | ... |
@@ -279,9 +276,9 @@ func (s *DockerSuite) TestUnpublishedPortsInPsOutput(c *testing.T) {
|
| 279 | 279 |
// Check docker ps o/p for last created container reports the specified unpublished port and port mapping |
| 280 | 280 |
out, _ = dockerCmd(c, "ps", "-n=1") |
| 281 | 281 |
// Missing unpublished exposed ports (unpPort1) in docker ps output |
| 282 |
- assert.Assert(c, out, checker.Contains, unpPort1) |
|
| 282 |
+ assert.Assert(c, strings.Contains(out, unpPort1)) |
|
| 283 | 283 |
// Missing port binding (expBnd2) in docker ps output |
| 284 |
- assert.Assert(c, out, checker.Contains, expBnd2) |
|
| 284 |
+ assert.Assert(c, strings.Contains(out, expBnd2)) |
|
| 285 | 285 |
} |
| 286 | 286 |
|
| 287 | 287 |
func (s *DockerSuite) TestPortHostBinding(c *testing.T) {
|
| ... | ... |
@@ -93,19 +93,16 @@ func (s *DockerDaemonSuite) TestPruneImageDangling(c *testing.T) {
|
| 93 | 93 |
|
| 94 | 94 |
out, err := s.d.Cmd("images", "-q", "--no-trunc")
|
| 95 | 95 |
assert.NilError(c, err) |
| 96 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, id) |
|
| 97 |
- |
|
| 96 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), id)) |
|
| 98 | 97 |
out, err = s.d.Cmd("image", "prune", "--force")
|
| 99 | 98 |
assert.NilError(c, err) |
| 100 | 99 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), id)) |
| 101 | 100 |
out, err = s.d.Cmd("images", "-q", "--no-trunc")
|
| 102 | 101 |
assert.NilError(c, err) |
| 103 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, id) |
|
| 104 |
- |
|
| 102 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), id)) |
|
| 105 | 103 |
out, err = s.d.Cmd("image", "prune", "--force", "--all")
|
| 106 | 104 |
assert.NilError(c, err) |
| 107 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, id) |
|
| 108 |
- |
|
| 105 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), id)) |
|
| 109 | 106 |
out, err = s.d.Cmd("images", "-q", "--no-trunc")
|
| 110 | 107 |
assert.NilError(c, err) |
| 111 | 108 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), id)) |
| ... | ... |
@@ -123,11 +120,11 @@ func (s *DockerSuite) TestPruneContainerUntil(c *testing.T) {
|
| 123 | 123 |
cli.WaitExited(c, id2, 5*time.Second) |
| 124 | 124 |
|
| 125 | 125 |
out = cli.DockerCmd(c, "container", "prune", "--force", "--filter", "until="+until).Combined() |
| 126 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, id1) |
|
| 126 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), id1)) |
|
| 127 | 127 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), id2)) |
| 128 | 128 |
out = cli.DockerCmd(c, "ps", "-a", "-q", "--no-trunc").Combined() |
| 129 | 129 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), id1)) |
| 130 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, id2) |
|
| 130 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), id2)) |
|
| 131 | 131 |
} |
| 132 | 132 |
|
| 133 | 133 |
func (s *DockerSuite) TestPruneContainerLabel(c *testing.T) {
|
| ... | ... |
@@ -160,28 +157,24 @@ func (s *DockerSuite) TestPruneContainerLabel(c *testing.T) {
|
| 160 | 160 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), id1)) |
| 161 | 161 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), id2)) |
| 162 | 162 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), id3)) |
| 163 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, id4) |
|
| 164 |
- |
|
| 163 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), id4)) |
|
| 165 | 164 |
out = cli.DockerCmd(c, "container", "prune", "--force", "--filter", "label=foo").Combined() |
| 166 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, id1) |
|
| 165 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), id1)) |
|
| 167 | 166 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), id2)) |
| 168 | 167 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), id3)) |
| 169 | 168 |
out = cli.DockerCmd(c, "ps", "-a", "-q", "--no-trunc").Combined() |
| 170 | 169 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), id1)) |
| 171 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, id2) |
|
| 172 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, id3) |
|
| 173 |
- |
|
| 170 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), id2)) |
|
| 171 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), id3)) |
|
| 174 | 172 |
out = cli.DockerCmd(c, "container", "prune", "--force", "--filter", "label!=bar").Combined() |
| 175 | 173 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), id2)) |
| 176 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, id3) |
|
| 177 |
- |
|
| 174 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), id3)) |
|
| 178 | 175 |
out = cli.DockerCmd(c, "ps", "-a", "-q", "--no-trunc").Combined() |
| 179 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, id2) |
|
| 176 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), id2)) |
|
| 180 | 177 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), id3)) |
| 181 | 178 |
// With config.json label=foobar and CLI label!=foobar, CLI label!=foobar supersede |
| 182 | 179 |
out = cli.DockerCmd(c, "--config", d, "container", "prune", "--force", "--filter", "label!=foobar").Combined() |
| 183 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, id2) |
|
| 184 |
- |
|
| 180 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), id2)) |
|
| 185 | 181 |
out = cli.DockerCmd(c, "ps", "-a", "-q", "--no-trunc").Combined() |
| 186 | 182 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), id2)) |
| 187 | 183 |
} |
| ... | ... |
@@ -216,28 +209,24 @@ func (s *DockerSuite) TestPruneVolumeLabel(c *testing.T) {
|
| 216 | 216 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), id1)) |
| 217 | 217 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), id2)) |
| 218 | 218 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), id3)) |
| 219 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, id4) |
|
| 220 |
- |
|
| 219 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), id4)) |
|
| 221 | 220 |
out, _ = dockerCmd(c, "volume", "prune", "--force", "--filter", "label=foo") |
| 222 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, id1) |
|
| 221 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), id1)) |
|
| 223 | 222 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), id2)) |
| 224 | 223 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), id3)) |
| 225 | 224 |
out, _ = dockerCmd(c, "volume", "ls", "--format", "{{.Name}}")
|
| 226 | 225 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), id1)) |
| 227 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, id2) |
|
| 228 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, id3) |
|
| 229 |
- |
|
| 226 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), id2)) |
|
| 227 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), id3)) |
|
| 230 | 228 |
out, _ = dockerCmd(c, "volume", "prune", "--force", "--filter", "label!=bar") |
| 231 | 229 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), id2)) |
| 232 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, id3) |
|
| 233 |
- |
|
| 230 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), id3)) |
|
| 234 | 231 |
out, _ = dockerCmd(c, "volume", "ls", "--format", "{{.Name}}")
|
| 235 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, id2) |
|
| 232 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), id2)) |
|
| 236 | 233 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), id3)) |
| 237 | 234 |
// With config.json label=foobar and CLI label!=foobar, CLI label!=foobar supersede |
| 238 | 235 |
out, _ = dockerCmd(c, "--config", d, "volume", "prune", "--force", "--filter", "label!=foobar") |
| 239 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, id2) |
|
| 240 |
- |
|
| 236 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), id2)) |
|
| 241 | 237 |
out, _ = dockerCmd(c, "volume", "ls", "--format", "{{.Name}}")
|
| 242 | 238 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), id2)) |
| 243 | 239 |
} |
| ... | ... |
@@ -248,17 +237,16 @@ func (s *DockerSuite) TestPruneNetworkLabel(c *testing.T) {
|
| 248 | 248 |
dockerCmd(c, "network", "create", "n3") |
| 249 | 249 |
|
| 250 | 250 |
out, _ := dockerCmd(c, "network", "prune", "--force", "--filter", "label=foo") |
| 251 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, "n1") |
|
| 251 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), "n1")) |
|
| 252 | 252 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), "n2")) |
| 253 | 253 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), "n3")) |
| 254 | 254 |
out, _ = dockerCmd(c, "network", "prune", "--force", "--filter", "label!=bar") |
| 255 | 255 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), "n1")) |
| 256 | 256 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), "n2")) |
| 257 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, "n3") |
|
| 258 |
- |
|
| 257 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), "n3")) |
|
| 259 | 258 |
out, _ = dockerCmd(c, "network", "prune", "--force") |
| 260 | 259 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), "n1")) |
| 261 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, "n2") |
|
| 260 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), "n2")) |
|
| 262 | 261 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), "n3")) |
| 263 | 262 |
} |
| 264 | 263 |
|
| ... | ... |
@@ -274,8 +262,7 @@ func (s *DockerDaemonSuite) TestPruneImageLabel(c *testing.T) {
|
| 274 | 274 |
id1 := strings.TrimSpace(result.Combined()) |
| 275 | 275 |
out, err := s.d.Cmd("images", "-q", "--no-trunc")
|
| 276 | 276 |
assert.NilError(c, err) |
| 277 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, id1) |
|
| 278 |
- |
|
| 277 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), id1)) |
|
| 279 | 278 |
result = cli.BuildCmd(c, "test2", cli.Daemon(s.d), |
| 280 | 279 |
build.WithDockerfile(`FROM busybox |
| 281 | 280 |
LABEL bar=foo`), |
| ... | ... |
@@ -285,11 +272,10 @@ func (s *DockerDaemonSuite) TestPruneImageLabel(c *testing.T) {
|
| 285 | 285 |
id2 := strings.TrimSpace(result.Combined()) |
| 286 | 286 |
out, err = s.d.Cmd("images", "-q", "--no-trunc")
|
| 287 | 287 |
assert.NilError(c, err) |
| 288 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, id2) |
|
| 289 |
- |
|
| 288 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), id2)) |
|
| 290 | 289 |
out, err = s.d.Cmd("image", "prune", "--force", "--all", "--filter", "label=foo=bar")
|
| 291 | 290 |
assert.NilError(c, err) |
| 292 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, id1) |
|
| 291 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), id1)) |
|
| 293 | 292 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), id2)) |
| 294 | 293 |
out, err = s.d.Cmd("image", "prune", "--force", "--all", "--filter", "label!=bar=foo")
|
| 295 | 294 |
assert.NilError(c, err) |
| ... | ... |
@@ -298,5 +284,5 @@ func (s *DockerDaemonSuite) TestPruneImageLabel(c *testing.T) {
|
| 298 | 298 |
out, err = s.d.Cmd("image", "prune", "--force", "--all", "--filter", "label=bar=foo")
|
| 299 | 299 |
assert.NilError(c, err) |
| 300 | 300 |
assert.Assert(c, !strings.Contains(strings.TrimSpace(out), id1)) |
| 301 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, id2) |
|
| 301 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), id2)) |
|
| 302 | 302 |
} |
| ... | ... |
@@ -9,7 +9,6 @@ import ( |
| 9 | 9 |
"time" |
| 10 | 10 |
|
| 11 | 11 |
"github.com/docker/docker/api/types/versions" |
| 12 |
- "github.com/docker/docker/integration-cli/checker" |
|
| 13 | 12 |
"github.com/docker/docker/integration-cli/cli" |
| 14 | 13 |
"github.com/docker/docker/integration-cli/cli/build" |
| 15 | 14 |
"github.com/docker/docker/pkg/stringid" |
| ... | ... |
@@ -177,7 +176,7 @@ func (s *DockerSuite) TestPsListContainersSize(c *testing.T) {
|
| 177 | 177 |
assert.Equal(c, foundID, id[:12], check.Commentf("Expected id %s, got %s", id[:12], foundID))
|
| 178 | 178 |
expectedSize := fmt.Sprintf("%dB", 2+baseBytes)
|
| 179 | 179 |
foundSize := lines[1][sizeIndex:] |
| 180 |
- assert.Assert(c, foundSize, checker.Contains, expectedSize, check.Commentf("Expected size %q, got %q", expectedSize, foundSize))
|
|
| 180 |
+ assert.Assert(c, strings.Contains(foundSize, expectedSize), check.Commentf("Expected size %q, got %q", expectedSize, foundSize))
|
|
| 181 | 181 |
} |
| 182 | 182 |
|
| 183 | 183 |
func (s *DockerSuite) TestPsListContainersFilterStatus(c *testing.T) {
|
| ... | ... |
@@ -432,8 +431,8 @@ func (s *DockerSuite) TestPsListContainersFilterLabel(c *testing.T) {
|
| 432 | 432 |
// filter containers by exact key |
| 433 | 433 |
out, _ = dockerCmd(c, "ps", "-a", "-q", "--no-trunc", "--filter=label=match") |
| 434 | 434 |
containerOut = strings.TrimSpace(out) |
| 435 |
- assert.Assert(c, containerOut, checker.Contains, firstID) |
|
| 436 |
- assert.Assert(c, containerOut, checker.Contains, secondID) |
|
| 435 |
+ assert.Assert(c, strings.Contains(containerOut, firstID)) |
|
| 436 |
+ assert.Assert(c, strings.Contains(containerOut, secondID)) |
|
| 437 | 437 |
assert.Assert(c, !strings.Contains(containerOut, thirdID)) |
| 438 | 438 |
} |
| 439 | 439 |
|
| ... | ... |
@@ -453,13 +452,13 @@ func (s *DockerSuite) TestPsListContainersFilterExited(c *testing.T) {
|
| 453 | 453 |
|
| 454 | 454 |
// filter containers by exited=0 |
| 455 | 455 |
out, _ = dockerCmd(c, "ps", "-a", "-q", "--no-trunc", "--filter=exited=0") |
| 456 |
- assert.Assert(c, out, checker.Contains, strings.TrimSpace(firstZero)) |
|
| 457 |
- assert.Assert(c, out, checker.Contains, strings.TrimSpace(secondZero)) |
|
| 456 |
+ assert.Assert(c, strings.Contains(out, strings.TrimSpace(firstZero))) |
|
| 457 |
+ assert.Assert(c, strings.Contains(out, strings.TrimSpace(secondZero))) |
|
| 458 | 458 |
assert.Assert(c, !strings.Contains(out, strings.TrimSpace(firstNonZero))) |
| 459 | 459 |
assert.Assert(c, !strings.Contains(out, strings.TrimSpace(secondNonZero))) |
| 460 | 460 |
out, _ = dockerCmd(c, "ps", "-a", "-q", "--no-trunc", "--filter=exited=1") |
| 461 |
- assert.Assert(c, out, checker.Contains, strings.TrimSpace(firstNonZero)) |
|
| 462 |
- assert.Assert(c, out, checker.Contains, strings.TrimSpace(secondNonZero)) |
|
| 461 |
+ assert.Assert(c, strings.Contains(out, strings.TrimSpace(firstNonZero))) |
|
| 462 |
+ assert.Assert(c, strings.Contains(out, strings.TrimSpace(secondNonZero))) |
|
| 463 | 463 |
assert.Assert(c, !strings.Contains(out, strings.TrimSpace(firstZero))) |
| 464 | 464 |
assert.Assert(c, !strings.Contains(out, strings.TrimSpace(secondZero))) |
| 465 | 465 |
} |
| ... | ... |
@@ -528,7 +527,7 @@ func (s *DockerSuite) TestPsListContainersFilterCreated(c *testing.T) {
|
| 528 | 528 |
continue |
| 529 | 529 |
} |
| 530 | 530 |
hits++ |
| 531 |
- assert.Assert(c, line, checker.Contains, "Created", check.Commentf("Missing 'Created' on '%s'", line))
|
|
| 531 |
+ assert.Assert(c, strings.Contains(line, "Created"), check.Commentf("Missing 'Created' on '%s'", line))
|
|
| 532 | 532 |
} |
| 533 | 533 |
|
| 534 | 534 |
assert.Equal(c, hits, 1, check.Commentf("Should have seen '%s' in ps -a output once:%d\n%s", shortCID, hits, out))
|
| ... | ... |
@@ -742,8 +741,7 @@ func (s *DockerSuite) TestPsListContainersFilterNetwork(c *testing.T) {
|
| 742 | 742 |
assert.Equal(c, len(RemoveLinesForExistingElements(lines, existing)), 1) |
| 743 | 743 |
|
| 744 | 744 |
// Making sure onbridgenetwork is on the output |
| 745 |
- assert.Assert(c, containerOut, checker.Contains, "onbridgenetwork", check.Commentf("Missing the container on network\n"))
|
|
| 746 |
- |
|
| 745 |
+ assert.Assert(c, strings.Contains(containerOut, "onbridgenetwork"), check.Commentf("Missing the container on network\n"))
|
|
| 747 | 746 |
// Filter docker ps on networks bridge and none |
| 748 | 747 |
out, _ = dockerCmd(c, "ps", "--filter", "network=bridge", "--filter", "network=none") |
| 749 | 748 |
containerOut = strings.TrimSpace(string(out)) |
| ... | ... |
@@ -757,9 +755,8 @@ func (s *DockerSuite) TestPsListContainersFilterNetwork(c *testing.T) {
|
| 757 | 757 |
assert.Equal(c, len(RemoveLinesForExistingElements(lines, existing)), 2) |
| 758 | 758 |
|
| 759 | 759 |
// Making sure onbridgenetwork and onnonenetwork is on the output |
| 760 |
- assert.Assert(c, containerOut, checker.Contains, "onnonenetwork", check.Commentf("Missing the container on none network\n"))
|
|
| 761 |
- assert.Assert(c, containerOut, checker.Contains, "onbridgenetwork", check.Commentf("Missing the container on bridge network\n"))
|
|
| 762 |
- |
|
| 760 |
+ assert.Assert(c, strings.Contains(containerOut, "onnonenetwork"), check.Commentf("Missing the container on none network\n"))
|
|
| 761 |
+ assert.Assert(c, strings.Contains(containerOut, "onbridgenetwork"), check.Commentf("Missing the container on bridge network\n"))
|
|
| 763 | 762 |
nwID, _ := dockerCmd(c, "network", "inspect", "--format", "{{.ID}}", "bridge")
|
| 764 | 763 |
|
| 765 | 764 |
// Filter by network ID |
| ... | ... |
@@ -783,8 +780,7 @@ func (s *DockerSuite) TestPsListContainersFilterNetwork(c *testing.T) {
|
| 783 | 783 |
assert.Equal(c, len(RemoveLinesForExistingElements(lines, existing)), 1) |
| 784 | 784 |
|
| 785 | 785 |
// Making sure onbridgenetwork is on the output |
| 786 |
- assert.Assert(c, containerOut, checker.Contains, "onbridgenetwork", check.Commentf("Missing the container on network\n"))
|
|
| 787 |
- |
|
| 786 |
+ assert.Assert(c, strings.Contains(containerOut, "onbridgenetwork"), check.Commentf("Missing the container on network\n"))
|
|
| 788 | 787 |
} |
| 789 | 788 |
|
| 790 | 789 |
func (s *DockerSuite) TestPsByOrder(c *testing.T) {
|
| ... | ... |
@@ -817,9 +813,8 @@ func (s *DockerSuite) TestPsListContainersFilterPorts(c *testing.T) {
|
| 817 | 817 |
id2 := strings.TrimSpace(out) |
| 818 | 818 |
|
| 819 | 819 |
out, _ = dockerCmd(c, "ps", "--no-trunc", "-q") |
| 820 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, id1) |
|
| 821 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, id2) |
|
| 822 |
- |
|
| 820 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), id1)) |
|
| 821 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), id2)) |
|
| 823 | 822 |
out, _ = dockerCmd(c, "ps", "--no-trunc", "-q", "--filter", "publish=80-8080/udp") |
| 824 | 823 |
assert.Assert(c, strings.TrimSpace(out) != id1) |
| 825 | 824 |
assert.Assert(c, strings.TrimSpace(out) != id2) |
| ... | ... |
@@ -14,7 +14,6 @@ import ( |
| 14 | 14 |
"github.com/docker/distribution/manifest" |
| 15 | 15 |
"github.com/docker/distribution/manifest/manifestlist" |
| 16 | 16 |
"github.com/docker/distribution/manifest/schema2" |
| 17 |
- "github.com/docker/docker/integration-cli/checker" |
|
| 18 | 17 |
"github.com/docker/docker/integration-cli/cli/build" |
| 19 | 18 |
"github.com/go-check/check" |
| 20 | 19 |
"github.com/opencontainers/go-digest" |
| ... | ... |
@@ -461,8 +460,7 @@ func (s *DockerRegistrySuite) TestRunImplicitPullWithNoTag(c *testing.T) {
|
| 461 | 461 |
dockerCmd(c, "rmi", repoTag2) |
| 462 | 462 |
|
| 463 | 463 |
out, _ := dockerCmd(c, "run", repo) |
| 464 |
- assert.Assert(c, out, checker.Contains, fmt.Sprintf("Unable to find image '%s:latest' locally", repo))
|
|
| 465 |
- |
|
| 464 |
+ assert.Assert(c, strings.Contains(out, fmt.Sprintf("Unable to find image '%s:latest' locally", repo)))
|
|
| 466 | 465 |
// There should be only one line for repo, the one with repo:latest |
| 467 | 466 |
outImageCmd, _ := dockerCmd(c, "images", repo) |
| 468 | 467 |
splitOutImageCmd := strings.Split(strings.TrimSpace(outImageCmd), "\n") |
| ... | ... |
@@ -6,7 +6,6 @@ import ( |
| 6 | 6 |
"testing" |
| 7 | 7 |
"time" |
| 8 | 8 |
|
| 9 |
- "github.com/docker/docker/integration-cli/checker" |
|
| 10 | 9 |
"github.com/docker/docker/integration-cli/cli" |
| 11 | 10 |
"github.com/docker/docker/integration-cli/cli/build" |
| 12 | 11 |
"github.com/docker/docker/pkg/stringid" |
| ... | ... |
@@ -28,12 +27,11 @@ func (s *DockerSuite) TestRmiWithContainerFails(c *testing.T) {
|
| 28 | 28 |
// Container is using image, should not be able to rmi |
| 29 | 29 |
assert.ErrorContains(c, err, "") |
| 30 | 30 |
// Container is using image, error message should contain errSubstr |
| 31 |
- assert.Assert(c, out, checker.Contains, errSubstr, check.Commentf("Container: %q", cleanedContainerID))
|
|
| 32 |
- |
|
| 31 |
+ assert.Assert(c, strings.Contains(out, errSubstr), check.Commentf("Container: %q", cleanedContainerID))
|
|
| 33 | 32 |
// make sure it didn't delete the busybox name |
| 34 | 33 |
images, _ := dockerCmd(c, "images") |
| 35 | 34 |
// The name 'busybox' should not have been removed from images |
| 36 |
- assert.Assert(c, images, checker.Contains, "busybox") |
|
| 35 |
+ assert.Assert(c, strings.Contains(images, "busybox")) |
|
| 37 | 36 |
} |
| 38 | 37 |
|
| 39 | 38 |
func (s *DockerSuite) TestRmiTag(c *testing.T) {
|
| ... | ... |
@@ -155,7 +153,7 @@ func (s *DockerSuite) TestRmiImageIDForceWithRunningContainersAndMultipleTags(c |
| 155 | 155 |
out, _, err := dockerCmdWithError("rmi", "-f", imgID)
|
| 156 | 156 |
// rmi -f should not delete image with running containers |
| 157 | 157 |
assert.ErrorContains(c, err, "") |
| 158 |
- assert.Assert(c, out, checker.Contains, "(cannot be forced) - image is being used by running container") |
|
| 158 |
+ assert.Assert(c, strings.Contains(out, "(cannot be forced) - image is being used by running container")) |
|
| 159 | 159 |
} |
| 160 | 160 |
|
| 161 | 161 |
func (s *DockerSuite) TestRmiTagWithExistingContainers(c *testing.T) {
|
| ... | ... |
@@ -195,7 +193,7 @@ func (s *DockerSuite) TestRmiWithMultipleRepositories(c *testing.T) {
|
| 195 | 195 |
dockerCmd(c, "commit", "test", newTag) |
| 196 | 196 |
|
| 197 | 197 |
out, _ := dockerCmd(c, "rmi", newTag) |
| 198 |
- assert.Assert(c, out, checker.Contains, "Untagged: "+newTag) |
|
| 198 |
+ assert.Assert(c, strings.Contains(out, "Untagged: "+newTag)) |
|
| 199 | 199 |
} |
| 200 | 200 |
|
| 201 | 201 |
func (s *DockerSuite) TestRmiForceWithMultipleRepositories(c *testing.T) {
|
| ... | ... |
@@ -208,11 +206,11 @@ func (s *DockerSuite) TestRmiForceWithMultipleRepositories(c *testing.T) {
|
| 208 | 208 |
dockerCmd(c, "tag", tag1, tag2) |
| 209 | 209 |
|
| 210 | 210 |
out, _ := dockerCmd(c, "rmi", "-f", tag2) |
| 211 |
- assert.Assert(c, out, checker.Contains, "Untagged: "+tag2) |
|
| 211 |
+ assert.Assert(c, strings.Contains(out, "Untagged: "+tag2)) |
|
| 212 | 212 |
assert.Assert(c, !strings.Contains(out, "Untagged: "+tag1)) |
| 213 | 213 |
// Check built image still exists |
| 214 | 214 |
images, _ := dockerCmd(c, "images", "-a") |
| 215 |
- assert.Assert(c, images, checker.Contains, imageName, check.Commentf("Built image missing %q; Images: %q", imageName, images))
|
|
| 215 |
+ assert.Assert(c, strings.Contains(images, imageName), check.Commentf("Built image missing %q; Images: %q", imageName, images))
|
|
| 216 | 216 |
} |
| 217 | 217 |
|
| 218 | 218 |
func (s *DockerSuite) TestRmiBlank(c *testing.T) {
|
| ... | ... |
@@ -222,7 +220,7 @@ func (s *DockerSuite) TestRmiBlank(c *testing.T) {
|
| 222 | 222 |
// Wrong error message generated |
| 223 | 223 |
assert.Assert(c, !strings.Contains(out, "no such id"), check.Commentf("out: %s", out))
|
| 224 | 224 |
// Expected error message not generated |
| 225 |
- assert.Assert(c, out, checker.Contains, "image name cannot be blank", check.Commentf("out: %s", out))
|
|
| 225 |
+ assert.Assert(c, strings.Contains(out, "image name cannot be blank"), check.Commentf("out: %s", out))
|
|
| 226 | 226 |
} |
| 227 | 227 |
|
| 228 | 228 |
func (s *DockerSuite) TestRmiContainerImageNotFound(c *testing.T) {
|
| ... | ... |
@@ -247,7 +245,7 @@ func (s *DockerSuite) TestRmiContainerImageNotFound(c *testing.T) {
|
| 247 | 247 |
out, _, err := dockerCmdWithError("rmi", "-f", imageIds[0])
|
| 248 | 248 |
// The image of the running container should not be removed. |
| 249 | 249 |
assert.ErrorContains(c, err, "") |
| 250 |
- assert.Assert(c, out, checker.Contains, "image is being used by running container", check.Commentf("out: %s", out))
|
|
| 250 |
+ assert.Assert(c, strings.Contains(out, "image is being used by running container"), check.Commentf("out: %s", out))
|
|
| 251 | 251 |
} |
| 252 | 252 |
|
| 253 | 253 |
// #13422 |
| ... | ... |
@@ -286,13 +284,12 @@ RUN echo 2 #layer2 |
| 286 | 286 |
out, _, err := dockerCmdWithError("rmi", newTag)
|
| 287 | 287 |
// should not be untagged without the -f flag |
| 288 | 288 |
assert.ErrorContains(c, err, "") |
| 289 |
- assert.Assert(c, out, checker.Contains, cid[:12]) |
|
| 290 |
- assert.Assert(c, out, checker.Contains, "(must force)") |
|
| 291 |
- |
|
| 289 |
+ assert.Assert(c, strings.Contains(out, cid[:12])) |
|
| 290 |
+ assert.Assert(c, strings.Contains(out, "(must force)")) |
|
| 292 | 291 |
// Add the -f flag and test again. |
| 293 | 292 |
out, _ = dockerCmd(c, "rmi", "-f", newTag) |
| 294 | 293 |
// should be allowed to untag with the -f flag |
| 295 |
- assert.Assert(c, out, checker.Contains, fmt.Sprintf("Untagged: %s:latest", newTag))
|
|
| 294 |
+ assert.Assert(c, strings.Contains(out, fmt.Sprintf("Untagged: %s:latest", newTag)))
|
|
| 296 | 295 |
} |
| 297 | 296 |
|
| 298 | 297 |
func (*DockerSuite) TestRmiParentImageFail(c *testing.T) {
|
| ... | ... |
@@ -288,7 +288,7 @@ func (s *DockerSuite) TestRunWithNetAliasOnDefaultNetworks(c *testing.T) {
|
| 288 | 288 |
for _, net := range defaults {
|
| 289 | 289 |
out, _, err := dockerCmdWithError("run", "-d", "--net", net, "--net-alias", "alias_"+net, "busybox", "top")
|
| 290 | 290 |
assert.ErrorContains(c, err, "") |
| 291 |
- assert.Assert(c, out, checker.Contains, runconfig.ErrUnsupportedNetworkAndAlias.Error()) |
|
| 291 |
+ assert.Assert(c, strings.Contains(out, runconfig.ErrUnsupportedNetworkAndAlias.Error())) |
|
| 292 | 292 |
} |
| 293 | 293 |
} |
| 294 | 294 |
|
| ... | ... |
@@ -302,16 +302,14 @@ func (s *DockerSuite) TestUserDefinedNetworkAlias(c *testing.T) {
|
| 302 | 302 |
// Check if default short-id alias is added automatically |
| 303 | 303 |
id := strings.TrimSpace(cid1) |
| 304 | 304 |
aliases := inspectField(c, id, "NetworkSettings.Networks.net1.Aliases") |
| 305 |
- assert.Assert(c, aliases, checker.Contains, stringid.TruncateID(id)) |
|
| 306 |
- |
|
| 305 |
+ assert.Assert(c, strings.Contains(aliases, stringid.TruncateID(id))) |
|
| 307 | 306 |
cid2, _ := dockerCmd(c, "run", "-d", "--net=net1", "--name=second", "busybox:glibc", "top") |
| 308 | 307 |
assert.Assert(c, waitRun("second") == nil)
|
| 309 | 308 |
|
| 310 | 309 |
// Check if default short-id alias is added automatically |
| 311 | 310 |
id = strings.TrimSpace(cid2) |
| 312 | 311 |
aliases = inspectField(c, id, "NetworkSettings.Networks.net1.Aliases") |
| 313 |
- assert.Assert(c, aliases, checker.Contains, stringid.TruncateID(id)) |
|
| 314 |
- |
|
| 312 |
+ assert.Assert(c, strings.Contains(aliases, stringid.TruncateID(id))) |
|
| 315 | 313 |
// ping to first and its network-scoped aliases |
| 316 | 314 |
_, _, err := dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
|
| 317 | 315 |
assert.NilError(c, err) |
| ... | ... |
@@ -343,7 +341,7 @@ func (s *DockerSuite) TestUserDefinedNetworkAlias(c *testing.T) {
|
| 343 | 343 |
func (s *DockerSuite) TestRunWithDaemonFlags(c *testing.T) {
|
| 344 | 344 |
out, _, err := dockerCmdWithError("--exec-opt", "foo=bar", "run", "-i", "busybox", "true")
|
| 345 | 345 |
assert.ErrorContains(c, err, "") |
| 346 |
- assert.Assert(c, out, checker.Contains, "unknown flag: --exec-opt") |
|
| 346 |
+ assert.Assert(c, strings.Contains(out, "unknown flag: --exec-opt")) |
|
| 347 | 347 |
} |
| 348 | 348 |
|
| 349 | 349 |
// Regression test for #4979 |
| ... | ... |
@@ -2294,7 +2292,7 @@ func (s *DockerSuite) TestRunAllowPortRangeThroughExpose(c *testing.T) {
|
| 2294 | 2294 |
func (s *DockerSuite) TestRunExposePort(c *testing.T) {
|
| 2295 | 2295 |
out, _, err := dockerCmdWithError("run", "--expose", "80000", "busybox")
|
| 2296 | 2296 |
assert.Assert(c, err != nil, check.Commentf("--expose with an invalid port should error out"))
|
| 2297 |
- assert.Assert(c, out, checker.Contains, "invalid range format for --expose") |
|
| 2297 |
+ assert.Assert(c, strings.Contains(out, "invalid range format for --expose")) |
|
| 2298 | 2298 |
} |
| 2299 | 2299 |
|
| 2300 | 2300 |
func (s *DockerSuite) TestRunModeIpcHost(c *testing.T) {
|
| ... | ... |
@@ -2477,7 +2475,7 @@ func (s *DockerSuite) TestRunModeUTSHost(c *testing.T) {
|
| 2477 | 2477 |
} |
| 2478 | 2478 |
|
| 2479 | 2479 |
out, _ = dockerCmdWithFail(c, "run", "-h=name", "--uts=host", "busybox", "ps") |
| 2480 |
- assert.Assert(c, out, checker.Contains, runconfig.ErrConflictUTSHostname.Error()) |
|
| 2480 |
+ assert.Assert(c, strings.Contains(out, runconfig.ErrConflictUTSHostname.Error())) |
|
| 2481 | 2481 |
} |
| 2482 | 2482 |
|
| 2483 | 2483 |
func (s *DockerSuite) TestRunTLSVerify(c *testing.T) {
|
| ... | ... |
@@ -3593,7 +3591,7 @@ func (s *DockerSuite) TestContainerWithConflictingSharedNetwork(c *testing.T) {
|
| 3593 | 3593 |
// Connecting to the user defined network must fail |
| 3594 | 3594 |
out, _, err := dockerCmdWithError("network", "connect", "testnetwork1", "second")
|
| 3595 | 3595 |
assert.ErrorContains(c, err, "") |
| 3596 |
- assert.Assert(c, out, checker.Contains, runconfig.ErrConflictSharedNetwork.Error()) |
|
| 3596 |
+ assert.Assert(c, strings.Contains(out, runconfig.ErrConflictSharedNetwork.Error())) |
|
| 3597 | 3597 |
} |
| 3598 | 3598 |
|
| 3599 | 3599 |
func (s *DockerSuite) TestContainerWithConflictingNoneNetwork(c *testing.T) {
|
| ... | ... |
@@ -3607,8 +3605,7 @@ func (s *DockerSuite) TestContainerWithConflictingNoneNetwork(c *testing.T) {
|
| 3607 | 3607 |
// Connecting to the user defined network must fail |
| 3608 | 3608 |
out, _, err := dockerCmdWithError("network", "connect", "testnetwork1", "first")
|
| 3609 | 3609 |
assert.ErrorContains(c, err, "") |
| 3610 |
- assert.Assert(c, out, checker.Contains, runconfig.ErrConflictNoNetwork.Error()) |
|
| 3611 |
- |
|
| 3610 |
+ assert.Assert(c, strings.Contains(out, runconfig.ErrConflictNoNetwork.Error())) |
|
| 3612 | 3611 |
// create a container connected to testnetwork1 |
| 3613 | 3612 |
dockerCmd(c, "run", "-d", "--net=testnetwork1", "--name=second", "busybox", "top") |
| 3614 | 3613 |
assert.Assert(c, waitRun("second") == nil)
|
| ... | ... |
@@ -3857,7 +3854,7 @@ func (s *DockerSuite) TestRunNamedVolumesMountedAsShared(c *testing.T) {
|
| 3857 | 3857 |
testRequires(c, DaemonIsLinux, NotUserNamespace) |
| 3858 | 3858 |
out, exitCode, _ := dockerCmdWithError("run", "-v", "foo:/test:shared", "busybox", "touch", "/test/somefile")
|
| 3859 | 3859 |
assert.Assert(c, exitCode != 0) |
| 3860 |
- assert.Assert(c, out, checker.Contains, "invalid mount config") |
|
| 3860 |
+ assert.Assert(c, strings.Contains(out, "invalid mount config")) |
|
| 3861 | 3861 |
} |
| 3862 | 3862 |
|
| 3863 | 3863 |
func (s *DockerSuite) TestRunNamedVolumeCopyImageData(c *testing.T) {
|
| ... | ... |
@@ -4035,9 +4032,9 @@ func (s *DockerSuite) TestRunDNSInHostMode(c *testing.T) {
|
| 4035 | 4035 |
expectedOutput2 := "search example.com" |
| 4036 | 4036 |
expectedOutput3 := "options timeout:3" |
| 4037 | 4037 |
out := cli.DockerCmd(c, "run", "--dns=1.2.3.4", "--dns-search=example.com", "--dns-opt=timeout:3", "--net=host", "busybox", "cat", "/etc/resolv.conf").Combined() |
| 4038 |
- assert.Assert(c, out, checker.Contains, expectedOutput1, check.Commentf("Expected '%s', but got %q", expectedOutput1, out))
|
|
| 4039 |
- assert.Assert(c, out, checker.Contains, expectedOutput2, check.Commentf("Expected '%s', but got %q", expectedOutput2, out))
|
|
| 4040 |
- assert.Assert(c, out, checker.Contains, expectedOutput3, check.Commentf("Expected '%s', but got %q", expectedOutput3, out))
|
|
| 4038 |
+ assert.Assert(c, strings.Contains(out, expectedOutput1), check.Commentf("Expected '%s', but got %q", expectedOutput1, out))
|
|
| 4039 |
+ assert.Assert(c, strings.Contains(out, expectedOutput2), check.Commentf("Expected '%s', but got %q", expectedOutput2, out))
|
|
| 4040 |
+ assert.Assert(c, strings.Contains(out, expectedOutput3), check.Commentf("Expected '%s', but got %q", expectedOutput3, out))
|
|
| 4041 | 4041 |
} |
| 4042 | 4042 |
|
| 4043 | 4043 |
// Test case for #21976 |
| ... | ... |
@@ -4046,7 +4043,7 @@ func (s *DockerSuite) TestRunAddHostInHostMode(c *testing.T) {
|
| 4046 | 4046 |
|
| 4047 | 4047 |
expectedOutput := "1.2.3.4\textra" |
| 4048 | 4048 |
out, _ := dockerCmd(c, "run", "--add-host=extra:1.2.3.4", "--net=host", "busybox", "cat", "/etc/hosts") |
| 4049 |
- assert.Assert(c, out, checker.Contains, expectedOutput, check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 4049 |
+ assert.Assert(c, strings.Contains(out, expectedOutput), check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 4050 | 4050 |
} |
| 4051 | 4051 |
|
| 4052 | 4052 |
func (s *DockerSuite) TestRunRmAndWait(c *testing.T) {
|
| ... | ... |
@@ -4122,8 +4119,7 @@ func (s *DockerDaemonSuite) TestRunWithUlimitAndDaemonDefault(c *testing.T) {
|
| 4122 | 4122 |
|
| 4123 | 4123 |
out, err := s.d.Cmd("inspect", "--format", "{{.HostConfig.Ulimits}}", name)
|
| 4124 | 4124 |
assert.NilError(c, err) |
| 4125 |
- assert.Assert(c, out, checker.Contains, "[nofile=65535:65535]") |
|
| 4126 |
- |
|
| 4125 |
+ assert.Assert(c, strings.Contains(out, "[nofile=65535:65535]")) |
|
| 4127 | 4126 |
name = "test-B" |
| 4128 | 4127 |
_, err = s.d.Cmd("run", "--name", name, "--ulimit=nofile=42", "-d", "busybox", "top")
|
| 4129 | 4128 |
assert.NilError(c, err) |
| ... | ... |
@@ -4140,8 +4136,7 @@ func (s *DockerSuite) TestRunStoppedLoggingDriverNoLeak(c *testing.T) {
|
| 4140 | 4140 |
|
| 4141 | 4141 |
out, _, err := dockerCmdWithError("run", "--name=fail", "--log-driver=splunk", "busybox", "true")
|
| 4142 | 4142 |
assert.ErrorContains(c, err, "") |
| 4143 |
- assert.Assert(c, out, checker.Contains, "failed to initialize logging driver", check.Commentf("error should be about logging driver, got output %s", out))
|
|
| 4144 |
- |
|
| 4143 |
+ assert.Assert(c, strings.Contains(out, "failed to initialize logging driver"), check.Commentf("error should be about logging driver, got output %s", out))
|
|
| 4145 | 4144 |
// NGoroutines is not updated right away, so we need to wait before failing |
| 4146 | 4145 |
assert.Assert(c, waitForGoroutines(nroutines) == nil) |
| 4147 | 4146 |
} |
| ... | ... |
@@ -4162,7 +4157,7 @@ func (s *DockerSuite) TestRunCredentialSpecFailures(c *testing.T) {
|
| 4162 | 4162 |
for _, attempt := range attempts {
|
| 4163 | 4163 |
_, _, err := dockerCmdWithError("run", "--security-opt=credentialspec="+attempt.value, "busybox", "true")
|
| 4164 | 4164 |
assert.Assert(c, err != nil, check.Commentf("%s expected non-nil err", attempt.value))
|
| 4165 |
- assert.Assert(c, err.Error(), checker.Contains, attempt.expectedError, check.Commentf("%s expected %s got %s", attempt.value, attempt.expectedError, err))
|
|
| 4165 |
+ assert.Assert(c, strings.Contains(err.Error(), attempt.expectedError), check.Commentf("%s expected %s got %s", attempt.value, attempt.expectedError, err))
|
|
| 4166 | 4166 |
} |
| 4167 | 4167 |
} |
| 4168 | 4168 |
|
| ... | ... |
@@ -4178,8 +4173,8 @@ func (s *DockerSuite) TestRunCredentialSpecWellFormed(c *testing.T) {
|
| 4178 | 4178 |
// controller handy |
| 4179 | 4179 |
out, _ := dockerCmd(c, "run", "--rm", "--security-opt=credentialspec="+value, minimalBaseImage(), "nltest", "/PARENTDOMAIN") |
| 4180 | 4180 |
|
| 4181 |
- assert.Assert(c, out, checker.Contains, "hyperv.local.") |
|
| 4182 |
- assert.Assert(c, out, checker.Contains, "The command completed successfully") |
|
| 4181 |
+ assert.Assert(c, strings.Contains(out, "hyperv.local.")) |
|
| 4182 |
+ assert.Assert(c, strings.Contains(out, "The command completed successfully")) |
|
| 4183 | 4183 |
} |
| 4184 | 4184 |
} |
| 4185 | 4185 |
|
| ... | ... |
@@ -4198,10 +4193,9 @@ func (s *DockerSuite) TestRunDuplicateMount(c *testing.T) {
|
| 4198 | 4198 |
name := "test" |
| 4199 | 4199 |
out, _ := dockerCmd(c, "run", "--name", name, "-v", "/tmp:/tmp", "-v", "/tmp:/tmp", "busybox", "sh", "-c", "cat "+tmpFile.Name()+" && ls /") |
| 4200 | 4200 |
assert.Assert(c, !strings.Contains(out, "tmp:")) |
| 4201 |
- assert.Assert(c, out, checker.Contains, data) |
|
| 4202 |
- |
|
| 4201 |
+ assert.Assert(c, strings.Contains(out, data)) |
|
| 4203 | 4202 |
out = inspectFieldJSON(c, name, "Config.Volumes") |
| 4204 |
- assert.Assert(c, out, checker.Contains, "null") |
|
| 4203 |
+ assert.Assert(c, strings.Contains(out, "null")) |
|
| 4205 | 4204 |
} |
| 4206 | 4205 |
|
| 4207 | 4206 |
func (s *DockerSuite) TestRunWindowsWithCPUCount(c *testing.T) {
|
| ... | ... |
@@ -4238,10 +4232,9 @@ func (s *DockerSuite) TestRunProcessIsolationWithCPUCountCPUSharesAndCPUPercent( |
| 4238 | 4238 |
testRequires(c, DaemonIsWindows, IsolationIsProcess) |
| 4239 | 4239 |
|
| 4240 | 4240 |
out, _ := dockerCmd(c, "run", "--cpu-count=1", "--cpu-shares=1000", "--cpu-percent=80", "--name", "test", "busybox", "echo", "testing") |
| 4241 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, "WARNING: Conflicting options: CPU count takes priority over CPU shares on Windows Server Containers. CPU shares discarded") |
|
| 4242 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, "WARNING: Conflicting options: CPU count takes priority over CPU percent on Windows Server Containers. CPU percent discarded") |
|
| 4243 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, "testing") |
|
| 4244 |
- |
|
| 4241 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), "WARNING: Conflicting options: CPU count takes priority over CPU shares on Windows Server Containers. CPU shares discarded")) |
|
| 4242 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), "WARNING: Conflicting options: CPU count takes priority over CPU percent on Windows Server Containers. CPU percent discarded")) |
|
| 4243 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), "testing")) |
|
| 4245 | 4244 |
out = inspectField(c, "test", "HostConfig.CPUCount") |
| 4246 | 4245 |
assert.Equal(c, out, "1") |
| 4247 | 4246 |
|
| ... | ... |
@@ -4256,8 +4249,7 @@ func (s *DockerSuite) TestRunHypervIsolationWithCPUCountCPUSharesAndCPUPercent(c |
| 4256 | 4256 |
testRequires(c, DaemonIsWindows, IsolationIsHyperv) |
| 4257 | 4257 |
|
| 4258 | 4258 |
out, _ := dockerCmd(c, "run", "--cpu-count=1", "--cpu-shares=1000", "--cpu-percent=80", "--name", "test", "busybox", "echo", "testing") |
| 4259 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, "testing") |
|
| 4260 |
- |
|
| 4259 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), "testing")) |
|
| 4261 | 4260 |
out = inspectField(c, "test", "HostConfig.CPUCount") |
| 4262 | 4261 |
assert.Equal(c, out, "1") |
| 4263 | 4262 |
|
| ... | ... |
@@ -4328,7 +4320,7 @@ func (s *DockerSuite) TestRunMountReadOnlyDevShm(c *testing.T) {
|
| 4328 | 4328 |
"-v", fmt.Sprintf("%s:/dev/shm:ro", emptyDir),
|
| 4329 | 4329 |
"busybox", "touch", "/dev/shm/foo") |
| 4330 | 4330 |
assert.ErrorContains(c, err, "", out) |
| 4331 |
- assert.Assert(c, out, checker.Contains, "Read-only file system") |
|
| 4331 |
+ assert.Assert(c, strings.Contains(out, "Read-only file system")) |
|
| 4332 | 4332 |
} |
| 4333 | 4333 |
|
| 4334 | 4334 |
func (s *DockerSuite) TestRunMount(c *testing.T) {
|
| ... | ... |
@@ -4517,7 +4509,7 @@ func (s *DockerSuite) TestRunHostnameFQDN(c *testing.T) {
|
| 4517 | 4517 |
|
| 4518 | 4518 |
out, _ = dockerCmd(c, "run", "--hostname=foobar.example.com", "busybox", "sh", "-c", `cat /etc/hosts`) |
| 4519 | 4519 |
expectedOutput = "foobar.example.com foobar" |
| 4520 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, expectedOutput) |
|
| 4520 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), expectedOutput)) |
|
| 4521 | 4521 |
} |
| 4522 | 4522 |
|
| 4523 | 4523 |
// Test case for 29129 |
| ... | ... |
@@ -20,7 +20,6 @@ import ( |
| 20 | 20 |
|
| 21 | 21 |
"github.com/creack/pty" |
| 22 | 22 |
"github.com/docker/docker/client" |
| 23 |
- "github.com/docker/docker/integration-cli/checker" |
|
| 24 | 23 |
"github.com/docker/docker/integration-cli/cli" |
| 25 | 24 |
"github.com/docker/docker/integration-cli/cli/build" |
| 26 | 25 |
"github.com/docker/docker/pkg/homedir" |
| ... | ... |
@@ -79,7 +78,7 @@ func (s *DockerSuite) TestRunWithVolumesIsRecursive(c *testing.T) {
|
| 79 | 79 |
defer f.Close() |
| 80 | 80 |
|
| 81 | 81 |
out, _ := dockerCmd(c, "run", "--name", "test-data", "--volume", fmt.Sprintf("%s:/tmp:ro", tmpDir), "busybox:latest", "ls", "/tmp/tmpfs")
|
| 82 |
- assert.Assert(c, out, checker.Contains, filepath.Base(f.Name()), check.Commentf("Recursive bind mount test failed. Expected file not found"))
|
|
| 82 |
+ assert.Assert(c, strings.Contains(out, filepath.Base(f.Name())), check.Commentf("Recursive bind mount test failed. Expected file not found"))
|
|
| 83 | 83 |
} |
| 84 | 84 |
|
| 85 | 85 |
func (s *DockerSuite) TestRunDeviceDirectory(c *testing.T) {
|
| ... | ... |
@@ -89,10 +88,9 @@ func (s *DockerSuite) TestRunDeviceDirectory(c *testing.T) {
|
| 89 | 89 |
} |
| 90 | 90 |
|
| 91 | 91 |
out, _ := dockerCmd(c, "run", "--device", "/dev/snd:/dev/snd", "busybox", "sh", "-c", "ls /dev/snd/") |
| 92 |
- assert.Assert(c, strings.Trim(out, "\r\n"), checker.Contains, "timer", check.Commentf("expected output /dev/snd/timer"))
|
|
| 93 |
- |
|
| 92 |
+ assert.Assert(c, strings.Contains(strings.Trim(out, "\r\n"), "timer"), check.Commentf("expected output /dev/snd/timer"))
|
|
| 94 | 93 |
out, _ = dockerCmd(c, "run", "--device", "/dev/snd:/dev/othersnd", "busybox", "sh", "-c", "ls /dev/othersnd/") |
| 95 |
- assert.Assert(c, strings.Trim(out, "\r\n"), checker.Contains, "seq", check.Commentf("expected output /dev/othersnd/seq"))
|
|
| 94 |
+ assert.Assert(c, strings.Contains(strings.Trim(out, "\r\n"), "seq"), check.Commentf("expected output /dev/othersnd/seq"))
|
|
| 96 | 95 |
} |
| 97 | 96 |
|
| 98 | 97 |
// TestRunAttachDetach checks attaching and detaching with the default escape sequence. |
| ... | ... |
@@ -142,8 +140,8 @@ func (s *DockerSuite) TestRunAttachDetach(c *testing.T) {
|
| 142 | 142 |
|
| 143 | 143 |
out, _ = dockerCmd(c, "events", "--since=0", "--until", daemonUnixTime(c), "-f", "container="+name) |
| 144 | 144 |
// attach and detach event should be monitored |
| 145 |
- assert.Assert(c, out, checker.Contains, "attach") |
|
| 146 |
- assert.Assert(c, out, checker.Contains, "detach") |
|
| 145 |
+ assert.Assert(c, strings.Contains(out, "attach")) |
|
| 146 |
+ assert.Assert(c, strings.Contains(out, "detach")) |
|
| 147 | 147 |
} |
| 148 | 148 |
|
| 149 | 149 |
// TestRunAttachDetachFromFlag checks attaching and detaching with the escape sequence specified via flags. |
| ... | ... |
@@ -674,11 +672,10 @@ func (s *DockerSuite) TestRunWithSwappinessInvalid(c *testing.T) {
|
| 674 | 674 |
out, _, err := dockerCmdWithError("run", "--memory-swappiness", "101", "busybox", "true")
|
| 675 | 675 |
assert.ErrorContains(c, err, "") |
| 676 | 676 |
expected := "Valid memory swappiness range is 0-100" |
| 677 |
- assert.Assert(c, out, checker.Contains, expected, check.Commentf("Expected output to contain %q, not %q", out, expected))
|
|
| 678 |
- |
|
| 677 |
+ assert.Assert(c, strings.Contains(out, expected), check.Commentf("Expected output to contain %q, not %q", out, expected))
|
|
| 679 | 678 |
out, _, err = dockerCmdWithError("run", "--memory-swappiness", "-10", "busybox", "true")
|
| 680 | 679 |
assert.ErrorContains(c, err, "") |
| 681 |
- assert.Assert(c, out, checker.Contains, expected, check.Commentf("Expected output to contain %q, not %q", out, expected))
|
|
| 680 |
+ assert.Assert(c, strings.Contains(out, expected), check.Commentf("Expected output to contain %q, not %q", out, expected))
|
|
| 682 | 681 |
} |
| 683 | 682 |
|
| 684 | 683 |
func (s *DockerSuite) TestRunWithMemoryReservation(c *testing.T) {
|
| ... | ... |
@@ -698,12 +695,11 @@ func (s *DockerSuite) TestRunWithMemoryReservationInvalid(c *testing.T) {
|
| 698 | 698 |
out, _, err := dockerCmdWithError("run", "-m", "500M", "--memory-reservation", "800M", "busybox", "true")
|
| 699 | 699 |
assert.ErrorContains(c, err, "") |
| 700 | 700 |
expected := "Minimum memory limit can not be less than memory reservation limit" |
| 701 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, expected, check.Commentf("run container should fail with invalid memory reservation"))
|
|
| 702 |
- |
|
| 701 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), expected), check.Commentf("run container should fail with invalid memory reservation"))
|
|
| 703 | 702 |
out, _, err = dockerCmdWithError("run", "--memory-reservation", "1k", "busybox", "true")
|
| 704 | 703 |
assert.ErrorContains(c, err, "") |
| 705 | 704 |
expected = "Minimum memory reservation allowed is 4MB" |
| 706 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, expected, check.Commentf("run container should fail with invalid memory reservation"))
|
|
| 705 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), expected), check.Commentf("run container should fail with invalid memory reservation"))
|
|
| 707 | 706 |
} |
| 708 | 707 |
|
| 709 | 708 |
func (s *DockerSuite) TestStopContainerSignal(c *testing.T) {
|
| ... | ... |
@@ -715,7 +711,7 @@ func (s *DockerSuite) TestStopContainerSignal(c *testing.T) {
|
| 715 | 715 |
dockerCmd(c, "stop", containerID) |
| 716 | 716 |
out, _ = dockerCmd(c, "logs", containerID) |
| 717 | 717 |
|
| 718 |
- assert.Assert(c, out, checker.Contains, "exit trapped", check.Commentf("Expected `exit trapped` in the log"))
|
|
| 718 |
+ assert.Assert(c, strings.Contains(out, "exit trapped"), check.Commentf("Expected `exit trapped` in the log"))
|
|
| 719 | 719 |
} |
| 720 | 720 |
|
| 721 | 721 |
func (s *DockerSuite) TestRunSwapLessThanMemoryLimit(c *testing.T) {
|
| ... | ... |
@@ -815,7 +811,7 @@ func (s *DockerSuite) TestRunTmpfsMountsEnsureOrdered(c *testing.T) {
|
| 815 | 815 |
assert.NilError(c, err) |
| 816 | 816 |
defer tmpFile.Close() |
| 817 | 817 |
out, _ := dockerCmd(c, "run", "--tmpfs", "/run", "-v", tmpFile.Name()+":/run/test", "busybox", "ls", "/run") |
| 818 |
- assert.Assert(c, out, checker.Contains, "test") |
|
| 818 |
+ assert.Assert(c, strings.Contains(out, "test")) |
|
| 819 | 819 |
} |
| 820 | 820 |
|
| 821 | 821 |
func (s *DockerSuite) TestRunTmpfsMounts(c *testing.T) {
|
| ... | ... |
@@ -857,25 +853,25 @@ func (s *DockerSuite) TestRunTmpfsMountsWithOptions(c *testing.T) {
|
| 857 | 857 |
expectedOptions := []string{"rw", "nosuid", "nodev", "noexec", "relatime"}
|
| 858 | 858 |
out, _ := dockerCmd(c, "run", "--tmpfs", "/tmp", "busybox", "sh", "-c", "mount | grep 'tmpfs on /tmp'") |
| 859 | 859 |
for _, option := range expectedOptions {
|
| 860 |
- assert.Assert(c, out, checker.Contains, option) |
|
| 860 |
+ assert.Assert(c, strings.Contains(out, option)) |
|
| 861 | 861 |
} |
| 862 | 862 |
assert.Assert(c, !strings.Contains(out, "size=")) |
| 863 | 863 |
expectedOptions = []string{"rw", "nosuid", "nodev", "noexec", "relatime"}
|
| 864 | 864 |
out, _ = dockerCmd(c, "run", "--tmpfs", "/tmp:rw", "busybox", "sh", "-c", "mount | grep 'tmpfs on /tmp'") |
| 865 | 865 |
for _, option := range expectedOptions {
|
| 866 |
- assert.Assert(c, out, checker.Contains, option) |
|
| 866 |
+ assert.Assert(c, strings.Contains(out, option)) |
|
| 867 | 867 |
} |
| 868 | 868 |
assert.Assert(c, !strings.Contains(out, "size=")) |
| 869 | 869 |
expectedOptions = []string{"rw", "nosuid", "nodev", "relatime", "size=8192k"}
|
| 870 | 870 |
out, _ = dockerCmd(c, "run", "--tmpfs", "/tmp:rw,exec,size=8192k", "busybox", "sh", "-c", "mount | grep 'tmpfs on /tmp'") |
| 871 | 871 |
for _, option := range expectedOptions {
|
| 872 |
- assert.Assert(c, out, checker.Contains, option) |
|
| 872 |
+ assert.Assert(c, strings.Contains(out, option)) |
|
| 873 | 873 |
} |
| 874 | 874 |
|
| 875 | 875 |
expectedOptions = []string{"rw", "nosuid", "nodev", "noexec", "relatime", "size=4096k"}
|
| 876 | 876 |
out, _ = dockerCmd(c, "run", "--tmpfs", "/tmp:rw,size=8192k,exec,size=4096k,noexec", "busybox", "sh", "-c", "mount | grep 'tmpfs on /tmp'") |
| 877 | 877 |
for _, option := range expectedOptions {
|
| 878 |
- assert.Assert(c, out, checker.Contains, option) |
|
| 878 |
+ assert.Assert(c, strings.Contains(out, option)) |
|
| 879 | 879 |
} |
| 880 | 880 |
|
| 881 | 881 |
// We use debian:jessie as there is no findmnt in busybox. Also the output will be in the format of |
| ... | ... |
@@ -885,7 +881,7 @@ func (s *DockerSuite) TestRunTmpfsMountsWithOptions(c *testing.T) {
|
| 885 | 885 |
expectedOptions = []string{"shared"}
|
| 886 | 886 |
out, _ = dockerCmd(c, "run", "--tmpfs", "/tmp:shared", "debian:jessie", "findmnt", "-o", "TARGET,PROPAGATION", "/tmp") |
| 887 | 887 |
for _, option := range expectedOptions {
|
| 888 |
- assert.Assert(c, out, checker.Contains, option) |
|
| 888 |
+ assert.Assert(c, strings.Contains(out, option)) |
|
| 889 | 889 |
} |
| 890 | 890 |
} |
| 891 | 891 |
|
| ... | ... |
@@ -1390,16 +1386,14 @@ func (s *DockerSuite) TestRunDeviceSymlink(c *testing.T) {
|
| 1390 | 1390 |
|
| 1391 | 1391 |
// md5sum of 'dd if=/dev/zero bs=4K count=8' is bb7df04e1b0a2570657527a7e108ae23 |
| 1392 | 1392 |
out, _ := dockerCmd(c, "run", "--device", symZero+":/dev/symzero", "busybox", "sh", "-c", "dd if=/dev/symzero bs=4K count=8 | md5sum") |
| 1393 |
- assert.Assert(c, strings.Trim(out, "\r\n"), checker.Contains, "bb7df04e1b0a2570657527a7e108ae23", check.Commentf("expected output bb7df04e1b0a2570657527a7e108ae23"))
|
|
| 1394 |
- |
|
| 1393 |
+ assert.Assert(c, strings.Contains(strings.Trim(out, "\r\n"), "bb7df04e1b0a2570657527a7e108ae23"), check.Commentf("expected output bb7df04e1b0a2570657527a7e108ae23"))
|
|
| 1395 | 1394 |
// symlink "tmpDir/file" to a file "tmpDir/temp" will result in an error as it is not a device. |
| 1396 | 1395 |
out, _, err = dockerCmdWithError("run", "--device", symFile+":/dev/symzero", "busybox", "sh", "-c", "dd if=/dev/symzero bs=4K count=8 | md5sum")
|
| 1397 | 1396 |
assert.ErrorContains(c, err, "") |
| 1398 |
- assert.Assert(c, strings.Trim(out, "\r\n"), checker.Contains, "not a device node", check.Commentf("expected output 'not a device node'"))
|
|
| 1399 |
- |
|
| 1397 |
+ assert.Assert(c, strings.Contains(strings.Trim(out, "\r\n"), "not a device node"), check.Commentf("expected output 'not a device node'"))
|
|
| 1400 | 1398 |
// md5sum of 'dd if=/dev/zero bs=4K count=8' is bb7df04e1b0a2570657527a7e108ae23 (this time check with relative path backed, see #22271) |
| 1401 | 1399 |
out, _ = dockerCmd(c, "run", "--device", "/dev/symzero:/dev/symzero", "busybox", "sh", "-c", "dd if=/dev/symzero bs=4K count=8 | md5sum") |
| 1402 |
- assert.Assert(c, strings.Trim(out, "\r\n"), checker.Contains, "bb7df04e1b0a2570657527a7e108ae23", check.Commentf("expected output bb7df04e1b0a2570657527a7e108ae23"))
|
|
| 1400 |
+ assert.Assert(c, strings.Contains(strings.Trim(out, "\r\n"), "bb7df04e1b0a2570657527a7e108ae23"), check.Commentf("expected output bb7df04e1b0a2570657527a7e108ae23"))
|
|
| 1403 | 1401 |
} |
| 1404 | 1402 |
|
| 1405 | 1403 |
// TestRunPIDsLimit makes sure the pids cgroup is set with --pids-limit |
| ... | ... |
@@ -1437,7 +1431,7 @@ func (s *DockerSuite) TestRunUserDeviceAllowed(c *testing.T) {
|
| 1437 | 1437 |
|
| 1438 | 1438 |
file := "/sys/fs/cgroup/devices/devices.list" |
| 1439 | 1439 |
out, _ := dockerCmd(c, "run", "--device", "/dev/snd/timer:w", "busybox", "cat", file) |
| 1440 |
- assert.Assert(c, out, checker.Contains, fmt.Sprintf("c %d:%d w", stat.Rdev/256, stat.Rdev%256))
|
|
| 1440 |
+ assert.Assert(c, strings.Contains(out, fmt.Sprintf("c %d:%d w", stat.Rdev/256, stat.Rdev%256)))
|
|
| 1441 | 1441 |
} |
| 1442 | 1442 |
|
| 1443 | 1443 |
func (s *DockerDaemonSuite) TestRunSeccompJSONNewFormat(c *testing.T) {
|
| ... | ... |
@@ -1462,7 +1456,7 @@ func (s *DockerDaemonSuite) TestRunSeccompJSONNewFormat(c *testing.T) {
|
| 1462 | 1462 |
|
| 1463 | 1463 |
out, err := s.d.Cmd("run", "--security-opt", "seccomp="+tmpFile.Name(), "busybox", "chmod", "777", ".")
|
| 1464 | 1464 |
assert.ErrorContains(c, err, "") |
| 1465 |
- assert.Assert(c, out, checker.Contains, "Operation not permitted") |
|
| 1465 |
+ assert.Assert(c, strings.Contains(out, "Operation not permitted")) |
|
| 1466 | 1466 |
} |
| 1467 | 1467 |
|
| 1468 | 1468 |
func (s *DockerDaemonSuite) TestRunSeccompJSONNoNameAndNames(c *testing.T) {
|
| ... | ... |
@@ -1488,7 +1482,7 @@ func (s *DockerDaemonSuite) TestRunSeccompJSONNoNameAndNames(c *testing.T) {
|
| 1488 | 1488 |
|
| 1489 | 1489 |
out, err := s.d.Cmd("run", "--security-opt", "seccomp="+tmpFile.Name(), "busybox", "chmod", "777", ".")
|
| 1490 | 1490 |
assert.ErrorContains(c, err, "") |
| 1491 |
- assert.Assert(c, out, checker.Contains, "'name' and 'names' were specified in the seccomp profile, use either 'name' or 'names'") |
|
| 1491 |
+ assert.Assert(c, strings.Contains(out, "'name' and 'names' were specified in the seccomp profile, use either 'name' or 'names'")) |
|
| 1492 | 1492 |
} |
| 1493 | 1493 |
|
| 1494 | 1494 |
func (s *DockerDaemonSuite) TestRunSeccompJSONNoArchAndArchMap(c *testing.T) {
|
| ... | ... |
@@ -1525,7 +1519,7 @@ func (s *DockerDaemonSuite) TestRunSeccompJSONNoArchAndArchMap(c *testing.T) {
|
| 1525 | 1525 |
|
| 1526 | 1526 |
out, err := s.d.Cmd("run", "--security-opt", "seccomp="+tmpFile.Name(), "busybox", "chmod", "777", ".")
|
| 1527 | 1527 |
assert.ErrorContains(c, err, "") |
| 1528 |
- assert.Assert(c, out, checker.Contains, "'architectures' and 'archMap' were specified in the seccomp profile, use either 'architectures' or 'archMap'") |
|
| 1528 |
+ assert.Assert(c, strings.Contains(out, "'architectures' and 'archMap' were specified in the seccomp profile, use either 'architectures' or 'archMap'")) |
|
| 1529 | 1529 |
} |
| 1530 | 1530 |
|
| 1531 | 1531 |
func (s *DockerDaemonSuite) TestRunWithDaemonDefaultSeccompProfile(c *testing.T) {
|
| ... | ... |
@@ -1561,7 +1555,7 @@ func (s *DockerDaemonSuite) TestRunWithDaemonDefaultSeccompProfile(c *testing.T) |
| 1561 | 1561 |
|
| 1562 | 1562 |
out, err := s.d.Cmd("run", "busybox", "chmod", "777", ".")
|
| 1563 | 1563 |
assert.ErrorContains(c, err, "") |
| 1564 |
- assert.Assert(c, out, checker.Contains, "Operation not permitted") |
|
| 1564 |
+ assert.Assert(c, strings.Contains(out, "Operation not permitted")) |
|
| 1565 | 1565 |
} |
| 1566 | 1566 |
|
| 1567 | 1567 |
func (s *DockerSuite) TestRunWithNanoCPUs(c *testing.T) {
|
| ... | ... |
@@ -1585,5 +1579,5 @@ func (s *DockerSuite) TestRunWithNanoCPUs(c *testing.T) {
|
| 1585 | 1585 |
|
| 1586 | 1586 |
out, _, err = dockerCmdWithError("run", "--cpus", "0.5", "--cpu-quota", "50000", "--cpu-period", "100000", "busybox", "sh")
|
| 1587 | 1587 |
assert.ErrorContains(c, err, "") |
| 1588 |
- assert.Assert(c, out, checker.Contains, "Conflicting options: Nano CPUs and CPU Period cannot both be set") |
|
| 1588 |
+ assert.Assert(c, strings.Contains(out, "Conflicting options: Nano CPUs and CPU Period cannot both be set")) |
|
| 1589 | 1589 |
} |
| ... | ... |
@@ -16,7 +16,6 @@ import ( |
| 16 | 16 |
"testing" |
| 17 | 17 |
"time" |
| 18 | 18 |
|
| 19 |
- "github.com/docker/docker/integration-cli/checker" |
|
| 20 | 19 |
"github.com/docker/docker/integration-cli/cli/build" |
| 21 | 20 |
"github.com/go-check/check" |
| 22 | 21 |
"github.com/opencontainers/go-digest" |
| ... | ... |
@@ -395,15 +394,14 @@ func (s *DockerSuite) TestSaveLoadNoTag(c *testing.T) {
|
| 395 | 395 |
|
| 396 | 396 |
// Should not show 'name' but should show the image ID during the load |
| 397 | 397 |
assert.Assert(c, !strings.Contains(out, "Loaded image: ")) |
| 398 |
- assert.Assert(c, out, checker.Contains, "Loaded image ID:") |
|
| 399 |
- assert.Assert(c, out, checker.Contains, id) |
|
| 400 |
- |
|
| 398 |
+ assert.Assert(c, strings.Contains(out, "Loaded image ID:")) |
|
| 399 |
+ assert.Assert(c, strings.Contains(out, id)) |
|
| 401 | 400 |
// Test to make sure that save by name shows that name during load |
| 402 | 401 |
out, err = RunCommandPipelineWithOutput( |
| 403 | 402 |
exec.Command(dockerBinary, "save", name), |
| 404 | 403 |
exec.Command(dockerBinary, "load")) |
| 405 | 404 |
assert.NilError(c, err, "failed to save and load repo: %s, %v", out, err) |
| 406 | 405 |
|
| 407 |
- assert.Assert(c, out, checker.Contains, "Loaded image: "+name+":latest") |
|
| 406 |
+ assert.Assert(c, strings.Contains(out, "Loaded image: "+name+":latest")) |
|
| 408 | 407 |
assert.Assert(c, !strings.Contains(out, "Loaded image ID:")) |
| 409 | 408 |
} |
| ... | ... |
@@ -445,5 +445,5 @@ func (s *DockerSwarmSuite) TestServiceCreateWithNetworkAlias(c *testing.T) {
|
| 445 | 445 |
assert.Assert(c, json.Unmarshal([]byte(out), &aliases) == nil) |
| 446 | 446 |
assert.Equal(c, len(aliases), 1) |
| 447 | 447 |
|
| 448 |
- assert.Assert(c, task.Status.ContainerStatus.ContainerID, checker.Contains, aliases[0]) |
|
| 448 |
+ assert.Assert(c, strings.Contains(task.Status.ContainerStatus.ContainerID, aliases[0])) |
|
| 449 | 449 |
} |
| ... | ... |
@@ -6,7 +6,6 @@ import ( |
| 6 | 6 |
"testing" |
| 7 | 7 |
"time" |
| 8 | 8 |
|
| 9 |
- "github.com/docker/docker/integration-cli/checker" |
|
| 10 | 9 |
"github.com/docker/docker/integration-cli/cli" |
| 11 | 10 |
"github.com/go-check/check" |
| 12 | 11 |
"gotest.tools/assert" |
| ... | ... |
@@ -83,8 +82,7 @@ func (s *DockerSuite) TestStartRecordError(c *testing.T) {
|
| 83 | 83 |
assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
| 84 | 84 |
|
| 85 | 85 |
stateErr = inspectField(c, "test2", "State.Error") |
| 86 |
- assert.Assert(c, stateErr, checker.Contains, "port is already allocated") |
|
| 87 |
- |
|
| 86 |
+ assert.Assert(c, strings.Contains(stateErr, "port is already allocated")) |
|
| 88 | 87 |
// Expect the conflict to be resolved when we stop the initial container |
| 89 | 88 |
dockerCmd(c, "stop", "test") |
| 90 | 89 |
dockerCmd(c, "start", "test2") |
| ... | ... |
@@ -105,7 +103,7 @@ func (s *DockerSuite) TestStartPausedContainer(c *testing.T) {
|
| 105 | 105 |
// an error should have been shown that you cannot start paused container |
| 106 | 106 |
assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
| 107 | 107 |
// an error should have been shown that you cannot start paused container |
| 108 |
- assert.Assert(c, strings.ToLower(out), checker.Contains, "cannot start a paused container, try unpause instead") |
|
| 108 |
+ assert.Assert(c, strings.Contains(strings.ToLower(out), "cannot start a paused container, try unpause instead")) |
|
| 109 | 109 |
} |
| 110 | 110 |
|
| 111 | 111 |
func (s *DockerSuite) TestStartMultipleContainers(c *testing.T) {
|
| ... | ... |
@@ -161,7 +159,7 @@ func (s *DockerSuite) TestStartAttachMultipleContainers(c *testing.T) {
|
| 161 | 161 |
// err shouldn't be nil because start will fail |
| 162 | 162 |
assert.Assert(c, err != nil, check.Commentf("out: %s", out))
|
| 163 | 163 |
// output does not correspond to what was expected |
| 164 |
- assert.Assert(c, out, checker.Contains, "you cannot start and attach multiple containers at once") |
|
| 164 |
+ assert.Assert(c, strings.Contains(out, "you cannot start and attach multiple containers at once")) |
|
| 165 | 165 |
} |
| 166 | 166 |
|
| 167 | 167 |
// confirm the state of all the containers be stopped |
| ... | ... |
@@ -53,7 +53,7 @@ func (s *DockerSwarmSuite) TestSwarmUpdate(c *testing.T) {
|
| 53 | 53 |
// setting anything under 30m for cert-expiry is not allowed |
| 54 | 54 |
out, err = d.Cmd("swarm", "update", "--cert-expiry", "15m")
|
| 55 | 55 |
assert.ErrorContains(c, err, "") |
| 56 |
- assert.Assert(c, out, checker.Contains, "minimum certificate expiry time") |
|
| 56 |
+ assert.Assert(c, strings.Contains(out, "minimum certificate expiry time")) |
|
| 57 | 57 |
spec = getSpec() |
| 58 | 58 |
assert.Equal(c, spec.CAConfig.NodeCertExpiry, 30*time.Hour) |
| 59 | 59 |
|
| ... | ... |
@@ -135,14 +135,14 @@ func (s *DockerSwarmSuite) TestSwarmInitIPv6(c *testing.T) {
|
| 135 | 135 |
cli.Docker(cli.Args("swarm", "join", "::1"), cli.Daemon(d2)).Assert(c, icmd.Success)
|
| 136 | 136 |
|
| 137 | 137 |
out := cli.Docker(cli.Args("info"), cli.Daemon(d2)).Assert(c, icmd.Success).Combined()
|
| 138 |
- assert.Assert(c, out, checker.Contains, "Swarm: active") |
|
| 138 |
+ assert.Assert(c, strings.Contains(out, "Swarm: active")) |
|
| 139 | 139 |
} |
| 140 | 140 |
|
| 141 | 141 |
func (s *DockerSwarmSuite) TestSwarmInitUnspecifiedAdvertiseAddr(c *testing.T) {
|
| 142 | 142 |
d := s.AddDaemon(c, false, false) |
| 143 | 143 |
out, err := d.Cmd("swarm", "init", "--advertise-addr", "0.0.0.0")
|
| 144 | 144 |
assert.ErrorContains(c, err, "") |
| 145 |
- assert.Assert(c, out, checker.Contains, "advertise address must be a non-zero IP address") |
|
| 145 |
+ assert.Assert(c, strings.Contains(out, "advertise address must be a non-zero IP address")) |
|
| 146 | 146 |
} |
| 147 | 147 |
|
| 148 | 148 |
func (s *DockerSwarmSuite) TestSwarmIncompatibleDaemon(c *testing.T) {
|
| ... | ... |
@@ -157,14 +157,13 @@ func (s *DockerSwarmSuite) TestSwarmIncompatibleDaemon(c *testing.T) {
|
| 157 | 157 |
assert.ErrorContains(c, err, "") |
| 158 | 158 |
content, err := d.ReadLogFile() |
| 159 | 159 |
assert.NilError(c, err) |
| 160 |
- assert.Assert(c, string(content), checker.Contains, "--cluster-store and --cluster-advertise daemon configurations are incompatible with swarm mode") |
|
| 161 |
- |
|
| 160 |
+ assert.Assert(c, strings.Contains(string(content), "--cluster-store and --cluster-advertise daemon configurations are incompatible with swarm mode")) |
|
| 162 | 161 |
// start a daemon with --live-restore |
| 163 | 162 |
err = d.StartWithError("--live-restore")
|
| 164 | 163 |
assert.ErrorContains(c, err, "") |
| 165 | 164 |
content, err = d.ReadLogFile() |
| 166 | 165 |
assert.NilError(c, err) |
| 167 |
- assert.Assert(c, string(content), checker.Contains, "--live-restore daemon configuration is incompatible with swarm mode") |
|
| 166 |
+ assert.Assert(c, strings.Contains(string(content), "--live-restore daemon configuration is incompatible with swarm mode")) |
|
| 168 | 167 |
// restart for teardown |
| 169 | 168 |
d.StartNode(c) |
| 170 | 169 |
} |
| ... | ... |
@@ -211,19 +210,19 @@ func (s *DockerSwarmSuite) TestSwarmServiceListFilter(c *testing.T) {
|
| 211 | 211 |
// We search checker.Contains with `name+" "` to prevent prefix only. |
| 212 | 212 |
out, err = d.Cmd("service", "ls", "--filter", filter1)
|
| 213 | 213 |
assert.NilError(c, err, out) |
| 214 |
- assert.Assert(c, out, checker.Contains, name1+" ") |
|
| 214 |
+ assert.Assert(c, strings.Contains(out, name1+" ")) |
|
| 215 | 215 |
assert.Assert(c, !strings.Contains(out, name2+" ")) |
| 216 | 216 |
assert.Assert(c, !strings.Contains(out, name3+" ")) |
| 217 | 217 |
out, err = d.Cmd("service", "ls", "--filter", filter2)
|
| 218 | 218 |
assert.NilError(c, err, out) |
| 219 |
- assert.Assert(c, out, checker.Contains, name1+" ") |
|
| 220 |
- assert.Assert(c, out, checker.Contains, name2+" ") |
|
| 219 |
+ assert.Assert(c, strings.Contains(out, name1+" ")) |
|
| 220 |
+ assert.Assert(c, strings.Contains(out, name2+" ")) |
|
| 221 | 221 |
assert.Assert(c, !strings.Contains(out, name3+" ")) |
| 222 | 222 |
out, err = d.Cmd("service", "ls")
|
| 223 | 223 |
assert.NilError(c, err, out) |
| 224 |
- assert.Assert(c, out, checker.Contains, name1+" ") |
|
| 225 |
- assert.Assert(c, out, checker.Contains, name2+" ") |
|
| 226 |
- assert.Assert(c, out, checker.Contains, name3+" ") |
|
| 224 |
+ assert.Assert(c, strings.Contains(out, name1+" ")) |
|
| 225 |
+ assert.Assert(c, strings.Contains(out, name2+" ")) |
|
| 226 |
+ assert.Assert(c, strings.Contains(out, name3+" ")) |
|
| 227 | 227 |
} |
| 228 | 228 |
|
| 229 | 229 |
func (s *DockerSwarmSuite) TestSwarmNodeListFilter(c *testing.T) {
|
| ... | ... |
@@ -238,8 +237,7 @@ func (s *DockerSwarmSuite) TestSwarmNodeListFilter(c *testing.T) {
|
| 238 | 238 |
|
| 239 | 239 |
out, err = d.Cmd("node", "ls", "--filter", filter)
|
| 240 | 240 |
assert.NilError(c, err, out) |
| 241 |
- assert.Assert(c, out, checker.Contains, name) |
|
| 242 |
- |
|
| 241 |
+ assert.Assert(c, strings.Contains(out, name)) |
|
| 243 | 242 |
out, err = d.Cmd("node", "ls", "--filter", "name=none")
|
| 244 | 243 |
assert.NilError(c, err, out) |
| 245 | 244 |
assert.Assert(c, !strings.Contains(out, name)) |
| ... | ... |
@@ -260,10 +258,9 @@ func (s *DockerSwarmSuite) TestSwarmNodeTaskListFilter(c *testing.T) {
|
| 260 | 260 |
|
| 261 | 261 |
out, err = d.Cmd("node", "ps", "--filter", filter, "self")
|
| 262 | 262 |
assert.NilError(c, err, out) |
| 263 |
- assert.Assert(c, out, checker.Contains, name+".1") |
|
| 264 |
- assert.Assert(c, out, checker.Contains, name+".2") |
|
| 265 |
- assert.Assert(c, out, checker.Contains, name+".3") |
|
| 266 |
- |
|
| 263 |
+ assert.Assert(c, strings.Contains(out, name+".1")) |
|
| 264 |
+ assert.Assert(c, strings.Contains(out, name+".2")) |
|
| 265 |
+ assert.Assert(c, strings.Contains(out, name+".3")) |
|
| 267 | 266 |
out, err = d.Cmd("node", "ps", "--filter", "name=none", "self")
|
| 268 | 267 |
assert.NilError(c, err, out) |
| 269 | 268 |
assert.Assert(c, !strings.Contains(out, name+".1")) |
| ... | ... |
@@ -487,8 +484,7 @@ func (s *DockerSwarmSuite) TestSwarmIngressNetwork(c *testing.T) {
|
| 487 | 487 |
// But only one is allowed |
| 488 | 488 |
out, err = d.Cmd("network", "create", "-d", "overlay", "--ingress", "another-ingress")
|
| 489 | 489 |
assert.ErrorContains(c, err, "") |
| 490 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, "is already present") |
|
| 491 |
- |
|
| 490 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), "is already present")) |
|
| 492 | 491 |
// It cannot be removed if it is being used |
| 493 | 492 |
out, err = d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "srv1", "-p", "9000:8000", "busybox", "top")
|
| 494 | 493 |
assert.NilError(c, err, out) |
| ... | ... |
@@ -509,13 +505,11 @@ func (s *DockerSwarmSuite) TestSwarmIngressNetwork(c *testing.T) {
|
| 509 | 509 |
// A service which needs the ingress network cannot be created if no ingress is present |
| 510 | 510 |
out, err = d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "srv2", "-p", "500:500", "busybox", "top")
|
| 511 | 511 |
assert.ErrorContains(c, err, "") |
| 512 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, "no ingress network is present") |
|
| 513 |
- |
|
| 512 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), "no ingress network is present")) |
|
| 514 | 513 |
// An existing service cannot be updated to use the ingress nw if the nw is not present |
| 515 | 514 |
out, err = d.Cmd("service", "update", "--detach", "--publish-add", "9000:8000", "srv1")
|
| 516 | 515 |
assert.ErrorContains(c, err, "") |
| 517 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, "no ingress network is present") |
|
| 518 |
- |
|
| 516 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), "no ingress network is present")) |
|
| 519 | 517 |
// But services which do not need routing mesh can be created regardless |
| 520 | 518 |
out, err = d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", "srv3", "--endpoint-mode", "dnsrr", "busybox", "top")
|
| 521 | 519 |
assert.NilError(c, err, out) |
| ... | ... |
@@ -561,13 +555,12 @@ func (s *DockerSwarmSuite) TestSwarmTaskListFilter(c *testing.T) {
|
| 561 | 561 |
|
| 562 | 562 |
out, err = d.Cmd("service", "ps", "--filter", filter, name)
|
| 563 | 563 |
assert.NilError(c, err, out) |
| 564 |
- assert.Assert(c, out, checker.Contains, name+".1") |
|
| 565 |
- assert.Assert(c, out, checker.Contains, name+".2") |
|
| 566 |
- assert.Assert(c, out, checker.Contains, name+".3") |
|
| 567 |
- |
|
| 564 |
+ assert.Assert(c, strings.Contains(out, name+".1")) |
|
| 565 |
+ assert.Assert(c, strings.Contains(out, name+".2")) |
|
| 566 |
+ assert.Assert(c, strings.Contains(out, name+".3")) |
|
| 568 | 567 |
out, err = d.Cmd("service", "ps", "--filter", "name="+name+".1", name)
|
| 569 | 568 |
assert.NilError(c, err, out) |
| 570 |
- assert.Assert(c, out, checker.Contains, name+".1") |
|
| 569 |
+ assert.Assert(c, strings.Contains(out, name+".1")) |
|
| 571 | 570 |
assert.Assert(c, !strings.Contains(out, name+".2")) |
| 572 | 571 |
assert.Assert(c, !strings.Contains(out, name+".3")) |
| 573 | 572 |
out, err = d.Cmd("service", "ps", "--filter", "name=none", name)
|
| ... | ... |
@@ -585,12 +578,10 @@ func (s *DockerSwarmSuite) TestSwarmTaskListFilter(c *testing.T) {
|
| 585 | 585 |
filter = "name=redis-cluster" |
| 586 | 586 |
out, err = d.Cmd("service", "ps", "--filter", filter, name)
|
| 587 | 587 |
assert.NilError(c, err, out) |
| 588 |
- assert.Assert(c, out, checker.Contains, name) |
|
| 589 |
- |
|
| 588 |
+ assert.Assert(c, strings.Contains(out, name)) |
|
| 590 | 589 |
out, err = d.Cmd("service", "ps", "--filter", "name="+name, name)
|
| 591 | 590 |
assert.NilError(c, err, out) |
| 592 |
- assert.Assert(c, out, checker.Contains, name) |
|
| 593 |
- |
|
| 591 |
+ assert.Assert(c, strings.Contains(out, name)) |
|
| 594 | 592 |
out, err = d.Cmd("service", "ps", "--filter", "name=none", name)
|
| 595 | 593 |
assert.NilError(c, err, out) |
| 596 | 594 |
assert.Assert(c, !strings.Contains(out, name)) |
| ... | ... |
@@ -812,7 +803,7 @@ func (s *DockerSwarmSuite) TestSwarmNetworkPlugin(c *testing.T) {
|
| 812 | 812 |
|
| 813 | 813 |
out, err := d.Cmd("network", "create", "-d", globalNetworkPlugin, "foo")
|
| 814 | 814 |
assert.ErrorContains(c, err, "", out) |
| 815 |
- assert.Assert(c, out, checker.Contains, "not supported in swarm mode") |
|
| 815 |
+ assert.Assert(c, strings.Contains(out, "not supported in swarm mode")) |
|
| 816 | 816 |
} |
| 817 | 817 |
|
| 818 | 818 |
// Test case for #24712 |
| ... | ... |
@@ -831,7 +822,7 @@ func (s *DockerSwarmSuite) TestSwarmServiceEnvFile(c *testing.T) {
|
| 831 | 831 |
// The complete env is [VAR1=A VAR2=A VAR1=B VAR1=C VAR2= VAR2] and duplicates will be removed => [VAR1=C VAR2] |
| 832 | 832 |
out, err = d.Cmd("inspect", "--format", "{{ .Spec.TaskTemplate.ContainerSpec.Env }}", name)
|
| 833 | 833 |
assert.NilError(c, err, out) |
| 834 |
- assert.Assert(c, out, checker.Contains, "[VAR1=C VAR2]") |
|
| 834 |
+ assert.Assert(c, strings.Contains(out, "[VAR1=C VAR2]")) |
|
| 835 | 835 |
} |
| 836 | 836 |
|
| 837 | 837 |
func (s *DockerSwarmSuite) TestSwarmServiceTTY(c *testing.T) {
|
| ... | ... |
@@ -856,8 +847,7 @@ func (s *DockerSwarmSuite) TestSwarmServiceTTY(c *testing.T) {
|
| 856 | 856 |
|
| 857 | 857 |
out, err = d.Cmd("exec", id, "cat", "/status")
|
| 858 | 858 |
assert.NilError(c, err, out) |
| 859 |
- assert.Assert(c, out, checker.Contains, expectedOutput, check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 860 |
- |
|
| 859 |
+ assert.Assert(c, strings.Contains(out, expectedOutput), check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 861 | 860 |
// Remove service |
| 862 | 861 |
out, err = d.Cmd("service", "rm", name)
|
| 863 | 862 |
assert.NilError(c, err, out) |
| ... | ... |
@@ -879,7 +869,7 @@ func (s *DockerSwarmSuite) TestSwarmServiceTTY(c *testing.T) {
|
| 879 | 879 |
|
| 880 | 880 |
out, err = d.Cmd("exec", id, "cat", "/status")
|
| 881 | 881 |
assert.NilError(c, err, out) |
| 882 |
- assert.Assert(c, out, checker.Contains, expectedOutput, check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 882 |
+ assert.Assert(c, strings.Contains(out, expectedOutput), check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 883 | 883 |
} |
| 884 | 884 |
|
| 885 | 885 |
func (s *DockerSwarmSuite) TestSwarmServiceTTYUpdate(c *testing.T) {
|
| ... | ... |
@@ -966,9 +956,9 @@ func (s *DockerSwarmSuite) TestDNSConfig(c *testing.T) {
|
| 966 | 966 |
expectedOutput3 := "options timeout:3" |
| 967 | 967 |
out, err = d.Cmd("exec", id, "cat", "/etc/resolv.conf")
|
| 968 | 968 |
assert.NilError(c, err, out) |
| 969 |
- assert.Assert(c, out, checker.Contains, expectedOutput1, check.Commentf("Expected '%s', but got %q", expectedOutput1, out))
|
|
| 970 |
- assert.Assert(c, out, checker.Contains, expectedOutput2, check.Commentf("Expected '%s', but got %q", expectedOutput2, out))
|
|
| 971 |
- assert.Assert(c, out, checker.Contains, expectedOutput3, check.Commentf("Expected '%s', but got %q", expectedOutput3, out))
|
|
| 969 |
+ assert.Assert(c, strings.Contains(out, expectedOutput1), check.Commentf("Expected '%s', but got %q", expectedOutput1, out))
|
|
| 970 |
+ assert.Assert(c, strings.Contains(out, expectedOutput2), check.Commentf("Expected '%s', but got %q", expectedOutput2, out))
|
|
| 971 |
+ assert.Assert(c, strings.Contains(out, expectedOutput3), check.Commentf("Expected '%s', but got %q", expectedOutput3, out))
|
|
| 972 | 972 |
} |
| 973 | 973 |
|
| 974 | 974 |
func (s *DockerSwarmSuite) TestDNSConfigUpdate(c *testing.T) {
|
| ... | ... |
@@ -1036,7 +1026,7 @@ func (s *DockerSwarmSuite) TestUnlockEngineAndUnlockedSwarm(c *testing.T) {
|
| 1036 | 1036 |
result.Assert(c, icmd.Expected{
|
| 1037 | 1037 |
ExitCode: 1, |
| 1038 | 1038 |
}) |
| 1039 |
- assert.Assert(c, result.Combined(), checker.Contains, "Error: This node is not part of a swarm") |
|
| 1039 |
+ assert.Assert(c, strings.Contains(result.Combined(), "Error: This node is not part of a swarm")) |
|
| 1040 | 1040 |
assert.Assert(c, !strings.Contains(result.Combined(), "Please enter unlock key")) |
| 1041 | 1041 |
out, err := d.Cmd("swarm", "init")
|
| 1042 | 1042 |
assert.NilError(c, err, out) |
| ... | ... |
@@ -1047,7 +1037,7 @@ func (s *DockerSwarmSuite) TestUnlockEngineAndUnlockedSwarm(c *testing.T) {
|
| 1047 | 1047 |
result.Assert(c, icmd.Expected{
|
| 1048 | 1048 |
ExitCode: 1, |
| 1049 | 1049 |
}) |
| 1050 |
- assert.Assert(c, result.Combined(), checker.Contains, "Error: swarm is not locked") |
|
| 1050 |
+ assert.Assert(c, strings.Contains(result.Combined(), "Error: swarm is not locked")) |
|
| 1051 | 1051 |
assert.Assert(c, !strings.Contains(result.Combined(), "Please enter unlock key")) |
| 1052 | 1052 |
} |
| 1053 | 1053 |
|
| ... | ... |
@@ -1105,12 +1095,10 @@ func (s *DockerSwarmSuite) TestSwarmLeaveLocked(c *testing.T) {
|
| 1105 | 1105 |
assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateLocked) |
| 1106 | 1106 |
|
| 1107 | 1107 |
outs, _ = d.Cmd("node", "ls")
|
| 1108 |
- assert.Assert(c, outs, checker.Contains, "Swarm is encrypted and needs to be unlocked") |
|
| 1109 |
- |
|
| 1108 |
+ assert.Assert(c, strings.Contains(outs, "Swarm is encrypted and needs to be unlocked")) |
|
| 1110 | 1109 |
// `docker swarm leave` a locked swarm without --force will return an error |
| 1111 | 1110 |
outs, _ = d.Cmd("swarm", "leave")
|
| 1112 |
- assert.Assert(c, outs, checker.Contains, "Swarm is encrypted and locked.") |
|
| 1113 |
- |
|
| 1111 |
+ assert.Assert(c, strings.Contains(outs, "Swarm is encrypted and locked.")) |
|
| 1114 | 1112 |
// It is OK for user to leave a locked swarm with --force |
| 1115 | 1113 |
outs, err = d.Cmd("swarm", "leave", "--force")
|
| 1116 | 1114 |
assert.Assert(c, err == nil, check.Commentf("%s", outs))
|
| ... | ... |
@@ -1202,8 +1190,7 @@ func (s *DockerSwarmSuite) TestSwarmJoinPromoteLocked(c *testing.T) {
|
| 1202 | 1202 |
// promote worker |
| 1203 | 1203 |
outs, err = d1.Cmd("node", "promote", d2.NodeID())
|
| 1204 | 1204 |
assert.NilError(c, err) |
| 1205 |
- assert.Assert(c, outs, checker.Contains, "promoted to a manager in the swarm") |
|
| 1206 |
- |
|
| 1205 |
+ assert.Assert(c, strings.Contains(outs, "promoted to a manager in the swarm")) |
|
| 1207 | 1206 |
// join new manager node |
| 1208 | 1207 |
d3 := s.AddDaemon(c, true, true) |
| 1209 | 1208 |
|
| ... | ... |
@@ -1220,8 +1207,7 @@ func (s *DockerSwarmSuite) TestSwarmJoinPromoteLocked(c *testing.T) {
|
| 1220 | 1220 |
// demote manager back to worker - workers are not locked |
| 1221 | 1221 |
outs, err = d1.Cmd("node", "demote", d3.NodeID())
|
| 1222 | 1222 |
assert.NilError(c, err) |
| 1223 |
- assert.Assert(c, outs, checker.Contains, "demoted in the swarm") |
|
| 1224 |
- |
|
| 1223 |
+ assert.Assert(c, strings.Contains(outs, "demoted in the swarm")) |
|
| 1225 | 1224 |
// Wait for it to actually be demoted, for the key and cert to be replaced. |
| 1226 | 1225 |
// Then restart and assert that the node is not locked. If we don't wait for the cert |
| 1227 | 1226 |
// to be replaced, then the node still has the manager TLS key which is still locked |
| ... | ... |
@@ -1265,8 +1251,7 @@ func (s *DockerSwarmSuite) TestSwarmRotateUnlockKey(c *testing.T) {
|
| 1265 | 1265 |
assert.Equal(c, getNodeStatus(c, d), swarm.LocalNodeStateLocked) |
| 1266 | 1266 |
|
| 1267 | 1267 |
outs, _ = d.Cmd("node", "ls")
|
| 1268 |
- assert.Assert(c, outs, checker.Contains, "Swarm is encrypted and needs to be unlocked") |
|
| 1269 |
- |
|
| 1268 |
+ assert.Assert(c, strings.Contains(outs, "Swarm is encrypted and needs to be unlocked")) |
|
| 1270 | 1269 |
cmd := d.Command("swarm", "unlock")
|
| 1271 | 1270 |
cmd.Stdin = bytes.NewBufferString(unlockKey) |
| 1272 | 1271 |
result := icmd.RunCmd(cmd) |
| ... | ... |
@@ -1294,8 +1279,7 @@ func (s *DockerSwarmSuite) TestSwarmRotateUnlockKey(c *testing.T) {
|
| 1294 | 1294 |
}) |
| 1295 | 1295 |
|
| 1296 | 1296 |
outs, _ = d.Cmd("node", "ls")
|
| 1297 |
- assert.Assert(c, outs, checker.Contains, "Swarm is encrypted and needs to be unlocked") |
|
| 1298 |
- |
|
| 1297 |
+ assert.Assert(c, strings.Contains(outs, "Swarm is encrypted and needs to be unlocked")) |
|
| 1299 | 1298 |
cmd = d.Command("swarm", "unlock")
|
| 1300 | 1299 |
cmd.Stdin = bytes.NewBufferString(newUnlockKey) |
| 1301 | 1300 |
icmd.RunCmd(cmd).Assert(c, icmd.Success) |
| ... | ... |
@@ -1357,8 +1341,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterRotateUnlockKey(c *testing.T) {
|
| 1357 | 1357 |
assert.Equal(c, getNodeStatus(c, d), swarm.LocalNodeStateLocked) |
| 1358 | 1358 |
|
| 1359 | 1359 |
outs, _ := d.Cmd("node", "ls")
|
| 1360 |
- assert.Assert(c, outs, checker.Contains, "Swarm is encrypted and needs to be unlocked") |
|
| 1361 |
- |
|
| 1360 |
+ assert.Assert(c, strings.Contains(outs, "Swarm is encrypted and needs to be unlocked")) |
|
| 1362 | 1361 |
cmd := d.Command("swarm", "unlock")
|
| 1363 | 1362 |
cmd.Stdin = bytes.NewBufferString(unlockKey) |
| 1364 | 1363 |
result := icmd.RunCmd(cmd) |
| ... | ... |
@@ -1386,8 +1369,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterRotateUnlockKey(c *testing.T) {
|
| 1386 | 1386 |
}) |
| 1387 | 1387 |
|
| 1388 | 1388 |
outs, _ = d.Cmd("node", "ls")
|
| 1389 |
- assert.Assert(c, outs, checker.Contains, "Swarm is encrypted and needs to be unlocked") |
|
| 1390 |
- |
|
| 1389 |
+ assert.Assert(c, strings.Contains(outs, "Swarm is encrypted and needs to be unlocked")) |
|
| 1391 | 1390 |
cmd = d.Command("swarm", "unlock")
|
| 1392 | 1391 |
cmd.Stdin = bytes.NewBufferString(newUnlockKey) |
| 1393 | 1392 |
icmd.RunCmd(cmd).Assert(c, icmd.Success) |
| ... | ... |
@@ -1422,7 +1404,7 @@ func (s *DockerSwarmSuite) TestSwarmAlternateLockUnlock(c *testing.T) {
|
| 1422 | 1422 |
// set to lock |
| 1423 | 1423 |
outs, err := d.Cmd("swarm", "update", "--autolock")
|
| 1424 | 1424 |
assert.Assert(c, err == nil, check.Commentf("out: %v", outs))
|
| 1425 |
- assert.Assert(c, outs, checker.Contains, "docker swarm unlock") |
|
| 1425 |
+ assert.Assert(c, strings.Contains(outs, "docker swarm unlock")) |
|
| 1426 | 1426 |
unlockKey := getUnlockKey(d, c, outs) |
| 1427 | 1427 |
|
| 1428 | 1428 |
checkSwarmUnlockedToLocked(c, d) |
| ... | ... |
@@ -1460,7 +1442,7 @@ func (s *DockerSwarmSuite) TestExtraHosts(c *testing.T) {
|
| 1460 | 1460 |
expectedOutput := "1.2.3.4\texample.com" |
| 1461 | 1461 |
out, err = d.Cmd("exec", id, "cat", "/etc/hosts")
|
| 1462 | 1462 |
assert.NilError(c, err, out) |
| 1463 |
- assert.Assert(c, out, checker.Contains, expectedOutput, check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 1463 |
+ assert.Assert(c, strings.Contains(out, expectedOutput), check.Commentf("Expected '%s', but got %q", expectedOutput, out))
|
|
| 1464 | 1464 |
} |
| 1465 | 1465 |
|
| 1466 | 1466 |
func (s *DockerSwarmSuite) TestSwarmManagerAddress(c *testing.T) {
|
| ... | ... |
@@ -1493,9 +1475,8 @@ func (s *DockerSwarmSuite) TestSwarmNetworkIPAMOptions(c *testing.T) {
|
| 1493 | 1493 |
|
| 1494 | 1494 |
out, err = d.Cmd("network", "inspect", "--format", "{{.IPAM.Options}}", "foo")
|
| 1495 | 1495 |
assert.NilError(c, err, out) |
| 1496 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, "foo:bar") |
|
| 1497 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, "com.docker.network.ipam.serial:true") |
|
| 1498 |
- |
|
| 1496 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), "foo:bar")) |
|
| 1497 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), "com.docker.network.ipam.serial:true")) |
|
| 1499 | 1498 |
out, err = d.Cmd("service", "create", "--detach", "--no-resolve-image", "--network=foo", "--name", "top", "busybox", "top")
|
| 1500 | 1499 |
assert.NilError(c, err, out) |
| 1501 | 1500 |
|
| ... | ... |
@@ -1504,8 +1485,8 @@ func (s *DockerSwarmSuite) TestSwarmNetworkIPAMOptions(c *testing.T) {
|
| 1504 | 1504 |
|
| 1505 | 1505 |
out, err = d.Cmd("network", "inspect", "--format", "{{.IPAM.Options}}", "foo")
|
| 1506 | 1506 |
assert.NilError(c, err, out) |
| 1507 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, "foo:bar") |
|
| 1508 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, "com.docker.network.ipam.serial:true") |
|
| 1507 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), "foo:bar")) |
|
| 1508 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), "com.docker.network.ipam.serial:true")) |
|
| 1509 | 1509 |
} |
| 1510 | 1510 |
|
| 1511 | 1511 |
// Test case for issue #27866, which did not allow NW name that is the prefix of a swarm NW ID. |
| ... | ... |
@@ -1544,7 +1525,7 @@ func (s *DockerSwarmSuite) TestSwarmNetworkCreateDup(c *testing.T) {
|
| 1544 | 1544 |
out, err := d.Cmd("network", "create", "--driver", driver1, nwName)
|
| 1545 | 1545 |
assert.NilError(c, err, "out: %v", out) |
| 1546 | 1546 |
out, err = d.Cmd("network", "create", "--driver", driver2, nwName)
|
| 1547 |
- assert.Assert(c, out, checker.Contains, fmt.Sprintf("network with name %s already exists", nwName))
|
|
| 1547 |
+ assert.Assert(c, strings.Contains(out, fmt.Sprintf("network with name %s already exists", nwName)))
|
|
| 1548 | 1548 |
assert.ErrorContains(c, err, "") |
| 1549 | 1549 |
c.Logf("As expected, the attempt to network %q with %q failed: %s",
|
| 1550 | 1550 |
nwName, driver2, out) |
| ... | ... |
@@ -1568,9 +1549,9 @@ func (s *DockerSwarmSuite) TestSwarmPublishDuplicatePorts(c *testing.T) {
|
| 1568 | 1568 |
// Dynamic ports are likely to be 30000 and 30001 but doesn't matter |
| 1569 | 1569 |
out, err = d.Cmd("service", "inspect", "--format", "{{.Endpoint.Ports}} len={{len .Endpoint.Ports}}", id)
|
| 1570 | 1570 |
assert.NilError(c, err, out) |
| 1571 |
- assert.Assert(c, out, checker.Contains, "len=4") |
|
| 1572 |
- assert.Assert(c, out, checker.Contains, "{ tcp 80 5005 ingress}")
|
|
| 1573 |
- assert.Assert(c, out, checker.Contains, "{ tcp 80 5006 ingress}")
|
|
| 1571 |
+ assert.Assert(c, strings.Contains(out, "len=4")) |
|
| 1572 |
+ assert.Assert(c, strings.Contains(out, "{ tcp 80 5005 ingress}"))
|
|
| 1573 |
+ assert.Assert(c, strings.Contains(out, "{ tcp 80 5006 ingress}"))
|
|
| 1574 | 1574 |
} |
| 1575 | 1575 |
|
| 1576 | 1576 |
func (s *DockerSwarmSuite) TestSwarmJoinWithDrain(c *testing.T) {
|
| ... | ... |
@@ -1593,11 +1574,10 @@ func (s *DockerSwarmSuite) TestSwarmJoinWithDrain(c *testing.T) {
|
| 1593 | 1593 |
|
| 1594 | 1594 |
out, err = d.Cmd("node", "ls")
|
| 1595 | 1595 |
assert.NilError(c, err) |
| 1596 |
- assert.Assert(c, out, checker.Contains, "Drain") |
|
| 1597 |
- |
|
| 1596 |
+ assert.Assert(c, strings.Contains(out, "Drain")) |
|
| 1598 | 1597 |
out, err = d1.Cmd("node", "ls")
|
| 1599 | 1598 |
assert.NilError(c, err) |
| 1600 |
- assert.Assert(c, out, checker.Contains, "Drain") |
|
| 1599 |
+ assert.Assert(c, strings.Contains(out, "Drain")) |
|
| 1601 | 1600 |
} |
| 1602 | 1601 |
|
| 1603 | 1602 |
func (s *DockerSwarmSuite) TestSwarmInitWithDrain(c *testing.T) {
|
| ... | ... |
@@ -1608,7 +1588,7 @@ func (s *DockerSwarmSuite) TestSwarmInitWithDrain(c *testing.T) {
|
| 1608 | 1608 |
|
| 1609 | 1609 |
out, err = d.Cmd("node", "ls")
|
| 1610 | 1610 |
assert.NilError(c, err) |
| 1611 |
- assert.Assert(c, out, checker.Contains, "Drain") |
|
| 1611 |
+ assert.Assert(c, strings.Contains(out, "Drain")) |
|
| 1612 | 1612 |
} |
| 1613 | 1613 |
|
| 1614 | 1614 |
func (s *DockerSwarmSuite) TestSwarmReadonlyRootfs(c *testing.T) {
|
| ... | ... |
@@ -1671,8 +1651,7 @@ func (s *DockerSwarmSuite) TestNetworkInspectWithDuplicateNames(c *testing.T) {
|
| 1671 | 1671 |
// Name with duplicates |
| 1672 | 1672 |
out, err = d.Cmd("network", "inspect", "--format", "{{.ID}}", name)
|
| 1673 | 1673 |
assert.ErrorContains(c, err, "", out) |
| 1674 |
- assert.Assert(c, out, checker.Contains, "2 matches found based on name") |
|
| 1675 |
- |
|
| 1674 |
+ assert.Assert(c, strings.Contains(out, "2 matches found based on name")) |
|
| 1676 | 1675 |
out, err = d.Cmd("network", "rm", n2.ID)
|
| 1677 | 1676 |
assert.NilError(c, err, out) |
| 1678 | 1677 |
|
| ... | ... |
@@ -1694,7 +1673,7 @@ func (s *DockerSwarmSuite) TestNetworkInspectWithDuplicateNames(c *testing.T) {
|
| 1694 | 1694 |
// Name with duplicates |
| 1695 | 1695 |
out, err = d.Cmd("network", "inspect", "--format", "{{.ID}}", name)
|
| 1696 | 1696 |
assert.ErrorContains(c, err, "", out) |
| 1697 |
- assert.Assert(c, out, checker.Contains, "2 matches found based on name") |
|
| 1697 |
+ assert.Assert(c, strings.Contains(out, "2 matches found based on name")) |
|
| 1698 | 1698 |
} |
| 1699 | 1699 |
|
| 1700 | 1700 |
func (s *DockerSwarmSuite) TestSwarmStopSignal(c *testing.T) {
|
| ... | ... |
@@ -1741,17 +1720,17 @@ func (s *DockerSwarmSuite) TestSwarmServiceLsFilterMode(c *testing.T) {
|
| 1741 | 1741 |
|
| 1742 | 1742 |
out, err = d.Cmd("service", "ls")
|
| 1743 | 1743 |
assert.NilError(c, err, out) |
| 1744 |
- assert.Assert(c, out, checker.Contains, "top1") |
|
| 1745 |
- assert.Assert(c, out, checker.Contains, "top2") |
|
| 1744 |
+ assert.Assert(c, strings.Contains(out, "top1")) |
|
| 1745 |
+ assert.Assert(c, strings.Contains(out, "top2")) |
|
| 1746 | 1746 |
assert.Assert(c, !strings.Contains(out, "localnet")) |
| 1747 | 1747 |
out, err = d.Cmd("service", "ls", "--filter", "mode=global")
|
| 1748 | 1748 |
assert.Assert(c, !strings.Contains(out, "top1")) |
| 1749 |
- assert.Assert(c, out, checker.Contains, "top2") |
|
| 1749 |
+ assert.Assert(c, strings.Contains(out, "top2")) |
|
| 1750 | 1750 |
assert.NilError(c, err, out) |
| 1751 | 1751 |
|
| 1752 | 1752 |
out, err = d.Cmd("service", "ls", "--filter", "mode=replicated")
|
| 1753 | 1753 |
assert.NilError(c, err, out) |
| 1754 |
- assert.Assert(c, out, checker.Contains, "top1") |
|
| 1754 |
+ assert.Assert(c, strings.Contains(out, "top1")) |
|
| 1755 | 1755 |
assert.Assert(c, !strings.Contains(out, "top2")) |
| 1756 | 1756 |
} |
| 1757 | 1757 |
|
| ... | ... |
@@ -1760,11 +1739,10 @@ func (s *DockerSwarmSuite) TestSwarmInitUnspecifiedDataPathAddr(c *testing.T) {
|
| 1760 | 1760 |
|
| 1761 | 1761 |
out, err := d.Cmd("swarm", "init", "--data-path-addr", "0.0.0.0")
|
| 1762 | 1762 |
assert.ErrorContains(c, err, "") |
| 1763 |
- assert.Assert(c, out, checker.Contains, "data path address must be a non-zero IP") |
|
| 1764 |
- |
|
| 1763 |
+ assert.Assert(c, strings.Contains(out, "data path address must be a non-zero IP")) |
|
| 1765 | 1764 |
out, err = d.Cmd("swarm", "init", "--data-path-addr", "0.0.0.0:2000")
|
| 1766 | 1765 |
assert.ErrorContains(c, err, "") |
| 1767 |
- assert.Assert(c, out, checker.Contains, "data path address must be a non-zero IP") |
|
| 1766 |
+ assert.Assert(c, strings.Contains(out, "data path address must be a non-zero IP")) |
|
| 1768 | 1767 |
} |
| 1769 | 1768 |
|
| 1770 | 1769 |
func (s *DockerSwarmSuite) TestSwarmJoinLeave(c *testing.T) {
|
| ... | ... |
@@ -1896,21 +1874,18 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsService(c *testing.T) {
|
| 1896 | 1896 |
|
| 1897 | 1897 |
// wait for service update start |
| 1898 | 1898 |
out = waitForEvent(c, d, t1, "-f scope=swarm", "service update "+serviceID, defaultRetryCount) |
| 1899 |
- assert.Assert(c, out, checker.Contains, "updatestate.new=updating") |
|
| 1900 |
- |
|
| 1899 |
+ assert.Assert(c, strings.Contains(out, "updatestate.new=updating")) |
|
| 1901 | 1900 |
// allow service update complete. This is a service with 1 instance |
| 1902 | 1901 |
time.Sleep(400 * time.Millisecond) |
| 1903 | 1902 |
out = waitForEvent(c, d, t1, "-f scope=swarm", "service update "+serviceID, defaultRetryCount) |
| 1904 |
- assert.Assert(c, out, checker.Contains, "updatestate.new=completed, updatestate.old=updating") |
|
| 1905 |
- |
|
| 1903 |
+ assert.Assert(c, strings.Contains(out, "updatestate.new=completed, updatestate.old=updating")) |
|
| 1906 | 1904 |
// scale service |
| 1907 | 1905 |
t2 := daemonUnixTime(c) |
| 1908 | 1906 |
out, err = d.Cmd("service", "scale", "test=3")
|
| 1909 | 1907 |
assert.NilError(c, err, out) |
| 1910 | 1908 |
|
| 1911 | 1909 |
out = waitForEvent(c, d, t2, "-f scope=swarm", "service update "+serviceID, defaultRetryCount) |
| 1912 |
- assert.Assert(c, out, checker.Contains, "replicas.new=3, replicas.old=1") |
|
| 1913 |
- |
|
| 1910 |
+ assert.Assert(c, strings.Contains(out, "replicas.new=3, replicas.old=1")) |
|
| 1914 | 1911 |
// remove service |
| 1915 | 1912 |
t3 := daemonUnixTime(c) |
| 1916 | 1913 |
out, err = d.Cmd("service", "rm", "test")
|
| ... | ... |
@@ -1933,8 +1908,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterEventsNode(c *testing.T) {
|
| 1933 | 1933 |
|
| 1934 | 1934 |
// filter by type |
| 1935 | 1935 |
out = waitForEvent(c, d1, t1, "-f type=node", "node update "+d3ID, defaultRetryCount) |
| 1936 |
- assert.Assert(c, out, checker.Contains, "availability.new=pause, availability.old=active") |
|
| 1937 |
- |
|
| 1936 |
+ assert.Assert(c, strings.Contains(out, "availability.new=pause, availability.old=active")) |
|
| 1938 | 1937 |
t2 := daemonUnixTime(c) |
| 1939 | 1938 |
out, err = d1.Cmd("node", "demote", d3ID)
|
| 1940 | 1939 |
assert.NilError(c, err, out) |
| ... | ... |
@@ -2015,8 +1989,7 @@ func getUnlockKey(d *daemon.Daemon, c *testing.T, autolockOutput string) string |
| 2015 | 2015 |
|
| 2016 | 2016 |
// Check that "docker swarm init --autolock" or "docker swarm update --autolock" |
| 2017 | 2017 |
// contains all the expected strings, including the unlock key |
| 2018 |
- assert.Assert(c, autolockOutput, checker.Contains, "docker swarm unlock") |
|
| 2019 |
- assert.Assert(c, autolockOutput, checker.Contains, unlockKey) |
|
| 2020 |
- |
|
| 2018 |
+ assert.Assert(c, strings.Contains(autolockOutput, "docker swarm unlock")) |
|
| 2019 |
+ assert.Assert(c, strings.Contains(autolockOutput, unlockKey)) |
|
| 2021 | 2020 |
return unlockKey |
| 2022 | 2021 |
} |
| ... | ... |
@@ -14,7 +14,6 @@ import ( |
| 14 | 14 |
"github.com/docker/docker/api/types/mount" |
| 15 | 15 |
"github.com/docker/docker/api/types/network" |
| 16 | 16 |
"github.com/docker/docker/client" |
| 17 |
- "github.com/docker/docker/integration-cli/checker" |
|
| 18 | 17 |
"github.com/docker/docker/integration-cli/cli/build" |
| 19 | 18 |
"github.com/go-check/check" |
| 20 | 19 |
"gotest.tools/assert" |
| ... | ... |
@@ -61,9 +60,9 @@ func (s *DockerSuite) TestVolumeCLIInspectMulti(c *testing.T) {
|
| 61 | 61 |
}) |
| 62 | 62 |
|
| 63 | 63 |
out := result.Stdout() |
| 64 |
- assert.Assert(c, out, checker.Contains, "test1") |
|
| 65 |
- assert.Assert(c, out, checker.Contains, "test2") |
|
| 66 |
- assert.Assert(c, out, checker.Contains, "test3") |
|
| 64 |
+ assert.Assert(c, strings.Contains(out, "test1")) |
|
| 65 |
+ assert.Assert(c, strings.Contains(out, "test2")) |
|
| 66 |
+ assert.Assert(c, strings.Contains(out, "test3")) |
|
| 67 | 67 |
} |
| 68 | 68 |
|
| 69 | 69 |
func (s *DockerSuite) TestVolumeCLILs(c *testing.T) {
|
| ... | ... |
@@ -135,50 +134,47 @@ func (s *DockerSuite) TestVolumeCLILsFilterDangling(c *testing.T) {
|
| 135 | 135 |
out, _ := dockerCmd(c, "volume", "ls") |
| 136 | 136 |
|
| 137 | 137 |
// No filter, all volumes should show |
| 138 |
- assert.Assert(c, out, checker.Contains, "testnotinuse1\n", check.Commentf("expected volume 'testnotinuse1' in output"))
|
|
| 139 |
- assert.Assert(c, out, checker.Contains, "testisinuse1\n", check.Commentf("expected volume 'testisinuse1' in output"))
|
|
| 140 |
- assert.Assert(c, out, checker.Contains, "testisinuse2\n", check.Commentf("expected volume 'testisinuse2' in output"))
|
|
| 141 |
- |
|
| 138 |
+ assert.Assert(c, strings.Contains(out, "testnotinuse1\n"), check.Commentf("expected volume 'testnotinuse1' in output"))
|
|
| 139 |
+ assert.Assert(c, strings.Contains(out, "testisinuse1\n"), check.Commentf("expected volume 'testisinuse1' in output"))
|
|
| 140 |
+ assert.Assert(c, strings.Contains(out, "testisinuse2\n"), check.Commentf("expected volume 'testisinuse2' in output"))
|
|
| 142 | 141 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "dangling=false") |
| 143 | 142 |
|
| 144 | 143 |
// Explicitly disabling dangling |
| 145 | 144 |
assert.Assert(c, !strings.Contains(out, "testnotinuse1\n"), check.Commentf("expected volume 'testnotinuse1' in output"))
|
| 146 |
- assert.Assert(c, out, checker.Contains, "testisinuse1\n", check.Commentf("expected volume 'testisinuse1' in output"))
|
|
| 147 |
- assert.Assert(c, out, checker.Contains, "testisinuse2\n", check.Commentf("expected volume 'testisinuse2' in output"))
|
|
| 148 |
- |
|
| 145 |
+ assert.Assert(c, strings.Contains(out, "testisinuse1\n"), check.Commentf("expected volume 'testisinuse1' in output"))
|
|
| 146 |
+ assert.Assert(c, strings.Contains(out, "testisinuse2\n"), check.Commentf("expected volume 'testisinuse2' in output"))
|
|
| 149 | 147 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "dangling=true") |
| 150 | 148 |
|
| 151 | 149 |
// Filter "dangling" volumes; only "dangling" (unused) volumes should be in the output |
| 152 |
- assert.Assert(c, out, checker.Contains, "testnotinuse1\n", check.Commentf("expected volume 'testnotinuse1' in output"))
|
|
| 150 |
+ assert.Assert(c, strings.Contains(out, "testnotinuse1\n"), check.Commentf("expected volume 'testnotinuse1' in output"))
|
|
| 153 | 151 |
assert.Assert(c, !strings.Contains(out, "testisinuse1\n"), check.Commentf("volume 'testisinuse1' in output, but not expected"))
|
| 154 | 152 |
assert.Assert(c, !strings.Contains(out, "testisinuse2\n"), check.Commentf("volume 'testisinuse2' in output, but not expected"))
|
| 155 | 153 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "dangling=1") |
| 156 | 154 |
// Filter "dangling" volumes; only "dangling" (unused) volumes should be in the output, dangling also accept 1 |
| 157 |
- assert.Assert(c, out, checker.Contains, "testnotinuse1\n", check.Commentf("expected volume 'testnotinuse1' in output"))
|
|
| 155 |
+ assert.Assert(c, strings.Contains(out, "testnotinuse1\n"), check.Commentf("expected volume 'testnotinuse1' in output"))
|
|
| 158 | 156 |
assert.Assert(c, !strings.Contains(out, "testisinuse1\n"), check.Commentf("volume 'testisinuse1' in output, but not expected"))
|
| 159 | 157 |
assert.Assert(c, !strings.Contains(out, "testisinuse2\n"), check.Commentf("volume 'testisinuse2' in output, but not expected"))
|
| 160 | 158 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "dangling=0") |
| 161 | 159 |
// dangling=0 is same as dangling=false case |
| 162 | 160 |
assert.Assert(c, !strings.Contains(out, "testnotinuse1\n"), check.Commentf("expected volume 'testnotinuse1' in output"))
|
| 163 |
- assert.Assert(c, out, checker.Contains, "testisinuse1\n", check.Commentf("expected volume 'testisinuse1' in output"))
|
|
| 164 |
- assert.Assert(c, out, checker.Contains, "testisinuse2\n", check.Commentf("expected volume 'testisinuse2' in output"))
|
|
| 165 |
- |
|
| 161 |
+ assert.Assert(c, strings.Contains(out, "testisinuse1\n"), check.Commentf("expected volume 'testisinuse1' in output"))
|
|
| 162 |
+ assert.Assert(c, strings.Contains(out, "testisinuse2\n"), check.Commentf("expected volume 'testisinuse2' in output"))
|
|
| 166 | 163 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "name=testisin") |
| 167 | 164 |
assert.Assert(c, !strings.Contains(out, "testnotinuse1\n"), check.Commentf("expected volume 'testnotinuse1' in output"))
|
| 168 |
- assert.Assert(c, out, checker.Contains, "testisinuse1\n", check.Commentf("expected volume 'testisinuse1' in output"))
|
|
| 169 |
- assert.Assert(c, out, checker.Contains, "testisinuse2\n", check.Commentf("expected volume 'testisinuse2' in output"))
|
|
| 165 |
+ assert.Assert(c, strings.Contains(out, "testisinuse1\n"), check.Commentf("expected volume 'testisinuse1' in output"))
|
|
| 166 |
+ assert.Assert(c, strings.Contains(out, "testisinuse2\n"), check.Commentf("expected volume 'testisinuse2' in output"))
|
|
| 170 | 167 |
} |
| 171 | 168 |
|
| 172 | 169 |
func (s *DockerSuite) TestVolumeCLILsErrorWithInvalidFilterName(c *testing.T) {
|
| 173 | 170 |
out, _, err := dockerCmdWithError("volume", "ls", "-f", "FOO=123")
|
| 174 | 171 |
assert.ErrorContains(c, err, "") |
| 175 |
- assert.Assert(c, out, checker.Contains, "Invalid filter") |
|
| 172 |
+ assert.Assert(c, strings.Contains(out, "Invalid filter")) |
|
| 176 | 173 |
} |
| 177 | 174 |
|
| 178 | 175 |
func (s *DockerSuite) TestVolumeCLILsWithIncorrectFilterValue(c *testing.T) {
|
| 179 | 176 |
out, _, err := dockerCmdWithError("volume", "ls", "-f", "dangling=invalid")
|
| 180 | 177 |
assert.ErrorContains(c, err, "") |
| 181 |
- assert.Assert(c, out, checker.Contains, "Invalid filter") |
|
| 178 |
+ assert.Assert(c, strings.Contains(out, "Invalid filter")) |
|
| 182 | 179 |
} |
| 183 | 180 |
|
| 184 | 181 |
func (s *DockerSuite) TestVolumeCLIRm(c *testing.T) {
|
| ... | ... |
@@ -217,8 +213,7 @@ func (s *DockerSuite) TestVolumeCLINoArgs(c *testing.T) {
|
| 217 | 217 |
out, _ := dockerCmd(c, "volume") |
| 218 | 218 |
// no args should produce the cmd usage output |
| 219 | 219 |
usage := "Usage: docker volume COMMAND" |
| 220 |
- assert.Assert(c, out, checker.Contains, usage) |
|
| 221 |
- |
|
| 220 |
+ assert.Assert(c, strings.Contains(out, usage)) |
|
| 222 | 221 |
// invalid arg should error and show the command usage on stderr |
| 223 | 222 |
icmd.RunCommand(dockerBinary, "volume", "somearg").Assert(c, icmd.Expected{
|
| 224 | 223 |
ExitCode: 1, |
| ... | ... |
@@ -233,7 +228,7 @@ func (s *DockerSuite) TestVolumeCLINoArgs(c *testing.T) {
|
| 233 | 233 |
Error: "exit status 125", |
| 234 | 234 |
Err: usage, |
| 235 | 235 |
}) |
| 236 |
- assert.Assert(c, result.Stderr(), checker.Contains, "unknown flag: --no-such-flag") |
|
| 236 |
+ assert.Assert(c, strings.Contains(result.Stderr(), "unknown flag: --no-such-flag")) |
|
| 237 | 237 |
} |
| 238 | 238 |
|
| 239 | 239 |
func (s *DockerSuite) TestVolumeCLIInspectTmplError(c *testing.T) {
|
| ... | ... |
@@ -243,7 +238,7 @@ func (s *DockerSuite) TestVolumeCLIInspectTmplError(c *testing.T) {
|
| 243 | 243 |
out, exitCode, err := dockerCmdWithError("volume", "inspect", "--format='{{ .FooBar }}'", name)
|
| 244 | 244 |
assert.Assert(c, err != nil, check.Commentf("Output: %s", out))
|
| 245 | 245 |
assert.Equal(c, exitCode, 1, check.Commentf("Output: %s", out))
|
| 246 |
- assert.Assert(c, out, checker.Contains, "Template parsing error") |
|
| 246 |
+ assert.Assert(c, strings.Contains(out, "Template parsing error")) |
|
| 247 | 247 |
} |
| 248 | 248 |
|
| 249 | 249 |
func (s *DockerSuite) TestVolumeCLICreateWithOpts(c *testing.T) {
|
| ... | ... |
@@ -262,8 +257,8 @@ func (s *DockerSuite) TestVolumeCLICreateWithOpts(c *testing.T) {
|
| 262 | 262 |
assert.Equal(c, info[0], "tmpfs") |
| 263 | 263 |
assert.Equal(c, info[2], "/foo") |
| 264 | 264 |
assert.Equal(c, info[4], "tmpfs") |
| 265 |
- assert.Assert(c, info[5], checker.Contains, "uid=1000") |
|
| 266 |
- assert.Assert(c, info[5], checker.Contains, "size=1024k") |
|
| 265 |
+ assert.Assert(c, strings.Contains(info[5], "uid=1000")) |
|
| 266 |
+ assert.Assert(c, strings.Contains(info[5], "size=1024k")) |
|
| 267 | 267 |
break |
| 268 | 268 |
} |
| 269 | 269 |
} |
| ... | ... |
@@ -321,13 +316,12 @@ func (s *DockerSuite) TestVolumeCLILsFilterLabels(c *testing.T) {
|
| 321 | 321 |
out, _ := dockerCmd(c, "volume", "ls", "--filter", "label=foo") |
| 322 | 322 |
|
| 323 | 323 |
// filter with label=key |
| 324 |
- assert.Assert(c, out, checker.Contains, "testvolcreatelabel-1\n", check.Commentf("expected volume 'testvolcreatelabel-1' in output"))
|
|
| 325 |
- assert.Assert(c, out, checker.Contains, "testvolcreatelabel-2\n", check.Commentf("expected volume 'testvolcreatelabel-2' in output"))
|
|
| 326 |
- |
|
| 324 |
+ assert.Assert(c, strings.Contains(out, "testvolcreatelabel-1\n"), check.Commentf("expected volume 'testvolcreatelabel-1' in output"))
|
|
| 325 |
+ assert.Assert(c, strings.Contains(out, "testvolcreatelabel-2\n"), check.Commentf("expected volume 'testvolcreatelabel-2' in output"))
|
|
| 327 | 326 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "label=foo=bar1") |
| 328 | 327 |
|
| 329 | 328 |
// filter with label=key=value |
| 330 |
- assert.Assert(c, out, checker.Contains, "testvolcreatelabel-1\n", check.Commentf("expected volume 'testvolcreatelabel-1' in output"))
|
|
| 329 |
+ assert.Assert(c, strings.Contains(out, "testvolcreatelabel-1\n"), check.Commentf("expected volume 'testvolcreatelabel-1' in output"))
|
|
| 331 | 330 |
assert.Assert(c, !strings.Contains(out, "testvolcreatelabel-2\n"), check.Commentf("expected volume 'testvolcreatelabel-2 in output"))
|
| 332 | 331 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "label=non-exist") |
| 333 | 332 |
outArr := strings.Split(strings.TrimSpace(out), "\n") |
| ... | ... |
@@ -350,9 +344,8 @@ func (s *DockerSuite) TestVolumeCLILsFilterDrivers(c *testing.T) {
|
| 350 | 350 |
|
| 351 | 351 |
// filter with driver=local |
| 352 | 352 |
out, _ := dockerCmd(c, "volume", "ls", "--filter", "driver=local") |
| 353 |
- assert.Assert(c, out, checker.Contains, "testvol-1\n", check.Commentf("expected volume 'testvol-1' in output"))
|
|
| 354 |
- assert.Assert(c, out, checker.Contains, "testvol-2\n", check.Commentf("expected volume 'testvol-2' in output"))
|
|
| 355 |
- |
|
| 353 |
+ assert.Assert(c, strings.Contains(out, "testvol-1\n"), check.Commentf("expected volume 'testvol-1' in output"))
|
|
| 354 |
+ assert.Assert(c, strings.Contains(out, "testvol-2\n"), check.Commentf("expected volume 'testvol-2' in output"))
|
|
| 356 | 355 |
// filter with driver=invaliddriver |
| 357 | 356 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "driver=invaliddriver") |
| 358 | 357 |
outArr := strings.Split(strings.TrimSpace(out), "\n") |
| ... | ... |
@@ -396,7 +389,7 @@ func (s *DockerSuite) TestVolumeCLIRmForce(c *testing.T) {
|
| 396 | 396 |
assert.Assert(c, !strings.Contains(out, name)) |
| 397 | 397 |
dockerCmd(c, "volume", "create", name) |
| 398 | 398 |
out, _ = dockerCmd(c, "volume", "ls") |
| 399 |
- assert.Assert(c, out, checker.Contains, name) |
|
| 399 |
+ assert.Assert(c, strings.Contains(out, name)) |
|
| 400 | 400 |
} |
| 401 | 401 |
|
| 402 | 402 |
// TestVolumeCLIRmForceInUse verifies that repeated `docker volume rm -f` calls does not remove a volume |
| ... | ... |
@@ -415,8 +408,7 @@ func (s *DockerSuite) TestVolumeCLIRmForceInUse(c *testing.T) {
|
| 415 | 415 |
assert.ErrorContains(c, err, "") |
| 416 | 416 |
assert.ErrorContains(c, err, "volume is in use") |
| 417 | 417 |
out, _ = dockerCmd(c, "volume", "ls") |
| 418 |
- assert.Assert(c, out, checker.Contains, name) |
|
| 419 |
- |
|
| 418 |
+ assert.Assert(c, strings.Contains(out, name)) |
|
| 420 | 419 |
// The original issue did not _remove_ the volume from the list |
| 421 | 420 |
// the first time. But a second call to `volume rm` removed it. |
| 422 | 421 |
// Calling `volume rm` a second time to confirm it's not removed |
| ... | ... |
@@ -425,8 +417,7 @@ func (s *DockerSuite) TestVolumeCLIRmForceInUse(c *testing.T) {
|
| 425 | 425 |
assert.ErrorContains(c, err, "") |
| 426 | 426 |
assert.ErrorContains(c, err, "volume is in use") |
| 427 | 427 |
out, _ = dockerCmd(c, "volume", "ls") |
| 428 |
- assert.Assert(c, out, checker.Contains, name) |
|
| 429 |
- |
|
| 428 |
+ assert.Assert(c, strings.Contains(out, name)) |
|
| 430 | 429 |
// Verify removing the volume after the container is removed works |
| 431 | 430 |
_, e := dockerCmd(c, "rm", cid) |
| 432 | 431 |
assert.Equal(c, e, 0) |
| ... | ... |
@@ -446,8 +437,7 @@ func (s *DockerSuite) TestVolumeCliInspectWithVolumeOpts(c *testing.T) {
|
| 446 | 446 |
name := "test1" |
| 447 | 447 |
dockerCmd(c, "volume", "create", "-d", "local", name) |
| 448 | 448 |
out, _ := dockerCmd(c, "volume", "inspect", "--format={{ .Options }}", name)
|
| 449 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, "map[]") |
|
| 450 |
- |
|
| 449 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), "map[]")) |
|
| 451 | 450 |
// With options |
| 452 | 451 |
name = "test2" |
| 453 | 452 |
k1, v1 := "type", "tmpfs" |
| ... | ... |
@@ -455,9 +445,9 @@ func (s *DockerSuite) TestVolumeCliInspectWithVolumeOpts(c *testing.T) {
|
| 455 | 455 |
k3, v3 := "o", "size=1m,uid=1000" |
| 456 | 456 |
dockerCmd(c, "volume", "create", "-d", "local", name, "--opt", fmt.Sprintf("%s=%s", k1, v1), "--opt", fmt.Sprintf("%s=%s", k2, v2), "--opt", fmt.Sprintf("%s=%s", k3, v3))
|
| 457 | 457 |
out, _ = dockerCmd(c, "volume", "inspect", "--format={{ .Options }}", name)
|
| 458 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, fmt.Sprintf("%s:%s", k1, v1))
|
|
| 459 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, fmt.Sprintf("%s:%s", k2, v2))
|
|
| 460 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, fmt.Sprintf("%s:%s", k3, v3))
|
|
| 458 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), fmt.Sprintf("%s:%s", k1, v1)))
|
|
| 459 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), fmt.Sprintf("%s:%s", k2, v2)))
|
|
| 460 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), fmt.Sprintf("%s:%s", k3, v3)))
|
|
| 461 | 461 |
} |
| 462 | 462 |
|
| 463 | 463 |
// Test case (1) for 21845: duplicate targets for --volumes-from |
| ... | ... |
@@ -482,9 +472,8 @@ func (s *DockerSuite) TestDuplicateMountpointsForVolumesFrom(c *testing.T) {
|
| 482 | 482 |
|
| 483 | 483 |
// Both volume should exist |
| 484 | 484 |
out, _ = dockerCmd(c, "volume", "ls", "-q") |
| 485 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, data1) |
|
| 486 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, data2) |
|
| 487 |
- |
|
| 485 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), data1)) |
|
| 486 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), data2)) |
|
| 488 | 487 |
out, _, err := dockerCmdWithError("run", "--name=app", "--volumes-from=data1", "--volumes-from=data2", "-d", "busybox", "top")
|
| 489 | 488 |
assert.Assert(c, err == nil, check.Commentf("Out: %s", out))
|
| 490 | 489 |
|
| ... | ... |
@@ -524,9 +513,8 @@ func (s *DockerSuite) TestDuplicateMountpointsForVolumesFromAndBind(c *testing.T |
| 524 | 524 |
|
| 525 | 525 |
// Both volume should exist |
| 526 | 526 |
out, _ = dockerCmd(c, "volume", "ls", "-q") |
| 527 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, data1) |
|
| 528 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, data2) |
|
| 529 |
- |
|
| 527 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), data1)) |
|
| 528 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), data2)) |
|
| 530 | 529 |
// /tmp/data is automatically created, because we are not using the modern mount API here |
| 531 | 530 |
out, _, err := dockerCmdWithError("run", "--name=app", "--volumes-from=data1", "--volumes-from=data2", "-v", "/tmp/data:/tmp/data", "-d", "busybox", "top")
|
| 532 | 531 |
assert.Assert(c, err == nil, check.Commentf("Out: %s", out))
|
| ... | ... |
@@ -567,9 +555,8 @@ func (s *DockerSuite) TestDuplicateMountpointsForVolumesFromAndMounts(c *testing |
| 567 | 567 |
|
| 568 | 568 |
// Both volume should exist |
| 569 | 569 |
out, _ = dockerCmd(c, "volume", "ls", "-q") |
| 570 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, data1) |
|
| 571 |
- assert.Assert(c, strings.TrimSpace(out), checker.Contains, data2) |
|
| 572 |
- |
|
| 570 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), data1)) |
|
| 571 |
+ assert.Assert(c, strings.Contains(strings.TrimSpace(out), data2)) |
|
| 573 | 572 |
err := os.MkdirAll("/tmp/data", 0755)
|
| 574 | 573 |
assert.NilError(c, err) |
| 575 | 574 |
// Mounts is available in API |