Browse code

Use Assert statement to replace condition judgment part of #16756 Signed-off-by: Xiaoxu Chen <chenxiaoxu14@otcaix.iscas.ac.cn>

Xiaoxu Chen authored on 2015/10/09 18:45:28
Showing 1 changed files
... ...
@@ -5,6 +5,7 @@ import (
5 5
 	"runtime"
6 6
 	"strings"
7 7
 
8
+	"github.com/docker/docker/pkg/integration/checker"
8 9
 	"github.com/go-check/check"
9 10
 )
10 11
 
... ...
@@ -39,17 +40,15 @@ func newDockerHubPullSuite() *DockerHubPullSuite {
39 39
 func (s *DockerHubPullSuite) SetUpSuite(c *check.C) {
40 40
 	testRequires(c, DaemonIsLinux)
41 41
 	s.d = NewDaemon(c)
42
-	if err := s.d.Start(); err != nil {
43
-		c.Fatalf("starting push/pull test daemon: %v", err)
44
-	}
42
+	err := s.d.Start()
43
+	c.Assert(err, checker.IsNil, check.Commentf("starting push/pull test daemon: %v", err))
45 44
 }
46 45
 
47 46
 // TearDownSuite stops the suite daemon.
48 47
 func (s *DockerHubPullSuite) TearDownSuite(c *check.C) {
49 48
 	if s.d != nil {
50
-		if err := s.d.Stop(); err != nil {
51
-			c.Fatalf("stopping push/pull test daemon: %v", err)
52
-		}
49
+		err := s.d.Stop()
50
+		c.Assert(err, checker.IsNil, check.Commentf("stopping push/pull test daemon: %v", err))
53 51
 	}
54 52
 }
55 53
 
... ...
@@ -71,7 +70,7 @@ func (s *DockerHubPullSuite) TearDownTest(c *check.C) {
71 71
 // output. The function fails the test when the command returns an error.
72 72
 func (s *DockerHubPullSuite) Cmd(c *check.C, name string, arg ...string) string {
73 73
 	out, err := s.CmdWithError(name, arg...)
74
-	c.Assert(err, check.IsNil, check.Commentf("%q failed with errors: %s, %v", strings.Join(arg, " "), out, err))
74
+	c.Assert(err, checker.IsNil, check.Commentf("%q failed with errors: %s, %v", strings.Join(arg, " "), out, err))
75 75
 	return out
76 76
 }
77 77