Browse Source

Merge pull request #16858 from cxxly/16756-refactor-docker_cli_login_test

refactor integration-cli/docker_cli_login_test.go with Assert
Vincent Demeester 9 năm trước cách đây
mục cha
commit
1e5165275f

+ 3 - 3
integration-cli/docker_cli_login_test.go

@@ -4,6 +4,7 @@ import (
 	"bytes"
 	"bytes"
 	"os/exec"
 	"os/exec"
 
 
+	"github.com/docker/docker/pkg/integration/checker"
 	"github.com/go-check/check"
 	"github.com/go-check/check"
 )
 )
 
 
@@ -14,8 +15,7 @@ func (s *DockerSuite) TestLoginWithoutTTY(c *check.C) {
 	cmd.Stdin = bytes.NewBufferString("buffer test string \n")
 	cmd.Stdin = bytes.NewBufferString("buffer test string \n")
 
 
 	// run the command and block until it's done
 	// run the command and block until it's done
-	if err := cmd.Run(); err == nil {
-		c.Fatal("Expected non nil err when loginning in & TTY not available")
-	}
+	err := cmd.Run()
+	c.Assert(err, checker.NotNil) //"Expected non nil err when loginning in & TTY not available"
 
 
 }
 }