Use Assert statement to replace condition judgment

part of #16756
Signed-off-by: Xiaoxu Chen <chenxiaoxu14@otcaix.iscas.ac.cn>
This commit is contained in:
Xiaoxu Chen 2015-10-09 17:45:28 +08:00
parent 6654b0e05f
commit ee7fdbe8b9
1 changed files with 6 additions and 7 deletions

View File

@ -5,6 +5,7 @@ import (
"runtime"
"strings"
"github.com/docker/docker/pkg/integration/checker"
"github.com/go-check/check"
)
@ -39,17 +40,15 @@ func newDockerHubPullSuite() *DockerHubPullSuite {
func (s *DockerHubPullSuite) SetUpSuite(c *check.C) {
testRequires(c, DaemonIsLinux)
s.d = NewDaemon(c)
if err := s.d.Start(); err != nil {
c.Fatalf("starting push/pull test daemon: %v", err)
}
err := s.d.Start()
c.Assert(err, checker.IsNil, check.Commentf("starting push/pull test daemon: %v", err))
}
// TearDownSuite stops the suite daemon.
func (s *DockerHubPullSuite) TearDownSuite(c *check.C) {
if s.d != nil {
if err := s.d.Stop(); err != nil {
c.Fatalf("stopping push/pull test daemon: %v", err)
}
err := s.d.Stop()
c.Assert(err, checker.IsNil, check.Commentf("stopping push/pull test daemon: %v", err))
}
}
@ -71,7 +70,7 @@ func (s *DockerHubPullSuite) TearDownTest(c *check.C) {
// output. The function fails the test when the command returns an error.
func (s *DockerHubPullSuite) Cmd(c *check.C, name string, arg ...string) string {
out, err := s.CmdWithError(name, arg...)
c.Assert(err, check.IsNil, check.Commentf("%q failed with errors: %s, %v", strings.Join(arg, " "), out, err))
c.Assert(err, checker.IsNil, check.Commentf("%q failed with errors: %s, %v", strings.Join(arg, " "), out, err))
return out
}