sed -E -i 's#\bcheck\.(Equals|DeepEquals|HasLen|IsNil|Matches|Not|NotNil)\b#checker.\1#g' \
-- "integration-cli/docker_api_containers_test.go" "integration-cli/docker_cli_attach_test.go" "integration-cli/docker_cli_attach_unix_test.go" "integration-cli/docker_cli_build_test.go" "integration-cli/docker_cli_build_unix_test.go" "integration-cli/docker_cli_by_digest_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_health_test.go" "integration-cli/docker_cli_images_test.go" "integration-cli/docker_cli_inspect_test.go" "integration-cli/docker_cli_netmode_test.go" "integration-cli/docker_cli_network_unix_test.go" "integration-cli/docker_cli_port_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_health_test.go" "integration-cli/docker_cli_swarm_test.go" "integration-cli/docker_cli_volume_test.go" "integration-cli/docker_utils_test.go" "pkg/discovery/discovery_test.go" "pkg/discovery/file/file_test.go" "pkg/discovery/generator_test.go" "pkg/discovery/kv/kv_test.go" "pkg/discovery/memory/memory_test.go" "pkg/discovery/nodes/nodes_test.go"
Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 230f7bcc02569dfa916401ac6259643be8bb84f7)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -1457,7 +1457,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeHostConfigOmitted(c *testin |
| 1457 | 1457 |
containerJSON, err := cli.ContainerInspect(context.Background(), container.ID) |
| 1458 | 1458 |
assert.NilError(c, err) |
| 1459 | 1459 |
|
| 1460 |
- assert.Assert(c, containerJSON.HostConfig.ShmSize, check.Equals, defaultSHMSize) |
|
| 1460 |
+ assert.Assert(c, containerJSON.HostConfig.ShmSize, checker.Equals, defaultSHMSize) |
|
| 1461 | 1461 |
|
| 1462 | 1462 |
out, _ := dockerCmd(c, "start", "-i", containerJSON.ID) |
| 1463 | 1463 |
shmRegexp := regexp.MustCompile(`shm on /dev/shm type tmpfs(.*)size=65536k`) |
| ... | ... |
@@ -1484,7 +1484,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeOmitted(c *testing.T) {
|
| 1484 | 1484 |
containerJSON, err := cli.ContainerInspect(context.Background(), container.ID) |
| 1485 | 1485 |
assert.NilError(c, err) |
| 1486 | 1486 |
|
| 1487 |
- assert.Assert(c, containerJSON.HostConfig.ShmSize, check.Equals, int64(67108864)) |
|
| 1487 |
+ assert.Assert(c, containerJSON.HostConfig.ShmSize, checker.Equals, int64(67108864)) |
|
| 1488 | 1488 |
|
| 1489 | 1489 |
out, _ := dockerCmd(c, "start", "-i", containerJSON.ID) |
| 1490 | 1490 |
shmRegexp := regexp.MustCompile(`shm on /dev/shm type tmpfs(.*)size=65536k`) |
| ... | ... |
@@ -1515,7 +1515,7 @@ func (s *DockerSuite) TestPostContainersCreateWithShmSize(c *testing.T) {
|
| 1515 | 1515 |
containerJSON, err := cli.ContainerInspect(context.Background(), container.ID) |
| 1516 | 1516 |
assert.NilError(c, err) |
| 1517 | 1517 |
|
| 1518 |
- assert.Assert(c, containerJSON.HostConfig.ShmSize, check.Equals, int64(1073741824)) |
|
| 1518 |
+ assert.Assert(c, containerJSON.HostConfig.ShmSize, checker.Equals, int64(1073741824)) |
|
| 1519 | 1519 |
|
| 1520 | 1520 |
out, _ := dockerCmd(c, "start", "-i", containerJSON.ID) |
| 1521 | 1521 |
shmRegex := regexp.MustCompile(`shm on /dev/shm type tmpfs(.*)size=1048576k`) |
| ... | ... |
@@ -1542,9 +1542,9 @@ func (s *DockerSuite) TestPostContainersCreateMemorySwappinessHostConfigOmitted( |
| 1542 | 1542 |
assert.NilError(c, err) |
| 1543 | 1543 |
|
| 1544 | 1544 |
if versions.LessThan(testEnv.DaemonAPIVersion(), "1.31") {
|
| 1545 |
- assert.Assert(c, *containerJSON.HostConfig.MemorySwappiness, check.Equals, int64(-1)) |
|
| 1545 |
+ assert.Assert(c, *containerJSON.HostConfig.MemorySwappiness, checker.Equals, int64(-1)) |
|
| 1546 | 1546 |
} else {
|
| 1547 |
- assert.Assert(c, containerJSON.HostConfig.MemorySwappiness, check.IsNil) |
|
| 1547 |
+ assert.Assert(c, containerJSON.HostConfig.MemorySwappiness, checker.IsNil) |
|
| 1548 | 1548 |
} |
| 1549 | 1549 |
} |
| 1550 | 1550 |
|
| ... | ... |
@@ -1614,7 +1614,7 @@ func (s *DockerSuite) TestContainerAPIStatsWithNetworkDisabled(c *testing.T) {
|
| 1614 | 1614 |
err = cli.ContainerStart(context.Background(), name, types.ContainerStartOptions{})
|
| 1615 | 1615 |
assert.NilError(c, err) |
| 1616 | 1616 |
|
| 1617 |
- assert.Assert(c, waitRun(name), check.IsNil) |
|
| 1617 |
+ assert.Assert(c, waitRun(name), checker.IsNil) |
|
| 1618 | 1618 |
|
| 1619 | 1619 |
type b struct {
|
| 1620 | 1620 |
stats types.ContainerStats |
| ... | ... |
@@ -147,7 +147,7 @@ func (s *DockerSuite) TestAttachDisconnect(c *testing.T) {
|
| 147 | 147 |
stdout, err := cmd.StdoutPipe() |
| 148 | 148 |
assert.NilError(c, err) |
| 149 | 149 |
defer stdout.Close() |
| 150 |
- assert.Assert(c, cmd.Start(), check.IsNil) |
|
| 150 |
+ assert.Assert(c, cmd.Start(), checker.IsNil) |
|
| 151 | 151 |
defer func() {
|
| 152 | 152 |
cmd.Process.Kill() |
| 153 | 153 |
cmd.Wait() |
| ... | ... |
@@ -157,13 +157,13 @@ func (s *DockerSuite) TestAttachDisconnect(c *testing.T) {
|
| 157 | 157 |
assert.NilError(c, err) |
| 158 | 158 |
out, err = bufio.NewReader(stdout).ReadString('\n')
|
| 159 | 159 |
assert.NilError(c, err) |
| 160 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, "hello") |
|
| 160 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, "hello") |
|
| 161 | 161 |
|
| 162 |
- assert.Assert(c, stdin.Close(), check.IsNil) |
|
| 162 |
+ assert.Assert(c, stdin.Close(), checker.IsNil) |
|
| 163 | 163 |
|
| 164 | 164 |
// Expect container to still be running after stdin is closed |
| 165 | 165 |
running := inspectField(c, id, "State.Running") |
| 166 |
- assert.Assert(c, running, check.Equals, "true") |
|
| 166 |
+ assert.Assert(c, running, checker.Equals, "true") |
|
| 167 | 167 |
} |
| 168 | 168 |
|
| 169 | 169 |
func (s *DockerSuite) TestAttachPausedContainer(c *testing.T) {
|
| ... | ... |
@@ -51,7 +51,7 @@ func (s *DockerSuite) TestAttachClosedOnContainerStop(c *testing.T) {
|
| 51 | 51 |
case err := <-errChan: |
| 52 | 52 |
tty.Close() |
| 53 | 53 |
out, _ := ioutil.ReadAll(pty) |
| 54 |
- assert.Assert(c, err, check.IsNil, check.Commentf("out: %v", string(out)))
|
|
| 54 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("out: %v", string(out)))
|
|
| 55 | 55 |
case <-time.After(attachWait): |
| 56 | 56 |
c.Fatal("timed out without attach returning")
|
| 57 | 57 |
} |
| ... | ... |
@@ -74,7 +74,7 @@ func (s *DockerSuite) TestAttachAfterDetach(c *testing.T) {
|
| 74 | 74 |
close(cmdExit) |
| 75 | 75 |
}() |
| 76 | 76 |
|
| 77 |
- assert.Assert(c, waitRun(name), check.IsNil) |
|
| 77 |
+ assert.Assert(c, waitRun(name), checker.IsNil) |
|
| 78 | 78 |
|
| 79 | 79 |
cpty.Write([]byte{16})
|
| 80 | 80 |
time.Sleep(100 * time.Millisecond) |
| ... | ... |
@@ -4373,7 +4373,7 @@ func (s *DockerSuite) TestBuildBuildTimeArgExpansion(c *testing.T) {
|
| 4373 | 4373 |
) |
| 4374 | 4374 |
|
| 4375 | 4375 |
res := inspectField(c, imgName, "Config.WorkingDir") |
| 4376 |
- assert.Assert(c, filepath.ToSlash(res), check.Equals, filepath.ToSlash(wdVal)) |
|
| 4376 |
+ assert.Assert(c, filepath.ToSlash(res), checker.Equals, filepath.ToSlash(wdVal)) |
|
| 4377 | 4377 |
|
| 4378 | 4378 |
var resArr []string |
| 4379 | 4379 |
inspectFieldAndUnmarshall(c, imgName, "Config.Env", &resArr) |
| ... | ... |
@@ -4754,7 +4754,7 @@ func (s *DockerSuite) TestBuildMultipleTags(c *testing.T) {
|
| 4754 | 4754 |
|
| 4755 | 4755 |
id1 := getIDByName(c, "tag1") |
| 4756 | 4756 |
id2 := getIDByName(c, "tag2:v2") |
| 4757 |
- assert.Assert(c, id1, check.Equals, id2) |
|
| 4757 |
+ assert.Assert(c, id1, checker.Equals, id2) |
|
| 4758 | 4758 |
} |
| 4759 | 4759 |
|
| 4760 | 4760 |
// #17290 |
| ... | ... |
@@ -5572,7 +5572,7 @@ func (s *DockerSuite) TestBuildNetContainer(c *testing.T) {
|
| 5572 | 5572 |
`)) |
| 5573 | 5573 |
|
| 5574 | 5574 |
host, _ := dockerCmd(c, "run", "testbuildnetcontainer", "cat", "/otherhost") |
| 5575 |
- assert.Assert(c, strings.TrimSpace(host), check.Equals, "foobar") |
|
| 5575 |
+ assert.Assert(c, strings.TrimSpace(host), checker.Equals, "foobar") |
|
| 5576 | 5576 |
} |
| 5577 | 5577 |
|
| 5578 | 5578 |
func (s *DockerSuite) TestBuildWithExtraHost(c *testing.T) {
|
| ... | ... |
@@ -5777,9 +5777,9 @@ func (s *DockerSuite) TestBuildMultiStageMultipleBuilds(c *testing.T) {
|
| 5777 | 5777 |
cli.BuildCmd(c, "build2", build.WithExternalBuildContext(ctx)) |
| 5778 | 5778 |
|
| 5779 | 5779 |
out := cli.DockerCmd(c, "run", "build2", "cat", "bar").Combined() |
| 5780 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, "abc") |
|
| 5780 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, "abc") |
|
| 5781 | 5781 |
out = cli.DockerCmd(c, "run", "build2", "cat", "foo").Combined() |
| 5782 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, "def") |
|
| 5782 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, "def") |
|
| 5783 | 5783 |
} |
| 5784 | 5784 |
|
| 5785 | 5785 |
func (s *DockerSuite) TestBuildMultiStageImplicitFrom(c *testing.T) {
|
| ... | ... |
@@ -5893,9 +5893,9 @@ func (s *DockerSuite) TestBuildMultiStageMultipleBuildsWindows(c *testing.T) {
|
| 5893 | 5893 |
cli.BuildCmd(c, "build2", build.WithExternalBuildContext(ctx)) |
| 5894 | 5894 |
|
| 5895 | 5895 |
out := cli.DockerCmd(c, "run", "build2", "cmd.exe", "/s", "/c", "type", "c:\\bar").Combined() |
| 5896 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, "abc") |
|
| 5896 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, "abc") |
|
| 5897 | 5897 |
out = cli.DockerCmd(c, "run", "build2", "cmd.exe", "/s", "/c", "type", "c:\\foo").Combined() |
| 5898 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, "def") |
|
| 5898 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, "def") |
|
| 5899 | 5899 |
} |
| 5900 | 5900 |
|
| 5901 | 5901 |
func (s *DockerSuite) TestBuildCopyFromForbidWindowsSystemPaths(c *testing.T) {
|
| ... | ... |
@@ -6223,5 +6223,5 @@ func (s *DockerSuite) TestBuildIidFileCleanupOnFail(c *testing.T) {
|
| 6223 | 6223 |
}) |
| 6224 | 6224 |
_, err = os.Stat(tmpIidFile) |
| 6225 | 6225 |
assert.ErrorContains(c, err, "") |
| 6226 |
- assert.Assert(c, os.IsNotExist(err), check.Equals, true) |
|
| 6226 |
+ assert.Assert(c, os.IsNotExist(err), checker.Equals, true) |
|
| 6227 | 6227 |
} |
| ... | ... |
@@ -76,12 +76,12 @@ func (s *DockerSuite) TestBuildResourceConstraintsAreUsed(c *testing.T) {
|
| 76 | 76 |
err = json.Unmarshal([]byte(cfg), &c2) |
| 77 | 77 |
assert.Assert(c, err, checker.IsNil, check.Commentf(cfg)) |
| 78 | 78 |
|
| 79 |
- assert.Assert(c, c2.Memory, check.Not(checker.Equals), int64(64*1024*1024), check.Commentf("resource leaked from build for Memory"))
|
|
| 80 |
- assert.Assert(c, c2.MemorySwap, check.Not(checker.Equals), int64(-1), check.Commentf("resource leaked from build for MemorySwap"))
|
|
| 81 |
- assert.Assert(c, c2.CpusetCpus, check.Not(checker.Equals), "0", check.Commentf("resource leaked from build for CpusetCpus"))
|
|
| 82 |
- assert.Assert(c, c2.CpusetMems, check.Not(checker.Equals), "0", check.Commentf("resource leaked from build for CpusetMems"))
|
|
| 83 |
- assert.Assert(c, c2.CPUShares, check.Not(checker.Equals), int64(100), check.Commentf("resource leaked from build for CPUShares"))
|
|
| 84 |
- assert.Assert(c, c2.CPUQuota, check.Not(checker.Equals), int64(8000), check.Commentf("resource leaked from build for CPUQuota"))
|
|
| 79 |
+ assert.Assert(c, c2.Memory, checker.Not(checker.Equals), int64(64*1024*1024), check.Commentf("resource leaked from build for Memory"))
|
|
| 80 |
+ assert.Assert(c, c2.MemorySwap, checker.Not(checker.Equals), int64(-1), check.Commentf("resource leaked from build for MemorySwap"))
|
|
| 81 |
+ assert.Assert(c, c2.CpusetCpus, checker.Not(checker.Equals), "0", check.Commentf("resource leaked from build for CpusetCpus"))
|
|
| 82 |
+ assert.Assert(c, c2.CpusetMems, checker.Not(checker.Equals), "0", check.Commentf("resource leaked from build for CpusetMems"))
|
|
| 83 |
+ assert.Assert(c, c2.CPUShares, checker.Not(checker.Equals), int64(100), check.Commentf("resource leaked from build for CPUShares"))
|
|
| 84 |
+ assert.Assert(c, c2.CPUQuota, checker.Not(checker.Equals), int64(8000), check.Commentf("resource leaked from build for CPUQuota"))
|
|
| 85 | 85 |
assert.Assert(c, c2.Ulimits, checker.IsNil, check.Commentf("resource leaked from build for Ulimits"))
|
| 86 | 86 |
} |
| 87 | 87 |
|
| ... | ... |
@@ -389,7 +389,7 @@ func (s *DockerRegistrySuite) TestListDanglingImagesWithDigests(c *testing.T) {
|
| 389 | 389 |
|
| 390 | 390 |
func (s *DockerRegistrySuite) TestInspectImageWithDigests(c *testing.T) {
|
| 391 | 391 |
digest, err := setupImage(c) |
| 392 |
- assert.Assert(c, err, check.IsNil, check.Commentf("error setting up image"))
|
|
| 392 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("error setting up image"))
|
|
| 393 | 393 |
|
| 394 | 394 |
imageReference := fmt.Sprintf("%s@%s", repoName, digest)
|
| 395 | 395 |
|
| ... | ... |
@@ -556,7 +556,7 @@ func (s *DockerRegistrySuite) TestPullFailsWithAlteredManifest(c *testing.T) {
|
| 556 | 556 |
// Pull from the registry using the <name>@<digest> reference. |
| 557 | 557 |
imageReference := fmt.Sprintf("%s@%s", repoName, manifestDigest)
|
| 558 | 558 |
out, exitStatus, _ := dockerCmdWithError("pull", imageReference)
|
| 559 |
- assert.Assert(c, exitStatus, checker.Not(check.Equals), 0) |
|
| 559 |
+ assert.Assert(c, exitStatus, checker.Not(checker.Equals), 0) |
|
| 560 | 560 |
|
| 561 | 561 |
expectedErrorMsg := fmt.Sprintf("manifest verification failed for digest %s", manifestDigest)
|
| 562 | 562 |
assert.Assert(c, is.Contains(out, expectedErrorMsg)) |
| ... | ... |
@@ -598,7 +598,7 @@ func (s *DockerSchema1RegistrySuite) TestPullFailsWithAlteredManifest(c *testing |
| 598 | 598 |
// Pull from the registry using the <name>@<digest> reference. |
| 599 | 599 |
imageReference := fmt.Sprintf("%s@%s", repoName, manifestDigest)
|
| 600 | 600 |
out, exitStatus, _ := dockerCmdWithError("pull", imageReference)
|
| 601 |
- assert.Assert(c, exitStatus, checker.Not(check.Equals), 0) |
|
| 601 |
+ assert.Assert(c, exitStatus, checker.Not(checker.Equals), 0) |
|
| 602 | 602 |
|
| 603 | 603 |
expectedErrorMsg := fmt.Sprintf("image verification failed for digest %s", manifestDigest)
|
| 604 | 604 |
assert.Assert(c, out, checker.Contains, expectedErrorMsg) |
| ... | ... |
@@ -641,7 +641,7 @@ func (s *DockerRegistrySuite) TestPullFailsWithAlteredLayer(c *testing.T) {
|
| 641 | 641 |
// Pull from the registry using the <name>@<digest> reference. |
| 642 | 642 |
imageReference := fmt.Sprintf("%s@%s", repoName, manifestDigest)
|
| 643 | 643 |
out, exitStatus, _ := dockerCmdWithError("pull", imageReference)
|
| 644 |
- assert.Assert(c, exitStatus, checker.Not(check.Equals), 0, check.Commentf("expected a non-zero exit status"))
|
|
| 644 |
+ assert.Assert(c, exitStatus, checker.Not(checker.Equals), 0, check.Commentf("expected a non-zero exit status"))
|
|
| 645 | 645 |
|
| 646 | 646 |
expectedErrorMsg := fmt.Sprintf("filesystem layer verification failed for digest %s", targetLayerDigest)
|
| 647 | 647 |
assert.Assert(c, out, checker.Contains, expectedErrorMsg, check.Commentf("expected error message in output: %s", out))
|
| ... | ... |
@@ -684,7 +684,7 @@ func (s *DockerSchema1RegistrySuite) TestPullFailsWithAlteredLayer(c *testing.T) |
| 684 | 684 |
// Pull from the registry using the <name>@<digest> reference. |
| 685 | 685 |
imageReference := fmt.Sprintf("%s@%s", repoName, manifestDigest)
|
| 686 | 686 |
out, exitStatus, _ := dockerCmdWithError("pull", imageReference)
|
| 687 |
- assert.Assert(c, exitStatus, checker.Not(check.Equals), 0, check.Commentf("expected a non-zero exit status"))
|
|
| 687 |
+ assert.Assert(c, exitStatus, checker.Not(checker.Equals), 0, check.Commentf("expected a non-zero exit status"))
|
|
| 688 | 688 |
|
| 689 | 689 |
expectedErrorMsg := fmt.Sprintf("filesystem layer verification failed for digest %s", targetLayerDigest)
|
| 690 | 690 |
assert.Assert(c, out, checker.Contains, expectedErrorMsg, check.Commentf("expected error message in output: %s", out))
|
| ... | ... |
@@ -37,7 +37,7 @@ func (s *DockerSuite) TestCreateArgs(c *testing.T) {
|
| 37 | 37 |
} |
| 38 | 38 |
|
| 39 | 39 |
err := json.Unmarshal([]byte(out), &containers) |
| 40 |
- assert.Assert(c, err, check.IsNil, check.Commentf("Error inspecting the container: %s", err))
|
|
| 40 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("Error inspecting the container: %s", err))
|
|
| 41 | 41 |
assert.Equal(c, len(containers), 1) |
| 42 | 42 |
|
| 43 | 43 |
cont := containers[0] |
| ... | ... |
@@ -96,11 +96,11 @@ func (s *DockerSuite) TestCreateHostConfig(c *testing.T) {
|
| 96 | 96 |
} |
| 97 | 97 |
|
| 98 | 98 |
err := json.Unmarshal([]byte(out), &containers) |
| 99 |
- assert.Assert(c, err, check.IsNil, check.Commentf("Error inspecting the container: %s", err))
|
|
| 99 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("Error inspecting the container: %s", err))
|
|
| 100 | 100 |
assert.Equal(c, len(containers), 1) |
| 101 | 101 |
|
| 102 | 102 |
cont := containers[0] |
| 103 |
- assert.Assert(c, cont.HostConfig, check.NotNil, check.Commentf("Expected HostConfig, got none"))
|
|
| 103 |
+ assert.Assert(c, cont.HostConfig, checker.NotNil, check.Commentf("Expected HostConfig, got none"))
|
|
| 104 | 104 |
assert.Assert(c, cont.HostConfig.PublishAllPorts, checker.True, check.Commentf("Expected PublishAllPorts, got false"))
|
| 105 | 105 |
} |
| 106 | 106 |
|
| ... | ... |
@@ -117,12 +117,12 @@ func (s *DockerSuite) TestCreateWithPortRange(c *testing.T) {
|
| 117 | 117 |
} |
| 118 | 118 |
} |
| 119 | 119 |
err := json.Unmarshal([]byte(out), &containers) |
| 120 |
- assert.Assert(c, err, check.IsNil, check.Commentf("Error inspecting the container: %s", err))
|
|
| 120 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("Error inspecting the container: %s", err))
|
|
| 121 | 121 |
assert.Equal(c, len(containers), 1) |
| 122 | 122 |
|
| 123 | 123 |
cont := containers[0] |
| 124 | 124 |
|
| 125 |
- assert.Assert(c, cont.HostConfig, check.NotNil, check.Commentf("Expected HostConfig, got none"))
|
|
| 125 |
+ assert.Assert(c, cont.HostConfig, checker.NotNil, check.Commentf("Expected HostConfig, got none"))
|
|
| 126 | 126 |
assert.Assert(c, cont.HostConfig.PortBindings, checker.HasLen, 4, check.Commentf("Expected 4 ports bindings, got %d", len(cont.HostConfig.PortBindings)))
|
| 127 | 127 |
|
| 128 | 128 |
for k, v := range cont.HostConfig.PortBindings {
|
| ... | ... |
@@ -147,11 +147,11 @@ func (s *DockerSuite) TestCreateWithLargePortRange(c *testing.T) {
|
| 147 | 147 |
} |
| 148 | 148 |
|
| 149 | 149 |
err := json.Unmarshal([]byte(out), &containers) |
| 150 |
- assert.Assert(c, err, check.IsNil, check.Commentf("Error inspecting the container: %s", err))
|
|
| 150 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("Error inspecting the container: %s", err))
|
|
| 151 | 151 |
assert.Equal(c, len(containers), 1) |
| 152 | 152 |
|
| 153 | 153 |
cont := containers[0] |
| 154 |
- assert.Assert(c, cont.HostConfig, check.NotNil, check.Commentf("Expected HostConfig, got none"))
|
|
| 154 |
+ assert.Assert(c, cont.HostConfig, checker.NotNil, check.Commentf("Expected HostConfig, got none"))
|
|
| 155 | 155 |
assert.Assert(c, cont.HostConfig.PortBindings, checker.HasLen, 65535) |
| 156 | 156 |
|
| 157 | 157 |
for k, v := range cont.HostConfig.PortBindings {
|
| ... | ... |
@@ -179,7 +179,7 @@ func (s *DockerSuite) TestCreateVolumesCreated(c *testing.T) {
|
| 179 | 179 |
dockerCmd(c, "create", "--name", name, "-v", prefix+slash+"foo", "busybox") |
| 180 | 180 |
|
| 181 | 181 |
dir, err := inspectMountSourceField(name, prefix+slash+"foo") |
| 182 |
- assert.Assert(c, err, check.IsNil, check.Commentf("Error getting volume host path: %q", err))
|
|
| 182 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("Error getting volume host path: %q", err))
|
|
| 183 | 183 |
|
| 184 | 184 |
if _, err := os.Stat(dir); err != nil && os.IsNotExist(err) {
|
| 185 | 185 |
c.Fatalf("Volume was not created")
|
| ... | ... |
@@ -362,9 +362,9 @@ exec "$@"`, |
| 362 | 362 |
|
| 363 | 363 |
out := cli.DockerCmd(c, "create", "--entrypoint=", name, "echo", "foo").Combined() |
| 364 | 364 |
id := strings.TrimSpace(out) |
| 365 |
- assert.Assert(c, id, check.Not(check.Equals), "") |
|
| 365 |
+ assert.Assert(c, id, checker.Not(checker.Equals), "") |
|
| 366 | 366 |
out = cli.DockerCmd(c, "start", "-a", id).Combined() |
| 367 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, "foo") |
|
| 367 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, "foo") |
|
| 368 | 368 |
} |
| 369 | 369 |
|
| 370 | 370 |
// #22471 |
| ... | ... |
@@ -130,13 +130,13 @@ func (s *DockerDaemonSuite) TestDaemonRestartUnlessStopped(c *testing.T) {
|
| 130 | 130 |
var format string |
| 131 | 131 |
for name, shouldRun := range m {
|
| 132 | 132 |
out, err := s.d.Cmd("ps")
|
| 133 |
- assert.Assert(c, err, check.IsNil, check.Commentf("run ps: %v", out))
|
|
| 133 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("run ps: %v", out))
|
|
| 134 | 134 |
if shouldRun {
|
| 135 | 135 |
format = "%scontainer %q is not running" |
| 136 | 136 |
} else {
|
| 137 | 137 |
format = "%scontainer %q is running" |
| 138 | 138 |
} |
| 139 |
- assert.Assert(c, strings.Contains(out, name), check.Equals, shouldRun, check.Commentf(format, prefix, name)) |
|
| 139 |
+ assert.Assert(c, strings.Contains(out, name), checker.Equals, shouldRun, check.Commentf(format, prefix, name)) |
|
| 140 | 140 |
} |
| 141 | 141 |
} |
| 142 | 142 |
|
| ... | ... |
@@ -216,7 +216,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithInvalidBasesize(c *testing.T) {
|
| 216 | 216 |
|
| 217 | 217 |
if newBasesizeBytes < oldBasesizeBytes {
|
| 218 | 218 |
err := s.d.RestartWithError("--storage-opt", fmt.Sprintf("dm.basesize=%d", newBasesizeBytes))
|
| 219 |
- assert.Assert(c, err, check.NotNil, check.Commentf("daemon should not have started as new base device size is less than existing base device size: %v", err))
|
|
| 219 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("daemon should not have started as new base device size is less than existing base device size: %v", err))
|
|
| 220 | 220 |
// 'err != nil' is expected behaviour, no new daemon started, |
| 221 | 221 |
// so no need to stop daemon. |
| 222 | 222 |
if err != nil {
|
| ... | ... |
@@ -240,12 +240,12 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithIncreasedBasesize(c *testing.T) |
| 240 | 240 |
} |
| 241 | 241 |
|
| 242 | 242 |
err := s.d.RestartWithError("--storage-opt", fmt.Sprintf("dm.basesize=%d", newBasesizeBytes))
|
| 243 |
- assert.Assert(c, err, check.IsNil, check.Commentf("we should have been able to start the daemon with increased base device size: %v", err))
|
|
| 243 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("we should have been able to start the daemon with increased base device size: %v", err))
|
|
| 244 | 244 |
|
| 245 | 245 |
basesizeAfterRestart := getBaseDeviceSize(c, s.d) |
| 246 | 246 |
newBasesize, err := convertBasesize(newBasesizeBytes) |
| 247 |
- assert.Assert(c, err, check.IsNil, check.Commentf("Error in converting base device size: %v", err))
|
|
| 248 |
- assert.Assert(c, newBasesize, check.Equals, basesizeAfterRestart, check.Commentf("Basesize passed is not equal to Basesize set"))
|
|
| 247 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("Error in converting base device size: %v", err))
|
|
| 248 |
+ assert.Assert(c, newBasesize, checker.Equals, basesizeAfterRestart, check.Commentf("Basesize passed is not equal to Basesize set"))
|
|
| 249 | 249 |
s.d.Stop(c) |
| 250 | 250 |
} |
| 251 | 251 |
|
| ... | ... |
@@ -477,7 +477,7 @@ func (s *DockerDaemonSuite) TestDaemonIPv6HostMode(c *testing.T) {
|
| 477 | 477 |
} |
| 478 | 478 |
|
| 479 | 479 |
func (s *DockerDaemonSuite) TestDaemonLogLevelWrong(c *testing.T) {
|
| 480 |
- assert.Assert(c, s.d.StartWithError("--log-level=bogus"), check.NotNil, check.Commentf("Daemon shouldn't start with wrong log level"))
|
|
| 480 |
+ assert.Assert(c, s.d.StartWithError("--log-level=bogus"), checker.NotNil, check.Commentf("Daemon shouldn't start with wrong log level"))
|
|
| 481 | 481 |
} |
| 482 | 482 |
|
| 483 | 483 |
func (s *DockerDaemonSuite) TestDaemonLogLevelDebug(c *testing.T) {
|
| ... | ... |
@@ -679,7 +679,7 @@ func (s *DockerDaemonSuite) TestDaemonBridgeIP(c *testing.T) {
|
| 679 | 679 |
|
| 680 | 680 |
containerIP := d.FindContainerIP(c, "test") |
| 681 | 681 |
ip = net.ParseIP(containerIP) |
| 682 |
- assert.Assert(c, bridgeIPNet.Contains(ip), check.Equals, true, check.Commentf("Container IP-Address must be in the same subnet range : %s", containerIP))
|
|
| 682 |
+ assert.Assert(c, bridgeIPNet.Contains(ip), checker.Equals, true, check.Commentf("Container IP-Address must be in the same subnet range : %s", containerIP))
|
|
| 683 | 683 |
deleteInterface(c, defaultNetworkBridge) |
| 684 | 684 |
} |
| 685 | 685 |
|
| ... | ... |
@@ -783,7 +783,7 @@ func (s *DockerDaemonSuite) TestDaemonDefaultGatewayIPv4Implicit(c *testing.T) {
|
| 783 | 783 |
expectedMessage := fmt.Sprintf("default via %s dev", bridgeIP)
|
| 784 | 784 |
out, err := d.Cmd("run", "busybox", "ip", "-4", "route", "list", "0/0")
|
| 785 | 785 |
assert.NilError(c, err, out) |
| 786 |
- assert.Assert(c, strings.Contains(out, expectedMessage), check.Equals, true, check.Commentf("Implicit default gateway should be bridge IP %s, but default route was '%s'", bridgeIP, strings.TrimSpace(out)))
|
|
| 786 |
+ assert.Assert(c, strings.Contains(out, expectedMessage), checker.Equals, true, check.Commentf("Implicit default gateway should be bridge IP %s, but default route was '%s'", bridgeIP, strings.TrimSpace(out)))
|
|
| 787 | 787 |
deleteInterface(c, defaultNetworkBridge) |
| 788 | 788 |
} |
| 789 | 789 |
|
| ... | ... |
@@ -803,7 +803,7 @@ func (s *DockerDaemonSuite) TestDaemonDefaultGatewayIPv4Explicit(c *testing.T) {
|
| 803 | 803 |
expectedMessage := fmt.Sprintf("default via %s dev", gatewayIP)
|
| 804 | 804 |
out, err := d.Cmd("run", "busybox", "ip", "-4", "route", "list", "0/0")
|
| 805 | 805 |
assert.NilError(c, err, out) |
| 806 |
- assert.Assert(c, strings.Contains(out, expectedMessage), check.Equals, true, check.Commentf("Explicit default gateway should be %s, but default route was '%s'", gatewayIP, strings.TrimSpace(out)))
|
|
| 806 |
+ assert.Assert(c, strings.Contains(out, expectedMessage), checker.Equals, true, check.Commentf("Explicit default gateway should be %s, but default route was '%s'", gatewayIP, strings.TrimSpace(out)))
|
|
| 807 | 807 |
deleteInterface(c, defaultNetworkBridge) |
| 808 | 808 |
} |
| 809 | 809 |
|
| ... | ... |
@@ -844,8 +844,8 @@ func (s *DockerDaemonSuite) TestDaemonIP(c *testing.T) {
|
| 844 | 844 |
defer d.Restart(c) |
| 845 | 845 |
|
| 846 | 846 |
out, err := d.Cmd("run", "-d", "-p", "8000:8000", "busybox", "top")
|
| 847 |
- assert.Assert(c, err, check.NotNil, check.Commentf("Running a container must fail with an invalid --ip option"))
|
|
| 848 |
- assert.Assert(c, strings.Contains(out, "Error starting userland proxy"), check.Equals, true) |
|
| 847 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("Running a container must fail with an invalid --ip option"))
|
|
| 848 |
+ assert.Assert(c, strings.Contains(out, "Error starting userland proxy"), checker.Equals, true) |
|
| 849 | 849 |
|
| 850 | 850 |
ifName := "dummy" |
| 851 | 851 |
createInterface(c, "dummy", ifName, ipStr) |
| ... | ... |
@@ -858,7 +858,7 @@ func (s *DockerDaemonSuite) TestDaemonIP(c *testing.T) {
|
| 858 | 858 |
result.Assert(c, icmd.Success) |
| 859 | 859 |
regex := fmt.Sprintf("DNAT.*%s.*dpt:8000", ip.String())
|
| 860 | 860 |
matched, _ := regexp.MatchString(regex, result.Combined()) |
| 861 |
- assert.Assert(c, matched, check.Equals, true, check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined()))
|
|
| 861 |
+ assert.Assert(c, matched, checker.Equals, true, check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined()))
|
|
| 862 | 862 |
} |
| 863 | 863 |
|
| 864 | 864 |
func (s *DockerDaemonSuite) TestDaemonICCPing(c *testing.T) {
|
| ... | ... |
@@ -878,7 +878,7 @@ func (s *DockerDaemonSuite) TestDaemonICCPing(c *testing.T) {
|
| 878 | 878 |
result.Assert(c, icmd.Success) |
| 879 | 879 |
regex := fmt.Sprintf("DROP.*all.*%s.*%s", bridgeName, bridgeName)
|
| 880 | 880 |
matched, _ := regexp.MatchString(regex, result.Combined()) |
| 881 |
- assert.Assert(c, matched, check.Equals, true, check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined()))
|
|
| 881 |
+ assert.Assert(c, matched, checker.Equals, true, check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined()))
|
|
| 882 | 882 |
// Pinging another container must fail with --icc=false |
| 883 | 883 |
pingContainers(c, d, true) |
| 884 | 884 |
|
| ... | ... |
@@ -911,7 +911,7 @@ func (s *DockerDaemonSuite) TestDaemonICCLinkExpose(c *testing.T) {
|
| 911 | 911 |
result.Assert(c, icmd.Success) |
| 912 | 912 |
regex := fmt.Sprintf("DROP.*all.*%s.*%s", bridgeName, bridgeName)
|
| 913 | 913 |
matched, _ := regexp.MatchString(regex, result.Combined()) |
| 914 |
- assert.Assert(c, matched, check.Equals, true, check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined()))
|
|
| 914 |
+ assert.Assert(c, matched, checker.Equals, true, check.Commentf("iptables output should have contained %q, but was %q", regex, result.Combined()))
|
|
| 915 | 915 |
out, err := d.Cmd("run", "-d", "--expose", "4567", "--name", "icc1", "busybox", "nc", "-l", "-p", "4567")
|
| 916 | 916 |
assert.NilError(c, err, out) |
| 917 | 917 |
|
| ... | ... |
@@ -1136,7 +1136,7 @@ func (s *DockerDaemonSuite) TestDaemonLoggingDriverNoneLogsError(c *testing.T) {
|
| 1136 | 1136 |
assert.NilError(c, err, out) |
| 1137 | 1137 |
|
| 1138 | 1138 |
out, err = s.d.Cmd("logs", "test")
|
| 1139 |
- assert.Assert(c, err, check.NotNil, check.Commentf("Logs should fail with 'none' driver"))
|
|
| 1139 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("Logs should fail with 'none' driver"))
|
|
| 1140 | 1140 |
expected := `configured logging driver does not support reading` |
| 1141 | 1141 |
assert.Assert(c, strings.Contains(out, expected)) |
| 1142 | 1142 |
} |
| ... | ... |
@@ -1151,8 +1151,8 @@ func (s *DockerDaemonSuite) TestDaemonLoggingDriverShouldBeIgnoredForBuild(c *te |
| 1151 | 1151 |
build.WithoutCache, |
| 1152 | 1152 |
) |
| 1153 | 1153 |
comment := check.Commentf("Failed to build image. output %s, exitCode %d, err %v", result.Combined(), result.ExitCode, result.Error)
|
| 1154 |
- assert.Assert(c, result.Error, check.IsNil, comment) |
|
| 1155 |
- assert.Assert(c, result.ExitCode, check.Equals, 0, comment) |
|
| 1154 |
+ assert.Assert(c, result.Error, checker.IsNil, comment) |
|
| 1155 |
+ assert.Assert(c, result.ExitCode, checker.Equals, 0, comment) |
|
| 1156 | 1156 |
assert.Assert(c, result.Combined(), checker.Contains, "foo", comment) |
| 1157 | 1157 |
} |
| 1158 | 1158 |
|
| ... | ... |
@@ -1569,7 +1569,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithContainerWithRestartPolicyAlway |
| 1569 | 1569 |
|
| 1570 | 1570 |
out, err = s.d.Cmd("ps", "-q")
|
| 1571 | 1571 |
assert.NilError(c, err, out) |
| 1572 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, id[:12]) |
|
| 1572 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, id[:12]) |
|
| 1573 | 1573 |
} |
| 1574 | 1574 |
|
| 1575 | 1575 |
func (s *DockerDaemonSuite) TestDaemonWideLogConfig(c *testing.T) {
|
| ... | ... |
@@ -1630,7 +1630,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartRmVolumeInUse(c *testing.T) {
|
| 1630 | 1630 |
s.d.Restart(c) |
| 1631 | 1631 |
|
| 1632 | 1632 |
out, err = s.d.Cmd("volume", "rm", "test")
|
| 1633 |
- assert.Assert(c, err, check.NotNil, check.Commentf("should not be able to remove in use volume after daemon restart"))
|
|
| 1633 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("should not be able to remove in use volume after daemon restart"))
|
|
| 1634 | 1634 |
assert.Assert(c, out, checker.Contains, "in use") |
| 1635 | 1635 |
} |
| 1636 | 1636 |
|
| ... | ... |
@@ -1648,7 +1648,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartLocalVolumes(c *testing.T) {
|
| 1648 | 1648 |
// FIXME(vdemeester) should be a unit test |
| 1649 | 1649 |
func (s *DockerDaemonSuite) TestDaemonCorruptedLogDriverAddress(c *testing.T) {
|
| 1650 | 1650 |
d := daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution)) |
| 1651 |
- assert.Assert(c, d.StartWithError("--log-driver=syslog", "--log-opt", "syslog-address=corrupted:42"), check.NotNil)
|
|
| 1651 |
+ assert.Assert(c, d.StartWithError("--log-driver=syslog", "--log-opt", "syslog-address=corrupted:42"), checker.NotNil)
|
|
| 1652 | 1652 |
expected := "syslog-address should be in form proto://address" |
| 1653 | 1653 |
icmd.RunCommand("grep", expected, d.LogFileName()).Assert(c, icmd.Success)
|
| 1654 | 1654 |
} |
| ... | ... |
@@ -1656,7 +1656,7 @@ func (s *DockerDaemonSuite) TestDaemonCorruptedLogDriverAddress(c *testing.T) {
|
| 1656 | 1656 |
// FIXME(vdemeester) should be a unit test |
| 1657 | 1657 |
func (s *DockerDaemonSuite) TestDaemonCorruptedFluentdAddress(c *testing.T) {
|
| 1658 | 1658 |
d := daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution)) |
| 1659 |
- assert.Assert(c, d.StartWithError("--log-driver=fluentd", "--log-opt", "fluentd-address=corrupted:c"), check.NotNil)
|
|
| 1659 |
+ assert.Assert(c, d.StartWithError("--log-driver=fluentd", "--log-opt", "fluentd-address=corrupted:c"), checker.NotNil)
|
|
| 1660 | 1660 |
expected := "invalid fluentd-address corrupted:c: " |
| 1661 | 1661 |
icmd.RunCommand("grep", expected, d.LogFileName()).Assert(c, icmd.Success)
|
| 1662 | 1662 |
} |
| ... | ... |
@@ -1749,9 +1749,9 @@ func (s *DockerDaemonSuite) TestBridgeIPIsExcludedFromAllocatorPool(c *testing.T |
| 1749 | 1749 |
break |
| 1750 | 1750 |
} |
| 1751 | 1751 |
ip, err := s.d.Cmd("inspect", "--format", "'{{.NetworkSettings.IPAddress}}'", contName)
|
| 1752 |
- assert.Assert(c, err, check.IsNil, check.Commentf("%s", ip))
|
|
| 1752 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("%s", ip))
|
|
| 1753 | 1753 |
|
| 1754 |
- assert.Assert(c, ip, check.Not(check.Equals), bridgeIP) |
|
| 1754 |
+ assert.Assert(c, ip, checker.Not(checker.Equals), bridgeIP) |
|
| 1755 | 1755 |
cont++ |
| 1756 | 1756 |
} |
| 1757 | 1757 |
} |
| ... | ... |
@@ -1889,7 +1889,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithLinks(c *testing.T) {
|
| 1889 | 1889 |
assert.NilError(c, err, out) |
| 1890 | 1890 |
out, err = s.d.Cmd("start", "-a", "test2")
|
| 1891 | 1891 |
assert.NilError(c, err, out) |
| 1892 |
- assert.Assert(c, strings.Contains(out, "1 packets transmitted, 1 packets received"), check.Equals, true, check.Commentf("%s", out))
|
|
| 1892 |
+ assert.Assert(c, strings.Contains(out, "1 packets transmitted, 1 packets received"), checker.Equals, true, check.Commentf("%s", out))
|
|
| 1893 | 1893 |
} |
| 1894 | 1894 |
|
| 1895 | 1895 |
func (s *DockerDaemonSuite) TestDaemonRestartWithNames(c *testing.T) {
|
| ... | ... |
@@ -1999,14 +1999,14 @@ func (s *DockerDaemonSuite) TestCleanupMountsAfterDaemonCrash(c *testing.T) {
|
| 1999 | 1999 |
id := strings.TrimSpace(out) |
| 2000 | 2000 |
|
| 2001 | 2001 |
// kill the daemon |
| 2002 |
- assert.Assert(c, s.d.Kill(), check.IsNil) |
|
| 2002 |
+ assert.Assert(c, s.d.Kill(), checker.IsNil) |
|
| 2003 | 2003 |
|
| 2004 | 2004 |
// Check if there are mounts with container id visible from the host. |
| 2005 | 2005 |
// If not, those mounts exist in container's own mount ns, and so |
| 2006 | 2006 |
// the following check for mounts being cleared is pointless. |
| 2007 | 2007 |
skipMountCheck := false |
| 2008 | 2008 |
mountOut, err := ioutil.ReadFile("/proc/self/mountinfo")
|
| 2009 |
- assert.Assert(c, err, check.IsNil, check.Commentf("Output: %s", mountOut))
|
|
| 2009 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("Output: %s", mountOut))
|
|
| 2010 | 2010 |
if !strings.Contains(string(mountOut), id) {
|
| 2011 | 2011 |
skipMountCheck = true |
| 2012 | 2012 |
} |
| ... | ... |
@@ -2031,9 +2031,9 @@ func (s *DockerDaemonSuite) TestCleanupMountsAfterDaemonCrash(c *testing.T) {
|
| 2031 | 2031 |
} |
| 2032 | 2032 |
// Now, container mounts should be gone. |
| 2033 | 2033 |
mountOut, err = ioutil.ReadFile("/proc/self/mountinfo")
|
| 2034 |
- assert.Assert(c, err, check.IsNil, check.Commentf("Output: %s", mountOut))
|
|
| 2034 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("Output: %s", mountOut))
|
|
| 2035 | 2035 |
comment := check.Commentf("%s is still mounted from older daemon start:\nDaemon root repository %s\n%s", id, s.d.Root, mountOut)
|
| 2036 |
- assert.Assert(c, strings.Contains(string(mountOut), id), check.Equals, false, comment) |
|
| 2036 |
+ assert.Assert(c, strings.Contains(string(mountOut), id), checker.Equals, false, comment) |
|
| 2037 | 2037 |
} |
| 2038 | 2038 |
|
| 2039 | 2039 |
// TestDaemonRestartWithUnpausedRunningContainer requires live restore of running containers. |
| ... | ... |
@@ -2112,12 +2112,12 @@ func (s *DockerDaemonSuite) TestRunLinksChanged(c *testing.T) {
|
| 2112 | 2112 |
assert.NilError(c, err, out) |
| 2113 | 2113 |
out, err = s.d.Cmd("start", "-a", "test2")
|
| 2114 | 2114 |
assert.ErrorContains(c, err, "", out) |
| 2115 |
- assert.Assert(c, out, check.Not(checker.Contains), "1 packets transmitted, 1 packets received") |
|
| 2115 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "1 packets transmitted, 1 packets received") |
|
| 2116 | 2116 |
|
| 2117 | 2117 |
s.d.Restart(c) |
| 2118 | 2118 |
out, err = s.d.Cmd("start", "-a", "test2")
|
| 2119 | 2119 |
assert.ErrorContains(c, err, "", out) |
| 2120 |
- assert.Assert(c, out, check.Not(checker.Contains), "1 packets transmitted, 1 packets received") |
|
| 2120 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "1 packets transmitted, 1 packets received") |
|
| 2121 | 2121 |
} |
| 2122 | 2122 |
|
| 2123 | 2123 |
func (s *DockerDaemonSuite) TestDaemonStartWithoutColors(c *testing.T) {
|
| ... | ... |
@@ -2166,8 +2166,8 @@ func (s *DockerDaemonSuite) TestDaemonStartWithoutColors(c *testing.T) {
|
| 2166 | 2166 |
s.d.Stop(c) |
| 2167 | 2167 |
// Wait for io.Copy() before checking output |
| 2168 | 2168 |
<-done |
| 2169 |
- assert.Assert(c, b.String(), check.Not(check.Equals), "") |
|
| 2170 |
- assert.Assert(c, b.String(), check.Not(checker.Contains), infoLog) |
|
| 2169 |
+ assert.Assert(c, b.String(), checker.Not(checker.Equals), "") |
|
| 2170 |
+ assert.Assert(c, b.String(), checker.Not(checker.Contains), infoLog) |
|
| 2171 | 2171 |
} |
| 2172 | 2172 |
|
| 2173 | 2173 |
func (s *DockerDaemonSuite) TestDaemonDebugLog(c *testing.T) {
|
| ... | ... |
@@ -2369,8 +2369,8 @@ func (s *DockerDaemonSuite) TestBuildOnDisabledBridgeNetworkDaemon(c *testing.T) |
| 2369 | 2369 |
build.WithoutCache, |
| 2370 | 2370 |
) |
| 2371 | 2371 |
comment := check.Commentf("Failed to build image. output %s, exitCode %d, err %v", result.Combined(), result.ExitCode, result.Error)
|
| 2372 |
- assert.Assert(c, result.Error, check.IsNil, comment) |
|
| 2373 |
- assert.Assert(c, result.ExitCode, check.Equals, 0, comment) |
|
| 2372 |
+ assert.Assert(c, result.Error, checker.IsNil, comment) |
|
| 2373 |
+ assert.Assert(c, result.ExitCode, checker.Equals, 0, comment) |
|
| 2374 | 2374 |
} |
| 2375 | 2375 |
|
| 2376 | 2376 |
// Test case for #21976 |
| ... | ... |
@@ -2727,18 +2727,18 @@ func (s *DockerDaemonSuite) TestExecWithUserAfterLiveRestore(c *testing.T) {
|
| 2727 | 2727 |
|
| 2728 | 2728 |
// Wait for shell command to be completed |
| 2729 | 2729 |
_, err = s.d.Cmd("exec", "top", "sh", "-c", `for i in $(seq 1 5); do if [ -e /adduser_end ]; then rm -f /adduser_end && break; else sleep 1 && false; fi; done`)
|
| 2730 |
- assert.Assert(c, err, check.IsNil, check.Commentf("Timeout waiting for shell command to be completed"))
|
|
| 2730 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("Timeout waiting for shell command to be completed"))
|
|
| 2731 | 2731 |
|
| 2732 | 2732 |
out1, err := s.d.Cmd("exec", "-u", "test", "top", "id")
|
| 2733 | 2733 |
// uid=100(test) gid=101(test) groups=101(test) |
| 2734 |
- assert.Assert(c, err, check.IsNil, check.Commentf("Output: %s", out1))
|
|
| 2734 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("Output: %s", out1))
|
|
| 2735 | 2735 |
|
| 2736 | 2736 |
// restart daemon. |
| 2737 | 2737 |
s.d.Restart(c, "--live-restore") |
| 2738 | 2738 |
|
| 2739 | 2739 |
out2, err := s.d.Cmd("exec", "-u", "test", "top", "id")
|
| 2740 |
- assert.Assert(c, err, check.IsNil, check.Commentf("Output: %s", out2))
|
|
| 2741 |
- assert.Assert(c, out2, check.Equals, out1, check.Commentf("Output: before restart '%s', after restart '%s'", out1, out2))
|
|
| 2740 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("Output: %s", out2))
|
|
| 2741 |
+ assert.Assert(c, out2, checker.Equals, out1, check.Commentf("Output: before restart '%s', after restart '%s'", out1, out2))
|
|
| 2742 | 2742 |
|
| 2743 | 2743 |
out, err = s.d.Cmd("stop", "top")
|
| 2744 | 2744 |
assert.NilError(c, err, "Output: %s", out) |
| ... | ... |
@@ -2848,7 +2848,7 @@ func (s *DockerDaemonSuite) TestShmSize(c *testing.T) {
|
| 2848 | 2848 |
assert.Assert(c, pattern.MatchString(out), checker.True) |
| 2849 | 2849 |
out, err = s.d.Cmd("inspect", "--format", "{{.HostConfig.ShmSize}}", name)
|
| 2850 | 2850 |
assert.NilError(c, err, "Output: %s", out) |
| 2851 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, fmt.Sprintf("%v", size))
|
|
| 2851 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, fmt.Sprintf("%v", size))
|
|
| 2852 | 2852 |
} |
| 2853 | 2853 |
|
| 2854 | 2854 |
func (s *DockerDaemonSuite) TestShmSizeReload(c *testing.T) {
|
| ... | ... |
@@ -2872,7 +2872,7 @@ func (s *DockerDaemonSuite) TestShmSizeReload(c *testing.T) {
|
| 2872 | 2872 |
assert.Assert(c, pattern.MatchString(out), checker.True) |
| 2873 | 2873 |
out, err = s.d.Cmd("inspect", "--format", "{{.HostConfig.ShmSize}}", name)
|
| 2874 | 2874 |
assert.NilError(c, err, "Output: %s", out) |
| 2875 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, fmt.Sprintf("%v", size))
|
|
| 2875 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, fmt.Sprintf("%v", size))
|
|
| 2876 | 2876 |
|
| 2877 | 2877 |
size = 67108864 * 3 |
| 2878 | 2878 |
configData = []byte(fmt.Sprintf(`{"default-shm-size": "%dM"}`, size/1024/1024))
|
| ... | ... |
@@ -2888,7 +2888,7 @@ func (s *DockerDaemonSuite) TestShmSizeReload(c *testing.T) {
|
| 2888 | 2888 |
assert.Assert(c, pattern.MatchString(out), checker.True) |
| 2889 | 2889 |
out, err = s.d.Cmd("inspect", "--format", "{{.HostConfig.ShmSize}}", name)
|
| 2890 | 2890 |
assert.NilError(c, err, "Output: %s", out) |
| 2891 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, fmt.Sprintf("%v", size))
|
|
| 2891 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, fmt.Sprintf("%v", size))
|
|
| 2892 | 2892 |
} |
| 2893 | 2893 |
|
| 2894 | 2894 |
func testDaemonStartIpcMode(c *testing.T, from, mode string, valid bool) {
|
| ... | ... |
@@ -287,7 +287,7 @@ func (s *DockerExternalVolumeSuite) TestVolumeCLICreateOptionConflict(c *testing |
| 287 | 287 |
dockerCmd(c, "volume", "create", "test") |
| 288 | 288 |
|
| 289 | 289 |
out, _, err := dockerCmdWithError("volume", "create", "test", "--driver", volumePluginName)
|
| 290 |
- assert.Assert(c, err, check.NotNil, check.Commentf("volume create exception name already in use with another driver"))
|
|
| 290 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("volume create exception name already in use with another driver"))
|
|
| 291 | 291 |
assert.Assert(c, out, checker.Contains, "must be unique") |
| 292 | 292 |
|
| 293 | 293 |
out, _ = dockerCmd(c, "volume", "inspect", "--format={{ .Driver }}", "test")
|
| ... | ... |
@@ -463,21 +463,21 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverList(c *testing.T) {
|
| 463 | 463 |
dockerCmd(c, "volume", "create", "-d", volumePluginName, "abc3") |
| 464 | 464 |
out, _ := dockerCmd(c, "volume", "ls") |
| 465 | 465 |
ls := strings.Split(strings.TrimSpace(out), "\n") |
| 466 |
- assert.Assert(c, len(ls), check.Equals, 2, check.Commentf("\n%s", out))
|
|
| 466 |
+ assert.Assert(c, len(ls), checker.Equals, 2, check.Commentf("\n%s", out))
|
|
| 467 | 467 |
|
| 468 | 468 |
vol := strings.Fields(ls[len(ls)-1]) |
| 469 |
- assert.Assert(c, len(vol), check.Equals, 2, check.Commentf("%v", vol))
|
|
| 470 |
- assert.Assert(c, vol[0], check.Equals, volumePluginName) |
|
| 471 |
- assert.Assert(c, vol[1], check.Equals, "abc3") |
|
| 469 |
+ assert.Assert(c, len(vol), checker.Equals, 2, check.Commentf("%v", vol))
|
|
| 470 |
+ assert.Assert(c, vol[0], checker.Equals, volumePluginName) |
|
| 471 |
+ assert.Assert(c, vol[1], checker.Equals, "abc3") |
|
| 472 | 472 |
|
| 473 |
- assert.Assert(c, s.ec.lists, check.Equals, 1) |
|
| 473 |
+ assert.Assert(c, s.ec.lists, checker.Equals, 1) |
|
| 474 | 474 |
} |
| 475 | 475 |
|
| 476 | 476 |
func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverGet(c *testing.T) {
|
| 477 | 477 |
out, _, err := dockerCmdWithError("volume", "inspect", "dummy")
|
| 478 | 478 |
assert.ErrorContains(c, err, "", out) |
| 479 | 479 |
assert.Assert(c, out, checker.Contains, "No such volume") |
| 480 |
- assert.Assert(c, s.ec.gets, check.Equals, 1) |
|
| 480 |
+ assert.Assert(c, s.ec.gets, checker.Equals, 1) |
|
| 481 | 481 |
|
| 482 | 482 |
dockerCmd(c, "volume", "create", "test", "-d", volumePluginName) |
| 483 | 483 |
out, _ = dockerCmd(c, "volume", "inspect", "test") |
| ... | ... |
@@ -113,7 +113,7 @@ func (s *DockerSuite) TestHealth(c *testing.T) {
|
| 113 | 113 |
|
| 114 | 114 |
failsStr, _ := dockerCmd(c, "inspect", "--format={{.State.Health.FailingStreak}}", "fatal_healthcheck")
|
| 115 | 115 |
fails, err := strconv.Atoi(strings.TrimSpace(failsStr)) |
| 116 |
- assert.Assert(c, err, check.IsNil) |
|
| 116 |
+ assert.Assert(c, err, checker.IsNil) |
|
| 117 | 117 |
assert.Assert(c, fails >= 3, checker.Equals, true) |
| 118 | 118 |
dockerCmd(c, "rm", "-f", "fatal_healthcheck") |
| 119 | 119 |
|
| ... | ... |
@@ -92,9 +92,9 @@ func (s *DockerSuite) TestImagesFilterLabelMatch(c *testing.T) {
|
| 92 | 92 |
|
| 93 | 93 |
out, _ := dockerCmd(c, "images", "--no-trunc", "-q", "-f", "label=match") |
| 94 | 94 |
out = strings.TrimSpace(out) |
| 95 |
- assert.Assert(c, out, check.Matches, fmt.Sprintf("[\\s\\w:]*%s[\\s\\w:]*", image1ID))
|
|
| 96 |
- assert.Assert(c, out, check.Matches, fmt.Sprintf("[\\s\\w:]*%s[\\s\\w:]*", image2ID))
|
|
| 97 |
- assert.Assert(c, out, check.Not(check.Matches), fmt.Sprintf("[\\s\\w:]*%s[\\s\\w:]*", image3ID))
|
|
| 95 |
+ assert.Assert(c, out, checker.Matches, fmt.Sprintf("[\\s\\w:]*%s[\\s\\w:]*", image1ID))
|
|
| 96 |
+ assert.Assert(c, out, checker.Matches, fmt.Sprintf("[\\s\\w:]*%s[\\s\\w:]*", image2ID))
|
|
| 97 |
+ assert.Assert(c, out, checker.Not(checker.Matches), fmt.Sprintf("[\\s\\w:]*%s[\\s\\w:]*", image3ID))
|
|
| 98 | 98 |
|
| 99 | 99 |
out, _ = dockerCmd(c, "images", "--no-trunc", "-q", "-f", "label=match=me too") |
| 100 | 100 |
out = strings.TrimSpace(out) |
| ... | ... |
@@ -223,7 +223,7 @@ func (s *DockerSuite) TestInspectBindMountPoint(c *testing.T) {
|
| 223 | 223 |
assert.NilError(c, err) |
| 224 | 224 |
|
| 225 | 225 |
// check that there is only one mountpoint |
| 226 |
- assert.Assert(c, mp, check.HasLen, 1) |
|
| 226 |
+ assert.Assert(c, mp, checker.HasLen, 1) |
|
| 227 | 227 |
|
| 228 | 228 |
m := mp[0] |
| 229 | 229 |
|
| ... | ... |
@@ -304,7 +304,7 @@ func (s *DockerSuite) TestInspectNoSizeFlagContainer(c *testing.T) {
|
| 304 | 304 |
|
| 305 | 305 |
formatStr := "--format={{.SizeRw}},{{.SizeRootFs}}"
|
| 306 | 306 |
out, _ := dockerCmd(c, "inspect", "--type=container", formatStr, "busybox") |
| 307 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, "<nil>,<nil>", check.Commentf("Expected not to display size info: %s", out))
|
|
| 307 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, "<nil>,<nil>", check.Commentf("Expected not to display size info: %s", out))
|
|
| 308 | 308 |
} |
| 309 | 309 |
|
| 310 | 310 |
func (s *DockerSuite) TestInspectSizeFlagContainer(c *testing.T) {
|
| ... | ... |
@@ -314,8 +314,8 @@ func (s *DockerSuite) TestInspectSizeFlagContainer(c *testing.T) {
|
| 314 | 314 |
out, _ := dockerCmd(c, "inspect", "-s", "--type=container", formatStr, "busybox") |
| 315 | 315 |
sz := strings.Split(out, ",") |
| 316 | 316 |
|
| 317 |
- assert.Assert(c, strings.TrimSpace(sz[0]), check.Not(check.Equals), "<nil>") |
|
| 318 |
- assert.Assert(c, strings.TrimSpace(sz[1]), check.Not(check.Equals), "<nil>") |
|
| 317 |
+ assert.Assert(c, strings.TrimSpace(sz[0]), checker.Not(checker.Equals), "<nil>") |
|
| 318 |
+ assert.Assert(c, strings.TrimSpace(sz[1]), checker.Not(checker.Equals), "<nil>") |
|
| 319 | 319 |
} |
| 320 | 320 |
|
| 321 | 321 |
func (s *DockerSuite) TestInspectTemplateError(c *testing.T) {
|
| ... | ... |
@@ -324,11 +324,11 @@ func (s *DockerSuite) TestInspectTemplateError(c *testing.T) {
|
| 324 | 324 |
runSleepingContainer(c, "--name=container1", "-d") |
| 325 | 325 |
|
| 326 | 326 |
out, _, err := dockerCmdWithError("inspect", "--type=container", "--format='Format container: {{.ThisDoesNotExist}}'", "container1")
|
| 327 |
- assert.Assert(c, err, check.Not(check.IsNil)) |
|
| 327 |
+ assert.Assert(c, err, checker.Not(checker.IsNil)) |
|
| 328 | 328 |
assert.Assert(c, out, checker.Contains, "Template parsing error") |
| 329 | 329 |
|
| 330 | 330 |
out, _, err = dockerCmdWithError("inspect", "--type=image", "--format='Format container: {{.ThisDoesNotExist}}'", "busybox")
|
| 331 |
- assert.Assert(c, err, check.Not(check.IsNil)) |
|
| 331 |
+ assert.Assert(c, err, checker.Not(checker.IsNil)) |
|
| 332 | 332 |
assert.Assert(c, out, checker.Contains, "Template parsing error") |
| 333 | 333 |
} |
| 334 | 334 |
|
| ... | ... |
@@ -356,7 +356,7 @@ func (s *DockerSuite) TestInspectStopWhenNotFound(c *testing.T) {
|
| 356 | 356 |
runSleepingContainer(c, "--name=busybox2", "-d") |
| 357 | 357 |
result := dockerCmdWithResult("inspect", "--type=container", "--format='{{.Name}}'", "busybox1", "busybox2", "missing")
|
| 358 | 358 |
|
| 359 |
- assert.Assert(c, result.Error, checker.Not(check.IsNil)) |
|
| 359 |
+ assert.Assert(c, result.Error, checker.Not(checker.IsNil)) |
|
| 360 | 360 |
assert.Assert(c, result.Stdout(), checker.Contains, "busybox1") |
| 361 | 361 |
assert.Assert(c, result.Stdout(), checker.Contains, "busybox2") |
| 362 | 362 |
assert.Assert(c, result.Stderr(), checker.Contains, "Error: No such container: missing") |
| ... | ... |
@@ -364,7 +364,7 @@ func (s *DockerSuite) TestInspectStopWhenNotFound(c *testing.T) {
|
| 364 | 364 |
// test inspect would not fast fail |
| 365 | 365 |
result = dockerCmdWithResult("inspect", "--type=container", "--format='{{.Name}}'", "missing", "busybox1", "busybox2")
|
| 366 | 366 |
|
| 367 |
- assert.Assert(c, result.Error, checker.Not(check.IsNil)) |
|
| 367 |
+ assert.Assert(c, result.Error, checker.Not(checker.IsNil)) |
|
| 368 | 368 |
assert.Assert(c, result.Stdout(), checker.Contains, "busybox1") |
| 369 | 369 |
assert.Assert(c, result.Stdout(), checker.Contains, "busybox2") |
| 370 | 370 |
assert.Assert(c, result.Stderr(), checker.Contains, "Error: No such container: missing") |
| ... | ... |
@@ -19,7 +19,7 @@ const stringCheckPS = "PID USER" |
| 19 | 19 |
// stop the tests. |
| 20 | 20 |
func dockerCmdWithFail(c *testing.T, args ...string) (string, int) {
|
| 21 | 21 |
out, status, err := dockerCmdWithError(args...) |
| 22 |
- assert.Assert(c, err, check.NotNil, check.Commentf("%v", out))
|
|
| 22 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("%v", out))
|
|
| 23 | 23 |
return out, status |
| 24 | 24 |
} |
| 25 | 25 |
|
| ... | ... |
@@ -64,7 +64,7 @@ func (s *DockerNetworkSuite) TearDownTest(c *testing.T) {
|
| 64 | 64 |
func (s *DockerNetworkSuite) SetUpSuite(c *testing.T) {
|
| 65 | 65 |
mux := http.NewServeMux() |
| 66 | 66 |
s.server = httptest.NewServer(mux) |
| 67 |
- assert.Assert(c, s.server, check.NotNil, check.Commentf("Failed to start an HTTP Server"))
|
|
| 67 |
+ assert.Assert(c, s.server, checker.NotNil, check.Commentf("Failed to start an HTTP Server"))
|
|
| 68 | 68 |
setupRemoteNetworkDrivers(c, mux, s.server.URL, dummyNetworkDriver, dummyIPAMDriver) |
| 69 | 69 |
} |
| 70 | 70 |
|
| ... | ... |
@@ -360,7 +360,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkLsFilter(c *testing.T) {
|
| 360 | 360 |
|
| 361 | 361 |
out, _ = dockerCmd(c, "network", "ls", "-f", "label=nonexistent") |
| 362 | 362 |
outArr := strings.Split(strings.TrimSpace(out), "\n") |
| 363 |
- assert.Assert(c, len(outArr), check.Equals, 1, check.Commentf("%s\n", out))
|
|
| 363 |
+ assert.Assert(c, len(outArr), checker.Equals, 1, check.Commentf("%s\n", out))
|
|
| 364 | 364 |
|
| 365 | 365 |
out, _ = dockerCmd(c, "network", "ls", "-f", "driver=null") |
| 366 | 366 |
assertNwList(c, out, []string{"none"})
|
| ... | ... |
@@ -390,7 +390,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkCreateLabel(c *testing.T) {
|
| 390 | 390 |
|
| 391 | 391 |
out, _, err := dockerCmdWithError("network", "inspect", "--format={{ .Labels."+testLabel+" }}", testNet)
|
| 392 | 392 |
assert.NilError(c, err) |
| 393 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, testValue) |
|
| 393 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, testValue) |
|
| 394 | 394 |
|
| 395 | 395 |
dockerCmd(c, "network", "rm", testNet) |
| 396 | 396 |
assertNwNotAvailable(c, testNet) |
| ... | ... |
@@ -433,7 +433,7 @@ func (s *DockerSuite) TestDockerNetworkInspect(c *testing.T) {
|
| 433 | 433 |
assert.Equal(c, len(networkResources), 1) |
| 434 | 434 |
|
| 435 | 435 |
out, _ = dockerCmd(c, "network", "inspect", "--format={{ .Name }}", "host")
|
| 436 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, "host") |
|
| 436 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, "host") |
|
| 437 | 437 |
} |
| 438 | 438 |
|
| 439 | 439 |
func (s *DockerSuite) TestDockerNetworkInspectWithID(c *testing.T) {
|
| ... | ... |
@@ -441,10 +441,10 @@ func (s *DockerSuite) TestDockerNetworkInspectWithID(c *testing.T) {
|
| 441 | 441 |
networkID := strings.TrimSpace(out) |
| 442 | 442 |
assertNwIsAvailable(c, "test2") |
| 443 | 443 |
out, _ = dockerCmd(c, "network", "inspect", "--format={{ .Id }}", "test2")
|
| 444 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, networkID) |
|
| 444 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, networkID) |
|
| 445 | 445 |
|
| 446 | 446 |
out, _ = dockerCmd(c, "network", "inspect", "--format={{ .ID }}", "test2")
|
| 447 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, networkID) |
|
| 447 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, networkID) |
|
| 448 | 448 |
} |
| 449 | 449 |
|
| 450 | 450 |
func (s *DockerSuite) TestDockerInspectMultipleNetwork(c *testing.T) {
|
| ... | ... |
@@ -505,7 +505,7 @@ func (s *DockerSuite) TestDockerInspectNetworkWithContainerName(c *testing.T) {
|
| 505 | 505 |
}() |
| 506 | 506 |
|
| 507 | 507 |
out, _ := dockerCmd(c, "run", "-d", "--name", "testNetInspect1", "--net", "brNetForInspect", "busybox", "top") |
| 508 |
- assert.Assert(c, waitRun("testNetInspect1"), check.IsNil)
|
|
| 508 |
+ assert.Assert(c, waitRun("testNetInspect1"), checker.IsNil)
|
|
| 509 | 509 |
containerID := strings.TrimSpace(out) |
| 510 | 510 |
defer func() {
|
| 511 | 511 |
// we don't stop container by name, because we'll rename it later |
| ... | ... |
@@ -546,7 +546,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectDisconnect(c *testing.T) {
|
| 546 | 546 |
|
| 547 | 547 |
// run a container |
| 548 | 548 |
out, _ := dockerCmd(c, "run", "-d", "--name", "test", "busybox", "top") |
| 549 |
- assert.Assert(c, waitRun("test"), check.IsNil)
|
|
| 549 |
+ assert.Assert(c, waitRun("test"), checker.IsNil)
|
|
| 550 | 550 |
containerID := strings.TrimSpace(out) |
| 551 | 551 |
|
| 552 | 552 |
// connect the container to the test network |
| ... | ... |
@@ -570,7 +570,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectDisconnect(c *testing.T) {
|
| 570 | 570 |
|
| 571 | 571 |
// run another container |
| 572 | 572 |
out, _ = dockerCmd(c, "run", "-d", "--net", "test", "--name", "test2", "busybox", "top") |
| 573 |
- assert.Assert(c, waitRun("test2"), check.IsNil)
|
|
| 573 |
+ assert.Assert(c, waitRun("test2"), checker.IsNil)
|
|
| 574 | 574 |
containerID = strings.TrimSpace(out) |
| 575 | 575 |
|
| 576 | 576 |
nr = getNwResource(c, "test") |
| ... | ... |
@@ -1138,7 +1138,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkHostModeUngracefulDaemonRestart(c |
| 1138 | 1138 |
|
| 1139 | 1139 |
func (s *DockerNetworkSuite) TestDockerNetworkConnectToHostFromOtherNetwork(c *testing.T) {
|
| 1140 | 1140 |
dockerCmd(c, "run", "-d", "--name", "container1", "busybox", "top") |
| 1141 |
- assert.Assert(c, waitRun("container1"), check.IsNil)
|
|
| 1141 |
+ assert.Assert(c, waitRun("container1"), checker.IsNil)
|
|
| 1142 | 1142 |
dockerCmd(c, "network", "disconnect", "bridge", "container1") |
| 1143 | 1143 |
out, _, err := dockerCmdWithError("network", "connect", "host", "container1")
|
| 1144 | 1144 |
assert.ErrorContains(c, err, "", out) |
| ... | ... |
@@ -1147,7 +1147,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectToHostFromOtherNetwork(c *t |
| 1147 | 1147 |
|
| 1148 | 1148 |
func (s *DockerNetworkSuite) TestDockerNetworkDisconnectFromHost(c *testing.T) {
|
| 1149 | 1149 |
dockerCmd(c, "run", "-d", "--name", "container1", "--net=host", "busybox", "top") |
| 1150 |
- assert.Assert(c, waitRun("container1"), check.IsNil)
|
|
| 1150 |
+ assert.Assert(c, waitRun("container1"), checker.IsNil)
|
|
| 1151 | 1151 |
out, _, err := dockerCmdWithError("network", "disconnect", "host", "container1")
|
| 1152 | 1152 |
assert.Assert(c, err, checker.NotNil, check.Commentf("Should err out disconnect from host"))
|
| 1153 | 1153 |
assert.Assert(c, out, checker.Contains, runconfig.ErrConflictHostNetwork.Error()) |
| ... | ... |
@@ -1157,7 +1157,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectWithPortMapping(c *testing. |
| 1157 | 1157 |
testRequires(c, NotArm) |
| 1158 | 1158 |
dockerCmd(c, "network", "create", "test1") |
| 1159 | 1159 |
dockerCmd(c, "run", "-d", "--name", "c1", "-p", "5000:5000", "busybox", "top") |
| 1160 |
- assert.Assert(c, waitRun("c1"), check.IsNil)
|
|
| 1160 |
+ assert.Assert(c, waitRun("c1"), checker.IsNil)
|
|
| 1161 | 1161 |
dockerCmd(c, "network", "connect", "test1", "c1") |
| 1162 | 1162 |
} |
| 1163 | 1163 |
|
| ... | ... |
@@ -1181,7 +1181,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectDisconnectWithPortMapping(c |
| 1181 | 1181 |
dockerCmd(c, "network", "create", "ccc") |
| 1182 | 1182 |
|
| 1183 | 1183 |
dockerCmd(c, "run", "-d", "--name", cnt, "-p", "9000:90", "-p", "70", "busybox", "top") |
| 1184 |
- assert.Assert(c, waitRun(cnt), check.IsNil) |
|
| 1184 |
+ assert.Assert(c, waitRun(cnt), checker.IsNil) |
|
| 1185 | 1185 |
curPortMap, _ := dockerCmd(c, "port", cnt, "70") |
| 1186 | 1186 |
curExplPortMap, _ := dockerCmd(c, "port", cnt, "90") |
| 1187 | 1187 |
|
| ... | ... |
@@ -1211,7 +1211,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectWithMac(c *testing.T) {
|
| 1211 | 1211 |
macAddress := "02:42:ac:11:00:02" |
| 1212 | 1212 |
dockerCmd(c, "network", "create", "mynetwork") |
| 1213 | 1213 |
dockerCmd(c, "run", "--name=test", "-d", "--mac-address", macAddress, "busybox", "top") |
| 1214 |
- assert.Assert(c, waitRun("test"), check.IsNil)
|
|
| 1214 |
+ assert.Assert(c, waitRun("test"), checker.IsNil)
|
|
| 1215 | 1215 |
mac1 := inspectField(c, "test", "NetworkSettings.Networks.bridge.MacAddress") |
| 1216 | 1216 |
assert.Assert(c, strings.TrimSpace(mac1), checker.Equals, macAddress) |
| 1217 | 1217 |
dockerCmd(c, "network", "connect", "mynetwork", "test") |
| ... | ... |
@@ -1296,7 +1296,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectPreferredIP(c *testing.T) {
|
| 1296 | 1296 |
|
| 1297 | 1297 |
// run a container on first network specifying the ip addresses |
| 1298 | 1298 |
dockerCmd(c, "run", "-d", "--name", "c0", "--net=n0", "--ip", "172.28.99.88", "--ip6", "2001:db8:1234::9988", "busybox", "top") |
| 1299 |
- assert.Assert(c, waitRun("c0"), check.IsNil)
|
|
| 1299 |
+ assert.Assert(c, waitRun("c0"), checker.IsNil)
|
|
| 1300 | 1300 |
verifyIPAddressConfig(c, "c0", "n0", "172.28.99.88", "2001:db8:1234::9988") |
| 1301 | 1301 |
verifyIPAddresses(c, "c0", "n0", "172.28.99.88", "2001:db8:1234::9988") |
| 1302 | 1302 |
|
| ... | ... |
@@ -1336,7 +1336,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectPreferredIPStoppedContainer |
| 1336 | 1336 |
|
| 1337 | 1337 |
// start the container, verify config has not changed and ip addresses are assigned |
| 1338 | 1338 |
dockerCmd(c, "start", "c0") |
| 1339 |
- assert.Assert(c, waitRun("c0"), check.IsNil)
|
|
| 1339 |
+ assert.Assert(c, waitRun("c0"), checker.IsNil)
|
|
| 1340 | 1340 |
verifyIPAddressConfig(c, "c0", "n0", "172.30.55.44", "2001:db8:abcd::5544") |
| 1341 | 1341 |
verifyIPAddresses(c, "c0", "n0", "172.30.55.44", "2001:db8:abcd::5544") |
| 1342 | 1342 |
|
| ... | ... |
@@ -1376,21 +1376,21 @@ func checkUnsupportedNetworkAndIP(c *testing.T, nwMode string) {
|
| 1376 | 1376 |
func verifyIPAddressConfig(c *testing.T, cName, nwname, ipv4, ipv6 string) {
|
| 1377 | 1377 |
if ipv4 != "" {
|
| 1378 | 1378 |
out := inspectField(c, cName, fmt.Sprintf("NetworkSettings.Networks.%s.IPAMConfig.IPv4Address", nwname))
|
| 1379 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, ipv4) |
|
| 1379 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, ipv4) |
|
| 1380 | 1380 |
} |
| 1381 | 1381 |
|
| 1382 | 1382 |
if ipv6 != "" {
|
| 1383 | 1383 |
out := inspectField(c, cName, fmt.Sprintf("NetworkSettings.Networks.%s.IPAMConfig.IPv6Address", nwname))
|
| 1384 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, ipv6) |
|
| 1384 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, ipv6) |
|
| 1385 | 1385 |
} |
| 1386 | 1386 |
} |
| 1387 | 1387 |
|
| 1388 | 1388 |
func verifyIPAddresses(c *testing.T, cName, nwname, ipv4, ipv6 string) {
|
| 1389 | 1389 |
out := inspectField(c, cName, fmt.Sprintf("NetworkSettings.Networks.%s.IPAddress", nwname))
|
| 1390 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, ipv4) |
|
| 1390 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, ipv4) |
|
| 1391 | 1391 |
|
| 1392 | 1392 |
out = inspectField(c, cName, fmt.Sprintf("NetworkSettings.Networks.%s.GlobalIPv6Address", nwname))
|
| 1393 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, ipv6) |
|
| 1393 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, ipv6) |
|
| 1394 | 1394 |
} |
| 1395 | 1395 |
|
| 1396 | 1396 |
func (s *DockerNetworkSuite) TestDockerNetworkConnectLinkLocalIP(c *testing.T) {
|
| ... | ... |
@@ -1406,13 +1406,13 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectLinkLocalIP(c *testing.T) {
|
| 1406 | 1406 |
|
| 1407 | 1407 |
// run two containers with link-local ip on the test network |
| 1408 | 1408 |
dockerCmd(c, "run", "-d", "--name", "c0", "--net=n0", "--link-local-ip", "169.254.7.7", "--link-local-ip", "fe80::254:77", "busybox", "top") |
| 1409 |
- assert.Assert(c, waitRun("c0"), check.IsNil)
|
|
| 1409 |
+ assert.Assert(c, waitRun("c0"), checker.IsNil)
|
|
| 1410 | 1410 |
dockerCmd(c, "run", "-d", "--name", "c1", "--net=n0", "--link-local-ip", "169.254.8.8", "--link-local-ip", "fe80::254:88", "busybox", "top") |
| 1411 |
- assert.Assert(c, waitRun("c1"), check.IsNil)
|
|
| 1411 |
+ assert.Assert(c, waitRun("c1"), checker.IsNil)
|
|
| 1412 | 1412 |
|
| 1413 | 1413 |
// run a container on the default network and connect it to the test network specifying a link-local address |
| 1414 | 1414 |
dockerCmd(c, "run", "-d", "--name", "c2", "busybox", "top") |
| 1415 |
- assert.Assert(c, waitRun("c2"), check.IsNil)
|
|
| 1415 |
+ assert.Assert(c, waitRun("c2"), checker.IsNil)
|
|
| 1416 | 1416 |
dockerCmd(c, "network", "connect", "--link-local-ip", "169.254.9.9", "n0", "c2") |
| 1417 | 1417 |
|
| 1418 | 1418 |
// verify the three containers can ping each other via the link-local addresses |
| ... | ... |
@@ -1446,13 +1446,13 @@ func (s *DockerSuite) TestUserDefinedNetworkConnectDisconnectLink(c *testing.T) |
| 1446 | 1446 |
dockerCmd(c, "network", "create", "-d", "bridge", "foo2") |
| 1447 | 1447 |
|
| 1448 | 1448 |
dockerCmd(c, "run", "-d", "--net=foo1", "--name=first", "busybox", "top") |
| 1449 |
- assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 1449 |
+ assert.Assert(c, waitRun("first"), checker.IsNil)
|
|
| 1450 | 1450 |
|
| 1451 | 1451 |
// run a container in a user-defined network with a link for an existing container |
| 1452 | 1452 |
// and a link for a container that doesn't exist |
| 1453 | 1453 |
dockerCmd(c, "run", "-d", "--net=foo1", "--name=second", "--link=first:FirstInFoo1", |
| 1454 | 1454 |
"--link=third:bar", "busybox", "top") |
| 1455 |
- assert.Assert(c, waitRun("second"), check.IsNil)
|
|
| 1455 |
+ assert.Assert(c, waitRun("second"), checker.IsNil)
|
|
| 1456 | 1456 |
|
| 1457 | 1457 |
// ping to first and its alias FirstInFoo1 must succeed |
| 1458 | 1458 |
_, _, err := dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
|
| ... | ... |
@@ -1520,10 +1520,10 @@ func (s *DockerSuite) TestUserDefinedNetworkConnectDisconnectAlias(c *testing.T) |
| 1520 | 1520 |
dockerCmd(c, "network", "create", "-d", "bridge", "net2") |
| 1521 | 1521 |
|
| 1522 | 1522 |
cid, _ := dockerCmd(c, "run", "-d", "--net=net1", "--name=first", "--net-alias=foo", "busybox:glibc", "top") |
| 1523 |
- assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 1523 |
+ assert.Assert(c, waitRun("first"), checker.IsNil)
|
|
| 1524 | 1524 |
|
| 1525 | 1525 |
dockerCmd(c, "run", "-d", "--net=net1", "--name=second", "busybox:glibc", "top") |
| 1526 |
- assert.Assert(c, waitRun("second"), check.IsNil)
|
|
| 1526 |
+ assert.Assert(c, waitRun("second"), checker.IsNil)
|
|
| 1527 | 1527 |
|
| 1528 | 1528 |
// ping first container and its alias |
| 1529 | 1529 |
_, _, err := dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
|
| ... | ... |
@@ -1574,10 +1574,10 @@ func (s *DockerSuite) TestUserDefinedNetworkConnectivity(c *testing.T) {
|
| 1574 | 1574 |
dockerCmd(c, "network", "create", "-d", "bridge", "br.net1") |
| 1575 | 1575 |
|
| 1576 | 1576 |
dockerCmd(c, "run", "-d", "--net=br.net1", "--name=c1.net1", "busybox:glibc", "top") |
| 1577 |
- assert.Assert(c, waitRun("c1.net1"), check.IsNil)
|
|
| 1577 |
+ assert.Assert(c, waitRun("c1.net1"), checker.IsNil)
|
|
| 1578 | 1578 |
|
| 1579 | 1579 |
dockerCmd(c, "run", "-d", "--net=br.net1", "--name=c2.net1", "busybox:glibc", "top") |
| 1580 |
- assert.Assert(c, waitRun("c2.net1"), check.IsNil)
|
|
| 1580 |
+ assert.Assert(c, waitRun("c2.net1"), checker.IsNil)
|
|
| 1581 | 1581 |
|
| 1582 | 1582 |
// ping first container by its unqualified name |
| 1583 | 1583 |
_, _, err := dockerCmdWithError("exec", "c2.net1", "ping", "-c", "1", "c1.net1")
|
| ... | ... |
@@ -1602,7 +1602,7 @@ func (s *DockerSuite) TestEmbeddedDNSInvalidInput(c *testing.T) {
|
| 1602 | 1602 |
|
| 1603 | 1603 |
func (s *DockerSuite) TestDockerNetworkConnectFailsNoInspectChange(c *testing.T) {
|
| 1604 | 1604 |
dockerCmd(c, "run", "-d", "--name=bb", "busybox", "top") |
| 1605 |
- assert.Assert(c, waitRun("bb"), check.IsNil)
|
|
| 1605 |
+ assert.Assert(c, waitRun("bb"), checker.IsNil)
|
|
| 1606 | 1606 |
defer dockerCmd(c, "stop", "bb") |
| 1607 | 1607 |
|
| 1608 | 1608 |
ns0 := inspectField(c, "bb", "NetworkSettings.Networks.bridge") |
| ... | ... |
@@ -1612,7 +1612,7 @@ func (s *DockerSuite) TestDockerNetworkConnectFailsNoInspectChange(c *testing.T) |
| 1612 | 1612 |
assert.ErrorContains(c, err, "") |
| 1613 | 1613 |
|
| 1614 | 1614 |
ns1 := inspectField(c, "bb", "NetworkSettings.Networks.bridge") |
| 1615 |
- assert.Assert(c, ns1, check.Equals, ns0) |
|
| 1615 |
+ assert.Assert(c, ns1, checker.Equals, ns0) |
|
| 1616 | 1616 |
} |
| 1617 | 1617 |
|
| 1618 | 1618 |
func (s *DockerSuite) TestDockerNetworkInternalMode(c *testing.T) {
|
| ... | ... |
@@ -1622,9 +1622,9 @@ func (s *DockerSuite) TestDockerNetworkInternalMode(c *testing.T) {
|
| 1622 | 1622 |
assert.Assert(c, nr.Internal, checker.True) |
| 1623 | 1623 |
|
| 1624 | 1624 |
dockerCmd(c, "run", "-d", "--net=internal", "--name=first", "busybox:glibc", "top") |
| 1625 |
- assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 1625 |
+ assert.Assert(c, waitRun("first"), checker.IsNil)
|
|
| 1626 | 1626 |
dockerCmd(c, "run", "-d", "--net=internal", "--name=second", "busybox:glibc", "top") |
| 1627 |
- assert.Assert(c, waitRun("second"), check.IsNil)
|
|
| 1627 |
+ assert.Assert(c, waitRun("second"), checker.IsNil)
|
|
| 1628 | 1628 |
out, _, err := dockerCmdWithError("exec", "first", "ping", "-W", "4", "-c", "1", "8.8.8.8")
|
| 1629 | 1629 |
assert.ErrorContains(c, err, "") |
| 1630 | 1630 |
assert.Assert(c, out, checker.Contains, "100% packet loss") |
| ... | ... |
@@ -1733,7 +1733,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkValidateIP(c *testing.T) {
|
| 1733 | 1733 |
|
| 1734 | 1734 |
_, _, err = dockerCmdWithError("run", "-d", "--name", "mynet0", "--net=mynet", "--ip", "172.28.99.88", "--ip6", "2001:db8:1234::9988", "busybox", "top")
|
| 1735 | 1735 |
assert.NilError(c, err) |
| 1736 |
- assert.Assert(c, waitRun("mynet0"), check.IsNil)
|
|
| 1736 |
+ assert.Assert(c, waitRun("mynet0"), checker.IsNil)
|
|
| 1737 | 1737 |
verifyIPAddressConfig(c, "mynet0", "mynet", "172.28.99.88", "2001:db8:1234::9988") |
| 1738 | 1738 |
verifyIPAddresses(c, "mynet0", "mynet", "172.28.99.88", "2001:db8:1234::9988") |
| 1739 | 1739 |
|
| ... | ... |
@@ -335,14 +335,14 @@ func (s *DockerSuite) TestPortBindingOnSandbox(c *testing.T) {
|
| 335 | 335 |
|
| 336 | 336 |
dockerCmd(c, "run", "--net", "internal-net", "-d", "--name", "c1", |
| 337 | 337 |
"-p", "8080:8080", "busybox", "nc", "-l", "-p", "8080") |
| 338 |
- assert.Assert(c, waitRun("c1"), check.IsNil)
|
|
| 338 |
+ assert.Assert(c, waitRun("c1"), checker.IsNil)
|
|
| 339 | 339 |
|
| 340 | 340 |
_, _, err := dockerCmdWithError("run", "--net=host", "busybox", "nc", "localhost", "8080")
|
| 341 |
- assert.Assert(c, err, check.NotNil, check.Commentf("Port mapping on internal network is expected to fail"))
|
|
| 341 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("Port mapping on internal network is expected to fail"))
|
|
| 342 | 342 |
// Connect container to another normal bridge network |
| 343 | 343 |
dockerCmd(c, "network", "create", "-d", "bridge", "foo-net") |
| 344 | 344 |
dockerCmd(c, "network", "connect", "foo-net", "c1") |
| 345 | 345 |
|
| 346 | 346 |
_, _, err = dockerCmdWithError("run", "--net=host", "busybox", "nc", "localhost", "8080")
|
| 347 |
- assert.Assert(c, err, check.IsNil, check.Commentf("Port mapping on the new network is expected to succeed"))
|
|
| 347 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("Port mapping on the new network is expected to succeed"))
|
|
| 348 | 348 |
} |
| ... | ... |
@@ -211,13 +211,13 @@ func (s *DockerSuite) TestUserDefinedNetworkLinks(c *testing.T) {
|
| 211 | 211 |
dockerCmd(c, "network", "create", "-d", "bridge", "udlinkNet") |
| 212 | 212 |
|
| 213 | 213 |
dockerCmd(c, "run", "-d", "--net=udlinkNet", "--name=first", "busybox", "top") |
| 214 |
- assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 214 |
+ assert.Assert(c, waitRun("first"), checker.IsNil)
|
|
| 215 | 215 |
|
| 216 | 216 |
// run a container in user-defined network udlinkNet with a link for an existing container |
| 217 | 217 |
// and a link for a container that doesn't exist |
| 218 | 218 |
dockerCmd(c, "run", "-d", "--net=udlinkNet", "--name=second", "--link=first:foo", |
| 219 | 219 |
"--link=third:bar", "busybox", "top") |
| 220 |
- assert.Assert(c, waitRun("second"), check.IsNil)
|
|
| 220 |
+ assert.Assert(c, waitRun("second"), checker.IsNil)
|
|
| 221 | 221 |
|
| 222 | 222 |
// ping to first and its alias foo must succeed |
| 223 | 223 |
_, _, err := dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
|
| ... | ... |
@@ -233,7 +233,7 @@ func (s *DockerSuite) TestUserDefinedNetworkLinks(c *testing.T) {
|
| 233 | 233 |
|
| 234 | 234 |
// start third container now |
| 235 | 235 |
dockerCmd(c, "run", "-d", "--net=udlinkNet", "--name=third", "busybox", "top") |
| 236 |
- assert.Assert(c, waitRun("third"), check.IsNil)
|
|
| 236 |
+ assert.Assert(c, waitRun("third"), checker.IsNil)
|
|
| 237 | 237 |
|
| 238 | 238 |
// ping to third and its alias must succeed now |
| 239 | 239 |
_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "third")
|
| ... | ... |
@@ -247,11 +247,11 @@ func (s *DockerSuite) TestUserDefinedNetworkLinksWithRestart(c *testing.T) {
|
| 247 | 247 |
dockerCmd(c, "network", "create", "-d", "bridge", "udlinkNet") |
| 248 | 248 |
|
| 249 | 249 |
dockerCmd(c, "run", "-d", "--net=udlinkNet", "--name=first", "busybox", "top") |
| 250 |
- assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 250 |
+ assert.Assert(c, waitRun("first"), checker.IsNil)
|
|
| 251 | 251 |
|
| 252 | 252 |
dockerCmd(c, "run", "-d", "--net=udlinkNet", "--name=second", "--link=first:foo", |
| 253 | 253 |
"busybox", "top") |
| 254 |
- assert.Assert(c, waitRun("second"), check.IsNil)
|
|
| 254 |
+ assert.Assert(c, waitRun("second"), checker.IsNil)
|
|
| 255 | 255 |
|
| 256 | 256 |
// ping to first and its alias foo must succeed |
| 257 | 257 |
_, _, err := dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
|
| ... | ... |
@@ -261,7 +261,7 @@ func (s *DockerSuite) TestUserDefinedNetworkLinksWithRestart(c *testing.T) {
|
| 261 | 261 |
|
| 262 | 262 |
// Restart first container |
| 263 | 263 |
dockerCmd(c, "restart", "first") |
| 264 |
- assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 264 |
+ assert.Assert(c, waitRun("first"), checker.IsNil)
|
|
| 265 | 265 |
|
| 266 | 266 |
// ping to first and its alias foo must still succeed |
| 267 | 267 |
_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
|
| ... | ... |
@@ -271,7 +271,7 @@ func (s *DockerSuite) TestUserDefinedNetworkLinksWithRestart(c *testing.T) {
|
| 271 | 271 |
|
| 272 | 272 |
// Restart second container |
| 273 | 273 |
dockerCmd(c, "restart", "second") |
| 274 |
- assert.Assert(c, waitRun("second"), check.IsNil)
|
|
| 274 |
+ assert.Assert(c, waitRun("second"), checker.IsNil)
|
|
| 275 | 275 |
|
| 276 | 276 |
// ping to first and its alias foo must still succeed |
| 277 | 277 |
_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
|
| ... | ... |
@@ -296,7 +296,7 @@ func (s *DockerSuite) TestUserDefinedNetworkAlias(c *testing.T) {
|
| 296 | 296 |
dockerCmd(c, "network", "create", "-d", "bridge", "net1") |
| 297 | 297 |
|
| 298 | 298 |
cid1, _ := dockerCmd(c, "run", "-d", "--net=net1", "--name=first", "--net-alias=foo1", "--net-alias=foo2", "busybox:glibc", "top") |
| 299 |
- assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 299 |
+ assert.Assert(c, waitRun("first"), checker.IsNil)
|
|
| 300 | 300 |
|
| 301 | 301 |
// Check if default short-id alias is added automatically |
| 302 | 302 |
id := strings.TrimSpace(cid1) |
| ... | ... |
@@ -304,7 +304,7 @@ func (s *DockerSuite) TestUserDefinedNetworkAlias(c *testing.T) {
|
| 304 | 304 |
assert.Assert(c, aliases, checker.Contains, stringid.TruncateID(id)) |
| 305 | 305 |
|
| 306 | 306 |
cid2, _ := dockerCmd(c, "run", "-d", "--net=net1", "--name=second", "busybox:glibc", "top") |
| 307 |
- assert.Assert(c, waitRun("second"), check.IsNil)
|
|
| 307 |
+ assert.Assert(c, waitRun("second"), checker.IsNil)
|
|
| 308 | 308 |
|
| 309 | 309 |
// Check if default short-id alias is added automatically |
| 310 | 310 |
id = strings.TrimSpace(cid2) |
| ... | ... |
@@ -324,7 +324,7 @@ func (s *DockerSuite) TestUserDefinedNetworkAlias(c *testing.T) {
|
| 324 | 324 |
|
| 325 | 325 |
// Restart first container |
| 326 | 326 |
dockerCmd(c, "restart", "first") |
| 327 |
- assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 327 |
+ assert.Assert(c, waitRun("first"), checker.IsNil)
|
|
| 328 | 328 |
|
| 329 | 329 |
// ping to first and its network-scoped aliases must succeed |
| 330 | 330 |
_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
|
| ... | ... |
@@ -2813,7 +2813,7 @@ func (s *DockerSuite) TestRunPIDHostWithChildIsKillable(c *testing.T) {
|
| 2813 | 2813 |
name := "ibuildthecloud" |
| 2814 | 2814 |
dockerCmd(c, "run", "-d", "--pid=host", "--name", name, "busybox", "sh", "-c", "sleep 30; echo hi") |
| 2815 | 2815 |
|
| 2816 |
- assert.Assert(c, waitRun(name), check.IsNil) |
|
| 2816 |
+ assert.Assert(c, waitRun(name), checker.IsNil) |
|
| 2817 | 2817 |
|
| 2818 | 2818 |
errchan := make(chan error) |
| 2819 | 2819 |
go func() {
|
| ... | ... |
@@ -3208,11 +3208,11 @@ func (s *DockerSuite) TestRunCreateContainerFailedCleanUp(c *testing.T) {
|
| 3208 | 3208 |
testRequires(c, DaemonIsLinux) |
| 3209 | 3209 |
name := "unique_name" |
| 3210 | 3210 |
_, _, err := dockerCmdWithError("run", "--name", name, "--link", "nothing:nothing", "busybox")
|
| 3211 |
- assert.Assert(c, err, check.NotNil, check.Commentf("Expected docker run to fail!"))
|
|
| 3211 |
+ assert.Assert(c, err, checker.NotNil, check.Commentf("Expected docker run to fail!"))
|
|
| 3212 | 3212 |
|
| 3213 | 3213 |
containerID, err := inspectFieldWithError(name, "Id") |
| 3214 | 3214 |
assert.Assert(c, err, checker.NotNil, check.Commentf("Expected not to have this container: %s!", containerID))
|
| 3215 |
- assert.Assert(c, containerID, check.Equals, "", check.Commentf("Expected not to have this container: %s!", containerID))
|
|
| 3215 |
+ assert.Assert(c, containerID, checker.Equals, "", check.Commentf("Expected not to have this container: %s!", containerID))
|
|
| 3216 | 3216 |
} |
| 3217 | 3217 |
|
| 3218 | 3218 |
func (s *DockerSuite) TestRunNamedVolume(c *testing.T) {
|
| ... | ... |
@@ -3221,10 +3221,10 @@ func (s *DockerSuite) TestRunNamedVolume(c *testing.T) {
|
| 3221 | 3221 |
dockerCmd(c, "run", "--name=test", "-v", "testing:"+prefix+"/foo", "busybox", "sh", "-c", "echo hello > "+prefix+"/foo/bar") |
| 3222 | 3222 |
|
| 3223 | 3223 |
out, _ := dockerCmd(c, "run", "--volumes-from", "test", "busybox", "sh", "-c", "cat "+prefix+"/foo/bar") |
| 3224 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, "hello") |
|
| 3224 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, "hello") |
|
| 3225 | 3225 |
|
| 3226 | 3226 |
out, _ = dockerCmd(c, "run", "-v", "testing:"+prefix+"/foo", "busybox", "sh", "-c", "cat "+prefix+"/foo/bar") |
| 3227 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, "hello") |
|
| 3227 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, "hello") |
|
| 3228 | 3228 |
} |
| 3229 | 3229 |
|
| 3230 | 3230 |
func (s *DockerSuite) TestRunWithUlimits(c *testing.T) {
|
| ... | ... |
@@ -3464,7 +3464,7 @@ func (s *DockerSuite) TestContainersInUserDefinedNetwork(c *testing.T) {
|
| 3464 | 3464 |
testRequires(c, DaemonIsLinux, NotUserNamespace, NotArm) |
| 3465 | 3465 |
dockerCmd(c, "network", "create", "-d", "bridge", "testnetwork") |
| 3466 | 3466 |
dockerCmd(c, "run", "-d", "--net=testnetwork", "--name=first", "busybox", "top") |
| 3467 |
- assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 3467 |
+ assert.Assert(c, waitRun("first"), checker.IsNil)
|
|
| 3468 | 3468 |
dockerCmd(c, "run", "-t", "--net=testnetwork", "--name=second", "busybox", "ping", "-c", "1", "first") |
| 3469 | 3469 |
} |
| 3470 | 3470 |
|
| ... | ... |
@@ -3475,9 +3475,9 @@ func (s *DockerSuite) TestContainersInMultipleNetworks(c *testing.T) {
|
| 3475 | 3475 |
dockerCmd(c, "network", "create", "-d", "bridge", "testnetwork2") |
| 3476 | 3476 |
// Run and connect containers to testnetwork1 |
| 3477 | 3477 |
dockerCmd(c, "run", "-d", "--net=testnetwork1", "--name=first", "busybox", "top") |
| 3478 |
- assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 3478 |
+ assert.Assert(c, waitRun("first"), checker.IsNil)
|
|
| 3479 | 3479 |
dockerCmd(c, "run", "-d", "--net=testnetwork1", "--name=second", "busybox", "top") |
| 3480 |
- assert.Assert(c, waitRun("second"), check.IsNil)
|
|
| 3480 |
+ assert.Assert(c, waitRun("second"), checker.IsNil)
|
|
| 3481 | 3481 |
// Check connectivity between containers in testnetwork2 |
| 3482 | 3482 |
dockerCmd(c, "exec", "first", "ping", "-c", "1", "second.testnetwork1") |
| 3483 | 3483 |
// Connect containers to testnetwork2 |
| ... | ... |
@@ -3494,9 +3494,9 @@ func (s *DockerSuite) TestContainersNetworkIsolation(c *testing.T) {
|
| 3494 | 3494 |
dockerCmd(c, "network", "create", "-d", "bridge", "testnetwork2") |
| 3495 | 3495 |
// Run 1 container in testnetwork1 and another in testnetwork2 |
| 3496 | 3496 |
dockerCmd(c, "run", "-d", "--net=testnetwork1", "--name=first", "busybox", "top") |
| 3497 |
- assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 3497 |
+ assert.Assert(c, waitRun("first"), checker.IsNil)
|
|
| 3498 | 3498 |
dockerCmd(c, "run", "-d", "--net=testnetwork2", "--name=second", "busybox", "top") |
| 3499 |
- assert.Assert(c, waitRun("second"), check.IsNil)
|
|
| 3499 |
+ assert.Assert(c, waitRun("second"), checker.IsNil)
|
|
| 3500 | 3500 |
|
| 3501 | 3501 |
// Check Isolation between containers : ping must fail |
| 3502 | 3502 |
_, _, err := dockerCmdWithError("exec", "first", "ping", "-c", "1", "second")
|
| ... | ... |
@@ -3520,9 +3520,9 @@ func (s *DockerSuite) TestNetworkRmWithActiveContainers(c *testing.T) {
|
| 3520 | 3520 |
dockerCmd(c, "network", "create", "-d", "bridge", "testnetwork1") |
| 3521 | 3521 |
// Run and connect containers to testnetwork1 |
| 3522 | 3522 |
dockerCmd(c, "run", "-d", "--net=testnetwork1", "--name=first", "busybox", "top") |
| 3523 |
- assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 3523 |
+ assert.Assert(c, waitRun("first"), checker.IsNil)
|
|
| 3524 | 3524 |
dockerCmd(c, "run", "-d", "--net=testnetwork1", "--name=second", "busybox", "top") |
| 3525 |
- assert.Assert(c, waitRun("second"), check.IsNil)
|
|
| 3525 |
+ assert.Assert(c, waitRun("second"), checker.IsNil)
|
|
| 3526 | 3526 |
// Network delete with active containers must fail |
| 3527 | 3527 |
_, _, err := dockerCmdWithError("network", "rm", "testnetwork1")
|
| 3528 | 3528 |
assert.ErrorContains(c, err, "") |
| ... | ... |
@@ -3540,9 +3540,9 @@ func (s *DockerSuite) TestContainerRestartInMultipleNetworks(c *testing.T) {
|
| 3540 | 3540 |
|
| 3541 | 3541 |
// Run and connect containers to testnetwork1 |
| 3542 | 3542 |
dockerCmd(c, "run", "-d", "--net=testnetwork1", "--name=first", "busybox", "top") |
| 3543 |
- assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 3543 |
+ assert.Assert(c, waitRun("first"), checker.IsNil)
|
|
| 3544 | 3544 |
dockerCmd(c, "run", "-d", "--net=testnetwork1", "--name=second", "busybox", "top") |
| 3545 |
- assert.Assert(c, waitRun("second"), check.IsNil)
|
|
| 3545 |
+ assert.Assert(c, waitRun("second"), checker.IsNil)
|
|
| 3546 | 3546 |
// Check connectivity between containers in testnetwork2 |
| 3547 | 3547 |
dockerCmd(c, "exec", "first", "ping", "-c", "1", "second.testnetwork1") |
| 3548 | 3548 |
// Connect containers to testnetwork2 |
| ... | ... |
@@ -3568,7 +3568,7 @@ func (s *DockerSuite) TestContainerWithConflictingHostNetworks(c *testing.T) {
|
| 3568 | 3568 |
testRequires(c, DaemonIsLinux, NotUserNamespace) |
| 3569 | 3569 |
// Run a container with --net=host |
| 3570 | 3570 |
dockerCmd(c, "run", "-d", "--net=host", "--name=first", "busybox", "top") |
| 3571 |
- assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 3571 |
+ assert.Assert(c, waitRun("first"), checker.IsNil)
|
|
| 3572 | 3572 |
|
| 3573 | 3573 |
// Create a network using bridge driver |
| 3574 | 3574 |
dockerCmd(c, "network", "create", "-d", "bridge", "testnetwork1") |
| ... | ... |
@@ -3581,10 +3581,10 @@ func (s *DockerSuite) TestContainerWithConflictingHostNetworks(c *testing.T) {
|
| 3581 | 3581 |
func (s *DockerSuite) TestContainerWithConflictingSharedNetwork(c *testing.T) {
|
| 3582 | 3582 |
testRequires(c, DaemonIsLinux) |
| 3583 | 3583 |
dockerCmd(c, "run", "-d", "--name=first", "busybox", "top") |
| 3584 |
- assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 3584 |
+ assert.Assert(c, waitRun("first"), checker.IsNil)
|
|
| 3585 | 3585 |
// Run second container in first container's network namespace |
| 3586 | 3586 |
dockerCmd(c, "run", "-d", "--net=container:first", "--name=second", "busybox", "top") |
| 3587 |
- assert.Assert(c, waitRun("second"), check.IsNil)
|
|
| 3587 |
+ assert.Assert(c, waitRun("second"), checker.IsNil)
|
|
| 3588 | 3588 |
|
| 3589 | 3589 |
// Create a network using bridge driver |
| 3590 | 3590 |
dockerCmd(c, "network", "create", "-d", "bridge", "testnetwork1") |
| ... | ... |
@@ -3598,7 +3598,7 @@ func (s *DockerSuite) TestContainerWithConflictingSharedNetwork(c *testing.T) {
|
| 3598 | 3598 |
func (s *DockerSuite) TestContainerWithConflictingNoneNetwork(c *testing.T) {
|
| 3599 | 3599 |
testRequires(c, DaemonIsLinux) |
| 3600 | 3600 |
dockerCmd(c, "run", "-d", "--net=none", "--name=first", "busybox", "top") |
| 3601 |
- assert.Assert(c, waitRun("first"), check.IsNil)
|
|
| 3601 |
+ assert.Assert(c, waitRun("first"), checker.IsNil)
|
|
| 3602 | 3602 |
|
| 3603 | 3603 |
// Create a network using bridge driver |
| 3604 | 3604 |
dockerCmd(c, "network", "create", "-d", "bridge", "testnetwork1") |
| ... | ... |
@@ -3610,7 +3610,7 @@ func (s *DockerSuite) TestContainerWithConflictingNoneNetwork(c *testing.T) {
|
| 3610 | 3610 |
|
| 3611 | 3611 |
// create a container connected to testnetwork1 |
| 3612 | 3612 |
dockerCmd(c, "run", "-d", "--net=testnetwork1", "--name=second", "busybox", "top") |
| 3613 |
- assert.Assert(c, waitRun("second"), check.IsNil)
|
|
| 3613 |
+ assert.Assert(c, waitRun("second"), checker.IsNil)
|
|
| 3614 | 3614 |
|
| 3615 | 3615 |
// Connect second container to none network. it must fail as well |
| 3616 | 3616 |
_, _, err = dockerCmdWithError("network", "connect", "none", "second")
|
| ... | ... |
@@ -3626,7 +3626,7 @@ func (s *DockerSuite) TestRunStdinBlockedAfterContainerExit(c *testing.T) {
|
| 3626 | 3626 |
stdout := bytes.NewBuffer(nil) |
| 3627 | 3627 |
cmd.Stdout = stdout |
| 3628 | 3628 |
cmd.Stderr = stdout |
| 3629 |
- assert.Assert(c, cmd.Start(), check.IsNil) |
|
| 3629 |
+ assert.Assert(c, cmd.Start(), checker.IsNil) |
|
| 3630 | 3630 |
|
| 3631 | 3631 |
waitChan := make(chan error) |
| 3632 | 3632 |
go func() {
|
| ... | ... |
@@ -3635,7 +3635,7 @@ func (s *DockerSuite) TestRunStdinBlockedAfterContainerExit(c *testing.T) {
|
| 3635 | 3635 |
|
| 3636 | 3636 |
select {
|
| 3637 | 3637 |
case err := <-waitChan: |
| 3638 |
- assert.Assert(c, err, check.IsNil, check.Commentf(stdout.String())) |
|
| 3638 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf(stdout.String())) |
|
| 3639 | 3639 |
case <-time.After(30 * time.Second): |
| 3640 | 3640 |
c.Fatal("timeout waiting for command to exit")
|
| 3641 | 3641 |
} |
| ... | ... |
@@ -3870,7 +3870,7 @@ func (s *DockerSuite) TestRunNamedVolumeCopyImageData(c *testing.T) {
|
| 3870 | 3870 |
|
| 3871 | 3871 |
dockerCmd(c, "run", "-v", "foo:/foo", testImg) |
| 3872 | 3872 |
out, _ := dockerCmd(c, "run", "-v", "foo:/foo", "busybox", "cat", "/foo/hello") |
| 3873 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, "hello") |
|
| 3873 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, "hello") |
|
| 3874 | 3874 |
} |
| 3875 | 3875 |
|
| 3876 | 3876 |
func (s *DockerSuite) TestRunNamedVolumeNotRemoved(c *testing.T) {
|
| ... | ... |
@@ -3942,7 +3942,7 @@ func (s *DockerSuite) TestRunAttachFailedNoLeak(c *testing.T) {
|
| 3942 | 3942 |
runSleepingContainer(c, "--name=test", "-p", "8000:8000") |
| 3943 | 3943 |
|
| 3944 | 3944 |
// Wait until container is fully up and running |
| 3945 |
- assert.Assert(c, waitRun("test"), check.IsNil)
|
|
| 3945 |
+ assert.Assert(c, waitRun("test"), checker.IsNil)
|
|
| 3946 | 3946 |
|
| 3947 | 3947 |
out, _, err := dockerCmdWithError("run", "--name=fail", "-p", "8000:8000", "busybox", "true")
|
| 3948 | 3948 |
// We will need the following `inspect` to diagnose the issue if test fails (#21247) |
| ... | ... |
@@ -4102,7 +4102,7 @@ exec "$@"`, |
| 4102 | 4102 |
cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx)) |
| 4103 | 4103 |
|
| 4104 | 4104 |
out := cli.DockerCmd(c, "run", "--entrypoint=", "-t", name, "echo", "foo").Combined() |
| 4105 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, "foo") |
|
| 4105 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, "foo") |
|
| 4106 | 4106 |
|
| 4107 | 4107 |
// CMD will be reset as well (the same as setting a custom entrypoint) |
| 4108 | 4108 |
cli.Docker(cli.Args("run", "--entrypoint=", "-t", name)).Assert(c, icmd.Expected{
|
| ... | ... |
@@ -4495,8 +4495,8 @@ func (s *DockerSuite) TestRunMount(c *testing.T) {
|
| 4495 | 4495 |
_, _, err := dockerCmdWithError(append([]string{"run", "-i", "-d", "--name", cName},
|
| 4496 | 4496 |
append(opts, []string{"busybox", "top"}...)...)...)
|
| 4497 | 4497 |
if testCase.valid {
|
| 4498 |
- assert.Assert(c, err, check.IsNil, check.Commentf("got error while creating a container with %v (%s)", opts, cName))
|
|
| 4499 |
- assert.Assert(c, testCase.fn(cName), check.IsNil, check.Commentf("got error while executing test for %v (%s)", opts, cName))
|
|
| 4498 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("got error while creating a container with %v (%s)", opts, cName))
|
|
| 4499 |
+ assert.Assert(c, testCase.fn(cName), checker.IsNil, check.Commentf("got error while executing test for %v (%s)", opts, cName))
|
|
| 4500 | 4500 |
dockerCmd(c, "rm", "-f", cName) |
| 4501 | 4501 |
} else {
|
| 4502 | 4502 |
assert.Assert(c, err, checker.NotNil, check.Commentf("got nil while creating a container with %v (%s)", opts, cName))
|
| ... | ... |
@@ -108,7 +108,7 @@ func (s *DockerSuite) TestRunAttachDetach(c *testing.T) {
|
| 108 | 108 |
defer cpty.Close() |
| 109 | 109 |
cmd.Stdin = tty |
| 110 | 110 |
assert.NilError(c, cmd.Start()) |
| 111 |
- assert.Assert(c, waitRun(name), check.IsNil) |
|
| 111 |
+ assert.Assert(c, waitRun(name), checker.IsNil) |
|
| 112 | 112 |
|
| 113 | 113 |
_, err = cpty.Write([]byte("hello\n"))
|
| 114 | 114 |
assert.NilError(c, err) |
| ... | ... |
@@ -167,7 +167,7 @@ func (s *DockerSuite) TestRunAttachDetachFromFlag(c *testing.T) {
|
| 167 | 167 |
if err := cmd.Start(); err != nil {
|
| 168 | 168 |
c.Fatal(err) |
| 169 | 169 |
} |
| 170 |
- assert.Assert(c, waitRun(name), check.IsNil) |
|
| 170 |
+ assert.Assert(c, waitRun(name), checker.IsNil) |
|
| 171 | 171 |
|
| 172 | 172 |
if _, err := cpty.Write([]byte("hello\n")); err != nil {
|
| 173 | 173 |
c.Fatal(err) |
| ... | ... |
@@ -210,7 +210,7 @@ func (s *DockerSuite) TestRunAttachDetachFromFlag(c *testing.T) {
|
| 210 | 210 |
func (s *DockerSuite) TestRunAttachDetachFromInvalidFlag(c *testing.T) {
|
| 211 | 211 |
name := "attach-detach" |
| 212 | 212 |
dockerCmd(c, "run", "--name", name, "-itd", "busybox", "top") |
| 213 |
- assert.Assert(c, waitRun(name), check.IsNil) |
|
| 213 |
+ assert.Assert(c, waitRun(name), checker.IsNil) |
|
| 214 | 214 |
|
| 215 | 215 |
// specify an invalid detach key, container will ignore it and use default |
| 216 | 216 |
cmd := exec.Command(dockerBinary, "attach", "--detach-keys=ctrl-A,a", name) |
| ... | ... |
@@ -283,7 +283,7 @@ func (s *DockerSuite) TestRunAttachDetachFromConfig(c *testing.T) {
|
| 283 | 283 |
if err := cmd.Start(); err != nil {
|
| 284 | 284 |
c.Fatal(err) |
| 285 | 285 |
} |
| 286 |
- assert.Assert(c, waitRun(name), check.IsNil) |
|
| 286 |
+ assert.Assert(c, waitRun(name), checker.IsNil) |
|
| 287 | 287 |
|
| 288 | 288 |
if _, err := cpty.Write([]byte("hello\n")); err != nil {
|
| 289 | 289 |
c.Fatal(err) |
| ... | ... |
@@ -366,7 +366,7 @@ func (s *DockerSuite) TestRunAttachDetachKeysOverrideConfig(c *testing.T) {
|
| 366 | 366 |
if err := cmd.Start(); err != nil {
|
| 367 | 367 |
c.Fatal(err) |
| 368 | 368 |
} |
| 369 |
- assert.Assert(c, waitRun(name), check.IsNil) |
|
| 369 |
+ assert.Assert(c, waitRun(name), checker.IsNil) |
|
| 370 | 370 |
|
| 371 | 371 |
if _, err := cpty.Write([]byte("hello\n")); err != nil {
|
| 372 | 372 |
c.Fatal(err) |
| ... | ... |
@@ -427,7 +427,7 @@ func (s *DockerSuite) TestRunAttachInvalidDetachKeySequencePreserved(c *testing. |
| 427 | 427 |
c.Fatal(err) |
| 428 | 428 |
} |
| 429 | 429 |
go cmd.Wait() |
| 430 |
- assert.Assert(c, waitRun(name), check.IsNil) |
|
| 430 |
+ assert.Assert(c, waitRun(name), checker.IsNil) |
|
| 431 | 431 |
|
| 432 | 432 |
// Invalid escape sequence aba, should print aba in output |
| 433 | 433 |
if _, err := cpty.Write(keyA); err != nil {
|
| ... | ... |
@@ -793,7 +793,7 @@ func (s *DockerSuite) TestRunWithDefaultShmSize(c *testing.T) {
|
| 793 | 793 |
c.Fatalf("Expected shm of 64MB in mount command, got %v", out)
|
| 794 | 794 |
} |
| 795 | 795 |
shmSize := inspectField(c, name, "HostConfig.ShmSize") |
| 796 |
- assert.Assert(c, shmSize, check.Equals, "67108864") |
|
| 796 |
+ assert.Assert(c, shmSize, checker.Equals, "67108864") |
|
| 797 | 797 |
} |
| 798 | 798 |
|
| 799 | 799 |
func (s *DockerSuite) TestRunWithShmSize(c *testing.T) {
|
| ... | ... |
@@ -806,7 +806,7 @@ func (s *DockerSuite) TestRunWithShmSize(c *testing.T) {
|
| 806 | 806 |
c.Fatalf("Expected shm of 1GB in mount command, got %v", out)
|
| 807 | 807 |
} |
| 808 | 808 |
shmSize := inspectField(c, name, "HostConfig.ShmSize") |
| 809 |
- assert.Assert(c, shmSize, check.Equals, "1073741824") |
|
| 809 |
+ assert.Assert(c, shmSize, checker.Equals, "1073741824") |
|
| 810 | 810 |
} |
| 811 | 811 |
|
| 812 | 812 |
func (s *DockerSuite) TestRunTmpfsMountsEnsureOrdered(c *testing.T) {
|
| ... | ... |
@@ -895,23 +895,23 @@ func (s *DockerSuite) TestRunSysctls(c *testing.T) {
|
| 895 | 895 |
var err error |
| 896 | 896 |
|
| 897 | 897 |
out, _ := dockerCmd(c, "run", "--sysctl", "net.ipv4.ip_forward=1", "--name", "test", "busybox", "cat", "/proc/sys/net/ipv4/ip_forward") |
| 898 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, "1") |
|
| 898 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, "1") |
|
| 899 | 899 |
|
| 900 | 900 |
out = inspectFieldJSON(c, "test", "HostConfig.Sysctls") |
| 901 | 901 |
|
| 902 | 902 |
sysctls := make(map[string]string) |
| 903 | 903 |
err = json.Unmarshal([]byte(out), &sysctls) |
| 904 | 904 |
assert.NilError(c, err) |
| 905 |
- assert.Assert(c, sysctls["net.ipv4.ip_forward"], check.Equals, "1") |
|
| 905 |
+ assert.Assert(c, sysctls["net.ipv4.ip_forward"], checker.Equals, "1") |
|
| 906 | 906 |
|
| 907 | 907 |
out, _ = dockerCmd(c, "run", "--sysctl", "net.ipv4.ip_forward=0", "--name", "test1", "busybox", "cat", "/proc/sys/net/ipv4/ip_forward") |
| 908 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, "0") |
|
| 908 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, "0") |
|
| 909 | 909 |
|
| 910 | 910 |
out = inspectFieldJSON(c, "test1", "HostConfig.Sysctls") |
| 911 | 911 |
|
| 912 | 912 |
err = json.Unmarshal([]byte(out), &sysctls) |
| 913 | 913 |
assert.NilError(c, err) |
| 914 |
- assert.Assert(c, sysctls["net.ipv4.ip_forward"], check.Equals, "0") |
|
| 914 |
+ assert.Assert(c, sysctls["net.ipv4.ip_forward"], checker.Equals, "0") |
|
| 915 | 915 |
|
| 916 | 916 |
icmd.RunCommand(dockerBinary, "run", "--sysctl", "kernel.foobar=1", "--name", "test2", |
| 917 | 917 |
"busybox", "cat", "/proc/sys/kernel/foobar").Assert(c, icmd.Expected{
|
| ... | ... |
@@ -129,8 +129,8 @@ func (s *DockerSuite) TestSaveImageId(c *testing.T) {
|
| 129 | 129 |
cleanedShortImageID := strings.TrimSpace(out) |
| 130 | 130 |
|
| 131 | 131 |
// Make sure IDs are not empty |
| 132 |
- assert.Assert(c, cleanedLongImageID, checker.Not(check.Equals), "", check.Commentf("Id should not be empty."))
|
|
| 133 |
- assert.Assert(c, cleanedShortImageID, checker.Not(check.Equals), "", check.Commentf("Id should not be empty."))
|
|
| 132 |
+ assert.Assert(c, cleanedLongImageID, checker.Not(checker.Equals), "", check.Commentf("Id should not be empty."))
|
|
| 133 |
+ assert.Assert(c, cleanedShortImageID, checker.Not(checker.Equals), "", check.Commentf("Id should not be empty."))
|
|
| 134 | 134 |
|
| 135 | 135 |
saveCmd := exec.Command(dockerBinary, "save", cleanedShortImageID) |
| 136 | 136 |
tarCmd := exec.Command("tar", "t")
|
| ... | ... |
@@ -124,7 +124,7 @@ func (s *DockerSwarmSuite) TestServiceHealthStart(c *testing.T) {
|
| 124 | 124 |
|
| 125 | 125 |
// task should be blocked at starting status |
| 126 | 126 |
task = d.GetTask(c, task.ID) |
| 127 |
- assert.Assert(c, task.Status.State, check.Equals, swarm.TaskStateStarting) |
|
| 127 |
+ assert.Assert(c, task.Status.State, checker.Equals, swarm.TaskStateStarting) |
|
| 128 | 128 |
|
| 129 | 129 |
// make it healthy |
| 130 | 130 |
d.Cmd("exec", containerID, "touch", "/status")
|
| ... | ... |
@@ -803,7 +803,7 @@ func setupRemoteGlobalNetworkPlugin(c *testing.T, mux *http.ServeMux, url, netDr |
| 803 | 803 |
func (s *DockerSwarmSuite) TestSwarmNetworkPlugin(c *testing.T) {
|
| 804 | 804 |
mux := http.NewServeMux() |
| 805 | 805 |
s.server = httptest.NewServer(mux) |
| 806 |
- assert.Assert(c, s.server, check.NotNil) // check that HTTP server has started |
|
| 806 |
+ assert.Assert(c, s.server, checker.NotNil) // check that HTTP server has started |
|
| 807 | 807 |
setupRemoteGlobalNetworkPlugin(c, mux, s.server.URL, globalNetworkPlugin, globalIPAMPlugin) |
| 808 | 808 |
defer func() {
|
| 809 | 809 |
s.server.Close() |
| ... | ... |
@@ -29,23 +29,23 @@ func (s *DockerSuite) TestVolumeCLICreate(c *testing.T) {
|
| 29 | 29 |
// test using hidden --name option |
| 30 | 30 |
out, _ := dockerCmd(c, "volume", "create", "--name=test") |
| 31 | 31 |
name := strings.TrimSpace(out) |
| 32 |
- assert.Assert(c, name, check.Equals, "test") |
|
| 32 |
+ assert.Assert(c, name, checker.Equals, "test") |
|
| 33 | 33 |
|
| 34 | 34 |
out, _ = dockerCmd(c, "volume", "create", "test2") |
| 35 | 35 |
name = strings.TrimSpace(out) |
| 36 |
- assert.Assert(c, name, check.Equals, "test2") |
|
| 36 |
+ assert.Assert(c, name, checker.Equals, "test2") |
|
| 37 | 37 |
} |
| 38 | 38 |
|
| 39 | 39 |
func (s *DockerSuite) TestVolumeCLIInspect(c *testing.T) {
|
| 40 |
- assert.Assert(c, exec.Command(dockerBinary, "volume", "inspect", "doesnotexist").Run(), check.Not(check.IsNil), check.Commentf("volume inspect should error on non-existent volume"))
|
|
| 40 |
+ assert.Assert(c, exec.Command(dockerBinary, "volume", "inspect", "doesnotexist").Run(), checker.Not(checker.IsNil), check.Commentf("volume inspect should error on non-existent volume"))
|
|
| 41 | 41 |
out, _ := dockerCmd(c, "volume", "create") |
| 42 | 42 |
name := strings.TrimSpace(out) |
| 43 | 43 |
out, _ = dockerCmd(c, "volume", "inspect", "--format={{ .Name }}", name)
|
| 44 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, name) |
|
| 44 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, name) |
|
| 45 | 45 |
|
| 46 | 46 |
dockerCmd(c, "volume", "create", "test") |
| 47 | 47 |
out, _ = dockerCmd(c, "volume", "inspect", "--format={{ .Name }}", "test")
|
| 48 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, "test") |
|
| 48 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, "test") |
|
| 49 | 49 |
} |
| 50 | 50 |
|
| 51 | 51 |
func (s *DockerSuite) TestVolumeCLIInspectMulti(c *testing.T) {
|
| ... | ... |
@@ -141,7 +141,7 @@ func (s *DockerSuite) TestVolumeCLILsFilterDangling(c *testing.T) {
|
| 141 | 141 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "dangling=false") |
| 142 | 142 |
|
| 143 | 143 |
// Explicitly disabling dangling |
| 144 |
- assert.Assert(c, out, check.Not(checker.Contains), "testnotinuse1\n", check.Commentf("expected volume 'testnotinuse1' in output"))
|
|
| 144 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "testnotinuse1\n", check.Commentf("expected volume 'testnotinuse1' in output"))
|
|
| 145 | 145 |
assert.Assert(c, out, checker.Contains, "testisinuse1\n", check.Commentf("expected volume 'testisinuse1' in output"))
|
| 146 | 146 |
assert.Assert(c, out, checker.Contains, "testisinuse2\n", check.Commentf("expected volume 'testisinuse2' in output"))
|
| 147 | 147 |
|
| ... | ... |
@@ -149,23 +149,23 @@ func (s *DockerSuite) TestVolumeCLILsFilterDangling(c *testing.T) {
|
| 149 | 149 |
|
| 150 | 150 |
// Filter "dangling" volumes; only "dangling" (unused) volumes should be in the output |
| 151 | 151 |
assert.Assert(c, out, checker.Contains, "testnotinuse1\n", check.Commentf("expected volume 'testnotinuse1' in output"))
|
| 152 |
- assert.Assert(c, out, check.Not(checker.Contains), "testisinuse1\n", check.Commentf("volume 'testisinuse1' in output, but not expected"))
|
|
| 153 |
- assert.Assert(c, out, check.Not(checker.Contains), "testisinuse2\n", check.Commentf("volume 'testisinuse2' in output, but not expected"))
|
|
| 152 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "testisinuse1\n", check.Commentf("volume 'testisinuse1' in output, but not expected"))
|
|
| 153 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "testisinuse2\n", check.Commentf("volume 'testisinuse2' in output, but not expected"))
|
|
| 154 | 154 |
|
| 155 | 155 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "dangling=1") |
| 156 | 156 |
// Filter "dangling" volumes; only "dangling" (unused) volumes should be in the output, dangling also accept 1 |
| 157 | 157 |
assert.Assert(c, out, checker.Contains, "testnotinuse1\n", check.Commentf("expected volume 'testnotinuse1' in output"))
|
| 158 |
- assert.Assert(c, out, check.Not(checker.Contains), "testisinuse1\n", check.Commentf("volume 'testisinuse1' in output, but not expected"))
|
|
| 159 |
- assert.Assert(c, out, check.Not(checker.Contains), "testisinuse2\n", check.Commentf("volume 'testisinuse2' in output, but not expected"))
|
|
| 158 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "testisinuse1\n", check.Commentf("volume 'testisinuse1' in output, but not expected"))
|
|
| 159 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "testisinuse2\n", check.Commentf("volume 'testisinuse2' in output, but not expected"))
|
|
| 160 | 160 |
|
| 161 | 161 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "dangling=0") |
| 162 | 162 |
// dangling=0 is same as dangling=false case |
| 163 |
- assert.Assert(c, out, check.Not(checker.Contains), "testnotinuse1\n", check.Commentf("expected volume 'testnotinuse1' in output"))
|
|
| 163 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "testnotinuse1\n", check.Commentf("expected volume 'testnotinuse1' in output"))
|
|
| 164 | 164 |
assert.Assert(c, out, checker.Contains, "testisinuse1\n", check.Commentf("expected volume 'testisinuse1' in output"))
|
| 165 | 165 |
assert.Assert(c, out, checker.Contains, "testisinuse2\n", check.Commentf("expected volume 'testisinuse2' in output"))
|
| 166 | 166 |
|
| 167 | 167 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "name=testisin") |
| 168 |
- assert.Assert(c, out, check.Not(checker.Contains), "testnotinuse1\n", check.Commentf("expected volume 'testnotinuse1' in output"))
|
|
| 168 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "testnotinuse1\n", check.Commentf("expected volume 'testnotinuse1' in output"))
|
|
| 169 | 169 |
assert.Assert(c, out, checker.Contains, "testisinuse1\n", check.Commentf("expected volume 'testisinuse1' in output"))
|
| 170 | 170 |
assert.Assert(c, out, checker.Contains, "testisinuse2\n", check.Commentf("expected volume 'testisinuse2' in output"))
|
| 171 | 171 |
} |
| ... | ... |
@@ -200,17 +200,17 @@ func (s *DockerSuite) TestVolumeCLIRm(c *testing.T) {
|
| 200 | 200 |
}) |
| 201 | 201 |
|
| 202 | 202 |
out, _ = dockerCmd(c, "run", "--volumes-from=test", "--name=test2", "busybox", "sh", "-c", "cat /foo/bar") |
| 203 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, "hello") |
|
| 203 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, "hello") |
|
| 204 | 204 |
dockerCmd(c, "rm", "-fv", "test2") |
| 205 | 205 |
dockerCmd(c, "volume", "inspect", volumeID) |
| 206 | 206 |
dockerCmd(c, "rm", "-f", "test") |
| 207 | 207 |
|
| 208 | 208 |
out, _ = dockerCmd(c, "run", "--name=test2", "-v", volumeID+":"+prefix+"/foo", "busybox", "sh", "-c", "cat /foo/bar") |
| 209 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, "hello", check.Commentf("volume data was removed"))
|
|
| 209 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, "hello", check.Commentf("volume data was removed"))
|
|
| 210 | 210 |
dockerCmd(c, "rm", "test2") |
| 211 | 211 |
|
| 212 | 212 |
dockerCmd(c, "volume", "rm", volumeID) |
| 213 |
- assert.Assert(c, exec.Command("volume", "rm", "doesnotexist").Run(), check.Not(check.IsNil), check.Commentf("volume rm should fail with non-existent volume"))
|
|
| 213 |
+ assert.Assert(c, exec.Command("volume", "rm", "doesnotexist").Run(), checker.Not(checker.IsNil), check.Commentf("volume rm should fail with non-existent volume"))
|
|
| 214 | 214 |
} |
| 215 | 215 |
|
| 216 | 216 |
// FIXME(vdemeester) should be a unit test in cli/command/volume package |
| ... | ... |
@@ -280,7 +280,7 @@ func (s *DockerSuite) TestVolumeCLICreateLabel(c *testing.T) {
|
| 280 | 280 |
assert.NilError(c, err) |
| 281 | 281 |
|
| 282 | 282 |
out, _ := dockerCmd(c, "volume", "inspect", "--format={{ .Labels."+testLabel+" }}", testVol)
|
| 283 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, testValue) |
|
| 283 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, testValue) |
|
| 284 | 284 |
} |
| 285 | 285 |
|
| 286 | 286 |
func (s *DockerSuite) TestVolumeCLICreateLabelMultiple(c *testing.T) {
|
| ... | ... |
@@ -306,7 +306,7 @@ func (s *DockerSuite) TestVolumeCLICreateLabelMultiple(c *testing.T) {
|
| 306 | 306 |
|
| 307 | 307 |
for k, v := range testLabels {
|
| 308 | 308 |
out, _ := dockerCmd(c, "volume", "inspect", "--format={{ .Labels."+k+" }}", testVol)
|
| 309 |
- assert.Assert(c, strings.TrimSpace(out), check.Equals, v) |
|
| 309 |
+ assert.Assert(c, strings.TrimSpace(out), checker.Equals, v) |
|
| 310 | 310 |
} |
| 311 | 311 |
} |
| 312 | 312 |
|
| ... | ... |
@@ -329,15 +329,15 @@ func (s *DockerSuite) TestVolumeCLILsFilterLabels(c *testing.T) {
|
| 329 | 329 |
|
| 330 | 330 |
// filter with label=key=value |
| 331 | 331 |
assert.Assert(c, out, checker.Contains, "testvolcreatelabel-1\n", check.Commentf("expected volume 'testvolcreatelabel-1' in output"))
|
| 332 |
- assert.Assert(c, out, check.Not(checker.Contains), "testvolcreatelabel-2\n", check.Commentf("expected volume 'testvolcreatelabel-2 in output"))
|
|
| 332 |
+ assert.Assert(c, out, checker.Not(checker.Contains), "testvolcreatelabel-2\n", check.Commentf("expected volume 'testvolcreatelabel-2 in output"))
|
|
| 333 | 333 |
|
| 334 | 334 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "label=non-exist") |
| 335 | 335 |
outArr := strings.Split(strings.TrimSpace(out), "\n") |
| 336 |
- assert.Assert(c, len(outArr), check.Equals, 1, check.Commentf("\n%s", out))
|
|
| 336 |
+ assert.Assert(c, len(outArr), checker.Equals, 1, check.Commentf("\n%s", out))
|
|
| 337 | 337 |
|
| 338 | 338 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "label=foo=non-exist") |
| 339 | 339 |
outArr = strings.Split(strings.TrimSpace(out), "\n") |
| 340 |
- assert.Assert(c, len(outArr), check.Equals, 1, check.Commentf("\n%s", out))
|
|
| 340 |
+ assert.Assert(c, len(outArr), checker.Equals, 1, check.Commentf("\n%s", out))
|
|
| 341 | 341 |
} |
| 342 | 342 |
|
| 343 | 343 |
func (s *DockerSuite) TestVolumeCLILsFilterDrivers(c *testing.T) {
|
| ... | ... |
@@ -358,17 +358,17 @@ func (s *DockerSuite) TestVolumeCLILsFilterDrivers(c *testing.T) {
|
| 358 | 358 |
// filter with driver=invaliddriver |
| 359 | 359 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "driver=invaliddriver") |
| 360 | 360 |
outArr := strings.Split(strings.TrimSpace(out), "\n") |
| 361 |
- assert.Assert(c, len(outArr), check.Equals, 1, check.Commentf("\n%s", out))
|
|
| 361 |
+ assert.Assert(c, len(outArr), checker.Equals, 1, check.Commentf("\n%s", out))
|
|
| 362 | 362 |
|
| 363 | 363 |
// filter with driver=loca |
| 364 | 364 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "driver=loca") |
| 365 | 365 |
outArr = strings.Split(strings.TrimSpace(out), "\n") |
| 366 |
- assert.Assert(c, len(outArr), check.Equals, 1, check.Commentf("\n%s", out))
|
|
| 366 |
+ assert.Assert(c, len(outArr), checker.Equals, 1, check.Commentf("\n%s", out))
|
|
| 367 | 367 |
|
| 368 | 368 |
// filter with driver= |
| 369 | 369 |
out, _ = dockerCmd(c, "volume", "ls", "--filter", "driver=") |
| 370 | 370 |
outArr = strings.Split(strings.TrimSpace(out), "\n") |
| 371 |
- assert.Assert(c, len(outArr), check.Equals, 1, check.Commentf("\n%s", out))
|
|
| 371 |
+ assert.Assert(c, len(outArr), checker.Equals, 1, check.Commentf("\n%s", out))
|
|
| 372 | 372 |
} |
| 373 | 373 |
|
| 374 | 374 |
func (s *DockerSuite) TestVolumeCLIRmForceUsage(c *testing.T) {
|
| ... | ... |
@@ -431,13 +431,13 @@ func (s *DockerSuite) TestVolumeCLIRmForceInUse(c *testing.T) {
|
| 431 | 431 |
|
| 432 | 432 |
// Verify removing the volume after the container is removed works |
| 433 | 433 |
_, e := dockerCmd(c, "rm", cid) |
| 434 |
- assert.Assert(c, e, check.Equals, 0) |
|
| 434 |
+ assert.Assert(c, e, checker.Equals, 0) |
|
| 435 | 435 |
|
| 436 | 436 |
_, e = dockerCmd(c, "volume", "rm", "-f", name) |
| 437 |
- assert.Assert(c, e, check.Equals, 0) |
|
| 437 |
+ assert.Assert(c, e, checker.Equals, 0) |
|
| 438 | 438 |
|
| 439 | 439 |
out, e = dockerCmd(c, "volume", "ls") |
| 440 |
- assert.Assert(c, e, check.Equals, 0) |
|
| 440 |
+ assert.Assert(c, e, checker.Equals, 0) |
|
| 441 | 441 |
assert.Assert(c, out, checker.Not(checker.Contains), name) |
| 442 | 442 |
} |
| 443 | 443 |
|
| ... | ... |
@@ -77,7 +77,7 @@ func inspectFieldAndUnmarshall(c *testing.T, name, field string, output interfac |
| 77 | 77 |
str := inspectFieldJSON(c, name, field) |
| 78 | 78 |
err := json.Unmarshal([]byte(str), output) |
| 79 | 79 |
if c != nil {
|
| 80 |
- assert.Assert(c, err, check.IsNil, check.Commentf("failed to unmarshal: %v", err))
|
|
| 80 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("failed to unmarshal: %v", err))
|
|
| 81 | 81 |
} |
| 82 | 82 |
} |
| 83 | 83 |
|
| ... | ... |
@@ -201,7 +201,7 @@ func buildImage(name string, cmdOperators ...cli.CmdOperator) *icmd.Result {
|
| 201 | 201 |
// Fail the test when error occurs. |
| 202 | 202 |
func writeFile(dst, content string, c *testing.T) {
|
| 203 | 203 |
// Create subdirectories if necessary |
| 204 |
- assert.Assert(c, os.MkdirAll(path.Dir(dst), 0700), check.IsNil) |
|
| 204 |
+ assert.Assert(c, os.MkdirAll(path.Dir(dst), 0700), checker.IsNil) |
|
| 205 | 205 |
f, err := os.OpenFile(dst, os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0700) |
| 206 | 206 |
assert.NilError(c, err) |
| 207 | 207 |
defer f.Close() |
| ... | ... |
@@ -263,7 +263,7 @@ func daemonTime(c *testing.T) time.Time {
|
| 263 | 263 |
assert.NilError(c, err) |
| 264 | 264 |
|
| 265 | 265 |
dt, err := time.Parse(time.RFC3339Nano, info.SystemTime) |
| 266 |
- assert.Assert(c, err, check.IsNil, check.Commentf("invalid time format in GET /info response"))
|
|
| 266 |
+ assert.Assert(c, err, checker.IsNil, check.Commentf("invalid time format in GET /info response"))
|
|
| 267 | 267 |
return dt |
| 268 | 268 |
} |
| 269 | 269 |
|
| ... | ... |
@@ -408,7 +408,7 @@ func waitForGoroutines(expected int) error {
|
| 408 | 408 |
// getErrorMessage returns the error message from an error API response |
| 409 | 409 |
func getErrorMessage(c *testing.T, body []byte) string {
|
| 410 | 410 |
var resp types.ErrorResponse |
| 411 |
- assert.Assert(c, json.Unmarshal(body, &resp), check.IsNil) |
|
| 411 |
+ assert.Assert(c, json.Unmarshal(body, &resp), checker.IsNil) |
|
| 412 | 412 |
return strings.TrimSpace(resp.Message) |
| 413 | 413 |
} |
| 414 | 414 |
|
| ... | ... |
@@ -15,64 +15,64 @@ var _ = check.Suite(&DiscoverySuite{})
|
| 15 | 15 |
|
| 16 | 16 |
func (s *DiscoverySuite) TestNewEntry(c *testing.T) {
|
| 17 | 17 |
entry, err := NewEntry("127.0.0.1:2375")
|
| 18 |
- assert.Assert(c, err, check.IsNil) |
|
| 19 |
- assert.Assert(c, entry.Equals(&Entry{Host: "127.0.0.1", Port: "2375"}), check.Equals, true)
|
|
| 20 |
- assert.Assert(c, entry.String(), check.Equals, "127.0.0.1:2375") |
|
| 18 |
+ assert.Assert(c, err, checker.IsNil) |
|
| 19 |
+ assert.Assert(c, entry.Equals(&Entry{Host: "127.0.0.1", Port: "2375"}), checker.Equals, true)
|
|
| 20 |
+ assert.Assert(c, entry.String(), checker.Equals, "127.0.0.1:2375") |
|
| 21 | 21 |
|
| 22 | 22 |
entry, err = NewEntry("[2001:db8:0:f101::2]:2375")
|
| 23 |
- assert.Assert(c, err, check.IsNil) |
|
| 24 |
- assert.Assert(c, entry.Equals(&Entry{Host: "2001:db8:0:f101::2", Port: "2375"}), check.Equals, true)
|
|
| 25 |
- assert.Assert(c, entry.String(), check.Equals, "[2001:db8:0:f101::2]:2375") |
|
| 23 |
+ assert.Assert(c, err, checker.IsNil) |
|
| 24 |
+ assert.Assert(c, entry.Equals(&Entry{Host: "2001:db8:0:f101::2", Port: "2375"}), checker.Equals, true)
|
|
| 25 |
+ assert.Assert(c, entry.String(), checker.Equals, "[2001:db8:0:f101::2]:2375") |
|
| 26 | 26 |
|
| 27 | 27 |
_, err = NewEntry("127.0.0.1")
|
| 28 |
- assert.Assert(c, err, check.NotNil) |
|
| 28 |
+ assert.Assert(c, err, checker.NotNil) |
|
| 29 | 29 |
} |
| 30 | 30 |
|
| 31 | 31 |
func (s *DiscoverySuite) TestParse(c *testing.T) {
|
| 32 | 32 |
scheme, uri := parse("127.0.0.1:2375")
|
| 33 |
- assert.Assert(c, scheme, check.Equals, "nodes") |
|
| 34 |
- assert.Assert(c, uri, check.Equals, "127.0.0.1:2375") |
|
| 33 |
+ assert.Assert(c, scheme, checker.Equals, "nodes") |
|
| 34 |
+ assert.Assert(c, uri, checker.Equals, "127.0.0.1:2375") |
|
| 35 | 35 |
|
| 36 | 36 |
scheme, uri = parse("localhost:2375")
|
| 37 |
- assert.Assert(c, scheme, check.Equals, "nodes") |
|
| 38 |
- assert.Assert(c, uri, check.Equals, "localhost:2375") |
|
| 37 |
+ assert.Assert(c, scheme, checker.Equals, "nodes") |
|
| 38 |
+ assert.Assert(c, uri, checker.Equals, "localhost:2375") |
|
| 39 | 39 |
|
| 40 | 40 |
scheme, uri = parse("scheme://127.0.0.1:2375")
|
| 41 |
- assert.Assert(c, scheme, check.Equals, "scheme") |
|
| 42 |
- assert.Assert(c, uri, check.Equals, "127.0.0.1:2375") |
|
| 41 |
+ assert.Assert(c, scheme, checker.Equals, "scheme") |
|
| 42 |
+ assert.Assert(c, uri, checker.Equals, "127.0.0.1:2375") |
|
| 43 | 43 |
|
| 44 | 44 |
scheme, uri = parse("scheme://localhost:2375")
|
| 45 |
- assert.Assert(c, scheme, check.Equals, "scheme") |
|
| 46 |
- assert.Assert(c, uri, check.Equals, "localhost:2375") |
|
| 45 |
+ assert.Assert(c, scheme, checker.Equals, "scheme") |
|
| 46 |
+ assert.Assert(c, uri, checker.Equals, "localhost:2375") |
|
| 47 | 47 |
|
| 48 | 48 |
scheme, uri = parse("")
|
| 49 |
- assert.Assert(c, scheme, check.Equals, "nodes") |
|
| 50 |
- assert.Assert(c, uri, check.Equals, "") |
|
| 49 |
+ assert.Assert(c, scheme, checker.Equals, "nodes") |
|
| 50 |
+ assert.Assert(c, uri, checker.Equals, "") |
|
| 51 | 51 |
} |
| 52 | 52 |
|
| 53 | 53 |
func (s *DiscoverySuite) TestCreateEntries(c *testing.T) {
|
| 54 | 54 |
entries, err := CreateEntries(nil) |
| 55 |
- assert.Assert(c, entries, check.DeepEquals, Entries{})
|
|
| 56 |
- assert.Assert(c, err, check.IsNil) |
|
| 55 |
+ assert.Assert(c, entries, checker.DeepEquals, Entries{})
|
|
| 56 |
+ assert.Assert(c, err, checker.IsNil) |
|
| 57 | 57 |
|
| 58 | 58 |
entries, err = CreateEntries([]string{"127.0.0.1:2375", "127.0.0.2:2375", "[2001:db8:0:f101::2]:2375", ""})
|
| 59 |
- assert.Assert(c, err, check.IsNil) |
|
| 59 |
+ assert.Assert(c, err, checker.IsNil) |
|
| 60 | 60 |
expected := Entries{
|
| 61 | 61 |
&Entry{Host: "127.0.0.1", Port: "2375"},
|
| 62 | 62 |
&Entry{Host: "127.0.0.2", Port: "2375"},
|
| 63 | 63 |
&Entry{Host: "2001:db8:0:f101::2", Port: "2375"},
|
| 64 | 64 |
} |
| 65 |
- assert.Assert(c, entries.Equals(expected), check.Equals, true) |
|
| 65 |
+ assert.Assert(c, entries.Equals(expected), checker.Equals, true) |
|
| 66 | 66 |
|
| 67 | 67 |
_, err = CreateEntries([]string{"127.0.0.1", "127.0.0.2"})
|
| 68 |
- assert.Assert(c, err, check.NotNil) |
|
| 68 |
+ assert.Assert(c, err, checker.NotNil) |
|
| 69 | 69 |
} |
| 70 | 70 |
|
| 71 | 71 |
func (s *DiscoverySuite) TestContainsEntry(c *testing.T) {
|
| 72 | 72 |
entries, err := CreateEntries([]string{"127.0.0.1:2375", "127.0.0.2:2375", ""})
|
| 73 |
- assert.Assert(c, err, check.IsNil) |
|
| 74 |
- assert.Assert(c, entries.Contains(&Entry{Host: "127.0.0.1", Port: "2375"}), check.Equals, true)
|
|
| 75 |
- assert.Assert(c, entries.Contains(&Entry{Host: "127.0.0.3", Port: "2375"}), check.Equals, false)
|
|
| 73 |
+ assert.Assert(c, err, checker.IsNil) |
|
| 74 |
+ assert.Assert(c, entries.Contains(&Entry{Host: "127.0.0.1", Port: "2375"}), checker.Equals, true)
|
|
| 75 |
+ assert.Assert(c, entries.Contains(&Entry{Host: "127.0.0.3", Port: "2375"}), checker.Equals, false)
|
|
| 76 | 76 |
} |
| 77 | 77 |
|
| 78 | 78 |
func (s *DiscoverySuite) TestEntriesEquality(c *testing.T) {
|
| ... | ... |
@@ -85,20 +85,20 @@ func (s *DiscoverySuite) TestEntriesEquality(c *testing.T) {
|
| 85 | 85 |
assert.Assert(c, entries.Equals(Entries{
|
| 86 | 86 |
&Entry{Host: "127.0.0.1", Port: "2375"},
|
| 87 | 87 |
&Entry{Host: "127.0.0.2", Port: "2375"},
|
| 88 |
- }), check.Equals, true) |
|
| 88 |
+ }), checker.Equals, true) |
|
| 89 | 89 |
|
| 90 | 90 |
// Different size |
| 91 | 91 |
assert.Assert(c, entries.Equals(Entries{
|
| 92 | 92 |
&Entry{Host: "127.0.0.1", Port: "2375"},
|
| 93 | 93 |
&Entry{Host: "127.0.0.2", Port: "2375"},
|
| 94 | 94 |
&Entry{Host: "127.0.0.3", Port: "2375"},
|
| 95 |
- }), check.Equals, false) |
|
| 95 |
+ }), checker.Equals, false) |
|
| 96 | 96 |
|
| 97 | 97 |
// Different content |
| 98 | 98 |
assert.Assert(c, entries.Equals(Entries{
|
| 99 | 99 |
&Entry{Host: "127.0.0.1", Port: "2375"},
|
| 100 | 100 |
&Entry{Host: "127.0.0.42", Port: "2375"},
|
| 101 |
- }), check.Equals, false) |
|
| 101 |
+ }), checker.Equals, false) |
|
| 102 | 102 |
|
| 103 | 103 |
} |
| 104 | 104 |
|
| ... | ... |
@@ -110,25 +110,25 @@ func (s *DiscoverySuite) TestEntriesDiff(c *testing.T) {
|
| 110 | 110 |
|
| 111 | 111 |
// No diff |
| 112 | 112 |
added, removed := entries.Diff(Entries{entry2, entry1})
|
| 113 |
- assert.Assert(c, added, check.HasLen, 0) |
|
| 114 |
- assert.Assert(c, removed, check.HasLen, 0) |
|
| 113 |
+ assert.Assert(c, added, checker.HasLen, 0) |
|
| 114 |
+ assert.Assert(c, removed, checker.HasLen, 0) |
|
| 115 | 115 |
|
| 116 | 116 |
// Add |
| 117 | 117 |
added, removed = entries.Diff(Entries{entry2, entry3, entry1})
|
| 118 |
- assert.Assert(c, added, check.HasLen, 1) |
|
| 119 |
- assert.Assert(c, added.Contains(entry3), check.Equals, true) |
|
| 120 |
- assert.Assert(c, removed, check.HasLen, 0) |
|
| 118 |
+ assert.Assert(c, added, checker.HasLen, 1) |
|
| 119 |
+ assert.Assert(c, added.Contains(entry3), checker.Equals, true) |
|
| 120 |
+ assert.Assert(c, removed, checker.HasLen, 0) |
|
| 121 | 121 |
|
| 122 | 122 |
// Remove |
| 123 | 123 |
added, removed = entries.Diff(Entries{entry2})
|
| 124 |
- assert.Assert(c, added, check.HasLen, 0) |
|
| 125 |
- assert.Assert(c, removed, check.HasLen, 1) |
|
| 126 |
- assert.Assert(c, removed.Contains(entry1), check.Equals, true) |
|
| 124 |
+ assert.Assert(c, added, checker.HasLen, 0) |
|
| 125 |
+ assert.Assert(c, removed, checker.HasLen, 1) |
|
| 126 |
+ assert.Assert(c, removed.Contains(entry1), checker.Equals, true) |
|
| 127 | 127 |
|
| 128 | 128 |
// Add and remove |
| 129 | 129 |
added, removed = entries.Diff(Entries{entry1, entry3})
|
| 130 |
- assert.Assert(c, added, check.HasLen, 1) |
|
| 131 |
- assert.Assert(c, added.Contains(entry3), check.Equals, true) |
|
| 132 |
- assert.Assert(c, removed, check.HasLen, 1) |
|
| 133 |
- assert.Assert(c, removed.Contains(entry2), check.Equals, true) |
|
| 130 |
+ assert.Assert(c, added, checker.HasLen, 1) |
|
| 131 |
+ assert.Assert(c, added.Contains(entry3), checker.Equals, true) |
|
| 132 |
+ assert.Assert(c, removed, checker.HasLen, 1) |
|
| 133 |
+ assert.Assert(c, removed.Contains(entry2), checker.Equals, true) |
|
| 134 | 134 |
} |
| ... | ... |
@@ -20,13 +20,13 @@ var _ = check.Suite(&DiscoverySuite{})
|
| 20 | 20 |
func (s *DiscoverySuite) TestInitialize(c *testing.T) {
|
| 21 | 21 |
d := &Discovery{}
|
| 22 | 22 |
d.Initialize("/path/to/file", 1000, 0, nil)
|
| 23 |
- assert.Assert(c, d.path, check.Equals, "/path/to/file") |
|
| 23 |
+ assert.Assert(c, d.path, checker.Equals, "/path/to/file") |
|
| 24 | 24 |
} |
| 25 | 25 |
|
| 26 | 26 |
func (s *DiscoverySuite) TestNew(c *testing.T) {
|
| 27 | 27 |
d, err := discovery.New("file:///path/to/file", 0, 0, nil)
|
| 28 |
- assert.Assert(c, err, check.IsNil) |
|
| 29 |
- assert.Assert(c, d.(*Discovery).path, check.Equals, "/path/to/file") |
|
| 28 |
+ assert.Assert(c, err, checker.IsNil) |
|
| 29 |
+ assert.Assert(c, d.(*Discovery).path, checker.Equals, "/path/to/file") |
|
| 30 | 30 |
} |
| 31 | 31 |
|
| 32 | 32 |
func (s *DiscoverySuite) TestContent(c *testing.T) {
|
| ... | ... |
@@ -35,17 +35,17 @@ func (s *DiscoverySuite) TestContent(c *testing.T) {
|
| 35 | 35 |
2.2.2.[2:4]:2222 |
| 36 | 36 |
` |
| 37 | 37 |
ips := parseFileContent([]byte(data)) |
| 38 |
- assert.Assert(c, ips, check.HasLen, 5) |
|
| 39 |
- assert.Assert(c, ips[0], check.Equals, "1.1.1.1:1111") |
|
| 40 |
- assert.Assert(c, ips[1], check.Equals, "1.1.1.2:1111") |
|
| 41 |
- assert.Assert(c, ips[2], check.Equals, "2.2.2.2:2222") |
|
| 42 |
- assert.Assert(c, ips[3], check.Equals, "2.2.2.3:2222") |
|
| 43 |
- assert.Assert(c, ips[4], check.Equals, "2.2.2.4:2222") |
|
| 38 |
+ assert.Assert(c, ips, checker.HasLen, 5) |
|
| 39 |
+ assert.Assert(c, ips[0], checker.Equals, "1.1.1.1:1111") |
|
| 40 |
+ assert.Assert(c, ips[1], checker.Equals, "1.1.1.2:1111") |
|
| 41 |
+ assert.Assert(c, ips[2], checker.Equals, "2.2.2.2:2222") |
|
| 42 |
+ assert.Assert(c, ips[3], checker.Equals, "2.2.2.3:2222") |
|
| 43 |
+ assert.Assert(c, ips[4], checker.Equals, "2.2.2.4:2222") |
|
| 44 | 44 |
} |
| 45 | 45 |
|
| 46 | 46 |
func (s *DiscoverySuite) TestRegister(c *testing.T) {
|
| 47 | 47 |
discovery := &Discovery{path: "/path/to/file"}
|
| 48 |
- assert.Assert(c, discovery.Register("0.0.0.0"), check.NotNil)
|
|
| 48 |
+ assert.Assert(c, discovery.Register("0.0.0.0"), checker.NotNil)
|
|
| 49 | 49 |
} |
| 50 | 50 |
|
| 51 | 51 |
func (s *DiscoverySuite) TestParsingContentsWithComments(c *testing.T) {
|
| ... | ... |
@@ -58,9 +58,9 @@ func (s *DiscoverySuite) TestParsingContentsWithComments(c *testing.T) {
|
| 58 | 58 |
### test ### |
| 59 | 59 |
` |
| 60 | 60 |
ips := parseFileContent([]byte(data)) |
| 61 |
- assert.Assert(c, ips, check.HasLen, 2) |
|
| 62 |
- assert.Assert(c, "1.1.1.1:1111", check.Equals, ips[0]) |
|
| 63 |
- assert.Assert(c, "3.3.3.3:3333", check.Equals, ips[1]) |
|
| 61 |
+ assert.Assert(c, ips, checker.HasLen, 2) |
|
| 62 |
+ assert.Assert(c, "1.1.1.1:1111", checker.Equals, ips[0]) |
|
| 63 |
+ assert.Assert(c, "3.3.3.3:3333", checker.Equals, ips[1]) |
|
| 64 | 64 |
} |
| 65 | 65 |
|
| 66 | 66 |
func (s *DiscoverySuite) TestWatch(c *testing.T) {
|
| ... | ... |
@@ -75,9 +75,9 @@ func (s *DiscoverySuite) TestWatch(c *testing.T) {
|
| 75 | 75 |
|
| 76 | 76 |
// Create a temporary file and remove it. |
| 77 | 77 |
tmp, err := ioutil.TempFile(os.TempDir(), "discovery-file-test") |
| 78 |
- assert.Assert(c, err, check.IsNil) |
|
| 79 |
- assert.Assert(c, tmp.Close(), check.IsNil) |
|
| 80 |
- assert.Assert(c, os.Remove(tmp.Name()), check.IsNil) |
|
| 78 |
+ assert.Assert(c, err, checker.IsNil) |
|
| 79 |
+ assert.Assert(c, tmp.Close(), checker.IsNil) |
|
| 80 |
+ assert.Assert(c, os.Remove(tmp.Name()), checker.IsNil) |
|
| 81 | 81 |
|
| 82 | 82 |
// Set up file discovery. |
| 83 | 83 |
d := &Discovery{}
|
| ... | ... |
@@ -86,7 +86,7 @@ func (s *DiscoverySuite) TestWatch(c *testing.T) {
|
| 86 | 86 |
ch, errCh := d.Watch(stopCh) |
| 87 | 87 |
|
| 88 | 88 |
// Make sure it fires errors since the file doesn't exist. |
| 89 |
- assert.Assert(c, <-errCh, check.NotNil) |
|
| 89 |
+ assert.Assert(c, <-errCh, checker.NotNil) |
|
| 90 | 90 |
// We have to drain the error channel otherwise Watch will get stuck. |
| 91 | 91 |
go func() {
|
| 92 | 92 |
for range errCh {
|
| ... | ... |
@@ -94,21 +94,21 @@ func (s *DiscoverySuite) TestWatch(c *testing.T) {
|
| 94 | 94 |
}() |
| 95 | 95 |
|
| 96 | 96 |
// Write the file and make sure we get the expected value back. |
| 97 |
- assert.Assert(c, ioutil.WriteFile(tmp.Name(), []byte(data), 0600), check.IsNil) |
|
| 98 |
- assert.Assert(c, <-ch, check.DeepEquals, expected) |
|
| 97 |
+ assert.Assert(c, ioutil.WriteFile(tmp.Name(), []byte(data), 0600), checker.IsNil) |
|
| 98 |
+ assert.Assert(c, <-ch, checker.DeepEquals, expected) |
|
| 99 | 99 |
|
| 100 | 100 |
// Add a new entry and look it up. |
| 101 | 101 |
expected = append(expected, &discovery.Entry{Host: "3.3.3.3", Port: "3333"})
|
| 102 | 102 |
f, err := os.OpenFile(tmp.Name(), os.O_APPEND|os.O_WRONLY, 0600) |
| 103 |
- assert.Assert(c, err, check.IsNil) |
|
| 104 |
- assert.Assert(c, f, check.NotNil) |
|
| 103 |
+ assert.Assert(c, err, checker.IsNil) |
|
| 104 |
+ assert.Assert(c, f, checker.NotNil) |
|
| 105 | 105 |
_, err = f.WriteString("\n3.3.3.3:3333\n")
|
| 106 |
- assert.Assert(c, err, check.IsNil) |
|
| 106 |
+ assert.Assert(c, err, checker.IsNil) |
|
| 107 | 107 |
f.Close() |
| 108 |
- assert.Assert(c, <-ch, check.DeepEquals, expected) |
|
| 108 |
+ assert.Assert(c, <-ch, checker.DeepEquals, expected) |
|
| 109 | 109 |
|
| 110 | 110 |
// Stop and make sure it closes all channels. |
| 111 | 111 |
close(stopCh) |
| 112 |
- assert.Assert(c, <-ch, check.IsNil) |
|
| 113 |
- assert.Assert(c, <-errCh, check.IsNil) |
|
| 112 |
+ assert.Assert(c, <-ch, checker.IsNil) |
|
| 113 |
+ assert.Assert(c, <-errCh, checker.IsNil) |
|
| 114 | 114 |
} |
| ... | ... |
@@ -6,48 +6,48 @@ import ( |
| 6 | 6 |
|
| 7 | 7 |
func (s *DiscoverySuite) TestGeneratorNotGenerate(c *testing.T) {
|
| 8 | 8 |
ips := Generate("127.0.0.1")
|
| 9 |
- assert.Assert(c, len(ips), check.Equals, 1) |
|
| 10 |
- assert.Assert(c, ips[0], check.Equals, "127.0.0.1") |
|
| 9 |
+ assert.Assert(c, len(ips), checker.Equals, 1) |
|
| 10 |
+ assert.Assert(c, ips[0], checker.Equals, "127.0.0.1") |
|
| 11 | 11 |
} |
| 12 | 12 |
|
| 13 | 13 |
func (s *DiscoverySuite) TestGeneratorWithPortNotGenerate(c *testing.T) {
|
| 14 | 14 |
ips := Generate("127.0.0.1:8080")
|
| 15 |
- assert.Assert(c, len(ips), check.Equals, 1) |
|
| 16 |
- assert.Assert(c, ips[0], check.Equals, "127.0.0.1:8080") |
|
| 15 |
+ assert.Assert(c, len(ips), checker.Equals, 1) |
|
| 16 |
+ assert.Assert(c, ips[0], checker.Equals, "127.0.0.1:8080") |
|
| 17 | 17 |
} |
| 18 | 18 |
|
| 19 | 19 |
func (s *DiscoverySuite) TestGeneratorMatchFailedNotGenerate(c *testing.T) {
|
| 20 | 20 |
ips := Generate("127.0.0.[1]")
|
| 21 |
- assert.Assert(c, len(ips), check.Equals, 1) |
|
| 22 |
- assert.Assert(c, ips[0], check.Equals, "127.0.0.[1]") |
|
| 21 |
+ assert.Assert(c, len(ips), checker.Equals, 1) |
|
| 22 |
+ assert.Assert(c, ips[0], checker.Equals, "127.0.0.[1]") |
|
| 23 | 23 |
} |
| 24 | 24 |
|
| 25 | 25 |
func (s *DiscoverySuite) TestGeneratorWithPort(c *testing.T) {
|
| 26 | 26 |
ips := Generate("127.0.0.[1:11]:2375")
|
| 27 |
- assert.Assert(c, len(ips), check.Equals, 11) |
|
| 28 |
- assert.Assert(c, ips[0], check.Equals, "127.0.0.1:2375") |
|
| 29 |
- assert.Assert(c, ips[1], check.Equals, "127.0.0.2:2375") |
|
| 30 |
- assert.Assert(c, ips[2], check.Equals, "127.0.0.3:2375") |
|
| 31 |
- assert.Assert(c, ips[3], check.Equals, "127.0.0.4:2375") |
|
| 32 |
- assert.Assert(c, ips[4], check.Equals, "127.0.0.5:2375") |
|
| 33 |
- assert.Assert(c, ips[5], check.Equals, "127.0.0.6:2375") |
|
| 34 |
- assert.Assert(c, ips[6], check.Equals, "127.0.0.7:2375") |
|
| 35 |
- assert.Assert(c, ips[7], check.Equals, "127.0.0.8:2375") |
|
| 36 |
- assert.Assert(c, ips[8], check.Equals, "127.0.0.9:2375") |
|
| 37 |
- assert.Assert(c, ips[9], check.Equals, "127.0.0.10:2375") |
|
| 38 |
- assert.Assert(c, ips[10], check.Equals, "127.0.0.11:2375") |
|
| 27 |
+ assert.Assert(c, len(ips), checker.Equals, 11) |
|
| 28 |
+ assert.Assert(c, ips[0], checker.Equals, "127.0.0.1:2375") |
|
| 29 |
+ assert.Assert(c, ips[1], checker.Equals, "127.0.0.2:2375") |
|
| 30 |
+ assert.Assert(c, ips[2], checker.Equals, "127.0.0.3:2375") |
|
| 31 |
+ assert.Assert(c, ips[3], checker.Equals, "127.0.0.4:2375") |
|
| 32 |
+ assert.Assert(c, ips[4], checker.Equals, "127.0.0.5:2375") |
|
| 33 |
+ assert.Assert(c, ips[5], checker.Equals, "127.0.0.6:2375") |
|
| 34 |
+ assert.Assert(c, ips[6], checker.Equals, "127.0.0.7:2375") |
|
| 35 |
+ assert.Assert(c, ips[7], checker.Equals, "127.0.0.8:2375") |
|
| 36 |
+ assert.Assert(c, ips[8], checker.Equals, "127.0.0.9:2375") |
|
| 37 |
+ assert.Assert(c, ips[9], checker.Equals, "127.0.0.10:2375") |
|
| 38 |
+ assert.Assert(c, ips[10], checker.Equals, "127.0.0.11:2375") |
|
| 39 | 39 |
} |
| 40 | 40 |
|
| 41 | 41 |
func (s *DiscoverySuite) TestGenerateWithMalformedInputAtRangeStart(c *testing.T) {
|
| 42 | 42 |
malformedInput := "127.0.0.[x:11]:2375" |
| 43 | 43 |
ips := Generate(malformedInput) |
| 44 |
- assert.Assert(c, len(ips), check.Equals, 1) |
|
| 45 |
- assert.Assert(c, ips[0], check.Equals, malformedInput) |
|
| 44 |
+ assert.Assert(c, len(ips), checker.Equals, 1) |
|
| 45 |
+ assert.Assert(c, ips[0], checker.Equals, malformedInput) |
|
| 46 | 46 |
} |
| 47 | 47 |
|
| 48 | 48 |
func (s *DiscoverySuite) TestGenerateWithMalformedInputAtRangeEnd(c *testing.T) {
|
| 49 | 49 |
malformedInput := "127.0.0.[1:x]:2375" |
| 50 | 50 |
ips := Generate(malformedInput) |
| 51 |
- assert.Assert(c, len(ips), check.Equals, 1) |
|
| 52 |
- assert.Assert(c, ips[0], check.Equals, malformedInput) |
|
| 51 |
+ assert.Assert(c, len(ips), checker.Equals, 1) |
|
| 52 |
+ assert.Assert(c, ips[0], checker.Equals, malformedInput) |
|
| 53 | 53 |
} |
| ... | ... |
@@ -30,9 +30,9 @@ func (ds *DiscoverySuite) TestInitialize(c *testing.T) {
|
| 30 | 30 |
d.store = storeMock |
| 31 | 31 |
|
| 32 | 32 |
s := d.store.(*FakeStore) |
| 33 |
- assert.Assert(c, s.Endpoints, check.HasLen, 1) |
|
| 34 |
- assert.Assert(c, s.Endpoints[0], check.Equals, "127.0.0.1") |
|
| 35 |
- assert.Assert(c, d.path, check.Equals, defaultDiscoveryPath) |
|
| 33 |
+ assert.Assert(c, s.Endpoints, checker.HasLen, 1) |
|
| 34 |
+ assert.Assert(c, s.Endpoints[0], checker.Equals, "127.0.0.1") |
|
| 35 |
+ assert.Assert(c, d.path, checker.Equals, defaultDiscoveryPath) |
|
| 36 | 36 |
|
| 37 | 37 |
storeMock = &FakeStore{
|
| 38 | 38 |
Endpoints: []string{"127.0.0.1:1234"},
|
| ... | ... |
@@ -42,9 +42,9 @@ func (ds *DiscoverySuite) TestInitialize(c *testing.T) {
|
| 42 | 42 |
d.store = storeMock |
| 43 | 43 |
|
| 44 | 44 |
s = d.store.(*FakeStore) |
| 45 |
- assert.Assert(c, s.Endpoints, check.HasLen, 1) |
|
| 46 |
- assert.Assert(c, s.Endpoints[0], check.Equals, "127.0.0.1:1234") |
|
| 47 |
- assert.Assert(c, d.path, check.Equals, "path/"+defaultDiscoveryPath) |
|
| 45 |
+ assert.Assert(c, s.Endpoints, checker.HasLen, 1) |
|
| 46 |
+ assert.Assert(c, s.Endpoints[0], checker.Equals, "127.0.0.1:1234") |
|
| 47 |
+ assert.Assert(c, d.path, checker.Equals, "path/"+defaultDiscoveryPath) |
|
| 48 | 48 |
|
| 49 | 49 |
storeMock = &FakeStore{
|
| 50 | 50 |
Endpoints: []string{"127.0.0.1:1234", "127.0.0.2:1234", "127.0.0.3:1234"},
|
| ... | ... |
@@ -54,12 +54,12 @@ func (ds *DiscoverySuite) TestInitialize(c *testing.T) {
|
| 54 | 54 |
d.store = storeMock |
| 55 | 55 |
|
| 56 | 56 |
s = d.store.(*FakeStore) |
| 57 |
- assert.Assert(c, s.Endpoints, check.HasLen, 3) |
|
| 58 |
- assert.Assert(c, s.Endpoints[0], check.Equals, "127.0.0.1:1234") |
|
| 59 |
- assert.Assert(c, s.Endpoints[1], check.Equals, "127.0.0.2:1234") |
|
| 60 |
- assert.Assert(c, s.Endpoints[2], check.Equals, "127.0.0.3:1234") |
|
| 57 |
+ assert.Assert(c, s.Endpoints, checker.HasLen, 3) |
|
| 58 |
+ assert.Assert(c, s.Endpoints[0], checker.Equals, "127.0.0.1:1234") |
|
| 59 |
+ assert.Assert(c, s.Endpoints[1], checker.Equals, "127.0.0.2:1234") |
|
| 60 |
+ assert.Assert(c, s.Endpoints[2], checker.Equals, "127.0.0.3:1234") |
|
| 61 | 61 |
|
| 62 |
- assert.Assert(c, d.path, check.Equals, "path/"+defaultDiscoveryPath) |
|
| 62 |
+ assert.Assert(c, d.path, checker.Equals, "path/"+defaultDiscoveryPath) |
|
| 63 | 63 |
} |
| 64 | 64 |
|
| 65 | 65 |
// Extremely limited mock store so we can test initialization |
| ... | ... |
@@ -181,12 +181,12 @@ BFrwkQE4HQtQBV60hYQUzzlSk44VFDz+jxIEtacRHaomDRh2FtOTz+I= |
| 181 | 181 |
-----END RSA PRIVATE KEY----- |
| 182 | 182 |
` |
| 183 | 183 |
certFile, err := ioutil.TempFile("", "cert")
|
| 184 |
- assert.Assert(c, err, check.IsNil) |
|
| 184 |
+ assert.Assert(c, err, checker.IsNil) |
|
| 185 | 185 |
defer os.Remove(certFile.Name()) |
| 186 | 186 |
certFile.Write([]byte(cert)) |
| 187 | 187 |
certFile.Close() |
| 188 | 188 |
keyFile, err := ioutil.TempFile("", "key")
|
| 189 |
- assert.Assert(c, err, check.IsNil) |
|
| 189 |
+ assert.Assert(c, err, checker.IsNil) |
|
| 190 | 190 |
defer os.Remove(keyFile.Name()) |
| 191 | 191 |
keyFile.Write([]byte(key)) |
| 192 | 192 |
keyFile.Close() |
| ... | ... |
@@ -198,11 +198,11 @@ BFrwkQE4HQtQBV60hYQUzzlSk44VFDz+jxIEtacRHaomDRh2FtOTz+I= |
| 198 | 198 |
"kv.certfile": certFile.Name(), |
| 199 | 199 |
"kv.keyfile": keyFile.Name(), |
| 200 | 200 |
}) |
| 201 |
- assert.Assert(c, err, check.IsNil) |
|
| 201 |
+ assert.Assert(c, err, checker.IsNil) |
|
| 202 | 202 |
s := d.store.(*Mock) |
| 203 |
- assert.Assert(c, s.Options.TLS, check.NotNil) |
|
| 204 |
- assert.Assert(c, s.Options.TLS.RootCAs, check.NotNil) |
|
| 205 |
- assert.Assert(c, s.Options.TLS.Certificates, check.HasLen, 1) |
|
| 203 |
+ assert.Assert(c, s.Options.TLS, checker.NotNil) |
|
| 204 |
+ assert.Assert(c, s.Options.TLS.RootCAs, checker.NotNil) |
|
| 205 |
+ assert.Assert(c, s.Options.TLS.Certificates, checker.HasLen, 1) |
|
| 206 | 206 |
} |
| 207 | 207 |
|
| 208 | 208 |
func (ds *DiscoverySuite) TestWatch(c *testing.T) {
|
| ... | ... |
@@ -239,13 +239,13 @@ func (ds *DiscoverySuite) TestWatch(c *testing.T) {
|
| 239 | 239 |
|
| 240 | 240 |
// Push the entries into the store channel and make sure discovery emits. |
| 241 | 241 |
mockCh <- kvs |
| 242 |
- assert.Assert(c, <-ch, check.DeepEquals, expected) |
|
| 242 |
+ assert.Assert(c, <-ch, checker.DeepEquals, expected) |
|
| 243 | 243 |
|
| 244 | 244 |
// Add a new entry. |
| 245 | 245 |
expected = append(expected, &discovery.Entry{Host: "3.3.3.3", Port: "3333"})
|
| 246 | 246 |
kvs = append(kvs, &store.KVPair{Key: path.Join("path", defaultDiscoveryPath, "3.3.3.3"), Value: []byte("3.3.3.3:3333")})
|
| 247 | 247 |
mockCh <- kvs |
| 248 |
- assert.Assert(c, <-ch, check.DeepEquals, expected) |
|
| 248 |
+ assert.Assert(c, <-ch, checker.DeepEquals, expected) |
|
| 249 | 249 |
|
| 250 | 250 |
close(mockCh) |
| 251 | 251 |
// Give it enough time to call WatchTree. |
| ... | ... |
@@ -253,8 +253,8 @@ func (ds *DiscoverySuite) TestWatch(c *testing.T) {
|
| 253 | 253 |
|
| 254 | 254 |
// Stop and make sure it closes all channels. |
| 255 | 255 |
close(stopCh) |
| 256 |
- assert.Assert(c, <-ch, check.IsNil) |
|
| 257 |
- assert.Assert(c, <-errCh, check.IsNil) |
|
| 256 |
+ assert.Assert(c, <-ch, checker.IsNil) |
|
| 257 |
+ assert.Assert(c, <-errCh, checker.IsNil) |
|
| 258 | 258 |
} |
| 259 | 259 |
|
| 260 | 260 |
// FakeStore implements store.Store methods. It mocks all store |
| ... | ... |
@@ -30,19 +30,19 @@ func (s *discoverySuite) TestWatch(c *testing.T) {
|
| 30 | 30 |
&discovery.Entry{Host: "1.1.1.1", Port: "1111"},
|
| 31 | 31 |
} |
| 32 | 32 |
|
| 33 |
- assert.Assert(c, d.Register("1.1.1.1:1111"), check.IsNil)
|
|
| 34 |
- assert.Assert(c, <-ch, check.DeepEquals, expected) |
|
| 33 |
+ assert.Assert(c, d.Register("1.1.1.1:1111"), checker.IsNil)
|
|
| 34 |
+ assert.Assert(c, <-ch, checker.DeepEquals, expected) |
|
| 35 | 35 |
|
| 36 | 36 |
expected = discovery.Entries{
|
| 37 | 37 |
&discovery.Entry{Host: "1.1.1.1", Port: "1111"},
|
| 38 | 38 |
&discovery.Entry{Host: "2.2.2.2", Port: "2222"},
|
| 39 | 39 |
} |
| 40 | 40 |
|
| 41 |
- assert.Assert(c, d.Register("2.2.2.2:2222"), check.IsNil)
|
|
| 42 |
- assert.Assert(c, <-ch, check.DeepEquals, expected) |
|
| 41 |
+ assert.Assert(c, d.Register("2.2.2.2:2222"), checker.IsNil)
|
|
| 42 |
+ assert.Assert(c, <-ch, checker.DeepEquals, expected) |
|
| 43 | 43 |
|
| 44 | 44 |
// Stop and make sure it closes all channels. |
| 45 | 45 |
close(stopCh) |
| 46 |
- assert.Assert(c, <-ch, check.IsNil) |
|
| 47 |
- assert.Assert(c, <-errCh, check.IsNil) |
|
| 46 |
+ assert.Assert(c, <-ch, checker.IsNil) |
|
| 47 |
+ assert.Assert(c, <-errCh, checker.IsNil) |
|
| 48 | 48 |
} |
| ... | ... |
@@ -18,20 +18,20 @@ var _ = check.Suite(&DiscoverySuite{})
|
| 18 | 18 |
func (s *DiscoverySuite) TestInitialize(c *testing.T) {
|
| 19 | 19 |
d := &Discovery{}
|
| 20 | 20 |
d.Initialize("1.1.1.1:1111,2.2.2.2:2222", 0, 0, nil)
|
| 21 |
- assert.Assert(c, len(d.entries), check.Equals, 2) |
|
| 22 |
- assert.Assert(c, d.entries[0].String(), check.Equals, "1.1.1.1:1111") |
|
| 23 |
- assert.Assert(c, d.entries[1].String(), check.Equals, "2.2.2.2:2222") |
|
| 21 |
+ assert.Assert(c, len(d.entries), checker.Equals, 2) |
|
| 22 |
+ assert.Assert(c, d.entries[0].String(), checker.Equals, "1.1.1.1:1111") |
|
| 23 |
+ assert.Assert(c, d.entries[1].String(), checker.Equals, "2.2.2.2:2222") |
|
| 24 | 24 |
} |
| 25 | 25 |
|
| 26 | 26 |
func (s *DiscoverySuite) TestInitializeWithPattern(c *testing.T) {
|
| 27 | 27 |
d := &Discovery{}
|
| 28 | 28 |
d.Initialize("1.1.1.[1:2]:1111,2.2.2.[2:4]:2222", 0, 0, nil)
|
| 29 |
- assert.Assert(c, len(d.entries), check.Equals, 5) |
|
| 30 |
- assert.Assert(c, d.entries[0].String(), check.Equals, "1.1.1.1:1111") |
|
| 31 |
- assert.Assert(c, d.entries[1].String(), check.Equals, "1.1.1.2:1111") |
|
| 32 |
- assert.Assert(c, d.entries[2].String(), check.Equals, "2.2.2.2:2222") |
|
| 33 |
- assert.Assert(c, d.entries[3].String(), check.Equals, "2.2.2.3:2222") |
|
| 34 |
- assert.Assert(c, d.entries[4].String(), check.Equals, "2.2.2.4:2222") |
|
| 29 |
+ assert.Assert(c, len(d.entries), checker.Equals, 5) |
|
| 30 |
+ assert.Assert(c, d.entries[0].String(), checker.Equals, "1.1.1.1:1111") |
|
| 31 |
+ assert.Assert(c, d.entries[1].String(), checker.Equals, "1.1.1.2:1111") |
|
| 32 |
+ assert.Assert(c, d.entries[2].String(), checker.Equals, "2.2.2.2:2222") |
|
| 33 |
+ assert.Assert(c, d.entries[3].String(), checker.Equals, "2.2.2.3:2222") |
|
| 34 |
+ assert.Assert(c, d.entries[4].String(), checker.Equals, "2.2.2.4:2222") |
|
| 35 | 35 |
} |
| 36 | 36 |
|
| 37 | 37 |
func (s *DiscoverySuite) TestWatch(c *testing.T) {
|
| ... | ... |
@@ -42,10 +42,10 @@ func (s *DiscoverySuite) TestWatch(c *testing.T) {
|
| 42 | 42 |
&discovery.Entry{Host: "2.2.2.2", Port: "2222"},
|
| 43 | 43 |
} |
| 44 | 44 |
ch, _ := d.Watch(nil) |
| 45 |
- assert.Assert(c, expected.Equals(<-ch), check.Equals, true) |
|
| 45 |
+ assert.Assert(c, expected.Equals(<-ch), checker.Equals, true) |
|
| 46 | 46 |
} |
| 47 | 47 |
|
| 48 | 48 |
func (s *DiscoverySuite) TestRegister(c *testing.T) {
|
| 49 | 49 |
d := &Discovery{}
|
| 50 |
- assert.Assert(c, d.Register("0.0.0.0"), check.NotNil)
|
|
| 50 |
+ assert.Assert(c, d.Register("0.0.0.0"), checker.NotNil)
|
|
| 51 | 51 |
} |