Browse Source

update pull-local#16756

Signed-off-by: heartlock <21521209@zju.edu.cn>
heartlock 9 years ago
parent
commit
dc9dd188cf
1 changed files with 7 additions and 18 deletions
  1. 7 18
      integration-cli/docker_cli_pull_local_test.go

+ 7 - 18
integration-cli/docker_cli_pull_local_test.go

@@ -34,9 +34,8 @@ func (s *DockerRegistrySuite) TestPullImageWithAliases(c *check.C) {
 	dockerCmd(c, "pull", repos[0])
 	dockerCmd(c, "inspect", repos[0])
 	for _, repo := range repos[1:] {
-		if _, _, err := dockerCmdWithError("inspect", repo); err == nil {
-			c.Fatalf("Image %v shouldn't have been pulled down", repo)
-		}
+		_, _, err := dockerCmdWithError("inspect", repo)
+		c.Assert(err, check.NotNil, check.Commentf("Image %v shouldn't have been pulled down", repo))
 	}
 }
 
@@ -54,9 +53,7 @@ func (s *DockerRegistrySuite) TestConcurrentPullWholeRepo(c *check.C) {
 		    ENV BAR bar
 		    CMD echo %s
 		`, repo), true)
-		if err != nil {
-			c.Fatal(err)
-		}
+		c.Assert(err, check.IsNil)
 		dockerCmd(c, "push", repo)
 		repos = append(repos, repo)
 	}
@@ -87,9 +84,7 @@ func (s *DockerRegistrySuite) TestConcurrentPullWholeRepo(c *check.C) {
 	for _, repo := range repos {
 		dockerCmd(c, "inspect", repo)
 		out, _ := dockerCmd(c, "run", "--rm", repo)
-		if strings.TrimSpace(out) != "/bin/sh -c echo "+repo {
-			c.Fatalf("CMD did not contain /bin/sh -c echo %s: %s", repo, out)
-		}
+		c.Assert(strings.TrimSpace(out), check.Equals, "/bin/sh -c echo "+repo, check.Commentf("CMD did not contain /bin/sh -c echo %s: %s", repo, out))
 	}
 }
 
@@ -112,9 +107,7 @@ func (s *DockerRegistrySuite) TestConcurrentFailingPull(c *check.C) {
 	// package is not goroutine-safe.
 	for i := 0; i != numPulls; i++ {
 		err := <-results
-		if err == nil {
-			c.Fatal("expected pull to fail")
-		}
+		c.Assert(err, check.NotNil, check.Commentf("expected pull to fail"))
 	}
 }
 
@@ -133,9 +126,7 @@ func (s *DockerRegistrySuite) TestConcurrentPullMultipleTags(c *check.C) {
 		    ENV BAR bar
 		    CMD echo %s
 		`, repo), true)
-		if err != nil {
-			c.Fatal(err)
-		}
+		c.Assert(err, check.IsNil)
 		dockerCmd(c, "push", repo)
 		repos = append(repos, repo)
 	}
@@ -165,8 +156,6 @@ func (s *DockerRegistrySuite) TestConcurrentPullMultipleTags(c *check.C) {
 	for _, repo := range repos {
 		dockerCmd(c, "inspect", repo)
 		out, _ := dockerCmd(c, "run", "--rm", repo)
-		if strings.TrimSpace(out) != "/bin/sh -c echo "+repo {
-			c.Fatalf("CMD did not contain /bin/sh -c echo %s: %s", repo, out)
-		}
+		c.Assert(strings.TrimSpace(out), check.Equals, "/bin/sh -c echo "+repo, check.Commentf("CMD did not contain /bin/sh -c echo %s; %s", repo, out))
 	}
 }