Browse code

update pull-local#16756

Signed-off-by: heartlock <21521209@zju.edu.cn>

heartlock authored on 2015/10/10 10:09:53
Showing 1 changed files
... ...
@@ -34,9 +34,8 @@ func (s *DockerRegistrySuite) TestPullImageWithAliases(c *check.C) {
34 34
 	dockerCmd(c, "pull", repos[0])
35 35
 	dockerCmd(c, "inspect", repos[0])
36 36
 	for _, repo := range repos[1:] {
37
-		if _, _, err := dockerCmdWithError("inspect", repo); err == nil {
38
-			c.Fatalf("Image %v shouldn't have been pulled down", repo)
39
-		}
37
+		_, _, err := dockerCmdWithError("inspect", repo)
38
+		c.Assert(err, check.NotNil, check.Commentf("Image %v shouldn't have been pulled down", repo))
40 39
 	}
41 40
 }
42 41
 
... ...
@@ -54,9 +53,7 @@ func (s *DockerRegistrySuite) TestConcurrentPullWholeRepo(c *check.C) {
54 54
 		    ENV BAR bar
55 55
 		    CMD echo %s
56 56
 		`, repo), true)
57
-		if err != nil {
58
-			c.Fatal(err)
59
-		}
57
+		c.Assert(err, check.IsNil)
60 58
 		dockerCmd(c, "push", repo)
61 59
 		repos = append(repos, repo)
62 60
 	}
... ...
@@ -87,9 +84,7 @@ func (s *DockerRegistrySuite) TestConcurrentPullWholeRepo(c *check.C) {
87 87
 	for _, repo := range repos {
88 88
 		dockerCmd(c, "inspect", repo)
89 89
 		out, _ := dockerCmd(c, "run", "--rm", repo)
90
-		if strings.TrimSpace(out) != "/bin/sh -c echo "+repo {
91
-			c.Fatalf("CMD did not contain /bin/sh -c echo %s: %s", repo, out)
92
-		}
90
+		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))
93 91
 	}
94 92
 }
95 93
 
... ...
@@ -112,9 +107,7 @@ func (s *DockerRegistrySuite) TestConcurrentFailingPull(c *check.C) {
112 112
 	// package is not goroutine-safe.
113 113
 	for i := 0; i != numPulls; i++ {
114 114
 		err := <-results
115
-		if err == nil {
116
-			c.Fatal("expected pull to fail")
117
-		}
115
+		c.Assert(err, check.NotNil, check.Commentf("expected pull to fail"))
118 116
 	}
119 117
 }
120 118
 
... ...
@@ -133,9 +126,7 @@ func (s *DockerRegistrySuite) TestConcurrentPullMultipleTags(c *check.C) {
133 133
 		    ENV BAR bar
134 134
 		    CMD echo %s
135 135
 		`, repo), true)
136
-		if err != nil {
137
-			c.Fatal(err)
138
-		}
136
+		c.Assert(err, check.IsNil)
139 137
 		dockerCmd(c, "push", repo)
140 138
 		repos = append(repos, repo)
141 139
 	}
... ...
@@ -165,8 +156,6 @@ func (s *DockerRegistrySuite) TestConcurrentPullMultipleTags(c *check.C) {
165 165
 	for _, repo := range repos {
166 166
 		dockerCmd(c, "inspect", repo)
167 167
 		out, _ := dockerCmd(c, "run", "--rm", repo)
168
-		if strings.TrimSpace(out) != "/bin/sh -c echo "+repo {
169
-			c.Fatalf("CMD did not contain /bin/sh -c echo %s: %s", repo, out)
170
-		}
168
+		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))
171 169
 	}
172 170
 }