Browse code

use gotest.tools assertions in docker_cli_push_test.go

Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 0811297608499e8be473473b80eaac9d2ced9dd8)
Signed-off-by: Tibor Vass <tibor@docker.com>

Tibor Vass authored on 2019/06/15 11:12:26
Showing 1 changed files
... ...
@@ -252,31 +252,31 @@ func (s *DockerSchema1RegistrySuite) TestCrossRepositoryLayerPushNotSupported(c
252 252
 	dockerCmd(c, "tag", "busybox", sourceRepoName)
253 253
 	// push the image to the registry
254 254
 	out1, _, err := dockerCmdWithError("push", sourceRepoName)
255
-	c.Assert(err, check.IsNil, check.Commentf("pushing the image to the private registry has failed: %s", out1))
255
+	assert.NilError(c, err, fmt.Sprintf("pushing the image to the private registry has failed: %s", out1))
256 256
 	// ensure that none of the layers were mounted from another repository during push
257
-	c.Assert(strings.Contains(out1, "Mounted from"), check.Equals, false)
257
+	assert.Assert(c, !strings.Contains(out1, "Mounted from"))
258 258
 
259 259
 	digest1 := reference.DigestRegexp.FindString(out1)
260
-	c.Assert(len(digest1), checker.GreaterThan, 0, check.Commentf("no digest found for pushed manifest"))
260
+	assert.Assert(c, len(digest1) > 0, "no digest found for pushed manifest")
261 261
 
262 262
 	destRepoName := fmt.Sprintf("%v/dockercli/crossrepopush", privateRegistryURL)
263 263
 	// retag the image to upload the same layers to another repo in the same registry
264 264
 	dockerCmd(c, "tag", "busybox", destRepoName)
265 265
 	// push the image to the registry
266 266
 	out2, _, err := dockerCmdWithError("push", destRepoName)
267
-	c.Assert(err, check.IsNil, check.Commentf("pushing the image to the private registry has failed: %s", out2))
267
+	assert.NilError(c, err, fmt.Sprintf("pushing the image to the private registry has failed: %s", out2))
268 268
 	// schema1 registry should not support cross-repo layer mounts, so ensure that this does not happen
269
-	c.Assert(strings.Contains(out2, "Mounted from"), check.Equals, false)
269
+	assert.Assert(c, !strings.Contains(out2, "Mounted from"))
270 270
 
271 271
 	digest2 := reference.DigestRegexp.FindString(out2)
272
-	c.Assert(len(digest2), checker.GreaterThan, 0, check.Commentf("no digest found for pushed manifest"))
273
-	c.Assert(digest1, check.Not(check.Equals), digest2)
272
+	assert.Assert(c, len(digest2) > 0, "no digest found for pushed manifest")
273
+	assert.Assert(c, digest1 != digest2)
274 274
 
275 275
 	// ensure that we can pull and run the second pushed repository
276 276
 	dockerCmd(c, "rmi", destRepoName)
277 277
 	dockerCmd(c, "pull", destRepoName)
278 278
 	out3, _ := dockerCmd(c, "run", destRepoName, "echo", "-n", "hello world")
279
-	c.Assert(out3, check.Equals, "hello world")
279
+	assert.Assert(c, out3 == "hello world")
280 280
 }
281 281
 
282 282
 func (s *DockerRegistryAuthHtpasswdSuite) TestPushNoCredentialsNoRetry(c *check.C) {