sed -E -i 's#\bc\.Check\(#c.Assert(#g' \
-- "integration-cli/docker_cli_build_test.go" "integration-cli/docker_cli_health_test.go" "integration-cli/docker_cli_run_test.go"
Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 5879446de9adbff7432f1ccaa781164fcd5efe26)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -4373,7 +4373,7 @@ func (s *DockerSuite) TestBuildBuildTimeArgExpansion(c *check.C) {
|
| 4373 | 4373 |
) |
| 4374 | 4374 |
|
| 4375 | 4375 |
res := inspectField(c, imgName, "Config.WorkingDir") |
| 4376 |
- c.Check(filepath.ToSlash(res), check.Equals, filepath.ToSlash(wdVal)) |
|
| 4376 |
+ c.Assert(filepath.ToSlash(res), check.Equals, filepath.ToSlash(wdVal)) |
|
| 4377 | 4377 |
|
| 4378 | 4378 |
var resArr []string |
| 4379 | 4379 |
inspectFieldAndUnmarshall(c, imgName, "Config.Env", &resArr) |
| ... | ... |
@@ -20,7 +20,7 @@ func waitForHealthStatus(c *check.C, name string, prev string, expected string) |
| 20 | 20 |
if out == expected {
|
| 21 | 21 |
return |
| 22 | 22 |
} |
| 23 |
- c.Check(out, checker.Equals, prev) |
|
| 23 |
+ c.Assert(out, checker.Equals, prev) |
|
| 24 | 24 |
if out != prev {
|
| 25 | 25 |
return |
| 26 | 26 |
} |
| ... | ... |
@@ -32,7 +32,7 @@ func getHealth(c *check.C, name string) *types.Health {
|
| 32 | 32 |
out, _ := dockerCmd(c, "inspect", "--format={{json .State.Health}}", name)
|
| 33 | 33 |
var health types.Health |
| 34 | 34 |
err := json.Unmarshal([]byte(out), &health) |
| 35 |
- c.Check(err, checker.Equals, nil) |
|
| 35 |
+ c.Assert(err, checker.Equals, nil) |
|
| 36 | 36 |
return &health |
| 37 | 37 |
} |
| 38 | 38 |
|
| ... | ... |
@@ -54,12 +54,12 @@ func (s *DockerSuite) TestHealth(c *check.C) {
|
| 54 | 54 |
cid, _ := dockerCmd(c, "create", "--name", name, imageName) |
| 55 | 55 |
out, _ := dockerCmd(c, "ps", "-a", "--format={{.ID}} {{.Status}}")
|
| 56 | 56 |
out = RemoveOutputForExistingElements(out, existingContainers) |
| 57 |
- c.Check(out, checker.Equals, cid[:12]+" Created\n") |
|
| 57 |
+ c.Assert(out, checker.Equals, cid[:12]+" Created\n") |
|
| 58 | 58 |
|
| 59 | 59 |
// Inspect the options |
| 60 | 60 |
out, _ = dockerCmd(c, "inspect", |
| 61 | 61 |
"--format=timeout={{.Config.Healthcheck.Timeout}} interval={{.Config.Healthcheck.Interval}} retries={{.Config.Healthcheck.Retries}} test={{.Config.Healthcheck.Test}}", name)
|
| 62 |
- c.Check(out, checker.Equals, "timeout=30s interval=1s retries=0 test=[CMD-SHELL cat /status]\n") |
|
| 62 |
+ c.Assert(out, checker.Equals, "timeout=30s interval=1s retries=0 test=[CMD-SHELL cat /status]\n") |
|
| 63 | 63 |
|
| 64 | 64 |
// Start |
| 65 | 65 |
dockerCmd(c, "start", name) |
| ... | ... |
@@ -71,7 +71,7 @@ func (s *DockerSuite) TestHealth(c *check.C) {
|
| 71 | 71 |
|
| 72 | 72 |
// Inspect the status |
| 73 | 73 |
out, _ = dockerCmd(c, "inspect", "--format={{.State.Health.Status}}", name)
|
| 74 |
- c.Check(out, checker.Equals, "unhealthy\n") |
|
| 74 |
+ c.Assert(out, checker.Equals, "unhealthy\n") |
|
| 75 | 75 |
|
| 76 | 76 |
// Make it healthy again |
| 77 | 77 |
dockerCmd(c, "exec", name, "touch", "/status") |
| ... | ... |
@@ -83,7 +83,7 @@ func (s *DockerSuite) TestHealth(c *check.C) {
|
| 83 | 83 |
// Disable the check from the CLI |
| 84 | 84 |
dockerCmd(c, "create", "--name=noh", "--no-healthcheck", imageName) |
| 85 | 85 |
out, _ = dockerCmd(c, "inspect", "--format={{.Config.Healthcheck.Test}}", "noh")
|
| 86 |
- c.Check(out, checker.Equals, "[NONE]\n") |
|
| 86 |
+ c.Assert(out, checker.Equals, "[NONE]\n") |
|
| 87 | 87 |
dockerCmd(c, "rm", "noh") |
| 88 | 88 |
|
| 89 | 89 |
// Disable the check with a new build |
| ... | ... |
@@ -91,7 +91,7 @@ func (s *DockerSuite) TestHealth(c *check.C) {
|
| 91 | 91 |
HEALTHCHECK NONE`)) |
| 92 | 92 |
|
| 93 | 93 |
out, _ = dockerCmd(c, "inspect", "--format={{.Config.Healthcheck.Test}}", "no_healthcheck")
|
| 94 |
- c.Check(out, checker.Equals, "[NONE]\n") |
|
| 94 |
+ c.Assert(out, checker.Equals, "[NONE]\n") |
|
| 95 | 95 |
|
| 96 | 96 |
// Enable the checks from the CLI |
| 97 | 97 |
_, _ = dockerCmd(c, "run", "-d", "--name=fatal_healthcheck", |
| ... | ... |
@@ -101,11 +101,11 @@ func (s *DockerSuite) TestHealth(c *check.C) {
|
| 101 | 101 |
"no_healthcheck") |
| 102 | 102 |
waitForHealthStatus(c, "fatal_healthcheck", "starting", "healthy") |
| 103 | 103 |
health := getHealth(c, "fatal_healthcheck") |
| 104 |
- c.Check(health.Status, checker.Equals, "healthy") |
|
| 105 |
- c.Check(health.FailingStreak, checker.Equals, 0) |
|
| 104 |
+ c.Assert(health.Status, checker.Equals, "healthy") |
|
| 105 |
+ c.Assert(health.FailingStreak, checker.Equals, 0) |
|
| 106 | 106 |
last := health.Log[len(health.Log)-1] |
| 107 |
- c.Check(last.ExitCode, checker.Equals, 0) |
|
| 108 |
- c.Check(last.Output, checker.Equals, "OK\n") |
|
| 107 |
+ c.Assert(last.ExitCode, checker.Equals, 0) |
|
| 108 |
+ c.Assert(last.Output, checker.Equals, "OK\n") |
|
| 109 | 109 |
|
| 110 | 110 |
// Fail the check |
| 111 | 111 |
dockerCmd(c, "exec", "fatal_healthcheck", "rm", "/status") |
| ... | ... |
@@ -113,8 +113,8 @@ func (s *DockerSuite) TestHealth(c *check.C) {
|
| 113 | 113 |
|
| 114 | 114 |
failsStr, _ := dockerCmd(c, "inspect", "--format={{.State.Health.FailingStreak}}", "fatal_healthcheck")
|
| 115 | 115 |
fails, err := strconv.Atoi(strings.TrimSpace(failsStr)) |
| 116 |
- c.Check(err, check.IsNil) |
|
| 117 |
- c.Check(fails >= 3, checker.Equals, true) |
|
| 116 |
+ c.Assert(err, check.IsNil) |
|
| 117 |
+ c.Assert(fails >= 3, checker.Equals, true) |
|
| 118 | 118 |
dockerCmd(c, "rm", "-f", "fatal_healthcheck") |
| 119 | 119 |
|
| 120 | 120 |
// Check timeout |
| ... | ... |
@@ -125,9 +125,9 @@ func (s *DockerSuite) TestHealth(c *check.C) {
|
| 125 | 125 |
waitForHealthStatus(c, "test", "starting", "unhealthy") |
| 126 | 126 |
health = getHealth(c, "test") |
| 127 | 127 |
last = health.Log[len(health.Log)-1] |
| 128 |
- c.Check(health.Status, checker.Equals, "unhealthy") |
|
| 129 |
- c.Check(last.ExitCode, checker.Equals, -1) |
|
| 130 |
- c.Check(last.Output, checker.Equals, "Health check exceeded timeout (1s)") |
|
| 128 |
+ c.Assert(health.Status, checker.Equals, "unhealthy") |
|
| 129 |
+ c.Assert(last.ExitCode, checker.Equals, -1) |
|
| 130 |
+ c.Assert(last.Output, checker.Equals, "Health check exceeded timeout (1s)") |
|
| 131 | 131 |
dockerCmd(c, "rm", "-f", "test") |
| 132 | 132 |
|
| 133 | 133 |
// Check JSON-format |
| ... | ... |
@@ -139,7 +139,7 @@ func (s *DockerSuite) TestHealth(c *check.C) {
|
| 139 | 139 |
CMD ["cat", "/my status"]`)) |
| 140 | 140 |
out, _ = dockerCmd(c, "inspect", |
| 141 | 141 |
"--format={{.Config.Healthcheck.Test}}", imageName)
|
| 142 |
- c.Check(out, checker.Equals, "[CMD cat /my status]\n") |
|
| 142 |
+ c.Assert(out, checker.Equals, "[CMD cat /my status]\n") |
|
| 143 | 143 |
|
| 144 | 144 |
} |
| 145 | 145 |
|
| ... | ... |
@@ -4161,7 +4161,7 @@ func (s *DockerSuite) TestRunCredentialSpecFailures(c *check.C) {
|
| 4161 | 4161 |
for _, attempt := range attempts {
|
| 4162 | 4162 |
_, _, err := dockerCmdWithError("run", "--security-opt=credentialspec="+attempt.value, "busybox", "true")
|
| 4163 | 4163 |
c.Assert(err, checker.NotNil, check.Commentf("%s expected non-nil err", attempt.value))
|
| 4164 |
- c.Check(err.Error(), checker.Contains, attempt.expectedError, check.Commentf("%s expected %s got %s", attempt.value, attempt.expectedError, err))
|
|
| 4164 |
+ c.Assert(err.Error(), checker.Contains, attempt.expectedError, check.Commentf("%s expected %s got %s", attempt.value, attempt.expectedError, err))
|
|
| 4165 | 4165 |
} |
| 4166 | 4166 |
} |
| 4167 | 4167 |
|
| ... | ... |
@@ -4177,8 +4177,8 @@ func (s *DockerSuite) TestRunCredentialSpecWellFormed(c *check.C) {
|
| 4177 | 4177 |
// controller handy |
| 4178 | 4178 |
out, _ := dockerCmd(c, "run", "--rm", "--security-opt=credentialspec="+value, minimalBaseImage(), "nltest", "/PARENTDOMAIN") |
| 4179 | 4179 |
|
| 4180 |
- c.Check(out, checker.Contains, "hyperv.local.") |
|
| 4181 |
- c.Check(out, checker.Contains, "The command completed successfully") |
|
| 4180 |
+ c.Assert(out, checker.Contains, "hyperv.local.") |
|
| 4181 |
+ c.Assert(out, checker.Contains, "The command completed successfully") |
|
| 4182 | 4182 |
} |
| 4183 | 4183 |
} |
| 4184 | 4184 |
|