Jelajahi Sumber

Merge pull request #39001 from thaJeztah/reduce_checkers

Remove some checkers and use gotest.tools
Brian Goff 6 tahun lalu
induk
melakukan
e2458561f9
83 mengubah file dengan 2763 tambahan dan 2880 penghapusan
  1. 2 2
      integration-cli/benchmark_test.go
  2. 4 4
      integration-cli/check_test.go
  3. 11 33
      integration-cli/checker/checker.go
  4. 1 2
      integration-cli/daemon/daemon.go
  5. 3 4
      integration-cli/daemon/daemon_swarm.go
  6. 36 35
      integration-cli/docker_api_attach_test.go
  7. 52 55
      integration-cli/docker_api_build_test.go
  8. 2 3
      integration-cli/docker_api_build_windows_test.go
  9. 155 155
      integration-cli/docker_api_containers_test.go
  10. 5 5
      integration-cli/docker_api_exec_resize_test.go
  11. 43 49
      integration-cli/docker_api_exec_test.go
  12. 35 35
      integration-cli/docker_api_images_test.go
  13. 23 24
      integration-cli/docker_api_inspect_test.go
  14. 24 25
      integration-cli/docker_api_logs_test.go
  15. 60 58
      integration-cli/docker_api_network_test.go
  16. 29 32
      integration-cli/docker_api_stats_test.go
  17. 40 39
      integration-cli/docker_api_swarm_service_test.go
  18. 101 110
      integration-cli/docker_api_swarm_test.go
  19. 34 34
      integration-cli/docker_api_test.go
  20. 6 5
      integration-cli/docker_cli_attach_test.go
  21. 20 20
      integration-cli/docker_cli_attach_unix_test.go
  22. 39 38
      integration-cli/docker_cli_build_test.go
  23. 5 4
      integration-cli/docker_cli_build_unix_test.go
  24. 37 39
      integration-cli/docker_cli_by_digest_test.go
  25. 4 3
      integration-cli/docker_cli_cp_from_container_test.go
  26. 116 176
      integration-cli/docker_cli_cp_test.go
  27. 6 5
      integration-cli/docker_cli_cp_to_container_test.go
  28. 10 10
      integration-cli/docker_cli_cp_to_container_unix_test.go
  29. 7 7
      integration-cli/docker_cli_cp_utils_test.go
  30. 11 10
      integration-cli/docker_cli_create_test.go
  31. 32 32
      integration-cli/docker_cli_daemon_plugins_test.go
  32. 152 156
      integration-cli/docker_cli_daemon_test.go
  33. 87 113
      integration-cli/docker_cli_events_test.go
  34. 74 76
      integration-cli/docker_cli_events_unix_test.go
  35. 71 79
      integration-cli/docker_cli_exec_test.go
  36. 11 11
      integration-cli/docker_cli_exec_unix_test.go
  37. 36 35
      integration-cli/docker_cli_external_volume_driver_unix_test.go
  38. 10 8
      integration-cli/docker_cli_images_test.go
  39. 10 9
      integration-cli/docker_cli_import_test.go
  40. 15 14
      integration-cli/docker_cli_info_test.go
  41. 33 33
      integration-cli/docker_cli_inspect_test.go
  42. 5 4
      integration-cli/docker_cli_links_test.go
  43. 5 4
      integration-cli/docker_cli_login_test.go
  44. 28 27
      integration-cli/docker_cli_logout_test.go
  45. 44 44
      integration-cli/docker_cli_logs_test.go
  46. 104 103
      integration-cli/docker_cli_network_unix_test.go
  47. 7 7
      integration-cli/docker_cli_plugins_logdriver_test.go
  48. 71 70
      integration-cli/docker_cli_plugins_test.go
  49. 11 10
      integration-cli/docker_cli_port_test.go
  50. 3 3
      integration-cli/docker_cli_proxy_test.go
  51. 27 26
      integration-cli/docker_cli_prune_unix_test.go
  52. 27 25
      integration-cli/docker_cli_ps_test.go
  53. 23 22
      integration-cli/docker_cli_pull_local_test.go
  54. 34 31
      integration-cli/docker_cli_pull_test.go
  55. 47 46
      integration-cli/docker_cli_push_test.go
  56. 7 6
      integration-cli/docker_cli_registry_user_agent_test.go
  57. 65 64
      integration-cli/docker_cli_restart_test.go
  58. 8 7
      integration-cli/docker_cli_rmi_test.go
  59. 113 112
      integration-cli/docker_cli_run_test.go
  60. 103 102
      integration-cli/docker_cli_run_unix_test.go
  61. 29 26
      integration-cli/docker_cli_save_load_test.go
  62. 14 14
      integration-cli/docker_cli_save_load_unix_test.go
  63. 31 31
      integration-cli/docker_cli_search_test.go
  64. 47 46
      integration-cli/docker_cli_service_create_test.go
  65. 3 2
      integration-cli/docker_cli_service_health_test.go
  66. 34 33
      integration-cli/docker_cli_service_logs_test.go
  67. 7 7
      integration-cli/docker_cli_service_scale_test.go
  68. 4 3
      integration-cli/docker_cli_sni_test.go
  69. 7 6
      integration-cli/docker_cli_start_test.go
  70. 26 24
      integration-cli/docker_cli_stats_test.go
  71. 172 171
      integration-cli/docker_cli_swarm_test.go
  72. 16 15
      integration-cli/docker_cli_swarm_unix_test.go
  73. 6 6
      integration-cli/docker_cli_top_test.go
  74. 56 58
      integration-cli/docker_cli_update_unix_test.go
  75. 11 9
      integration-cli/docker_cli_userns_test.go
  76. 4 3
      integration-cli/docker_cli_v2_only_test.go
  77. 22 37
      integration-cli/docker_cli_volume_test.go
  78. 47 46
      integration-cli/docker_deprecated_api_v124_test.go
  79. 6 6
      integration-cli/docker_deprecated_api_v124_unix_test.go
  80. 17 17
      integration-cli/docker_utils_test.go
  81. 7 7
      integration-cli/events_utils_test.go
  82. 12 12
      integration-cli/fixtures_linux_daemon_test.go
  83. 1 1
      vendor.conf

+ 2 - 2
integration-cli/benchmark_test.go

@@ -8,8 +8,8 @@ import (
 	"strings"
 	"sync"
 
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 func (s *DockerSuite) BenchmarkConcurrentContainerActions(c *check.C) {
@@ -90,6 +90,6 @@ func (s *DockerSuite) BenchmarkConcurrentContainerActions(c *check.C) {
 	close(chErr)
 
 	for err := range chErr {
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 	}
 }

+ 4 - 4
integration-cli/check_test.go

@@ -14,7 +14,6 @@ import (
 	"testing"
 	"time"
 
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli"
 	"github.com/docker/docker/integration-cli/daemon"
 	"github.com/docker/docker/integration-cli/environment"
@@ -25,6 +24,7 @@ import (
 	"github.com/docker/docker/internal/test/registry"
 	"github.com/docker/docker/pkg/reexec"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 const (
@@ -167,7 +167,7 @@ func (s *DockerRegistryAuthHtpasswdSuite) SetUpTest(c *check.C) {
 func (s *DockerRegistryAuthHtpasswdSuite) TearDownTest(c *check.C) {
 	if s.reg != nil {
 		out, err := s.d.Cmd("logout", privateRegistryURL)
-		c.Assert(err, check.IsNil, check.Commentf("%s", out))
+		assert.NilError(c, err, out)
 		s.reg.Close()
 	}
 	if s.d != nil {
@@ -200,7 +200,7 @@ func (s *DockerRegistryAuthTokenSuite) SetUpTest(c *check.C) {
 func (s *DockerRegistryAuthTokenSuite) TearDownTest(c *check.C) {
 	if s.reg != nil {
 		out, err := s.d.Cmd("logout", privateRegistryURL)
-		c.Assert(err, check.IsNil, check.Commentf("%s", out))
+		assert.NilError(c, err, out)
 		s.reg.Close()
 	}
 	if s.d != nil {
@@ -358,7 +358,7 @@ func (ps *DockerPluginSuite) SetUpSuite(c *check.C) {
 	defer cancel()
 
 	err := plugin.CreateInRegistry(ctx, ps.getPluginRepo(), nil)
-	c.Assert(err, checker.IsNil, check.Commentf("failed to create plugin"))
+	assert.NilError(c, err, "failed to create plugin")
 }
 
 func (ps *DockerPluginSuite) TearDownSuite(c *check.C) {

+ 11 - 33
integration-cli/checker/checker.go

@@ -9,38 +9,16 @@ import (
 // As a commodity, we bring all check.Checker variables into the current namespace to avoid having
 // to think about check.X versus checker.X.
 var (
-	DeepEquals   = check.DeepEquals
-	ErrorMatches = check.ErrorMatches
-	FitsTypeOf   = check.FitsTypeOf
-	HasLen       = check.HasLen
-	Implements   = check.Implements
-	IsNil        = check.IsNil
-	Matches      = check.Matches
-	Not          = check.Not
-	NotNil       = check.NotNil
-	PanicMatches = check.PanicMatches
-	Panics       = check.Panics
+	DeepEquals = check.DeepEquals
+	HasLen     = check.HasLen
+	IsNil      = check.IsNil
+	Matches    = check.Matches
+	Not        = check.Not
+	NotNil     = check.NotNil
 
-	Contains           = shakers.Contains
-	ContainsAny        = shakers.ContainsAny
-	Count              = shakers.Count
-	Equals             = shakers.Equals
-	EqualFold          = shakers.EqualFold
-	False              = shakers.False
-	GreaterOrEqualThan = shakers.GreaterOrEqualThan
-	GreaterThan        = shakers.GreaterThan
-	HasPrefix          = shakers.HasPrefix
-	HasSuffix          = shakers.HasSuffix
-	Index              = shakers.Index
-	IndexAny           = shakers.IndexAny
-	IsAfter            = shakers.IsAfter
-	IsBefore           = shakers.IsBefore
-	IsBetween          = shakers.IsBetween
-	IsLower            = shakers.IsLower
-	IsUpper            = shakers.IsUpper
-	LessOrEqualThan    = shakers.LessOrEqualThan
-	LessThan           = shakers.LessThan
-	TimeEquals         = shakers.TimeEquals
-	True               = shakers.True
-	TimeIgnore         = shakers.TimeIgnore
+	Contains    = shakers.Contains
+	Equals      = shakers.Equals
+	False       = shakers.False
+	GreaterThan = shakers.GreaterThan
+	True        = shakers.True
 )

+ 1 - 2
integration-cli/daemon/daemon.go

@@ -5,7 +5,6 @@ import (
 	"strings"
 	"time"
 
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/internal/test/daemon"
 	"github.com/go-check/check"
 	"github.com/pkg/errors"
@@ -91,7 +90,7 @@ func (d *Daemon) inspectFieldWithError(name, field string) (string, error) {
 // FIXME(vdemeester) should re-use ActivateContainers in some way
 func (d *Daemon) CheckActiveContainerCount(c *check.C) (interface{}, check.CommentInterface) {
 	out, err := d.Cmd("ps", "-q")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	if len(strings.TrimSpace(out)) == 0 {
 		return 0, nil
 	}

+ 3 - 4
integration-cli/daemon/daemon_swarm.go

@@ -9,7 +9,6 @@ import (
 	"github.com/docker/docker/api/types/filters"
 	"github.com/docker/docker/api/types/swarm"
 	"github.com/docker/docker/client"
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/go-check/check"
 	"gotest.tools/assert"
 )
@@ -111,7 +110,7 @@ func (d *Daemon) CheckRunningTaskNetworks(c *check.C) (interface{}, check.Commen
 	}
 
 	tasks, err := cli.TaskList(context.Background(), options)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	result := make(map[string]int)
 	for _, task := range tasks {
@@ -135,7 +134,7 @@ func (d *Daemon) CheckRunningTaskImages(c *check.C) (interface{}, check.CommentI
 	}
 
 	tasks, err := cli.TaskList(context.Background(), options)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	result := make(map[string]int)
 	for _, task := range tasks {
@@ -167,7 +166,7 @@ func (d *Daemon) CheckLocalNodeState(c *check.C) (interface{}, check.CommentInte
 // CheckControlAvailable returns the current swarm control available
 func (d *Daemon) CheckControlAvailable(c *check.C) (interface{}, check.CommentInterface) {
 	info := d.SwarmInfo(c)
-	c.Assert(info.LocalNodeState, checker.Equals, swarm.LocalNodeStateActive)
+	assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive)
 	return info.ControlAvailable, nil
 }
 

+ 36 - 35
integration-cli/docker_api_attach_test.go

@@ -14,12 +14,13 @@ import (
 
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/client"
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/internal/test/request"
 	"github.com/docker/docker/pkg/stdcopy"
 	"github.com/go-check/check"
 	"github.com/pkg/errors"
 	"golang.org/x/net/websocket"
+	"gotest.tools/assert"
+	is "gotest.tools/assert/cmp"
 )
 
 func (s *DockerSuite) TestGetContainersAttachWebsocket(c *check.C) {
@@ -27,17 +28,17 @@ func (s *DockerSuite) TestGetContainersAttachWebsocket(c *check.C) {
 	out, _ := dockerCmd(c, "run", "-dit", "busybox", "cat")
 
 	rwc, err := request.SockConn(time.Duration(10*time.Second), request.DaemonHost())
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	cleanedContainerID := strings.TrimSpace(out)
 	config, err := websocket.NewConfig(
 		"/containers/"+cleanedContainerID+"/attach/ws?stream=1&stdin=1&stdout=1&stderr=1",
 		"http://localhost",
 	)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	ws, err := websocket.NewClient(config, rwc)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer ws.Close()
 
 	expected := []byte("hello")
@@ -59,41 +60,41 @@ func (s *DockerSuite) TestGetContainersAttachWebsocket(c *check.C) {
 
 	select {
 	case err := <-inChan:
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 	case <-time.After(5 * time.Second):
 		c.Fatal("Timeout writing to ws")
 	}
 
 	select {
 	case err := <-outChan:
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 	case <-time.After(5 * time.Second):
 		c.Fatal("Timeout reading from ws")
 	}
 
-	c.Assert(actual, checker.DeepEquals, expected, check.Commentf("Websocket didn't return the expected data"))
+	assert.Assert(c, is.DeepEqual(actual, expected), "Websocket didn't return the expected data")
 }
 
 // regression gh14320
 func (s *DockerSuite) TestPostContainersAttachContainerNotFound(c *check.C) {
 	resp, _, err := request.Post("/containers/doesnotexist/attach")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	// connection will shutdown, err should be "persistent connection closed"
-	c.Assert(resp.StatusCode, checker.Equals, http.StatusNotFound)
+	assert.Equal(c, resp.StatusCode, http.StatusNotFound)
 	content, err := request.ReadBody(resp.Body)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	expected := "No such container: doesnotexist\r\n"
-	c.Assert(string(content), checker.Equals, expected)
+	assert.Equal(c, string(content), expected)
 }
 
 func (s *DockerSuite) TestGetContainersWsAttachContainerNotFound(c *check.C) {
 	res, body, err := request.Get("/containers/doesnotexist/attach/ws")
-	c.Assert(res.StatusCode, checker.Equals, http.StatusNotFound)
-	c.Assert(err, checker.IsNil)
+	assert.Equal(c, res.StatusCode, http.StatusNotFound)
+	assert.NilError(c, err)
 	b, err := request.ReadBody(body)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	expected := "No such container: doesnotexist"
-	c.Assert(getErrorMessage(c, b), checker.Contains, expected)
+	assert.Assert(c, strings.Contains(getErrorMessage(c, b), expected))
 }
 
 func (s *DockerSuite) TestPostContainersAttach(c *check.C) {
@@ -103,7 +104,7 @@ func (s *DockerSuite) TestPostContainersAttach(c *check.C) {
 		defer conn.Close()
 		expected := []byte("success")
 		_, err := conn.Write(expected)
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 
 		conn.SetReadDeadline(time.Now().Add(time.Second))
 		lenHeader := 0
@@ -112,29 +113,29 @@ func (s *DockerSuite) TestPostContainersAttach(c *check.C) {
 		}
 		actual := make([]byte, len(expected)+lenHeader)
 		_, err = io.ReadFull(br, actual)
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 		if !tty {
 			fdMap := map[string]byte{
 				"stdin":  0,
 				"stdout": 1,
 				"stderr": 2,
 			}
-			c.Assert(actual[0], checker.Equals, fdMap[stream])
+			assert.Equal(c, actual[0], fdMap[stream])
 		}
-		c.Assert(actual[lenHeader:], checker.DeepEquals, expected, check.Commentf("Attach didn't return the expected data from %s", stream))
+		assert.Assert(c, is.DeepEqual(actual[lenHeader:], expected), "Attach didn't return the expected data from %s", stream)
 	}
 
 	expectTimeout := func(conn net.Conn, br *bufio.Reader, stream string) {
 		defer conn.Close()
 		_, err := conn.Write([]byte{'t'})
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 
 		conn.SetReadDeadline(time.Now().Add(time.Second))
 		actual := make([]byte, 1)
 		_, err = io.ReadFull(br, actual)
 		opErr, ok := err.(*net.OpError)
-		c.Assert(ok, checker.Equals, true, check.Commentf("Error is expected to be *net.OpError, got %v", err))
-		c.Assert(opErr.Timeout(), checker.Equals, true, check.Commentf("Read from %s is expected to timeout", stream))
+		assert.Assert(c, ok, "Error is expected to be *net.OpError, got %v", err)
+		assert.Assert(c, opErr.Timeout(), "Read from %s is expected to timeout", stream)
 	}
 
 	// Create a container that only emits stdout.
@@ -142,12 +143,12 @@ func (s *DockerSuite) TestPostContainersAttach(c *check.C) {
 	cid = strings.TrimSpace(cid)
 	// Attach to the container's stdout stream.
 	conn, br, err := sockRequestHijack("POST", "/containers/"+cid+"/attach?stream=1&stdin=1&stdout=1", nil, "text/plain", request.DaemonHost())
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	// Check if the data from stdout can be received.
 	expectSuccess(conn, br, "stdout", false)
 	// Attach to the container's stderr stream.
 	conn, br, err = sockRequestHijack("POST", "/containers/"+cid+"/attach?stream=1&stdin=1&stderr=1", nil, "text/plain", request.DaemonHost())
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	// Since the container only emits stdout, attaching to stderr should return nothing.
 	expectTimeout(conn, br, "stdout")
 
@@ -155,10 +156,10 @@ func (s *DockerSuite) TestPostContainersAttach(c *check.C) {
 	cid, _ = dockerCmd(c, "run", "-di", "busybox", "/bin/sh", "-c", "cat >&2")
 	cid = strings.TrimSpace(cid)
 	conn, br, err = sockRequestHijack("POST", "/containers/"+cid+"/attach?stream=1&stdin=1&stderr=1", nil, "text/plain", request.DaemonHost())
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	expectSuccess(conn, br, "stderr", false)
 	conn, br, err = sockRequestHijack("POST", "/containers/"+cid+"/attach?stream=1&stdin=1&stdout=1", nil, "text/plain", request.DaemonHost())
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	expectTimeout(conn, br, "stderr")
 
 	// Test with tty.
@@ -166,19 +167,19 @@ func (s *DockerSuite) TestPostContainersAttach(c *check.C) {
 	cid = strings.TrimSpace(cid)
 	// Attach to stdout only.
 	conn, br, err = sockRequestHijack("POST", "/containers/"+cid+"/attach?stream=1&stdin=1&stdout=1", nil, "text/plain", request.DaemonHost())
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	expectSuccess(conn, br, "stdout", true)
 
 	// Attach without stdout stream.
 	conn, br, err = sockRequestHijack("POST", "/containers/"+cid+"/attach?stream=1&stdin=1&stderr=1", nil, "text/plain", request.DaemonHost())
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	// Nothing should be received because both the stdout and stderr of the container will be
 	// sent to the client as stdout when tty is enabled.
 	expectTimeout(conn, br, "stdout")
 
 	// Test the client API
 	client, err := client.NewClientWithOpts(client.FromEnv)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer client.Close()
 
 	cid, _ = dockerCmd(c, "run", "-di", "busybox", "/bin/sh", "-c", "echo hello; cat")
@@ -194,19 +195,19 @@ func (s *DockerSuite) TestPostContainersAttach(c *check.C) {
 	}
 
 	resp, err := client.ContainerAttach(context.Background(), cid, attachOpts)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	expectSuccess(resp.Conn, resp.Reader, "stdout", false)
 
 	// Make sure we do see "hello" if Logs is true
 	attachOpts.Logs = true
 	resp, err = client.ContainerAttach(context.Background(), cid, attachOpts)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	defer resp.Conn.Close()
 	resp.Conn.SetReadDeadline(time.Now().Add(time.Second))
 
 	_, err = resp.Conn.Write([]byte("success"))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	var outBuf, errBuf bytes.Buffer
 	_, err = stdcopy.StdCopy(&outBuf, &errBuf, resp.Reader)
@@ -214,9 +215,9 @@ func (s *DockerSuite) TestPostContainersAttach(c *check.C) {
 		// ignore the timeout error as it is expected
 		err = nil
 	}
-	c.Assert(err, checker.IsNil)
-	c.Assert(errBuf.String(), checker.Equals, "")
-	c.Assert(outBuf.String(), checker.Equals, "hello\nsuccess")
+	assert.NilError(c, err)
+	assert.Equal(c, errBuf.String(), "")
+	assert.Equal(c, outBuf.String(), "hello\nsuccess")
 }
 
 // SockRequestHijack creates a connection to specified host (with method, contenttype, …) and returns a hijacked connection

+ 52 - 55
integration-cli/docker_api_build_test.go

@@ -13,7 +13,6 @@ import (
 	"strings"
 
 	"github.com/docker/docker/api/types"
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/internal/test/fakecontext"
 	"github.com/docker/docker/internal/test/fakegit"
 	"github.com/docker/docker/internal/test/fakestorage"
@@ -41,17 +40,17 @@ RUN find /tmp/`
 	defer server.Close()
 
 	res, body, err := request.Post("/build?dockerfile=baz&remote="+server.URL()+"/testD", request.JSON)
-	c.Assert(err, checker.IsNil)
-	c.Assert(res.StatusCode, checker.Equals, http.StatusOK)
+	assert.NilError(c, err)
+	assert.Equal(c, res.StatusCode, http.StatusOK)
 
 	buf, err := request.ReadBody(body)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	// Make sure Dockerfile exists.
 	// Make sure 'baz' doesn't exist ANYWHERE despite being mentioned in the URL
 	out := string(buf)
-	c.Assert(out, checker.Contains, "RUN find /tmp")
-	c.Assert(out, checker.Not(checker.Contains), "baz")
+	assert.Assert(c, is.Contains(out, "RUN find /tmp"))
+	assert.Assert(c, !strings.Contains(out, "baz"))
 }
 
 func (s *DockerSuite) TestBuildAPIRemoteTarballContext(c *check.C) {
@@ -64,15 +63,11 @@ func (s *DockerSuite) TestBuildAPIRemoteTarballContext(c *check.C) {
 		Name: "Dockerfile",
 		Size: int64(len(dockerfile)),
 	})
-	// failed to write tar file header
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err, "failed to write tar file header")
 
 	_, err = tw.Write(dockerfile)
-	// failed to write tar file content
-	c.Assert(err, checker.IsNil)
-
-	// failed to close tar archive
-	c.Assert(tw.Close(), checker.IsNil)
+	assert.NilError(c, err, "failed to write tar file content")
+	assert.NilError(c, tw.Close(), "failed to close tar archive")
 
 	server := fakestorage.New(c, "", fakecontext.WithBinaryFiles(map[string]*bytes.Buffer{
 		"testT.tar": buffer,
@@ -80,8 +75,8 @@ func (s *DockerSuite) TestBuildAPIRemoteTarballContext(c *check.C) {
 	defer server.Close()
 
 	res, b, err := request.Post("/build?remote="+server.URL()+"/testT.tar", request.ContentType("application/tar"))
-	c.Assert(err, checker.IsNil)
-	c.Assert(res.StatusCode, checker.Equals, http.StatusOK)
+	assert.NilError(c, err)
+	assert.Equal(c, res.StatusCode, http.StatusOK)
 	b.Close()
 }
 
@@ -97,11 +92,11 @@ RUN echo 'wrong'`)
 		Size: int64(len(dockerfile)),
 	})
 	// failed to write tar file header
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	_, err = tw.Write(dockerfile)
 	// failed to write tar file content
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	custom := []byte(`FROM busybox
 RUN echo 'right'
@@ -112,14 +107,14 @@ RUN echo 'right'
 	})
 
 	// failed to write tar file header
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	_, err = tw.Write(custom)
 	// failed to write tar file content
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	// failed to close tar archive
-	c.Assert(tw.Close(), checker.IsNil)
+	assert.NilError(c, tw.Close())
 
 	server := fakestorage.New(c, "", fakecontext.WithBinaryFiles(map[string]*bytes.Buffer{
 		"testT.tar": buffer,
@@ -128,15 +123,15 @@ RUN echo 'right'
 
 	url := "/build?dockerfile=custom&remote=" + server.URL() + "/testT.tar"
 	res, body, err := request.Post(url, request.ContentType("application/tar"))
-	c.Assert(err, checker.IsNil)
-	c.Assert(res.StatusCode, checker.Equals, http.StatusOK)
+	assert.NilError(c, err)
+	assert.Equal(c, res.StatusCode, http.StatusOK)
 
 	defer body.Close()
 	content, err := request.ReadBody(body)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	// Build used the wrong dockerfile.
-	c.Assert(string(content), checker.Not(checker.Contains), "wrong")
+	assert.Assert(c, !strings.Contains(string(content), "wrong"))
 }
 
 func (s *DockerSuite) TestBuildAPILowerDockerfile(c *check.C) {
@@ -147,14 +142,14 @@ RUN echo from dockerfile`,
 	defer git.Close()
 
 	res, body, err := request.Post("/build?remote="+git.RepoURL, request.JSON)
-	c.Assert(err, checker.IsNil)
-	c.Assert(res.StatusCode, checker.Equals, http.StatusOK)
+	assert.NilError(c, err)
+	assert.Equal(c, res.StatusCode, http.StatusOK)
 
 	buf, err := request.ReadBody(body)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out := string(buf)
-	c.Assert(out, checker.Contains, "from dockerfile")
+	assert.Assert(c, is.Contains(out, "from dockerfile"))
 }
 
 func (s *DockerSuite) TestBuildAPIBuildGitWithF(c *check.C) {
@@ -168,14 +163,14 @@ RUN echo from Dockerfile`,
 
 	// Make sure it tries to 'dockerfile' query param value
 	res, body, err := request.Post("/build?dockerfile=baz&remote="+git.RepoURL, request.JSON)
-	c.Assert(err, checker.IsNil)
-	c.Assert(res.StatusCode, checker.Equals, http.StatusOK)
+	assert.NilError(c, err)
+	assert.Equal(c, res.StatusCode, http.StatusOK)
 
 	buf, err := request.ReadBody(body)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out := string(buf)
-	c.Assert(out, checker.Contains, "from baz")
+	assert.Assert(c, is.Contains(out, "from baz"))
 }
 
 func (s *DockerSuite) TestBuildAPIDoubleDockerfile(c *check.C) {
@@ -190,14 +185,14 @@ RUN echo from dockerfile`,
 
 	// Make sure it tries to 'dockerfile' query param value
 	res, body, err := request.Post("/build?remote="+git.RepoURL, request.JSON)
-	c.Assert(err, checker.IsNil)
-	c.Assert(res.StatusCode, checker.Equals, http.StatusOK)
+	assert.NilError(c, err)
+	assert.Equal(c, res.StatusCode, http.StatusOK)
 
 	buf, err := request.ReadBody(body)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out := string(buf)
-	c.Assert(out, checker.Contains, "from Dockerfile")
+	assert.Assert(c, is.Contains(out, "from Dockerfile"))
 }
 
 func (s *DockerSuite) TestBuildAPIUnnormalizedTarPaths(c *check.C) {
@@ -216,35 +211,37 @@ func (s *DockerSuite) TestBuildAPIUnnormalizedTarPaths(c *check.C) {
 			Size: int64(len(dockerfile)),
 		})
 		//failed to write tar file header
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 
 		_, err = tw.Write(dockerfile)
 		// failed to write Dockerfile in tar file content
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 
 		err = tw.WriteHeader(&tar.Header{
 			Name: "dir/./file",
 			Size: int64(len(fileContents)),
 		})
 		//failed to write tar file header
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 
 		_, err = tw.Write(fileContents)
 		// failed to write file contents in tar file content
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 
 		// failed to close tar archive
-		c.Assert(tw.Close(), checker.IsNil)
+		assert.NilError(c, tw.Close())
 
 		res, body, err := request.Post("/build", request.RawContent(ioutil.NopCloser(buffer)), request.ContentType("application/x-tar"))
-		c.Assert(err, checker.IsNil)
-		c.Assert(res.StatusCode, checker.Equals, http.StatusOK)
+		assert.NilError(c, err)
+		assert.Equal(c, res.StatusCode, http.StatusOK)
 
 		out, err := request.ReadBody(body)
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 		lines := strings.Split(string(out), "\n")
-		c.Assert(len(lines), checker.GreaterThan, 1)
-		c.Assert(lines[len(lines)-2], checker.Matches, ".*Successfully built [0-9a-f]{12}.*")
+		assert.Assert(c, len(lines) > 1)
+		matched, err := regexp.MatchString(".*Successfully built [0-9a-f]{12}.*", lines[len(lines)-2])
+		assert.NilError(c, err)
+		assert.Assert(c, matched)
 
 		re := regexp.MustCompile("Successfully built ([0-9a-f]{12})")
 		matches := re.FindStringSubmatch(lines[len(lines)-2])
@@ -254,7 +251,7 @@ func (s *DockerSuite) TestBuildAPIUnnormalizedTarPaths(c *check.C) {
 	imageA := buildFromTarContext([]byte("abc"))
 	imageB := buildFromTarContext([]byte("def"))
 
-	c.Assert(imageA, checker.Not(checker.Equals), imageB)
+	assert.Assert(c, imageA != imageB)
 }
 
 func (s *DockerSuite) TestBuildOnBuildWithCopy(c *check.C) {
@@ -274,12 +271,12 @@ func (s *DockerSuite) TestBuildOnBuildWithCopy(c *check.C) {
 		"/build",
 		request.RawContent(ctx.AsTarReader(c)),
 		request.ContentType("application/x-tar"))
-	c.Assert(err, checker.IsNil)
-	c.Assert(res.StatusCode, checker.Equals, http.StatusOK)
+	assert.NilError(c, err)
+	assert.Equal(c, res.StatusCode, http.StatusOK)
 
 	out, err := request.ReadBody(body)
-	c.Assert(err, checker.IsNil)
-	c.Assert(string(out), checker.Contains, "Successfully built")
+	assert.NilError(c, err)
+	assert.Assert(c, is.Contains(string(out), "Successfully built"))
 }
 
 func (s *DockerSuite) TestBuildOnBuildCache(c *check.C) {
@@ -427,8 +424,8 @@ func (s *DockerSuite) TestBuildChownOnCopy(c *check.C) {
 		"/build",
 		request.RawContent(ctx.AsTarReader(c)),
 		request.ContentType("application/x-tar"))
-	c.Assert(err, checker.IsNil)
-	c.Assert(res.StatusCode, checker.Equals, http.StatusOK)
+	assert.NilError(c, err)
+	assert.Equal(c, res.StatusCode, http.StatusOK)
 
 	out, err := request.ReadBody(body)
 	assert.NilError(c, err)
@@ -531,8 +528,8 @@ ENV foo bar`
 		"/build",
 		request.RawContent(ctx.AsTarReader(c)),
 		request.ContentType("application/x-tar"))
-	c.Assert(err, checker.IsNil)
-	c.Assert(res.StatusCode, checker.Equals, http.StatusOK)
+	assert.NilError(c, err)
+	assert.Equal(c, res.StatusCode, http.StatusOK)
 
 	out, err := request.ReadBody(body)
 	assert.NilError(c, err)

+ 2 - 3
integration-cli/docker_api_build_windows_test.go

@@ -5,7 +5,6 @@ package main
 import (
 	"net/http"
 
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/internal/test/fakecontext"
 	"github.com/docker/docker/internal/test/request"
 	"github.com/go-check/check"
@@ -30,8 +29,8 @@ func (s *DockerSuite) TestBuildWithRecycleBin(c *check.C) {
 		request.RawContent(ctx.AsTarReader(c)),
 		request.ContentType("application/x-tar"))
 
-	c.Assert(err, checker.IsNil)
-	c.Assert(res.StatusCode, checker.Equals, http.StatusOK)
+	assert.NilError(c, err)
+	assert.Equal(c, res.StatusCode, http.StatusOK)
 
 	out, err := request.ReadBody(body)
 	assert.NilError(c, err)

File diff ditekan karena terlalu besar
+ 155 - 155
integration-cli/docker_api_containers_test.go


+ 5 - 5
integration-cli/docker_api_exec_resize_test.go

@@ -10,9 +10,9 @@ import (
 	"sync"
 
 	"github.com/docker/docker/api/types/versions"
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/internal/test/request"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 func (s *DockerSuite) TestExecResizeAPIHeightWidthNoInt(c *check.C) {
@@ -22,11 +22,11 @@ func (s *DockerSuite) TestExecResizeAPIHeightWidthNoInt(c *check.C) {
 
 	endpoint := "/exec/" + cleanedContainerID + "/resize?h=foo&w=bar"
 	res, _, err := request.Post(endpoint)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	if versions.LessThan(testEnv.DaemonAPIVersion(), "1.32") {
-		c.Assert(res.StatusCode, checker.Equals, http.StatusInternalServerError)
+		assert.Equal(c, res.StatusCode, http.StatusInternalServerError)
 	} else {
-		c.Assert(res.StatusCode, checker.Equals, http.StatusBadRequest)
+		assert.Equal(c, res.StatusCode, http.StatusBadRequest)
 	}
 }
 
@@ -50,7 +50,7 @@ func (s *DockerSuite) TestExecResizeImmediatelyAfterExecStart(c *check.C) {
 		}
 
 		buf, err := request.ReadBody(body)
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 
 		out := map[string]string{}
 		err = json.Unmarshal(buf, &out)

+ 43 - 49
integration-cli/docker_api_exec_test.go

@@ -19,6 +19,7 @@ import (
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/internal/test/request"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 // Regression test for #9414
@@ -27,17 +28,15 @@ func (s *DockerSuite) TestExecAPICreateNoCmd(c *check.C) {
 	dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
 
 	res, body, err := request.Post(fmt.Sprintf("/containers/%s/exec", name), request.JSONBody(map[string]interface{}{"Cmd": nil}))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	if versions.LessThan(testEnv.DaemonAPIVersion(), "1.32") {
-		c.Assert(res.StatusCode, checker.Equals, http.StatusInternalServerError)
+		assert.Equal(c, res.StatusCode, http.StatusInternalServerError)
 	} else {
-		c.Assert(res.StatusCode, checker.Equals, http.StatusBadRequest)
+		assert.Equal(c, res.StatusCode, http.StatusBadRequest)
 	}
 	b, err := request.ReadBody(body)
-	c.Assert(err, checker.IsNil)
-
-	comment := check.Commentf("Expected message when creating exec command with no Cmd specified")
-	c.Assert(getErrorMessage(c, b), checker.Contains, "No exec command specified", comment)
+	assert.NilError(c, err)
+	assert.Assert(c, strings.Contains(getErrorMessage(c, b), "No exec command specified"), "Expected message when creating exec command with no Cmd specified")
 }
 
 func (s *DockerSuite) TestExecAPICreateNoValidContentType(c *check.C) {
@@ -50,17 +49,15 @@ func (s *DockerSuite) TestExecAPICreateNoValidContentType(c *check.C) {
 	}
 
 	res, body, err := request.Post(fmt.Sprintf("/containers/%s/exec", name), request.RawContent(ioutil.NopCloser(jsonData)), request.ContentType("test/plain"))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	if versions.LessThan(testEnv.DaemonAPIVersion(), "1.32") {
-		c.Assert(res.StatusCode, checker.Equals, http.StatusInternalServerError)
+		assert.Equal(c, res.StatusCode, http.StatusInternalServerError)
 	} else {
-		c.Assert(res.StatusCode, checker.Equals, http.StatusBadRequest)
+		assert.Equal(c, res.StatusCode, http.StatusBadRequest)
 	}
 	b, err := request.ReadBody(body)
-	c.Assert(err, checker.IsNil)
-
-	comment := check.Commentf("Expected message when creating exec command with invalid Content-Type specified")
-	c.Assert(getErrorMessage(c, b), checker.Contains, "Content-Type specified", comment)
+	assert.NilError(c, err)
+	assert.Assert(c, strings.Contains(getErrorMessage(c, b), "Content-Type specified"), "Expected message when creating exec command with invalid Content-Type specified")
 }
 
 func (s *DockerSuite) TestExecAPICreateContainerPaused(c *check.C) {
@@ -72,16 +69,14 @@ func (s *DockerSuite) TestExecAPICreateContainerPaused(c *check.C) {
 	dockerCmd(c, "pause", name)
 
 	cli, err := client.NewClientWithOpts(client.FromEnv)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer cli.Close()
 
 	config := types.ExecConfig{
 		Cmd: []string{"true"},
 	}
 	_, err = cli.ContainerExecCreate(context.Background(), name, config)
-
-	comment := check.Commentf("Expected message when creating exec command with Container %s is paused", name)
-	c.Assert(err.Error(), checker.Contains, "Container "+name+" is paused, unpause the container before exec", comment)
+	assert.ErrorContains(c, err, "Container "+name+" is paused, unpause the container before exec", "Expected message when creating exec command with Container %s is paused", name)
 }
 
 func (s *DockerSuite) TestExecAPIStart(c *check.C) {
@@ -93,7 +88,7 @@ func (s *DockerSuite) TestExecAPIStart(c *check.C) {
 
 	var execJSON struct{ PID int }
 	inspectExec(c, id, &execJSON)
-	c.Assert(execJSON.PID, checker.GreaterThan, 1)
+	assert.Assert(c, execJSON.PID > 1)
 
 	id = createExec(c, "test")
 	dockerCmd(c, "stop", "test")
@@ -117,8 +112,8 @@ func (s *DockerSuite) TestExecAPIStartEnsureHeaders(c *check.C) {
 
 	id := createExec(c, "test")
 	resp, _, err := request.Post(fmt.Sprintf("/exec/%s/start", id), request.RawString(`{"Detach": true}`), request.JSON)
-	c.Assert(err, checker.IsNil)
-	c.Assert(resp.Header.Get("Server"), checker.Not(checker.Equals), "")
+	assert.NilError(c, err)
+	assert.Assert(c, resp.Header.Get("Server") != "")
 }
 
 func (s *DockerSuite) TestExecAPIStartBackwardsCompatible(c *check.C) {
@@ -127,12 +122,12 @@ func (s *DockerSuite) TestExecAPIStartBackwardsCompatible(c *check.C) {
 	id := createExec(c, "test")
 
 	resp, body, err := request.Post(fmt.Sprintf("/v1.20/exec/%s/start", id), request.RawString(`{"Detach": true}`), request.ContentType("text/plain"))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	b, err := request.ReadBody(body)
 	comment := check.Commentf("response body: %s", b)
-	c.Assert(err, checker.IsNil, comment)
-	c.Assert(resp.StatusCode, checker.Equals, http.StatusOK, comment)
+	assert.NilError(c, err, comment)
+	assert.Equal(c, resp.StatusCode, http.StatusOK, comment)
 }
 
 // #19362
@@ -156,21 +151,21 @@ func (s *DockerSuite) TestExecAPIStartWithDetach(c *check.C) {
 	}
 
 	cli, err := client.NewClientWithOpts(client.FromEnv)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer cli.Close()
 
 	createResp, err := cli.ContainerExecCreate(context.Background(), name, config)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	_, body, err := request.Post(fmt.Sprintf("/exec/%s/start", createResp.ID), request.RawString(`{"Detach": true}`), request.JSON)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	b, err := request.ReadBody(body)
 	comment := check.Commentf("response body: %s", b)
-	c.Assert(err, checker.IsNil, comment)
+	assert.NilError(c, err, comment)
 
 	resp, _, err := request.Get("/_ping")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	if resp.StatusCode != http.StatusOK {
 		c.Fatal("daemon is down, it should alive")
 	}
@@ -189,7 +184,7 @@ func (s *DockerSuite) TestExecAPIStartValidCommand(c *check.C) {
 	var inspectJSON struct{ ExecIDs []string }
 	inspectContainer(c, name, &inspectJSON)
 
-	c.Assert(inspectJSON.ExecIDs, checker.IsNil)
+	assert.Assert(c, inspectJSON.ExecIDs == nil)
 }
 
 // #30311
@@ -208,7 +203,7 @@ func (s *DockerSuite) TestExecAPIStartInvalidCommand(c *check.C) {
 	var inspectJSON struct{ ExecIDs []string }
 	inspectContainer(c, name, &inspectJSON)
 
-	c.Assert(inspectJSON.ExecIDs, checker.IsNil)
+	assert.Assert(c, inspectJSON.ExecIDs == nil)
 }
 
 func (s *DockerSuite) TestExecStateCleanup(c *check.C) {
@@ -224,13 +219,13 @@ func (s *DockerSuite) TestExecStateCleanup(c *check.C) {
 
 	checkReadDir := func(c *check.C) (interface{}, check.CommentInterface) {
 		fi, err := ioutil.ReadDir(stateDir)
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 		return len(fi), nil
 	}
 
 	fi, err := ioutil.ReadDir(stateDir)
-	c.Assert(err, checker.IsNil)
-	c.Assert(len(fi), checker.GreaterThan, 1)
+	assert.NilError(c, err)
+	assert.Assert(c, len(fi) > 1)
 
 	id := createExecCmd(c, name, "ls")
 	startExec(c, id, http.StatusOK)
@@ -246,8 +241,8 @@ func (s *DockerSuite) TestExecStateCleanup(c *check.C) {
 
 	dockerCmd(c, "stop", name)
 	_, err = os.Stat(stateDir)
-	c.Assert(err, checker.NotNil)
-	c.Assert(os.IsNotExist(err), checker.True)
+	assert.ErrorContains(c, err, "")
+	assert.Assert(c, os.IsNotExist(err))
 }
 
 func createExec(c *check.C, name string) string {
@@ -256,34 +251,33 @@ func createExec(c *check.C, name string) string {
 
 func createExecCmd(c *check.C, name string, cmd string) string {
 	_, reader, err := request.Post(fmt.Sprintf("/containers/%s/exec", name), request.JSONBody(map[string]interface{}{"Cmd": []string{cmd}}))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	b, err := ioutil.ReadAll(reader)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer reader.Close()
 	createResp := struct {
 		ID string `json:"Id"`
 	}{}
-	c.Assert(json.Unmarshal(b, &createResp), checker.IsNil, check.Commentf(string(b)))
+	assert.NilError(c, json.Unmarshal(b, &createResp), string(b))
 	return createResp.ID
 }
 
 func startExec(c *check.C, id string, code int) {
 	resp, body, err := request.Post(fmt.Sprintf("/exec/%s/start", id), request.RawString(`{"Detach": true}`), request.JSON)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	b, err := request.ReadBody(body)
-	comment := check.Commentf("response body: %s", b)
-	c.Assert(err, checker.IsNil, comment)
-	c.Assert(resp.StatusCode, checker.Equals, code, comment)
+	assert.NilError(c, err, "response body: %s", b)
+	assert.Equal(c, resp.StatusCode, code, "response body: %s", b)
 }
 
 func inspectExec(c *check.C, id string, out interface{}) {
 	resp, body, err := request.Get(fmt.Sprintf("/exec/%s/json", id))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer body.Close()
-	c.Assert(resp.StatusCode, checker.Equals, http.StatusOK)
+	assert.Equal(c, resp.StatusCode, http.StatusOK)
 	err = json.NewDecoder(body).Decode(out)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 }
 
 func waitForExec(c *check.C, id string) {
@@ -305,9 +299,9 @@ func waitForExec(c *check.C, id string) {
 
 func inspectContainer(c *check.C, id string, out interface{}) {
 	resp, body, err := request.Get(fmt.Sprintf("/containers/%s/json", id))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer body.Close()
-	c.Assert(resp.StatusCode, checker.Equals, http.StatusOK)
+	assert.Equal(c, resp.StatusCode, http.StatusOK)
 	err = json.NewDecoder(body).Decode(out)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 }

+ 35 - 35
integration-cli/docker_api_images_test.go

@@ -11,17 +11,17 @@ import (
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types/filters"
 	"github.com/docker/docker/client"
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli"
 	"github.com/docker/docker/integration-cli/cli/build"
 	"github.com/docker/docker/internal/test/request"
 	"github.com/docker/docker/pkg/parsers/kernel"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 func (s *DockerSuite) TestAPIImagesFilter(c *check.C) {
 	cli, err := client.NewClientWithOpts(client.FromEnv)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer cli.Close()
 
 	name := "utest:tag1"
@@ -38,29 +38,29 @@ func (s *DockerSuite) TestAPIImagesFilter(c *check.C) {
 			Filters: filters,
 		}
 		images, err := cli.ImageList(context.Background(), options)
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 
 		return images
 	}
 
 	//incorrect number of matches returned
 	images := getImages("utest*/*")
-	c.Assert(images[0].RepoTags, checker.HasLen, 2)
+	assert.Equal(c, len(images[0].RepoTags), 2)
 
 	images = getImages("utest")
-	c.Assert(images[0].RepoTags, checker.HasLen, 1)
+	assert.Equal(c, len(images[0].RepoTags), 1)
 
 	images = getImages("utest*")
-	c.Assert(images[0].RepoTags, checker.HasLen, 1)
+	assert.Equal(c, len(images[0].RepoTags), 1)
 
 	images = getImages("*5000*/*")
-	c.Assert(images[0].RepoTags, checker.HasLen, 1)
+	assert.Equal(c, len(images[0].RepoTags), 1)
 }
 
 func (s *DockerSuite) TestAPIImagesSaveAndLoad(c *check.C) {
 	if runtime.GOOS == "windows" {
 		v, err := kernel.GetKernelVersion()
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 		build, _ := strconv.Atoi(strings.Split(strings.SplitN(v.String(), " ", 3)[2][1:], ".")[0])
 		if build == 16299 {
 			c.Skip("Temporarily disabled on RS3 builds")
@@ -72,24 +72,24 @@ func (s *DockerSuite) TestAPIImagesSaveAndLoad(c *check.C) {
 	id := getIDByName(c, "saveandload")
 
 	res, body, err := request.Get("/images/" + id + "/get")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer body.Close()
-	c.Assert(res.StatusCode, checker.Equals, http.StatusOK)
+	assert.Equal(c, res.StatusCode, http.StatusOK)
 
 	dockerCmd(c, "rmi", id)
 
 	res, loadBody, err := request.Post("/images/load", request.RawContent(body), request.ContentType("application/x-tar"))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer loadBody.Close()
-	c.Assert(res.StatusCode, checker.Equals, http.StatusOK)
+	assert.Equal(c, res.StatusCode, http.StatusOK)
 
 	inspectOut := cli.InspectCmd(c, id, cli.Format(".Id")).Combined()
-	c.Assert(strings.TrimSpace(string(inspectOut)), checker.Equals, id, check.Commentf("load did not work properly"))
+	assert.Equal(c, strings.TrimSpace(string(inspectOut)), id, "load did not work properly")
 }
 
 func (s *DockerSuite) TestAPIImagesDelete(c *check.C) {
 	cli, err := client.NewClientWithOpts(client.FromEnv)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer cli.Close()
 
 	if testEnv.OSType != "windows" {
@@ -102,18 +102,18 @@ func (s *DockerSuite) TestAPIImagesDelete(c *check.C) {
 	dockerCmd(c, "tag", name, "test:tag1")
 
 	_, err = cli.ImageRemove(context.Background(), id, types.ImageRemoveOptions{})
-	c.Assert(err.Error(), checker.Contains, "unable to delete")
+	assert.ErrorContains(c, err, "unable to delete")
 
 	_, err = cli.ImageRemove(context.Background(), "test:noexist", types.ImageRemoveOptions{})
-	c.Assert(err.Error(), checker.Contains, "No such image")
+	assert.ErrorContains(c, err, "No such image")
 
 	_, err = cli.ImageRemove(context.Background(), "test:tag1", types.ImageRemoveOptions{})
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 }
 
 func (s *DockerSuite) TestAPIImagesHistory(c *check.C) {
 	cli, err := client.NewClientWithOpts(client.FromEnv)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer cli.Close()
 
 	if testEnv.OSType != "windows" {
@@ -124,9 +124,9 @@ func (s *DockerSuite) TestAPIImagesHistory(c *check.C) {
 	id := getIDByName(c, name)
 
 	historydata, err := cli.ImageHistory(context.Background(), id)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
-	c.Assert(historydata, checker.Not(checker.HasLen), 0)
+	assert.Assert(c, len(historydata) != 0)
 	var found bool
 	for _, tag := range historydata[0].Tags {
 		if tag == "test-api-images-history:latest" {
@@ -134,13 +134,13 @@ func (s *DockerSuite) TestAPIImagesHistory(c *check.C) {
 			break
 		}
 	}
-	c.Assert(found, checker.True)
+	assert.Assert(c, found)
 }
 
 func (s *DockerSuite) TestAPIImagesImportBadSrc(c *check.C) {
 	if runtime.GOOS == "windows" {
 		v, err := kernel.GetKernelVersion()
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 		build, _ := strconv.Atoi(strings.Split(strings.SplitN(v.String(), " ", 3)[2][1:], ".")[0])
 		if build == 16299 {
 			c.Skip("Temporarily disabled on RS3 builds")
@@ -164,9 +164,9 @@ func (s *DockerSuite) TestAPIImagesImportBadSrc(c *check.C) {
 
 	for _, te := range tt {
 		res, _, err := request.Post(strings.Join([]string{"/images/create?fromSrc=", te.fromSrc}, ""), request.JSON)
-		c.Assert(err, check.IsNil)
-		c.Assert(res.StatusCode, checker.Equals, te.statusExp)
-		c.Assert(res.Header.Get("Content-Type"), checker.Equals, "application/json")
+		assert.NilError(c, err)
+		assert.Equal(c, res.StatusCode, te.statusExp)
+		assert.Equal(c, res.Header.Get("Content-Type"), "application/json")
 	}
 
 }
@@ -176,10 +176,10 @@ func (s *DockerSuite) TestAPIImagesSearchJSONContentType(c *check.C) {
 	testRequires(c, Network)
 
 	res, b, err := request.Get("/images/search?term=test", request.JSON)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	b.Close()
-	c.Assert(res.StatusCode, checker.Equals, http.StatusOK)
-	c.Assert(res.Header.Get("Content-Type"), checker.Equals, "application/json")
+	assert.Equal(c, res.StatusCode, http.StatusOK)
+	assert.Equal(c, res.Header.Get("Content-Type"), "application/json")
 }
 
 // Test case for 30027: image size reported as -1 in v1.12 client against v1.13 daemon.
@@ -189,20 +189,20 @@ func (s *DockerSuite) TestAPIImagesSizeCompatibility(c *check.C) {
 	defer apiclient.Close()
 
 	images, err := apiclient.ImageList(context.Background(), types.ImageListOptions{})
-	c.Assert(err, checker.IsNil)
-	c.Assert(len(images), checker.Not(checker.Equals), 0)
+	assert.NilError(c, err)
+	assert.Assert(c, len(images) != 0)
 	for _, image := range images {
-		c.Assert(image.Size, checker.Not(checker.Equals), int64(-1))
+		assert.Assert(c, image.Size != int64(-1))
 	}
 
 	apiclient, err = client.NewClientWithOpts(client.FromEnv, client.WithVersion("v1.24"))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer apiclient.Close()
 
 	v124Images, err := apiclient.ImageList(context.Background(), types.ImageListOptions{})
-	c.Assert(err, checker.IsNil)
-	c.Assert(len(v124Images), checker.Not(checker.Equals), 0)
+	assert.NilError(c, err)
+	assert.Assert(c, len(v124Images) != 0)
 	for _, image := range v124Images {
-		c.Assert(image.Size, checker.Not(checker.Equals), int64(-1))
+		assert.Assert(c, image.Size != int64(-1))
 	}
 }

+ 23 - 24
integration-cli/docker_api_inspect_test.go

@@ -8,7 +8,6 @@ import (
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types/versions/v1p20"
 	"github.com/docker/docker/client"
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/go-check/check"
 	"gotest.tools/assert"
 	is "gotest.tools/assert/cmp"
@@ -45,16 +44,16 @@ func (s *DockerSuite) TestInspectAPIContainerResponse(c *check.C) {
 
 		var inspectJSON map[string]interface{}
 		err := json.Unmarshal(body, &inspectJSON)
-		c.Assert(err, checker.IsNil, check.Commentf("Unable to unmarshal body for version %s", cs.version))
+		assert.NilError(c, err, "Unable to unmarshal body for version %s", cs.version)
 
 		for _, key := range cs.keys {
 			_, ok := inspectJSON[key]
-			c.Check(ok, checker.True, check.Commentf("%s does not exist in response for version %s", key, cs.version))
+			assert.Check(c, ok, "%s does not exist in response for version %s", key, cs.version)
 		}
 
 		//Issue #6830: type not properly converted to JSON/back
 		_, ok := inspectJSON["Path"].(bool)
-		c.Assert(ok, checker.False, check.Commentf("Path of `true` should not be converted to boolean `true` via JSON marshalling"))
+		assert.Assert(c, !ok, "Path of `true` should not be converted to boolean `true` via JSON marshalling")
 	}
 }
 
@@ -71,13 +70,13 @@ func (s *DockerSuite) TestInspectAPIContainerVolumeDriverLegacy(c *check.C) {
 
 		var inspectJSON map[string]interface{}
 		err := json.Unmarshal(body, &inspectJSON)
-		c.Assert(err, checker.IsNil, check.Commentf("Unable to unmarshal body for version %s", version))
+		assert.NilError(c, err, "Unable to unmarshal body for version %s", version)
 
 		config, ok := inspectJSON["Config"]
-		c.Assert(ok, checker.True, check.Commentf("Unable to find 'Config'"))
+		assert.Assert(c, ok, "Unable to find 'Config'")
 		cfg := config.(map[string]interface{})
 		_, ok = cfg["VolumeDriver"]
-		c.Assert(ok, checker.True, check.Commentf("API version %s expected to include VolumeDriver in 'Config'", version))
+		assert.Assert(c, ok, "API version %s expected to include VolumeDriver in 'Config'", version)
 	}
 }
 
@@ -90,31 +89,31 @@ func (s *DockerSuite) TestInspectAPIContainerVolumeDriver(c *check.C) {
 
 	var inspectJSON map[string]interface{}
 	err := json.Unmarshal(body, &inspectJSON)
-	c.Assert(err, checker.IsNil, check.Commentf("Unable to unmarshal body for version 1.25"))
+	assert.NilError(c, err, "Unable to unmarshal body for version 1.25")
 
 	config, ok := inspectJSON["Config"]
-	c.Assert(ok, checker.True, check.Commentf("Unable to find 'Config'"))
+	assert.Assert(c, ok, "Unable to find 'Config'")
 	cfg := config.(map[string]interface{})
 	_, ok = cfg["VolumeDriver"]
-	c.Assert(ok, checker.False, check.Commentf("API version 1.25 expected to not include VolumeDriver in 'Config'"))
+	assert.Assert(c, !ok, "API version 1.25 expected to not include VolumeDriver in 'Config'")
 
 	config, ok = inspectJSON["HostConfig"]
-	c.Assert(ok, checker.True, check.Commentf("Unable to find 'HostConfig'"))
+	assert.Assert(c, ok, "Unable to find 'HostConfig'")
 	cfg = config.(map[string]interface{})
 	_, ok = cfg["VolumeDriver"]
-	c.Assert(ok, checker.True, check.Commentf("API version 1.25 expected to include VolumeDriver in 'HostConfig'"))
+	assert.Assert(c, ok, "API version 1.25 expected to include VolumeDriver in 'HostConfig'")
 }
 
 func (s *DockerSuite) TestInspectAPIImageResponse(c *check.C) {
 	dockerCmd(c, "tag", "busybox:latest", "busybox:mytag")
 	cli, err := client.NewClientWithOpts(client.FromEnv)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer cli.Close()
 
 	imageJSON, _, err := cli.ImageInspectWithRaw(context.Background(), "busybox")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
-	c.Assert(imageJSON.RepoTags, checker.HasLen, 2)
+	assert.Check(c, len(imageJSON.RepoTags) == 2)
 	assert.Check(c, is.Contains(imageJSON.RepoTags, "busybox:latest"))
 	assert.Check(c, is.Contains(imageJSON.RepoTags, "busybox:mytag"))
 }
@@ -133,13 +132,13 @@ func (s *DockerSuite) TestInspectAPIEmptyFieldsInConfigPre121(c *check.C) {
 
 		var inspectJSON map[string]interface{}
 		err := json.Unmarshal(body, &inspectJSON)
-		c.Assert(err, checker.IsNil, check.Commentf("Unable to unmarshal body for version %s", version))
+		assert.NilError(c, err, "Unable to unmarshal body for version %s", version)
 		config, ok := inspectJSON["Config"]
-		c.Assert(ok, checker.True, check.Commentf("Unable to find 'Config'"))
+		assert.Assert(c, ok, "Unable to find 'Config'")
 		cfg := config.(map[string]interface{})
 		for _, f := range []string{"MacAddress", "NetworkDisabled", "ExposedPorts"} {
 			_, ok := cfg[f]
-			c.Check(ok, checker.True, check.Commentf("API version %s expected to include %s in 'Config'", version, f))
+			assert.Check(c, ok, "API version %s expected to include %s in 'Config'", version, f)
 		}
 	}
 }
@@ -155,10 +154,10 @@ func (s *DockerSuite) TestInspectAPIBridgeNetworkSettings120(c *check.C) {
 
 	var inspectJSON v1p20.ContainerJSON
 	err := json.Unmarshal(body, &inspectJSON)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	settings := inspectJSON.NetworkSettings
-	c.Assert(settings.IPAddress, checker.Not(checker.HasLen), 0)
+	assert.Assert(c, len(settings.IPAddress) != 0)
 }
 
 func (s *DockerSuite) TestInspectAPIBridgeNetworkSettings121(c *check.C) {
@@ -172,10 +171,10 @@ func (s *DockerSuite) TestInspectAPIBridgeNetworkSettings121(c *check.C) {
 
 	var inspectJSON types.ContainerJSON
 	err := json.Unmarshal(body, &inspectJSON)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	settings := inspectJSON.NetworkSettings
-	c.Assert(settings.IPAddress, checker.Not(checker.HasLen), 0)
-	c.Assert(settings.Networks["bridge"], checker.Not(checker.IsNil))
-	c.Assert(settings.IPAddress, checker.Equals, settings.Networks["bridge"].IPAddress)
+	assert.Assert(c, len(settings.IPAddress) != 0)
+	assert.Assert(c, settings.Networks["bridge"] != nil)
+	assert.Equal(c, settings.IPAddress, settings.Networks["bridge"].IPAddress)
 }

+ 24 - 25
integration-cli/docker_api_logs_test.go

@@ -14,16 +14,16 @@ import (
 
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/client"
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/internal/test/request"
 	"github.com/docker/docker/pkg/stdcopy"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 func (s *DockerSuite) TestLogsAPIWithStdout(c *check.C) {
 	out, _ := dockerCmd(c, "run", "-d", "-t", "busybox", "/bin/sh", "-c", "while true; do echo hello; sleep 1; done")
 	id := strings.TrimSpace(out)
-	c.Assert(waitRun(id), checker.IsNil)
+	assert.NilError(c, waitRun(id))
 
 	type logOut struct {
 		out string
@@ -32,8 +32,8 @@ func (s *DockerSuite) TestLogsAPIWithStdout(c *check.C) {
 
 	chLog := make(chan logOut)
 	res, body, err := request.Get(fmt.Sprintf("/containers/%s/logs?follow=1&stdout=1&timestamps=1", id))
-	c.Assert(err, checker.IsNil)
-	c.Assert(res.StatusCode, checker.Equals, http.StatusOK)
+	assert.NilError(c, err)
+	assert.Equal(c, res.StatusCode, http.StatusOK)
 
 	go func() {
 		defer body.Close()
@@ -47,7 +47,7 @@ func (s *DockerSuite) TestLogsAPIWithStdout(c *check.C) {
 
 	select {
 	case l := <-chLog:
-		c.Assert(l.err, checker.IsNil)
+		assert.NilError(c, l.err)
 		if !strings.HasSuffix(l.out, "hello") {
 			c.Fatalf("expected log output to container 'hello', but it does not")
 		}
@@ -60,12 +60,11 @@ func (s *DockerSuite) TestLogsAPINoStdoutNorStderr(c *check.C) {
 	name := "logs_test"
 	dockerCmd(c, "run", "-d", "-t", "--name", name, "busybox", "/bin/sh")
 	cli, err := client.NewClientWithOpts(client.FromEnv)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer cli.Close()
 
 	_, err = cli.ContainerLogs(context.Background(), name, types.ContainerLogsOptions{})
-	expected := "Bad parameters: you must choose at least one stream"
-	c.Assert(err.Error(), checker.Contains, expected)
+	assert.ErrorContains(c, err, "Bad parameters: you must choose at least one stream")
 }
 
 // Regression test for #12704
@@ -76,7 +75,7 @@ func (s *DockerSuite) TestLogsAPIFollowEmptyOutput(c *check.C) {
 
 	_, body, err := request.Get(fmt.Sprintf("/containers/%s/logs?follow=1&stdout=1&stderr=1&tail=all", name))
 	t1 := time.Now()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	body.Close()
 	elapsed := t1.Sub(t0).Seconds()
 	if elapsed > 20.0 {
@@ -87,19 +86,19 @@ func (s *DockerSuite) TestLogsAPIFollowEmptyOutput(c *check.C) {
 func (s *DockerSuite) TestLogsAPIContainerNotFound(c *check.C) {
 	name := "nonExistentContainer"
 	resp, _, err := request.Get(fmt.Sprintf("/containers/%s/logs?follow=1&stdout=1&stderr=1&tail=all", name))
-	c.Assert(err, checker.IsNil)
-	c.Assert(resp.StatusCode, checker.Equals, http.StatusNotFound)
+	assert.NilError(c, err)
+	assert.Equal(c, resp.StatusCode, http.StatusNotFound)
 }
 
 func (s *DockerSuite) TestLogsAPIUntilFutureFollow(c *check.C) {
 	testRequires(c, DaemonIsLinux)
 	name := "logsuntilfuturefollow"
 	dockerCmd(c, "run", "-d", "--name", name, "busybox", "/bin/sh", "-c", "while true; do date +%s; sleep 1; done")
-	c.Assert(waitRun(name), checker.IsNil)
+	assert.NilError(c, waitRun(name))
 
 	untilSecs := 5
 	untilDur, err := time.ParseDuration(fmt.Sprintf("%ds", untilSecs))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	until := daemonTime(c).Add(untilDur)
 
 	client, err := client.NewClientWithOpts(client.FromEnv)
@@ -109,7 +108,7 @@ func (s *DockerSuite) TestLogsAPIUntilFutureFollow(c *check.C) {
 
 	cfg := types.ContainerLogsOptions{Until: until.Format(time.RFC3339Nano), Follow: true, ShowStdout: true, Timestamps: true}
 	reader, err := client.ContainerLogs(context.Background(), name, cfg)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	type logOut struct {
 		out string
@@ -138,10 +137,10 @@ func (s *DockerSuite) TestLogsAPIUntilFutureFollow(c *check.C) {
 	for i := 0; i < untilSecs; i++ {
 		select {
 		case l := <-chLog:
-			c.Assert(l.err, checker.IsNil)
+			assert.NilError(c, l.err)
 			i, err := strconv.ParseInt(strings.Split(l.out, " ")[1], 10, 64)
-			c.Assert(err, checker.IsNil)
-			c.Assert(time.Unix(i, 0).UnixNano(), checker.LessOrEqualThan, until.UnixNano())
+			assert.NilError(c, err)
+			assert.Assert(c, time.Unix(i, 0).UnixNano() <= until.UnixNano())
 		case <-time.After(20 * time.Second):
 			c.Fatal("timeout waiting for logs to exit")
 		}
@@ -160,22 +159,22 @@ func (s *DockerSuite) TestLogsAPIUntil(c *check.C) {
 
 	extractBody := func(c *check.C, cfg types.ContainerLogsOptions) []string {
 		reader, err := client.ContainerLogs(context.Background(), name, cfg)
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 
 		actualStdout := new(bytes.Buffer)
 		actualStderr := ioutil.Discard
 		_, err = stdcopy.StdCopy(actualStdout, actualStderr, reader)
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 
 		return strings.Split(actualStdout.String(), "\n")
 	}
 
 	// Get timestamp of second log line
 	allLogs := extractBody(c, types.ContainerLogsOptions{Timestamps: true, ShowStdout: true})
-	c.Assert(len(allLogs), checker.GreaterOrEqualThan, 3)
+	assert.Assert(c, len(allLogs) >= 3)
 
 	t, err := time.Parse(time.RFC3339Nano, strings.Split(allLogs[1], " ")[0])
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	until := t.Format(time.RFC3339Nano)
 
 	// Get logs until the timestamp of second line, i.e. first two lines
@@ -183,7 +182,7 @@ func (s *DockerSuite) TestLogsAPIUntil(c *check.C) {
 
 	// Ensure log lines after cut-off are excluded
 	logsString := strings.Join(logs, "\n")
-	c.Assert(logsString, checker.Not(checker.Contains), "log3", check.Commentf("unexpected log message returned, until=%v", until))
+	assert.Assert(c, !strings.Contains(logsString, "log3"), "unexpected log message returned, until=%v", until)
 }
 
 func (s *DockerSuite) TestLogsAPIUntilDefaultValue(c *check.C) {
@@ -197,12 +196,12 @@ func (s *DockerSuite) TestLogsAPIUntilDefaultValue(c *check.C) {
 
 	extractBody := func(c *check.C, cfg types.ContainerLogsOptions) []string {
 		reader, err := client.ContainerLogs(context.Background(), name, cfg)
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 
 		actualStdout := new(bytes.Buffer)
 		actualStderr := ioutil.Discard
 		_, err = stdcopy.StdCopy(actualStdout, actualStderr, reader)
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 
 		return strings.Split(actualStdout.String(), "\n")
 	}
@@ -212,5 +211,5 @@ func (s *DockerSuite) TestLogsAPIUntilDefaultValue(c *check.C) {
 
 	// Test with default value specified and parameter omitted
 	defaultLogs := extractBody(c, types.ContainerLogsOptions{Timestamps: true, ShowStdout: true, Until: "0"})
-	c.Assert(defaultLogs, checker.DeepEquals, allLogs)
+	assert.DeepEqual(c, defaultLogs, allLogs)
 }

+ 60 - 58
integration-cli/docker_api_network_test.go

@@ -12,9 +12,9 @@ import (
 	"github.com/docker/docker/api/types/filters"
 	"github.com/docker/docker/api/types/network"
 	"github.com/docker/docker/api/types/versions"
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/internal/test/request"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 func (s *DockerSuite) TestAPINetworkGetDefaults(c *check.C) {
@@ -22,7 +22,7 @@ func (s *DockerSuite) TestAPINetworkGetDefaults(c *check.C) {
 	// By default docker daemon creates 3 networks. check if they are present
 	defaults := []string{"bridge", "host", "none"}
 	for _, nn := range defaults {
-		c.Assert(isNetworkAvailable(c, nn), checker.Equals, true)
+		assert.Assert(c, isNetworkAvailable(c, nn))
 	}
 }
 
@@ -44,7 +44,7 @@ func (s *DockerSuite) TestAPINetworkCreateCheckDuplicate(c *check.C) {
 
 	// Creating a new network first
 	createNetwork(c, configOnCheck, http.StatusCreated)
-	c.Assert(isNetworkAvailable(c, name), checker.Equals, true)
+	assert.Assert(c, isNetworkAvailable(c, name))
 
 	// Creating another network with same name and CheckDuplicate must fail
 	isOlderAPI := versions.LessThan(testEnv.DaemonAPIVersion(), "1.34")
@@ -67,14 +67,14 @@ func (s *DockerSuite) TestAPINetworkCreateCheckDuplicate(c *check.C) {
 func (s *DockerSuite) TestAPINetworkFilter(c *check.C) {
 	testRequires(c, DaemonIsLinux)
 	nr := getNetworkResource(c, getNetworkIDByName(c, "bridge"))
-	c.Assert(nr.Name, checker.Equals, "bridge")
+	assert.Equal(c, nr.Name, "bridge")
 }
 
 func (s *DockerSuite) TestAPINetworkInspectBridge(c *check.C) {
 	testRequires(c, DaemonIsLinux)
 	// Inspect default bridge network
 	nr := getNetworkResource(c, "bridge")
-	c.Assert(nr.Name, checker.Equals, "bridge")
+	assert.Equal(c, nr.Name, "bridge")
 
 	// run a container and attach it to the default bridge network
 	out, _ := dockerCmd(c, "run", "-d", "--name", "test", "busybox", "top")
@@ -83,16 +83,17 @@ func (s *DockerSuite) TestAPINetworkInspectBridge(c *check.C) {
 
 	// inspect default bridge network again and make sure the container is connected
 	nr = getNetworkResource(c, nr.ID)
-	c.Assert(nr.Driver, checker.Equals, "bridge")
-	c.Assert(nr.Scope, checker.Equals, "local")
-	c.Assert(nr.Internal, checker.Equals, false)
-	c.Assert(nr.EnableIPv6, checker.Equals, false)
-	c.Assert(nr.IPAM.Driver, checker.Equals, "default")
-	c.Assert(nr.Containers[containerID], checker.NotNil)
+	assert.Equal(c, nr.Driver, "bridge")
+	assert.Equal(c, nr.Scope, "local")
+	assert.Equal(c, nr.Internal, false)
+	assert.Equal(c, nr.EnableIPv6, false)
+	assert.Equal(c, nr.IPAM.Driver, "default")
+	_, ok := nr.Containers[containerID]
+	assert.Assert(c, ok)
 
 	ip, _, err := net.ParseCIDR(nr.Containers[containerID].IPv4Address)
-	c.Assert(err, checker.IsNil)
-	c.Assert(ip.String(), checker.Equals, containerIP)
+	assert.NilError(c, err)
+	assert.Equal(c, ip.String(), containerIP)
 }
 
 func (s *DockerSuite) TestAPINetworkInspectUserDefinedNetwork(c *check.C) {
@@ -111,19 +112,19 @@ func (s *DockerSuite) TestAPINetworkInspectUserDefinedNetwork(c *check.C) {
 		},
 	}
 	id0 := createNetwork(c, config, http.StatusCreated)
-	c.Assert(isNetworkAvailable(c, "br0"), checker.Equals, true)
+	assert.Assert(c, isNetworkAvailable(c, "br0"))
 
 	nr := getNetworkResource(c, id0)
-	c.Assert(len(nr.IPAM.Config), checker.Equals, 1)
-	c.Assert(nr.IPAM.Config[0].Subnet, checker.Equals, "172.28.0.0/16")
-	c.Assert(nr.IPAM.Config[0].IPRange, checker.Equals, "172.28.5.0/24")
-	c.Assert(nr.IPAM.Config[0].Gateway, checker.Equals, "172.28.5.254")
-	c.Assert(nr.Options["foo"], checker.Equals, "bar")
-	c.Assert(nr.Options["opts"], checker.Equals, "dopts")
+	assert.Equal(c, len(nr.IPAM.Config), 1)
+	assert.Equal(c, nr.IPAM.Config[0].Subnet, "172.28.0.0/16")
+	assert.Equal(c, nr.IPAM.Config[0].IPRange, "172.28.5.0/24")
+	assert.Equal(c, nr.IPAM.Config[0].Gateway, "172.28.5.254")
+	assert.Equal(c, nr.Options["foo"], "bar")
+	assert.Equal(c, nr.Options["opts"], "dopts")
 
 	// delete the network and make sure it is deleted
 	deleteNetwork(c, id0, true)
-	c.Assert(isNetworkAvailable(c, "br0"), checker.Equals, false)
+	assert.Assert(c, !isNetworkAvailable(c, "br0"))
 }
 
 func (s *DockerSuite) TestAPINetworkConnectDisconnect(c *check.C) {
@@ -135,9 +136,9 @@ func (s *DockerSuite) TestAPINetworkConnectDisconnect(c *check.C) {
 	}
 	id := createNetwork(c, config, http.StatusCreated)
 	nr := getNetworkResource(c, id)
-	c.Assert(nr.Name, checker.Equals, name)
-	c.Assert(nr.ID, checker.Equals, id)
-	c.Assert(len(nr.Containers), checker.Equals, 0)
+	assert.Equal(c, nr.Name, name)
+	assert.Equal(c, nr.ID, id)
+	assert.Equal(c, len(nr.Containers), 0)
 
 	// run a container
 	out, _ := dockerCmd(c, "run", "-d", "--name", "test", "busybox", "top")
@@ -148,20 +149,21 @@ func (s *DockerSuite) TestAPINetworkConnectDisconnect(c *check.C) {
 
 	// inspect the network to make sure container is connected
 	nr = getNetworkResource(c, nr.ID)
-	c.Assert(len(nr.Containers), checker.Equals, 1)
-	c.Assert(nr.Containers[containerID], checker.NotNil)
+	assert.Equal(c, len(nr.Containers), 1)
+	_, ok := nr.Containers[containerID]
+	assert.Assert(c, ok)
 
 	// check if container IP matches network inspect
 	ip, _, err := net.ParseCIDR(nr.Containers[containerID].IPv4Address)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	containerIP := findContainerIP(c, "test", "testnetwork")
-	c.Assert(ip.String(), checker.Equals, containerIP)
+	assert.Equal(c, ip.String(), containerIP)
 
 	// disconnect container from the network
 	disconnectNetwork(c, nr.ID, containerID)
 	nr = getNetworkResource(c, nr.ID)
-	c.Assert(nr.Name, checker.Equals, name)
-	c.Assert(len(nr.Containers), checker.Equals, 0)
+	assert.Equal(c, nr.Name, name)
+	assert.Equal(c, len(nr.Containers), 0)
 
 	// delete the network
 	deleteNetwork(c, nr.ID, true)
@@ -182,7 +184,7 @@ func (s *DockerSuite) TestAPINetworkIPAMMultipleBridgeNetworks(c *check.C) {
 		},
 	}
 	id0 := createNetwork(c, config0, http.StatusCreated)
-	c.Assert(isNetworkAvailable(c, "test0"), checker.Equals, true)
+	assert.Assert(c, isNetworkAvailable(c, "test0"))
 
 	ipam1 := &network.IPAM{
 		Driver: "default",
@@ -201,7 +203,7 @@ func (s *DockerSuite) TestAPINetworkIPAMMultipleBridgeNetworks(c *check.C) {
 	} else {
 		createNetwork(c, config1, http.StatusForbidden)
 	}
-	c.Assert(isNetworkAvailable(c, "test1"), checker.Equals, false)
+	assert.Assert(c, !isNetworkAvailable(c, "test1"))
 
 	ipam2 := &network.IPAM{
 		Driver: "default",
@@ -216,20 +218,20 @@ func (s *DockerSuite) TestAPINetworkIPAMMultipleBridgeNetworks(c *check.C) {
 		},
 	}
 	createNetwork(c, config2, http.StatusCreated)
-	c.Assert(isNetworkAvailable(c, "test2"), checker.Equals, true)
+	assert.Assert(c, isNetworkAvailable(c, "test2"))
 
 	// remove test0 and retry to create test1
 	deleteNetwork(c, id0, true)
 	createNetwork(c, config1, http.StatusCreated)
-	c.Assert(isNetworkAvailable(c, "test1"), checker.Equals, true)
+	assert.Assert(c, isNetworkAvailable(c, "test1"))
 
 	// for networks w/o ipam specified, docker will choose proper non-overlapping subnets
 	createNetwork(c, types.NetworkCreateRequest{Name: "test3"}, http.StatusCreated)
-	c.Assert(isNetworkAvailable(c, "test3"), checker.Equals, true)
+	assert.Assert(c, isNetworkAvailable(c, "test3"))
 	createNetwork(c, types.NetworkCreateRequest{Name: "test4"}, http.StatusCreated)
-	c.Assert(isNetworkAvailable(c, "test4"), checker.Equals, true)
+	assert.Assert(c, isNetworkAvailable(c, "test4"))
 	createNetwork(c, types.NetworkCreateRequest{Name: "test5"}, http.StatusCreated)
-	c.Assert(isNetworkAvailable(c, "test5"), checker.Equals, true)
+	assert.Assert(c, isNetworkAvailable(c, "test5"))
 
 	for i := 1; i < 6; i++ {
 		deleteNetwork(c, fmt.Sprintf("test%d", i), true)
@@ -267,13 +269,13 @@ func createDeletePredefinedNetwork(c *check.C, name string) {
 
 func isNetworkAvailable(c *check.C, name string) bool {
 	resp, body, err := request.Get("/networks")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer resp.Body.Close()
-	c.Assert(resp.StatusCode, checker.Equals, http.StatusOK)
+	assert.Equal(c, resp.StatusCode, http.StatusOK)
 
 	var nJSON []types.NetworkResource
 	err = json.NewDecoder(body).Decode(&nJSON)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	for _, n := range nJSON {
 		if n.Name == name {
@@ -290,16 +292,16 @@ func getNetworkIDByName(c *check.C, name string) string {
 	)
 	filterArgs.Add("name", name)
 	filterJSON, err := filters.ToJSON(filterArgs)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	v.Set("filters", filterJSON)
 
 	resp, body, err := request.Get("/networks?" + v.Encode())
-	c.Assert(resp.StatusCode, checker.Equals, http.StatusOK)
-	c.Assert(err, checker.IsNil)
+	assert.Equal(c, resp.StatusCode, http.StatusOK)
+	assert.NilError(c, err)
 
 	var nJSON []types.NetworkResource
 	err = json.NewDecoder(body).Decode(&nJSON)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	var res string
 	for _, n := range nJSON {
 		// Find exact match
@@ -307,37 +309,37 @@ func getNetworkIDByName(c *check.C, name string) string {
 			res = n.ID
 		}
 	}
-	c.Assert(res, checker.Not(checker.Equals), "")
+	assert.Assert(c, res != "")
 
 	return res
 }
 
 func getNetworkResource(c *check.C, id string) *types.NetworkResource {
 	_, obj, err := request.Get("/networks/" + id)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	nr := types.NetworkResource{}
 	err = json.NewDecoder(obj).Decode(&nr)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	return &nr
 }
 
 func createNetwork(c *check.C, config types.NetworkCreateRequest, expectedStatusCode int) string {
 	resp, body, err := request.Post("/networks/create", request.JSONBody(config))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer resp.Body.Close()
 
 	if expectedStatusCode >= 0 {
-		c.Assert(resp.StatusCode, checker.Equals, expectedStatusCode)
+		assert.Equal(c, resp.StatusCode, expectedStatusCode)
 	} else {
-		c.Assert(resp.StatusCode, checker.Not(checker.Equals), -expectedStatusCode)
+		assert.Assert(c, resp.StatusCode != -expectedStatusCode)
 	}
 
 	if expectedStatusCode == http.StatusCreated || expectedStatusCode < 0 {
 		var nr types.NetworkCreateResponse
 		err = json.NewDecoder(body).Decode(&nr)
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 
 		return nr.ID
 	}
@@ -350,8 +352,8 @@ func connectNetwork(c *check.C, nid, cid string) {
 	}
 
 	resp, _, err := request.Post("/networks/"+nid+"/connect", request.JSONBody(config))
-	c.Assert(resp.StatusCode, checker.Equals, http.StatusOK)
-	c.Assert(err, checker.IsNil)
+	assert.Equal(c, resp.StatusCode, http.StatusOK)
+	assert.NilError(c, err)
 }
 
 func disconnectNetwork(c *check.C, nid, cid string) {
@@ -360,17 +362,17 @@ func disconnectNetwork(c *check.C, nid, cid string) {
 	}
 
 	resp, _, err := request.Post("/networks/"+nid+"/disconnect", request.JSONBody(config))
-	c.Assert(resp.StatusCode, checker.Equals, http.StatusOK)
-	c.Assert(err, checker.IsNil)
+	assert.Equal(c, resp.StatusCode, http.StatusOK)
+	assert.NilError(c, err)
 }
 
 func deleteNetwork(c *check.C, id string, shouldSucceed bool) {
 	resp, _, err := request.Delete("/networks/" + id)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer resp.Body.Close()
 	if !shouldSucceed {
-		c.Assert(resp.StatusCode, checker.Not(checker.Equals), http.StatusOK)
+		assert.Assert(c, resp.StatusCode != http.StatusOK)
 		return
 	}
-	c.Assert(resp.StatusCode, checker.Equals, http.StatusNoContent)
+	assert.Equal(c, resp.StatusCode, http.StatusNoContent)
 }

+ 29 - 32
integration-cli/docker_api_stats_test.go

@@ -15,9 +15,9 @@ import (
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types/versions"
 	"github.com/docker/docker/client"
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/internal/test/request"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 var expectedNetworkInterfaceStats = strings.Split("rx_bytes rx_dropped rx_errors rx_packets tx_bytes tx_dropped tx_errors tx_packets", " ")
@@ -26,15 +26,16 @@ func (s *DockerSuite) TestAPIStatsNoStreamGetCpu(c *check.C) {
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "while true;usleep 100; do echo 'Hello'; done")
 
 	id := strings.TrimSpace(out)
-	c.Assert(waitRun(id), checker.IsNil)
+	assert.NilError(c, waitRun(id))
 	resp, body, err := request.Get(fmt.Sprintf("/containers/%s/stats?stream=false", id))
-	c.Assert(err, checker.IsNil)
-	c.Assert(resp.StatusCode, checker.Equals, http.StatusOK)
-	c.Assert(resp.Header.Get("Content-Type"), checker.Equals, "application/json")
+	assert.NilError(c, err)
+	assert.Equal(c, resp.StatusCode, http.StatusOK)
+	assert.Equal(c, resp.Header.Get("Content-Type"), "application/json")
+	assert.Equal(c, resp.Header.Get("Content-Type"), "application/json")
 
 	var v *types.Stats
 	err = json.NewDecoder(body).Decode(&v)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	body.Close()
 
 	var cpuPercent = 0.0
@@ -58,7 +59,7 @@ func (s *DockerSuite) TestAPIStatsNoStreamGetCpu(c *check.C) {
 		}
 	}
 
-	c.Assert(cpuPercent, check.Not(checker.Equals), 0.0, check.Commentf("docker stats with no-stream get cpu usage failed: was %v", cpuPercent))
+	assert.Assert(c, cpuPercent != 0.0, "docker stats with no-stream get cpu usage failed: was %v", cpuPercent)
 }
 
 func (s *DockerSuite) TestAPIStatsStoppedContainerInGoroutines(c *check.C) {
@@ -67,10 +68,10 @@ func (s *DockerSuite) TestAPIStatsStoppedContainerInGoroutines(c *check.C) {
 
 	getGoRoutines := func() int {
 		_, body, err := request.Get(fmt.Sprintf("/info"))
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 		info := types.Info{}
 		err = json.NewDecoder(body).Decode(&info)
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 		body.Close()
 		return info.NGoroutines
 	}
@@ -78,14 +79,14 @@ func (s *DockerSuite) TestAPIStatsStoppedContainerInGoroutines(c *check.C) {
 	// When the HTTP connection is closed, the number of goroutines should not increase.
 	routines := getGoRoutines()
 	_, body, err := request.Get(fmt.Sprintf("/containers/%s/stats", id))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	body.Close()
 
 	t := time.After(30 * time.Second)
 	for {
 		select {
 		case <-t:
-			c.Assert(getGoRoutines(), checker.LessOrEqualThan, routines)
+			assert.Assert(c, getGoRoutines() <= routines)
 			return
 		default:
 			if n := getGoRoutines(); n <= routines {
@@ -101,7 +102,7 @@ func (s *DockerSuite) TestAPIStatsNetworkStats(c *check.C) {
 
 	out := runSleepingContainer(c)
 	id := strings.TrimSpace(out)
-	c.Assert(waitRun(id), checker.IsNil)
+	assert.NilError(c, waitRun(id))
 
 	// Retrieve the container address
 	net := "bridge"
@@ -141,7 +142,7 @@ func (s *DockerSuite) TestAPIStatsNetworkStats(c *check.C) {
 			err = err2
 		}
 	}
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	pingouts := string(pingout[:])
 	nwStatsPost := getNetworkStats(c, id)
 	for _, v := range nwStatsPost {
@@ -157,10 +158,8 @@ func (s *DockerSuite) TestAPIStatsNetworkStats(c *check.C) {
 		expRxPkts++
 		expTxPkts++
 	}
-	c.Assert(postTxPackets, checker.GreaterOrEqualThan, expTxPkts,
-		check.Commentf("Reported less TxPackets than expected. Expected >= %d. Found %d. %s", expTxPkts, postTxPackets, pingouts))
-	c.Assert(postRxPackets, checker.GreaterOrEqualThan, expRxPkts,
-		check.Commentf("Reported less RxPackets than expected. Expected >= %d. Found %d. %s", expRxPkts, postRxPackets, pingouts))
+	assert.Assert(c, postTxPackets >= expTxPkts, "Reported less TxPackets than expected. Expected >= %d. Found %d. %s", expTxPkts, postTxPackets, pingouts)
+	assert.Assert(c, postRxPackets >= expRxPkts, "Reported less RxPackets than expected. Expected >= %d. Found %d. %s", expRxPkts, postRxPackets, pingouts)
 }
 
 func (s *DockerSuite) TestAPIStatsNetworkStatsVersioning(c *check.C) {
@@ -169,7 +168,7 @@ func (s *DockerSuite) TestAPIStatsNetworkStatsVersioning(c *check.C) {
 
 	out := runSleepingContainer(c)
 	id := strings.TrimSpace(out)
-	c.Assert(waitRun(id), checker.IsNil)
+	assert.NilError(c, waitRun(id))
 	wg := sync.WaitGroup{}
 
 	for i := 17; i <= 21; i++ {
@@ -179,11 +178,9 @@ func (s *DockerSuite) TestAPIStatsNetworkStatsVersioning(c *check.C) {
 			apiVersion := fmt.Sprintf("v1.%d", i)
 			statsJSONBlob := getVersionedStats(c, id, apiVersion)
 			if versions.LessThan(apiVersion, "v1.21") {
-				c.Assert(jsonBlobHasLTv121NetworkStats(statsJSONBlob), checker.Equals, true,
-					check.Commentf("Stats JSON blob from API %s %#v does not look like a <v1.21 API stats structure", apiVersion, statsJSONBlob))
+				assert.Assert(c, jsonBlobHasLTv121NetworkStats(statsJSONBlob), "Stats JSON blob from API %s %#v does not look like a <v1.21 API stats structure", apiVersion, statsJSONBlob)
 			} else {
-				c.Assert(jsonBlobHasGTE121NetworkStats(statsJSONBlob), checker.Equals, true,
-					check.Commentf("Stats JSON blob from API %s %#v does not look like a >=v1.21 API stats structure", apiVersion, statsJSONBlob))
+				assert.Assert(c, jsonBlobHasGTE121NetworkStats(statsJSONBlob), "Stats JSON blob from API %s %#v does not look like a >=v1.21 API stats structure", apiVersion, statsJSONBlob)
 			}
 		}(i)
 	}
@@ -194,10 +191,10 @@ func getNetworkStats(c *check.C, id string) map[string]types.NetworkStats {
 	var st *types.StatsJSON
 
 	_, body, err := request.Get(fmt.Sprintf("/containers/%s/stats?stream=false", id))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	err = json.NewDecoder(body).Decode(&st)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	body.Close()
 
 	return st.Networks
@@ -211,11 +208,11 @@ func getVersionedStats(c *check.C, id string, apiVersion string) map[string]inte
 	stats := make(map[string]interface{})
 
 	_, body, err := request.Get(fmt.Sprintf("/%s/containers/%s/stats?stream=false", apiVersion, id))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer body.Close()
 
 	err = json.NewDecoder(body).Decode(&stats)
-	c.Assert(err, checker.IsNil, check.Commentf("failed to decode stat: %s", err))
+	assert.NilError(c, err, "failed to decode stat: %s", err)
 
 	return stats
 }
@@ -263,15 +260,15 @@ func jsonBlobHasGTE121NetworkStats(blob map[string]interface{}) bool {
 func (s *DockerSuite) TestAPIStatsContainerNotFound(c *check.C) {
 	testRequires(c, DaemonIsLinux)
 	cli, err := client.NewClientWithOpts(client.FromEnv)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer cli.Close()
 
 	expected := "No such container: nonexistent"
 
 	_, err = cli.ContainerStats(context.Background(), "nonexistent", true)
-	c.Assert(err.Error(), checker.Contains, expected)
+	assert.ErrorContains(c, err, expected)
 	_, err = cli.ContainerStats(context.Background(), "nonexistent", false)
-	c.Assert(err.Error(), checker.Contains, expected)
+	assert.ErrorContains(c, err, expected)
 }
 
 func (s *DockerSuite) TestAPIStatsNoStreamConnectedContainers(c *check.C) {
@@ -279,11 +276,11 @@ func (s *DockerSuite) TestAPIStatsNoStreamConnectedContainers(c *check.C) {
 
 	out1 := runSleepingContainer(c)
 	id1 := strings.TrimSpace(out1)
-	c.Assert(waitRun(id1), checker.IsNil)
+	assert.NilError(c, waitRun(id1))
 
 	out2 := runSleepingContainer(c, "--net", "container:"+id1)
 	id2 := strings.TrimSpace(out2)
-	c.Assert(waitRun(id2), checker.IsNil)
+	assert.NilError(c, waitRun(id2))
 
 	ch := make(chan error, 1)
 	go func() {
@@ -307,7 +304,7 @@ func (s *DockerSuite) TestAPIStatsNoStreamConnectedContainers(c *check.C) {
 
 	select {
 	case err := <-ch:
-		c.Assert(err, checker.IsNil, check.Commentf("Error in stats Engine API: %v", err))
+		assert.NilError(c, err, "Error in stats Engine API: %v", err)
 	case <-time.After(15 * time.Second):
 		c.Fatalf("Stats did not return after timeout")
 	}

+ 40 - 39
integration-cli/docker_api_swarm_service_test.go

@@ -18,6 +18,7 @@ import (
 	testdaemon "github.com/docker/docker/internal/test/daemon"
 	"github.com/go-check/check"
 	"golang.org/x/sys/unix"
+	"gotest.tools/assert"
 	"gotest.tools/icmd"
 )
 
@@ -45,18 +46,18 @@ func (s *DockerSwarmSuite) TestAPIServiceUpdatePort(c *check.C) {
 
 	// Inspect the service and verify port mapping.
 	updatedService := d.GetService(c, serviceID)
-	c.Assert(updatedService.Spec.EndpointSpec, check.NotNil)
-	c.Assert(len(updatedService.Spec.EndpointSpec.Ports), check.Equals, 1)
-	c.Assert(updatedService.Spec.EndpointSpec.Ports[0].TargetPort, check.Equals, uint32(8083))
-	c.Assert(updatedService.Spec.EndpointSpec.Ports[0].PublishedPort, check.Equals, uint32(8082))
+	assert.Assert(c, updatedService.Spec.EndpointSpec != nil)
+	assert.Equal(c, len(updatedService.Spec.EndpointSpec.Ports), 1)
+	assert.Equal(c, updatedService.Spec.EndpointSpec.Ports[0].TargetPort, uint32(8083))
+	assert.Equal(c, updatedService.Spec.EndpointSpec.Ports[0].PublishedPort, uint32(8082))
 }
 
 func (s *DockerSwarmSuite) TestAPISwarmServicesEmptyList(c *check.C) {
 	d := s.AddDaemon(c, true, true)
 
 	services := d.ListServices(c)
-	c.Assert(services, checker.NotNil)
-	c.Assert(len(services), checker.Equals, 0, check.Commentf("services: %#v", services))
+	assert.Assert(c, services != nil)
+	assert.Assert(c, len(services) == 0, "services: %#v", services)
 }
 
 func (s *DockerSwarmSuite) TestAPISwarmServicesCreate(c *check.C) {
@@ -74,14 +75,14 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesCreate(c *check.C) {
 	// insertDefaults inserts UpdateConfig when service is fetched by ID
 	resp, _, err := client.ServiceInspectWithRaw(context.Background(), id, options)
 	out := fmt.Sprintf("%+v", resp)
-	c.Assert(err, checker.IsNil)
-	c.Assert(out, checker.Contains, "UpdateConfig")
+	assert.NilError(c, err)
+	assert.Assert(c, strings.Contains(out, "UpdateConfig"))
 
 	// insertDefaults inserts UpdateConfig when service is fetched by ID
 	resp, _, err = client.ServiceInspectWithRaw(context.Background(), "top", options)
 	out = fmt.Sprintf("%+v", resp)
-	c.Assert(err, checker.IsNil)
-	c.Assert(string(out), checker.Contains, "UpdateConfig")
+	assert.NilError(c, err)
+	assert.Assert(c, strings.Contains(out, "UpdateConfig"))
 
 	service := d.GetService(c, id)
 	instances = 5
@@ -155,7 +156,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesUpdate(c *check.C) {
 	// create a different tag
 	for _, d := range daemons {
 		out, err := d.Cmd("tag", image1, image2)
-		c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+		assert.NilError(c, err, out)
 	}
 
 	// create service
@@ -187,7 +188,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesUpdate(c *check.C) {
 	// Roll back to the previous version. This uses the CLI because
 	// rollback used to be a client-side operation.
 	out, err := daemons[0].Cmd("service", "update", "--detach", "--rollback", id)
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	// first batch
 	waitAndAssert(c, defaultReconciliationTimeout, daemons[0].CheckRunningTaskImages, checker.DeepEquals,
@@ -296,7 +297,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesUpdateStartFirst(c *check.C) {
 	// Roll back to the previous version. This uses the CLI because
 	// rollback is a client-side operation.
 	out, err := d.Cmd("service", "update", "--detach", "--rollback", id)
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	// first batch
 	waitAndAssert(c, defaultReconciliationTimeout, d.CheckRunningTaskImages, checker.DeepEquals,
@@ -336,12 +337,12 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesFailedUpdate(c *check.C) {
 	// should update 2 tasks and then pause
 	waitAndAssert(c, defaultReconciliationTimeout, daemons[0].CheckServiceUpdateState(id), checker.Equals, swarm.UpdateStatePaused)
 	v, _ := daemons[0].CheckServiceRunningTasks(id)(c)
-	c.Assert(v, checker.Equals, instances-2)
+	assert.Assert(c, v == instances-2)
 
 	// Roll back to the previous version. This uses the CLI because
 	// rollback used to be a client-side operation.
 	out, err := daemons[0].Cmd("service", "update", "--detach", "--rollback", id)
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	waitAndAssert(c, defaultReconciliationTimeout, daemons[0].CheckRunningTaskImages, checker.DeepEquals,
 		map[string]int{image1: instances})
@@ -366,7 +367,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServiceConstraintRole(c *check.C) {
 	tasks := daemons[0].GetServiceTasks(c, id)
 	for _, task := range tasks {
 		node := daemons[0].GetNode(c, task.NodeID)
-		c.Assert(node.Spec.Role, checker.Equals, swarm.NodeRoleWorker)
+		assert.Equal(c, node.Spec.Role, swarm.NodeRoleWorker)
 	}
 	//remove service
 	daemons[0].RemoveService(c, id)
@@ -380,7 +381,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServiceConstraintRole(c *check.C) {
 	// validate tasks are running on manager nodes
 	for _, task := range tasks {
 		node := daemons[0].GetNode(c, task.NodeID)
-		c.Assert(node.Spec.Role, checker.Equals, swarm.NodeRoleManager)
+		assert.Equal(c, node.Spec.Role, swarm.NodeRoleManager)
 	}
 	//remove service
 	daemons[0].RemoveService(c, id)
@@ -395,7 +396,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServiceConstraintRole(c *check.C) {
 	// validate tasks are not assigned to any node
 	tasks = daemons[0].GetServiceTasks(c, id)
 	for _, task := range tasks {
-		c.Assert(task.NodeID, checker.Equals, "")
+		assert.Equal(c, task.NodeID, "")
 	}
 }
 
@@ -408,7 +409,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServiceConstraintLabel(c *check.C) {
 	// wait for nodes ready
 	waitAndAssert(c, 5*time.Second, daemons[0].CheckNodeReadyCount, checker.Equals, nodeCount)
 	nodes := daemons[0].ListNodes(c)
-	c.Assert(len(nodes), checker.Equals, nodeCount)
+	assert.Equal(c, len(nodes), nodeCount)
 
 	// add labels to nodes
 	daemons[0].UpdateNode(c, nodes[0].ID, func(n *swarm.Node) {
@@ -433,7 +434,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServiceConstraintLabel(c *check.C) {
 	tasks := daemons[0].GetServiceTasks(c, id)
 	// validate all tasks are running on nodes[0]
 	for _, task := range tasks {
-		c.Assert(task.NodeID, checker.Equals, nodes[0].ID)
+		assert.Assert(c, task.NodeID == nodes[0].ID)
 	}
 	//remove service
 	daemons[0].RemoveService(c, id)
@@ -446,7 +447,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServiceConstraintLabel(c *check.C) {
 	tasks = daemons[0].GetServiceTasks(c, id)
 	// validate all tasks are NOT running on nodes[0]
 	for _, task := range tasks {
-		c.Assert(task.NodeID, checker.Not(checker.Equals), nodes[0].ID)
+		assert.Assert(c, task.NodeID != nodes[0].ID)
 	}
 	//remove service
 	daemons[0].RemoveService(c, id)
@@ -460,7 +461,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServiceConstraintLabel(c *check.C) {
 	tasks = daemons[0].GetServiceTasks(c, id)
 	// validate tasks are not assigned
 	for _, task := range tasks {
-		c.Assert(task.NodeID, checker.Equals, "")
+		assert.Assert(c, task.NodeID == "")
 	}
 	//remove service
 	daemons[0].RemoveService(c, id)
@@ -478,7 +479,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServiceConstraintLabel(c *check.C) {
 	tasks = daemons[0].GetServiceTasks(c, id)
 	// validate tasks are not assigned
 	for _, task := range tasks {
-		c.Assert(task.NodeID, checker.Equals, "")
+		assert.Assert(c, task.NodeID == "")
 	}
 	// make nodes[1] fulfills the constraints
 	daemons[0].UpdateNode(c, nodes[1].ID, func(n *swarm.Node) {
@@ -490,7 +491,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServiceConstraintLabel(c *check.C) {
 	waitAndAssert(c, defaultReconciliationTimeout, daemons[0].CheckServiceRunningTasks(id), checker.Equals, instances)
 	tasks = daemons[0].GetServiceTasks(c, id)
 	for _, task := range tasks {
-		c.Assert(task.NodeID, checker.Equals, nodes[1].ID)
+		assert.Assert(c, task.NodeID == nodes[1].ID)
 	}
 }
 
@@ -503,7 +504,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServicePlacementPrefs(c *check.C) {
 	// wait for nodes ready
 	waitAndAssert(c, 5*time.Second, daemons[0].CheckNodeReadyCount, checker.Equals, nodeCount)
 	nodes := daemons[0].ListNodes(c)
-	c.Assert(len(nodes), checker.Equals, nodeCount)
+	assert.Equal(c, len(nodes), nodeCount)
 
 	// add labels to nodes
 	daemons[0].UpdateNode(c, nodes[0].ID, func(n *swarm.Node) {
@@ -531,9 +532,9 @@ func (s *DockerSwarmSuite) TestAPISwarmServicePlacementPrefs(c *check.C) {
 	for _, task := range tasks {
 		tasksOnNode[task.NodeID]++
 	}
-	c.Assert(tasksOnNode[nodes[0].ID], checker.Equals, 2)
-	c.Assert(tasksOnNode[nodes[1].ID], checker.Equals, 1)
-	c.Assert(tasksOnNode[nodes[2].ID], checker.Equals, 1)
+	assert.Assert(c, tasksOnNode[nodes[0].ID] == 2)
+	assert.Assert(c, tasksOnNode[nodes[1].ID] == 1)
+	assert.Assert(c, tasksOnNode[nodes[2].ID] == 1)
 }
 
 func (s *DockerSwarmSuite) TestAPISwarmServicesStateReporting(c *check.C) {
@@ -562,24 +563,24 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesStateReporting(c *check.C) {
 	}
 
 	containers := getContainers()
-	c.Assert(containers, checker.HasLen, instances)
+	assert.Assert(c, len(containers) == instances)
 	var toRemove string
 	for i := range containers {
 		toRemove = i
 	}
 
 	_, err := containers[toRemove].Cmd("stop", toRemove)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	waitAndAssert(c, defaultReconciliationTimeout, reducedCheck(sumAsIntegers, d1.CheckActiveContainerCount, d2.CheckActiveContainerCount, d3.CheckActiveContainerCount), checker.Equals, instances)
 
 	containers2 := getContainers()
-	c.Assert(containers2, checker.HasLen, instances)
+	assert.Assert(c, len(containers2) == instances)
 	for i := range containers {
 		if i == toRemove {
-			c.Assert(containers2[i], checker.IsNil)
+			assert.Assert(c, containers2[i] == nil)
 		} else {
-			c.Assert(containers2[i], checker.NotNil)
+			assert.Assert(c, containers2[i] != nil)
 		}
 	}
 
@@ -590,22 +591,22 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesStateReporting(c *check.C) {
 
 	// try with killing process outside of docker
 	pidStr, err := containers[toRemove].Cmd("inspect", "-f", "{{.State.Pid}}", toRemove)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	pid, err := strconv.Atoi(strings.TrimSpace(pidStr))
-	c.Assert(err, checker.IsNil)
-	c.Assert(unix.Kill(pid, unix.SIGKILL), checker.IsNil)
+	assert.NilError(c, err)
+	assert.NilError(c, unix.Kill(pid, unix.SIGKILL))
 
 	time.Sleep(time.Second) // give some time to handle the signal
 
 	waitAndAssert(c, defaultReconciliationTimeout, reducedCheck(sumAsIntegers, d1.CheckActiveContainerCount, d2.CheckActiveContainerCount, d3.CheckActiveContainerCount), checker.Equals, instances)
 
 	containers2 = getContainers()
-	c.Assert(containers2, checker.HasLen, instances)
+	assert.Assert(c, len(containers2) == instances)
 	for i := range containers {
 		if i == toRemove {
-			c.Assert(containers2[i], checker.IsNil)
+			assert.Assert(c, containers2[i] == nil)
 		} else {
-			c.Assert(containers2[i], checker.NotNil)
+			assert.Assert(c, containers2[i] != nil)
 		}
 	}
 }

+ 101 - 110
integration-cli/docker_api_swarm_test.go

@@ -37,21 +37,21 @@ func (s *DockerSwarmSuite) TestAPISwarmInit(c *check.C) {
 	// todo: should find a better way to verify that components are running than /info
 	d1 := s.AddDaemon(c, true, true)
 	info := d1.SwarmInfo(c)
-	c.Assert(info.ControlAvailable, checker.True)
-	c.Assert(info.LocalNodeState, checker.Equals, swarm.LocalNodeStateActive)
-	c.Assert(info.Cluster.RootRotationInProgress, checker.False)
+	assert.Equal(c, info.ControlAvailable, true)
+	assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive)
+	assert.Equal(c, info.Cluster.RootRotationInProgress, false)
 
 	d2 := s.AddDaemon(c, true, false)
 	info = d2.SwarmInfo(c)
-	c.Assert(info.ControlAvailable, checker.False)
-	c.Assert(info.LocalNodeState, checker.Equals, swarm.LocalNodeStateActive)
+	assert.Equal(c, info.ControlAvailable, false)
+	assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive)
 
 	// Leaving cluster
-	c.Assert(d2.SwarmLeave(c, false), checker.IsNil)
+	assert.NilError(c, d2.SwarmLeave(c, false))
 
 	info = d2.SwarmInfo(c)
-	c.Assert(info.ControlAvailable, checker.False)
-	c.Assert(info.LocalNodeState, checker.Equals, swarm.LocalNodeStateInactive)
+	assert.Equal(c, info.ControlAvailable, false)
+	assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateInactive)
 
 	d2.SwarmJoin(c, swarm.JoinRequest{
 		ListenAddr:  d1.SwarmListenAddr(),
@@ -60,8 +60,8 @@ func (s *DockerSwarmSuite) TestAPISwarmInit(c *check.C) {
 	})
 
 	info = d2.SwarmInfo(c)
-	c.Assert(info.ControlAvailable, checker.False)
-	c.Assert(info.LocalNodeState, checker.Equals, swarm.LocalNodeStateActive)
+	assert.Equal(c, info.ControlAvailable, false)
+	assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive)
 
 	// Current state restoring after restarts
 	d1.Stop(c)
@@ -71,12 +71,12 @@ func (s *DockerSwarmSuite) TestAPISwarmInit(c *check.C) {
 	d2.StartNode(c)
 
 	info = d1.SwarmInfo(c)
-	c.Assert(info.ControlAvailable, checker.True)
-	c.Assert(info.LocalNodeState, checker.Equals, swarm.LocalNodeStateActive)
+	assert.Equal(c, info.ControlAvailable, true)
+	assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive)
 
 	info = d2.SwarmInfo(c)
-	c.Assert(info.ControlAvailable, checker.False)
-	c.Assert(info.LocalNodeState, checker.Equals, swarm.LocalNodeStateActive)
+	assert.Equal(c, info.ControlAvailable, false)
+	assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive)
 }
 
 func (s *DockerSwarmSuite) TestAPISwarmJoinToken(c *check.C) {
@@ -91,20 +91,18 @@ func (s *DockerSwarmSuite) TestAPISwarmJoinToken(c *check.C) {
 		ListenAddr:  d2.SwarmListenAddr(),
 		RemoteAddrs: []string{d1.SwarmListenAddr()},
 	})
-	c.Assert(err, checker.NotNil)
-	c.Assert(err.Error(), checker.Contains, "join token is necessary")
+	assert.ErrorContains(c, err, "join token is necessary")
 	info := d2.SwarmInfo(c)
-	c.Assert(info.LocalNodeState, checker.Equals, swarm.LocalNodeStateInactive)
+	assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateInactive)
 
 	err = c2.SwarmJoin(context.Background(), swarm.JoinRequest{
 		ListenAddr:  d2.SwarmListenAddr(),
 		JoinToken:   "foobaz",
 		RemoteAddrs: []string{d1.SwarmListenAddr()},
 	})
-	c.Assert(err, checker.NotNil)
-	c.Assert(err.Error(), checker.Contains, "invalid join token")
+	assert.ErrorContains(c, err, "invalid join token")
 	info = d2.SwarmInfo(c)
-	c.Assert(info.LocalNodeState, checker.Equals, swarm.LocalNodeStateInactive)
+	assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateInactive)
 
 	workerToken := d1.JoinTokens(c).Worker
 
@@ -114,10 +112,10 @@ func (s *DockerSwarmSuite) TestAPISwarmJoinToken(c *check.C) {
 		RemoteAddrs: []string{d1.SwarmListenAddr()},
 	})
 	info = d2.SwarmInfo(c)
-	c.Assert(info.LocalNodeState, checker.Equals, swarm.LocalNodeStateActive)
-	c.Assert(d2.SwarmLeave(c, false), checker.IsNil)
+	assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive)
+	assert.NilError(c, d2.SwarmLeave(c, false))
 	info = d2.SwarmInfo(c)
-	c.Assert(info.LocalNodeState, checker.Equals, swarm.LocalNodeStateInactive)
+	assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateInactive)
 
 	// change tokens
 	d1.RotateTokens(c)
@@ -127,19 +125,18 @@ func (s *DockerSwarmSuite) TestAPISwarmJoinToken(c *check.C) {
 		JoinToken:   workerToken,
 		RemoteAddrs: []string{d1.SwarmListenAddr()},
 	})
-	c.Assert(err, checker.NotNil)
-	c.Assert(err.Error(), checker.Contains, "join token is necessary")
+	assert.ErrorContains(c, err, "join token is necessary")
 	info = d2.SwarmInfo(c)
-	c.Assert(info.LocalNodeState, checker.Equals, swarm.LocalNodeStateInactive)
+	assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateInactive)
 
 	workerToken = d1.JoinTokens(c).Worker
 
 	d2.SwarmJoin(c, swarm.JoinRequest{JoinToken: workerToken, RemoteAddrs: []string{d1.SwarmListenAddr()}})
 	info = d2.SwarmInfo(c)
-	c.Assert(info.LocalNodeState, checker.Equals, swarm.LocalNodeStateActive)
-	c.Assert(d2.SwarmLeave(c, false), checker.IsNil)
+	assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive)
+	assert.NilError(c, d2.SwarmLeave(c, false))
 	info = d2.SwarmInfo(c)
-	c.Assert(info.LocalNodeState, checker.Equals, swarm.LocalNodeStateInactive)
+	assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateInactive)
 
 	// change spec, don't change tokens
 	d1.UpdateSwarm(c, func(s *swarm.Spec) {})
@@ -148,17 +145,16 @@ func (s *DockerSwarmSuite) TestAPISwarmJoinToken(c *check.C) {
 		ListenAddr:  d2.SwarmListenAddr(),
 		RemoteAddrs: []string{d1.SwarmListenAddr()},
 	})
-	c.Assert(err, checker.NotNil)
-	c.Assert(err.Error(), checker.Contains, "join token is necessary")
+	assert.ErrorContains(c, err, "join token is necessary")
 	info = d2.SwarmInfo(c)
-	c.Assert(info.LocalNodeState, checker.Equals, swarm.LocalNodeStateInactive)
+	assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateInactive)
 
 	d2.SwarmJoin(c, swarm.JoinRequest{JoinToken: workerToken, RemoteAddrs: []string{d1.SwarmListenAddr()}})
 	info = d2.SwarmInfo(c)
-	c.Assert(info.LocalNodeState, checker.Equals, swarm.LocalNodeStateActive)
-	c.Assert(d2.SwarmLeave(c, false), checker.IsNil)
+	assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive)
+	assert.NilError(c, d2.SwarmLeave(c, false))
 	info = d2.SwarmInfo(c)
-	c.Assert(info.LocalNodeState, checker.Equals, swarm.LocalNodeStateInactive)
+	assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateInactive)
 }
 
 func (s *DockerSwarmSuite) TestUpdateSwarmAddExternalCA(c *check.C) {
@@ -178,9 +174,9 @@ func (s *DockerSwarmSuite) TestUpdateSwarmAddExternalCA(c *check.C) {
 		}
 	})
 	info := d1.SwarmInfo(c)
-	c.Assert(info.Cluster.Spec.CAConfig.ExternalCAs, checker.HasLen, 2)
-	c.Assert(info.Cluster.Spec.CAConfig.ExternalCAs[0].CACert, checker.Equals, "")
-	c.Assert(info.Cluster.Spec.CAConfig.ExternalCAs[1].CACert, checker.Equals, "cacert")
+	assert.Equal(c, len(info.Cluster.Spec.CAConfig.ExternalCAs), 2)
+	assert.Equal(c, info.Cluster.Spec.CAConfig.ExternalCAs[0].CACert, "")
+	assert.Equal(c, info.Cluster.Spec.CAConfig.ExternalCAs[1].CACert, "cacert")
 }
 
 func (s *DockerSwarmSuite) TestAPISwarmCAHash(c *check.C) {
@@ -195,8 +191,7 @@ func (s *DockerSwarmSuite) TestAPISwarmCAHash(c *check.C) {
 		JoinToken:   replacementToken,
 		RemoteAddrs: []string{d1.SwarmListenAddr()},
 	})
-	c.Assert(err, checker.NotNil)
-	c.Assert(err.Error(), checker.Contains, "remote CA does not match fingerprint")
+	assert.ErrorContains(c, err, "remote CA does not match fingerprint")
 }
 
 func (s *DockerSwarmSuite) TestAPISwarmPromoteDemote(c *check.C) {
@@ -205,8 +200,8 @@ func (s *DockerSwarmSuite) TestAPISwarmPromoteDemote(c *check.C) {
 	d2 := s.AddDaemon(c, true, false)
 
 	info := d2.SwarmInfo(c)
-	c.Assert(info.ControlAvailable, checker.False)
-	c.Assert(info.LocalNodeState, checker.Equals, swarm.LocalNodeStateActive)
+	assert.Equal(c, info.ControlAvailable, false)
+	assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive)
 
 	d1.UpdateNode(c, d2.NodeID(), func(n *swarm.Node) {
 		n.Spec.Role = swarm.NodeRoleManager
@@ -243,10 +238,10 @@ func (s *DockerSwarmSuite) TestAPISwarmPromoteDemote(c *check.C) {
 	node.Spec.Role = swarm.NodeRoleWorker
 	url := fmt.Sprintf("/nodes/%s/update?version=%d", node.ID, node.Version.Index)
 	res, body, err := request.Post(url, request.Host(d1.Sock()), request.JSONBody(node.Spec))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	b, err := request.ReadBody(body)
-	c.Assert(err, checker.IsNil)
-	c.Assert(res.StatusCode, checker.Equals, http.StatusBadRequest, check.Commentf("output: %q", string(b)))
+	assert.NilError(c, err)
+	assert.Equal(c, res.StatusCode, http.StatusBadRequest, "output: %q", string(b))
 
 	// The warning specific to demoting the last manager is best-effort and
 	// won't appear until the Role field of the demoted manager has been
@@ -255,11 +250,11 @@ func (s *DockerSwarmSuite) TestAPISwarmPromoteDemote(c *check.C) {
 	// it anchors the regexp contrary to the documentation, and this makes
 	// it impossible to match something that includes a line break.
 	if !strings.Contains(string(b), "last manager of the swarm") {
-		c.Assert(string(b), checker.Contains, "this would result in a loss of quorum")
+		assert.Assert(c, strings.Contains(string(b), "this would result in a loss of quorum"))
 	}
 	info = d1.SwarmInfo(c)
-	c.Assert(info.LocalNodeState, checker.Equals, swarm.LocalNodeStateActive)
-	c.Assert(info.ControlAvailable, checker.True)
+	assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive)
+	assert.Equal(c, info.ControlAvailable, true)
 
 	// Promote already demoted node
 	d1.UpdateNode(c, d2.NodeID(), func(n *swarm.Node) {
@@ -290,7 +285,7 @@ func (s *DockerSwarmSuite) TestAPISwarmLeaderProxy(c *check.C) {
 	// query each node and make sure it returns 3 services
 	for _, d := range []*daemon.Daemon{d1, d2, d3} {
 		services := d.ListServices(c)
-		c.Assert(services, checker.HasLen, 3)
+		assert.Equal(c, len(services), 3)
 	}
 }
 
@@ -308,9 +303,9 @@ func (s *DockerSwarmSuite) TestAPISwarmLeaderElection(c *check.C) {
 	d3 := s.AddDaemon(c, true, true)
 
 	// assert that the first node we made is the leader, and the other two are followers
-	c.Assert(d1.GetNode(c, d1.NodeID()).ManagerStatus.Leader, checker.True)
-	c.Assert(d1.GetNode(c, d2.NodeID()).ManagerStatus.Leader, checker.False)
-	c.Assert(d1.GetNode(c, d3.NodeID()).ManagerStatus.Leader, checker.False)
+	assert.Equal(c, d1.GetNode(c, d1.NodeID()).ManagerStatus.Leader, true)
+	assert.Equal(c, d1.GetNode(c, d2.NodeID()).ManagerStatus.Leader, false)
+	assert.Equal(c, d1.GetNode(c, d3.NodeID()).ManagerStatus.Leader, false)
 
 	d1.Stop(c)
 
@@ -344,7 +339,7 @@ func (s *DockerSwarmSuite) TestAPISwarmLeaderElection(c *check.C) {
 	waitAndAssert(c, defaultReconciliationTimeout, checkLeader(d2, d3), checker.True)
 
 	// assert that we have a new leader
-	c.Assert(leader, checker.NotNil)
+	assert.Assert(c, leader != nil)
 
 	// Keep track of the current leader, since we want that to be chosen.
 	stableleader := leader
@@ -358,10 +353,10 @@ func (s *DockerSwarmSuite) TestAPISwarmLeaderElection(c *check.C) {
 	// pick out the leader and the followers again
 
 	// verify that we still only have 1 leader and 2 followers
-	c.Assert(leader, checker.NotNil)
-	c.Assert(followers, checker.HasLen, 2)
+	assert.Assert(c, leader != nil)
+	assert.Equal(c, len(followers), 2)
 	// and that after we added d1 back, the leader hasn't changed
-	c.Assert(leader.NodeID(), checker.Equals, stableleader.NodeID())
+	assert.Equal(c, leader.NodeID(), stableleader.NodeID())
 }
 
 func (s *DockerSwarmSuite) TestAPISwarmRaftQuorum(c *check.C) {
@@ -418,19 +413,19 @@ func (s *DockerSwarmSuite) TestAPISwarmLeaveRemovesContainer(c *check.C) {
 	d.CreateService(c, simpleTestService, setInstances(instances))
 
 	id, err := d.Cmd("run", "-d", "busybox", "top")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", id))
+	assert.NilError(c, err, id)
 	id = strings.TrimSpace(id)
 
 	waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, instances+1)
 
-	c.Assert(d.SwarmLeave(c, false), checker.NotNil)
-	c.Assert(d.SwarmLeave(c, true), checker.IsNil)
+	assert.ErrorContains(c, d.SwarmLeave(c, false), "")
+	assert.NilError(c, d.SwarmLeave(c, true))
 
 	waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 1)
 
 	id2, err := d.Cmd("ps", "-q")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", id2))
-	c.Assert(id, checker.HasPrefix, strings.TrimSpace(id2))
+	assert.NilError(c, err, id2)
+	assert.Assert(c, strings.HasPrefix(id, strings.TrimSpace(id2)))
 }
 
 // #23629
@@ -440,7 +435,7 @@ func (s *DockerSwarmSuite) TestAPISwarmLeaveOnPendingJoin(c *check.C) {
 	d2 := s.AddDaemon(c, false, false)
 
 	id, err := d2.Cmd("run", "-d", "busybox", "top")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", id))
+	assert.NilError(c, err, id)
 	id = strings.TrimSpace(id)
 
 	c2 := d2.NewClientT(c)
@@ -448,19 +443,18 @@ func (s *DockerSwarmSuite) TestAPISwarmLeaveOnPendingJoin(c *check.C) {
 		ListenAddr:  d2.SwarmListenAddr(),
 		RemoteAddrs: []string{"123.123.123.123:1234"},
 	})
-	c.Assert(err, check.NotNil)
-	c.Assert(err.Error(), checker.Contains, "Timeout was reached")
+	assert.ErrorContains(c, err, "Timeout was reached")
 
 	info := d2.SwarmInfo(c)
-	c.Assert(info.LocalNodeState, checker.Equals, swarm.LocalNodeStatePending)
+	assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStatePending)
 
-	c.Assert(d2.SwarmLeave(c, true), checker.IsNil)
+	assert.NilError(c, d2.SwarmLeave(c, true))
 
 	waitAndAssert(c, defaultReconciliationTimeout, d2.CheckActiveContainerCount, checker.Equals, 1)
 
 	id2, err := d2.Cmd("ps", "-q")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", id2))
-	c.Assert(id, checker.HasPrefix, strings.TrimSpace(id2))
+	assert.NilError(c, err, id2)
+	assert.Assert(c, strings.HasPrefix(id, strings.TrimSpace(id2)))
 }
 
 // #23705
@@ -472,15 +466,14 @@ func (s *DockerSwarmSuite) TestAPISwarmRestoreOnPendingJoin(c *check.C) {
 		ListenAddr:  d.SwarmListenAddr(),
 		RemoteAddrs: []string{"123.123.123.123:1234"},
 	})
-	c.Assert(err, check.NotNil)
-	c.Assert(err.Error(), checker.Contains, "Timeout was reached")
+	assert.ErrorContains(c, err, "Timeout was reached")
 
 	waitAndAssert(c, defaultReconciliationTimeout, d.CheckLocalNodeState, checker.Equals, swarm.LocalNodeStatePending)
 
 	d.RestartNode(c)
 
 	info := d.SwarmInfo(c)
-	c.Assert(info.LocalNodeState, checker.Equals, swarm.LocalNodeStateInactive)
+	assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateInactive)
 }
 
 func (s *DockerSwarmSuite) TestAPISwarmManagerRestore(c *check.C) {
@@ -540,16 +533,16 @@ func (s *DockerSwarmSuite) TestAPISwarmInvalidAddress(c *check.C) {
 		ListenAddr: "",
 	}
 	res, _, err := request.Post("/swarm/init", request.Host(d.Sock()), request.JSONBody(req))
-	c.Assert(err, checker.IsNil)
-	c.Assert(res.StatusCode, checker.Equals, http.StatusBadRequest)
+	assert.NilError(c, err)
+	assert.Equal(c, res.StatusCode, http.StatusBadRequest)
 
 	req2 := swarm.JoinRequest{
 		ListenAddr:  "0.0.0.0:2377",
 		RemoteAddrs: []string{""},
 	}
 	res, _, err = request.Post("/swarm/join", request.Host(d.Sock()), request.JSONBody(req2))
-	c.Assert(err, checker.IsNil)
-	c.Assert(res.StatusCode, checker.Equals, http.StatusBadRequest)
+	assert.NilError(c, err)
+	assert.Equal(c, res.StatusCode, http.StatusBadRequest)
 }
 
 func (s *DockerSwarmSuite) TestAPISwarmForceNewCluster(c *check.C) {
@@ -578,8 +571,8 @@ func (s *DockerSwarmSuite) TestAPISwarmForceNewCluster(c *check.C) {
 
 	d3 := s.AddDaemon(c, true, true)
 	info := d3.SwarmInfo(c)
-	c.Assert(info.ControlAvailable, checker.True)
-	c.Assert(info.LocalNodeState, checker.Equals, swarm.LocalNodeStateActive)
+	assert.Equal(c, info.ControlAvailable, true)
+	assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive)
 
 	instances = 4
 	d3.UpdateService(c, d3.GetService(c, id), setInstances(instances))
@@ -770,22 +763,22 @@ func checkClusterHealth(c *check.C, cl []*daemon.Daemon, managerCount, workerCou
 			waitAndAssert(c, defaultReconciliationTimeout, waitActive, checker.True)
 
 			if n.Spec.Role == swarm.NodeRoleManager {
-				c.Assert(n.ManagerStatus, checker.NotNil, check.Commentf("manager status of node %s (manager), reported by %s", n.ID, d.NodeID()))
+				assert.Assert(c, n.ManagerStatus != nil, "manager status of node %s (manager), reported by %s", n.ID, d.NodeID())
 				if n.ManagerStatus.Leader {
 					leaderFound = true
 				}
 				mCount++
 			} else {
-				c.Assert(n.ManagerStatus, checker.IsNil, check.Commentf("manager status of node %s (worker), reported by %s", n.ID, d.NodeID()))
+				assert.Assert(c, n.ManagerStatus == nil, "manager status of node %s (worker), reported by %s", n.ID, d.NodeID())
 				wCount++
 			}
 		}
-		c.Assert(leaderFound, checker.True, check.Commentf("lack of leader reported by node %s", info.NodeID))
-		c.Assert(mCount, checker.Equals, managerCount, check.Commentf("managers count reported by node %s", info.NodeID))
-		c.Assert(wCount, checker.Equals, workerCount, check.Commentf("workers count reported by node %s", info.NodeID))
+		assert.Equal(c, leaderFound, true, "lack of leader reported by node %s", info.NodeID)
+		assert.Equal(c, mCount, managerCount, "managers count reported by node %s", info.NodeID)
+		assert.Equal(c, wCount, workerCount, "workers count reported by node %s", info.NodeID)
 	}
-	c.Assert(totalMCount, checker.Equals, managerCount)
-	c.Assert(totalWCount, checker.Equals, workerCount)
+	assert.Equal(c, totalMCount, managerCount)
+	assert.Equal(c, totalWCount, workerCount)
 }
 
 func (s *DockerSwarmSuite) TestAPISwarmRestartCluster(c *check.C) {
@@ -795,16 +788,16 @@ func (s *DockerSwarmSuite) TestAPISwarmRestartCluster(c *check.C) {
 	for i := 0; i < mCount; i++ {
 		manager := s.AddDaemon(c, true, true)
 		info := manager.SwarmInfo(c)
-		c.Assert(info.ControlAvailable, checker.True)
-		c.Assert(info.LocalNodeState, checker.Equals, swarm.LocalNodeStateActive)
+		assert.Equal(c, info.ControlAvailable, true)
+		assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive)
 		nodes = append(nodes, manager)
 	}
 
 	for i := 0; i < wCount; i++ {
 		worker := s.AddDaemon(c, true, false)
 		info := worker.SwarmInfo(c)
-		c.Assert(info.ControlAvailable, checker.False)
-		c.Assert(info.LocalNodeState, checker.Equals, swarm.LocalNodeStateActive)
+		assert.Equal(c, info.ControlAvailable, false)
+		assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive)
 		nodes = append(nodes, worker)
 	}
 
@@ -825,7 +818,7 @@ func (s *DockerSwarmSuite) TestAPISwarmRestartCluster(c *check.C) {
 		wg.Wait()
 		close(errs)
 		for err := range errs {
-			c.Assert(err, check.IsNil)
+			assert.NilError(c, err)
 		}
 	}
 
@@ -846,7 +839,7 @@ func (s *DockerSwarmSuite) TestAPISwarmRestartCluster(c *check.C) {
 		wg.Wait()
 		close(errs)
 		for err := range errs {
-			c.Assert(err, check.IsNil)
+			assert.NilError(c, err)
 		}
 	}
 
@@ -867,7 +860,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesUpdateWithName(c *check.C) {
 	cli := d.NewClientT(c)
 	defer cli.Close()
 	_, err := cli.ServiceUpdate(context.Background(), service.Spec.Name, service.Version, service.Spec, types.ServiceUpdateOptions{})
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, instances)
 }
 
@@ -875,22 +868,20 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesUpdateWithName(c *check.C) {
 func (s *DockerSwarmSuite) TestAPISwarmUnlockNotLocked(c *check.C) {
 	d := s.AddDaemon(c, true, true)
 	err := d.SwarmUnlock(c, swarm.UnlockRequest{UnlockKey: "wrong-key"})
-	c.Assert(err, checker.NotNil)
-	c.Assert(err.Error(), checker.Contains, "swarm is not locked")
+	assert.ErrorContains(c, err, "swarm is not locked")
 }
 
 // #29885
 func (s *DockerSwarmSuite) TestAPISwarmErrorHandling(c *check.C) {
 	ln, err := net.Listen("tcp", fmt.Sprintf(":%d", defaultSwarmPort))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer ln.Close()
 	d := s.AddDaemon(c, false, false)
 	client := d.NewClientT(c)
 	_, err = client.SwarmInit(context.Background(), swarm.InitRequest{
 		ListenAddr: d.SwarmListenAddr(),
 	})
-	c.Assert(err, checker.NotNil)
-	c.Assert(err.Error(), checker.Contains, "address already in use")
+	assert.ErrorContains(c, err, "address already in use")
 }
 
 // Test case for 30242, where duplicate networks, with different drivers `bridge` and `overlay`,
@@ -909,20 +900,20 @@ func (s *DockerSwarmSuite) TestAPIDuplicateNetworks(c *check.C) {
 	networkCreate.Driver = "bridge"
 
 	n1, err := cli.NetworkCreate(context.Background(), name, networkCreate)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	networkCreate.Driver = "overlay"
 
 	n2, err := cli.NetworkCreate(context.Background(), name, networkCreate)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	r1, err := cli.NetworkInspect(context.Background(), n1.ID, types.NetworkInspectOptions{})
-	c.Assert(err, checker.IsNil)
-	c.Assert(r1.Scope, checker.Equals, "local")
+	assert.NilError(c, err)
+	assert.Equal(c, r1.Scope, "local")
 
 	r2, err := cli.NetworkInspect(context.Background(), n2.ID, types.NetworkInspectOptions{})
-	c.Assert(err, checker.IsNil)
-	c.Assert(r2.Scope, checker.Equals, "swarm")
+	assert.NilError(c, err)
+	assert.Equal(c, r2.Scope, "swarm")
 }
 
 // Test case for 30178
@@ -932,7 +923,7 @@ func (s *DockerSwarmSuite) TestAPISwarmHealthcheckNone(c *check.C) {
 	d := s.AddDaemon(c, true, true)
 
 	out, err := d.Cmd("network", "create", "-d", "overlay", "lb")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	instances := 1
 	d.CreateService(c, simpleTestService, setInstances(instances), func(s *swarm.Service) {
@@ -950,7 +941,7 @@ func (s *DockerSwarmSuite) TestAPISwarmHealthcheckNone(c *check.C) {
 	containers := d.ActiveContainers(c)
 
 	out, err = d.Cmd("exec", containers[0], "ping", "-c1", "-W3", "top")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 }
 
 func (s *DockerSwarmSuite) TestSwarmRepeatedRootRotation(c *check.C) {
@@ -971,7 +962,7 @@ func (s *DockerSwarmSuite) TestSwarmRepeatedRootRotation(c *check.C) {
 				KeyRequest: csr.NewBasicKeyRequest(),
 				CA:         &csr.CAConfig{Expiry: ca.RootCAExpiration},
 			})
-			c.Assert(err, checker.IsNil)
+			assert.NilError(c, err)
 		}
 		expectedCert := string(cert)
 		m.UpdateSwarm(c, func(s *swarm.Spec) {
@@ -986,8 +977,8 @@ func (s *DockerSwarmSuite) TestSwarmRepeatedRootRotation(c *check.C) {
 			info := m.SwarmInfo(c)
 
 			// the desired CA cert and key is always redacted
-			c.Assert(info.Cluster.Spec.CAConfig.SigningCAKey, checker.Equals, "")
-			c.Assert(info.Cluster.Spec.CAConfig.SigningCACert, checker.Equals, "")
+			assert.Equal(c, info.Cluster.Spec.CAConfig.SigningCAKey, "")
+			assert.Equal(c, info.Cluster.Spec.CAConfig.SigningCACert, "")
 
 			clusterTLSInfo = info.Cluster.TLSInfo
 
@@ -1000,7 +991,7 @@ func (s *DockerSwarmSuite) TestSwarmRepeatedRootRotation(c *check.C) {
 			time.Sleep(250 * time.Millisecond)
 		}
 		if cert != nil {
-			c.Assert(clusterTLSInfo.TrustRoot, checker.Equals, expectedCert)
+			assert.Equal(c, clusterTLSInfo.TrustRoot, expectedCert)
 		}
 		// could take another second or two for the nodes to trust the new roots after they've all gotten
 		// new TLS certificates
@@ -1016,8 +1007,8 @@ func (s *DockerSwarmSuite) TestSwarmRepeatedRootRotation(c *check.C) {
 			time.Sleep(250 * time.Millisecond)
 		}
 
-		c.Assert(m.GetNode(c, m.NodeID()).Description.TLSInfo, checker.DeepEquals, clusterTLSInfo)
-		c.Assert(m.GetNode(c, w.NodeID()).Description.TLSInfo, checker.DeepEquals, clusterTLSInfo)
+		assert.DeepEqual(c, m.GetNode(c, m.NodeID()).Description.TLSInfo, clusterTLSInfo)
+		assert.DeepEqual(c, m.GetNode(c, w.NodeID()).Description.TLSInfo, clusterTLSInfo)
 		currentTrustRoot = clusterTLSInfo.TrustRoot
 	}
 }

+ 34 - 34
integration-cli/docker_api_test.go

@@ -10,27 +10,27 @@ import (
 
 	"github.com/docker/docker/api"
 	"github.com/docker/docker/api/types/versions"
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/internal/test/request"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 func (s *DockerSuite) TestAPIOptionsRoute(c *check.C) {
 	resp, _, err := request.Do("/", request.Method(http.MethodOptions))
-	c.Assert(err, checker.IsNil)
-	c.Assert(resp.StatusCode, checker.Equals, http.StatusOK)
+	assert.NilError(c, err)
+	assert.Equal(c, resp.StatusCode, http.StatusOK)
 }
 
 func (s *DockerSuite) TestAPIGetEnabledCORS(c *check.C) {
 	res, body, err := request.Get("/version")
-	c.Assert(err, checker.IsNil)
-	c.Assert(res.StatusCode, checker.Equals, http.StatusOK)
+	assert.NilError(c, err)
+	assert.Equal(c, res.StatusCode, http.StatusOK)
 	body.Close()
 	// TODO: @runcom incomplete tests, why old integration tests had this headers
 	// and here none of the headers below are in the response?
 	//c.Log(res.Header)
-	//c.Assert(res.Header.Get("Access-Control-Allow-Origin"), check.Equals, "*")
-	//c.Assert(res.Header.Get("Access-Control-Allow-Headers"), check.Equals, "Origin, X-Requested-With, Content-Type, Accept, X-Registry-Auth")
+	//assert.Equal(c, res.Header.Get("Access-Control-Allow-Origin"), "*")
+	//assert.Equal(c, res.Header.Get("Access-Control-Allow-Headers"), "Origin, X-Requested-With, Content-Type, Accept, X-Registry-Auth")
 }
 
 func (s *DockerSuite) TestAPIClientVersionOldNotSupported(c *check.C) {
@@ -42,33 +42,33 @@ func (s *DockerSuite) TestAPIClientVersionOldNotSupported(c *check.C) {
 	}
 	v := strings.Split(api.MinVersion, ".")
 	vMinInt, err := strconv.Atoi(v[1])
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	vMinInt--
 	v[1] = strconv.Itoa(vMinInt)
 	version := strings.Join(v, ".")
 
 	resp, body, err := request.Get("/v" + version + "/version")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer body.Close()
-	c.Assert(resp.StatusCode, checker.Equals, http.StatusBadRequest)
+	assert.Equal(c, resp.StatusCode, http.StatusBadRequest)
 	expected := fmt.Sprintf("client version %s is too old. Minimum supported API version is %s, please upgrade your client to a newer version", version, api.MinVersion)
 	content, err := ioutil.ReadAll(body)
-	c.Assert(err, checker.IsNil)
-	c.Assert(strings.TrimSpace(string(content)), checker.Contains, expected)
+	assert.NilError(c, err)
+	assert.Equal(c, strings.TrimSpace(string(content)), expected)
 }
 
 func (s *DockerSuite) TestAPIErrorJSON(c *check.C) {
 	httpResp, body, err := request.Post("/containers/create", request.JSONBody(struct{}{}))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	if versions.LessThan(testEnv.DaemonAPIVersion(), "1.32") {
-		c.Assert(httpResp.StatusCode, checker.Equals, http.StatusInternalServerError)
+		assert.Equal(c, httpResp.StatusCode, http.StatusInternalServerError)
 	} else {
-		c.Assert(httpResp.StatusCode, checker.Equals, http.StatusBadRequest)
+		assert.Equal(c, httpResp.StatusCode, http.StatusBadRequest)
 	}
-	c.Assert(httpResp.Header.Get("Content-Type"), checker.Equals, "application/json")
+	assert.Assert(c, strings.Contains(httpResp.Header.Get("Content-Type"), "application/json"))
 	b, err := request.ReadBody(body)
-	c.Assert(err, checker.IsNil)
-	c.Assert(getErrorMessage(c, b), checker.Equals, "Config cannot be empty in order to create a container")
+	assert.NilError(c, err)
+	assert.Equal(c, getErrorMessage(c, b), "Config cannot be empty in order to create a container")
 }
 
 func (s *DockerSuite) TestAPIErrorPlainText(c *check.C) {
@@ -76,35 +76,35 @@ func (s *DockerSuite) TestAPIErrorPlainText(c *check.C) {
 	// in v1.23, but changed in 1.24, hence not applicable on Windows. See apiVersionSupportsJSONErrors
 	testRequires(c, DaemonIsLinux)
 	httpResp, body, err := request.Post("/v1.23/containers/create", request.JSONBody(struct{}{}))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	if versions.LessThan(testEnv.DaemonAPIVersion(), "1.32") {
-		c.Assert(httpResp.StatusCode, checker.Equals, http.StatusInternalServerError)
+		assert.Equal(c, httpResp.StatusCode, http.StatusInternalServerError)
 	} else {
-		c.Assert(httpResp.StatusCode, checker.Equals, http.StatusBadRequest)
+		assert.Equal(c, httpResp.StatusCode, http.StatusBadRequest)
 	}
-	c.Assert(httpResp.Header.Get("Content-Type"), checker.Contains, "text/plain")
+	assert.Assert(c, strings.Contains(httpResp.Header.Get("Content-Type"), "text/plain"))
 	b, err := request.ReadBody(body)
-	c.Assert(err, checker.IsNil)
-	c.Assert(strings.TrimSpace(string(b)), checker.Equals, "Config cannot be empty in order to create a container")
+	assert.NilError(c, err)
+	assert.Equal(c, strings.TrimSpace(string(b)), "Config cannot be empty in order to create a container")
 }
 
 func (s *DockerSuite) TestAPIErrorNotFoundJSON(c *check.C) {
 	// 404 is a different code path to normal errors, so test separately
 	httpResp, body, err := request.Get("/notfound", request.JSON)
-	c.Assert(err, checker.IsNil)
-	c.Assert(httpResp.StatusCode, checker.Equals, http.StatusNotFound)
-	c.Assert(httpResp.Header.Get("Content-Type"), checker.Equals, "application/json")
+	assert.NilError(c, err)
+	assert.Equal(c, httpResp.StatusCode, http.StatusNotFound)
+	assert.Assert(c, strings.Contains(httpResp.Header.Get("Content-Type"), "application/json"))
 	b, err := request.ReadBody(body)
-	c.Assert(err, checker.IsNil)
-	c.Assert(getErrorMessage(c, b), checker.Equals, "page not found")
+	assert.NilError(c, err)
+	assert.Equal(c, getErrorMessage(c, b), "page not found")
 }
 
 func (s *DockerSuite) TestAPIErrorNotFoundPlainText(c *check.C) {
 	httpResp, body, err := request.Get("/v1.23/notfound", request.JSON)
-	c.Assert(err, checker.IsNil)
-	c.Assert(httpResp.StatusCode, checker.Equals, http.StatusNotFound)
-	c.Assert(httpResp.Header.Get("Content-Type"), checker.Contains, "text/plain")
+	assert.NilError(c, err)
+	assert.Equal(c, httpResp.StatusCode, http.StatusNotFound)
+	assert.Assert(c, strings.Contains(httpResp.Header.Get("Content-Type"), "text/plain"))
 	b, err := request.ReadBody(body)
-	c.Assert(err, checker.IsNil)
-	c.Assert(strings.TrimSpace(string(b)), checker.Equals, "page not found")
+	assert.NilError(c, err)
+	assert.Equal(c, strings.TrimSpace(string(b)), "page not found")
 }

+ 6 - 5
integration-cli/docker_cli_attach_test.go

@@ -12,6 +12,7 @@ import (
 
 	"github.com/docker/docker/integration-cli/cli"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 	"gotest.tools/icmd"
 )
 
@@ -99,7 +100,7 @@ func (s *DockerSuite) TestAttachTTYWithoutStdin(c *check.C) {
 	out, _ := dockerCmd(c, "run", "-d", "-ti", "busybox")
 
 	id := strings.TrimSpace(out)
-	c.Assert(waitRun(id), check.IsNil)
+	assert.NilError(c, waitRun(id))
 
 	done := make(chan error)
 	go func() {
@@ -126,7 +127,7 @@ func (s *DockerSuite) TestAttachTTYWithoutStdin(c *check.C) {
 
 	select {
 	case err := <-done:
-		c.Assert(err, check.IsNil)
+		assert.NilError(c, err)
 	case <-time.After(attachWait):
 		c.Fatal("attach is running but should have failed")
 	}
@@ -144,7 +145,7 @@ func (s *DockerSuite) TestAttachDisconnect(c *check.C) {
 	}
 	defer stdin.Close()
 	stdout, err := cmd.StdoutPipe()
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	defer stdout.Close()
 	c.Assert(cmd.Start(), check.IsNil)
 	defer func() {
@@ -153,9 +154,9 @@ func (s *DockerSuite) TestAttachDisconnect(c *check.C) {
 	}()
 
 	_, err = stdin.Write([]byte("hello\n"))
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	out, err = bufio.NewReader(stdout).ReadString('\n')
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	c.Assert(strings.TrimSpace(out), check.Equals, "hello")
 
 	c.Assert(stdin.Close(), check.IsNil)

+ 20 - 20
integration-cli/docker_cli_attach_unix_test.go

@@ -9,9 +9,9 @@ import (
 	"strings"
 	"time"
 
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/go-check/check"
 	"github.com/kr/pty"
+	"gotest.tools/assert"
 )
 
 // #9860 Make sure attach ends when container ends (with no errors)
@@ -21,17 +21,17 @@ func (s *DockerSuite) TestAttachClosedOnContainerStop(c *check.C) {
 	out, _ := dockerCmd(c, "run", "-dti", "busybox", "/bin/sh", "-c", `trap 'exit 0' SIGTERM; while true; do sleep 1; done`)
 
 	id := strings.TrimSpace(out)
-	c.Assert(waitRun(id), check.IsNil)
+	assert.NilError(c, waitRun(id))
 
 	pty, tty, err := pty.Open()
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	attachCmd := exec.Command(dockerBinary, "attach", id)
 	attachCmd.Stdin = tty
 	attachCmd.Stdout = tty
 	attachCmd.Stderr = tty
 	err = attachCmd.Start()
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	errChan := make(chan error)
 	go func() {
@@ -62,7 +62,7 @@ func (s *DockerSuite) TestAttachAfterDetach(c *check.C) {
 	name := "detachtest"
 
 	cpty, tty, err := pty.Open()
-	c.Assert(err, checker.IsNil, check.Commentf("Could not open pty: %v", err))
+	assert.NilError(c, err, "Could not open pty: %v", err)
 	cmd := exec.Command(dockerBinary, "run", "-ti", "--name", name, "busybox")
 	cmd.Stdin = tty
 	cmd.Stdout = tty
@@ -87,7 +87,7 @@ func (s *DockerSuite) TestAttachAfterDetach(c *check.C) {
 	}
 
 	cpty, tty, err = pty.Open()
-	c.Assert(err, checker.IsNil, check.Commentf("Could not open pty: %v", err))
+	assert.NilError(c, err, "Could not open pty: %v", err)
 
 	cmd = exec.Command(dockerBinary, "attach", name)
 	cmd.Stdin = tty
@@ -95,7 +95,7 @@ func (s *DockerSuite) TestAttachAfterDetach(c *check.C) {
 	cmd.Stderr = tty
 
 	err = cmd.Start()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer cmd.Process.Kill()
 
 	bytes := make([]byte, 10)
@@ -114,45 +114,45 @@ func (s *DockerSuite) TestAttachAfterDetach(c *check.C) {
 
 	select {
 	case err := <-readErr:
-		c.Assert(err, check.IsNil)
+		assert.NilError(c, err)
 	case <-time.After(2 * time.Second):
 		c.Fatal("timeout waiting for attach read")
 	}
 
-	c.Assert(string(bytes[:nBytes]), checker.Contains, "/ #")
+	assert.Assert(c, strings.Contains(string(bytes[:nBytes]), "/ #"))
 }
 
 // TestAttachDetach checks that attach in tty mode can be detached using the long container ID
 func (s *DockerSuite) TestAttachDetach(c *check.C) {
 	out, _ := dockerCmd(c, "run", "-itd", "busybox", "cat")
 	id := strings.TrimSpace(out)
-	c.Assert(waitRun(id), check.IsNil)
+	assert.NilError(c, waitRun(id))
 
 	cpty, tty, err := pty.Open()
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	defer cpty.Close()
 
 	cmd := exec.Command(dockerBinary, "attach", id)
 	cmd.Stdin = tty
 	stdout, err := cmd.StdoutPipe()
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	defer stdout.Close()
 	err = cmd.Start()
-	c.Assert(err, check.IsNil)
-	c.Assert(waitRun(id), check.IsNil)
+	assert.NilError(c, err)
+	assert.NilError(c, waitRun(id))
 
 	_, err = cpty.Write([]byte("hello\n"))
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	out, err = bufio.NewReader(stdout).ReadString('\n')
-	c.Assert(err, check.IsNil)
-	c.Assert(strings.TrimSpace(out), checker.Equals, "hello")
+	assert.NilError(c, err)
+	assert.Equal(c, strings.TrimSpace(out), "hello")
 
 	// escape sequence
 	_, err = cpty.Write([]byte{16})
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	time.Sleep(100 * time.Millisecond)
 	_, err = cpty.Write([]byte{17})
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	ch := make(chan struct{})
 	go func() {
@@ -167,5 +167,5 @@ func (s *DockerSuite) TestAttachDetach(c *check.C) {
 	}
 
 	running := inspectField(c, id, "State.Running")
-	c.Assert(running, checker.Equals, "true") // container should be running
+	assert.Equal(c, running, "true") // container should be running
 }

+ 39 - 38
integration-cli/docker_cli_build_test.go

@@ -28,6 +28,7 @@ import (
 	"github.com/go-check/check"
 	"github.com/moby/buildkit/frontend/dockerfile/command"
 	"github.com/opencontainers/go-digest"
+	"gotest.tools/assert"
 	"gotest.tools/icmd"
 )
 
@@ -498,7 +499,7 @@ func (s *DockerSuite) TestBuildAddSingleFileToWorkdir(c *check.C) {
 	case <-time.After(15 * time.Second):
 		c.Fatal("Build with adding to workdir timed out")
 	case err := <-errChan:
-		c.Assert(err, check.IsNil)
+		assert.NilError(c, err)
 	}
 }
 
@@ -841,7 +842,7 @@ COPY test_file .`),
 	case <-time.After(15 * time.Second):
 		c.Fatal("Build with adding to workdir timed out")
 	case err := <-errChan:
-		c.Assert(err, check.IsNil)
+		assert.NilError(c, err)
 	}
 }
 
@@ -2068,9 +2069,9 @@ func (s *DockerSuite) TestBuildNoContext(c *check.C) {
 func (s *DockerSuite) TestBuildDockerfileStdin(c *check.C) {
 	name := "stdindockerfile"
 	tmpDir, err := ioutil.TempDir("", "fake-context")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	err = ioutil.WriteFile(filepath.Join(tmpDir, "foo"), []byte("bar"), 0600)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	icmd.RunCmd(icmd.Cmd{
 		Command: []string{dockerBinary, "build", "-t", name, "-f", "-", tmpDir},
@@ -2110,12 +2111,12 @@ func (s *DockerSuite) TestBuildDockerfileStdinDockerignoreIgnored(c *check.C) {
 func (s *DockerSuite) testBuildDockerfileStdinNoExtraFiles(c *check.C, hasDockerignore, ignoreDockerignore bool) {
 	name := "stdindockerfilenoextra"
 	tmpDir, err := ioutil.TempDir("", "fake-context")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	defer os.RemoveAll(tmpDir)
 
 	writeFile := func(filename, content string) {
 		err = ioutil.WriteFile(filepath.Join(tmpDir, filename), []byte(content), 0600)
-		c.Assert(err, check.IsNil)
+		assert.NilError(c, err)
 	}
 
 	writeFile("foo", "bar")
@@ -2850,7 +2851,7 @@ RUN cat /existing-directory/test/foo | grep Hi
 ADD test.tar /existing-directory-trailing-slash/
 RUN cat /existing-directory-trailing-slash/test/foo | grep Hi`
 		tmpDir, err := ioutil.TempDir("", "fake-context")
-		c.Assert(err, check.IsNil)
+		assert.NilError(c, err)
 		testTar, err := os.Create(filepath.Join(tmpDir, "test.tar"))
 		if err != nil {
 			c.Fatalf("failed to create test.tar archive: %v", err)
@@ -2890,7 +2891,7 @@ func (s *DockerSuite) TestBuildAddBrokenTar(c *check.C) {
 FROM busybox
 ADD test.tar /`
 		tmpDir, err := ioutil.TempDir("", "fake-context")
-		c.Assert(err, check.IsNil)
+		assert.NilError(c, err)
 		testTar, err := os.Create(filepath.Join(tmpDir, "test.tar"))
 		if err != nil {
 			c.Fatalf("failed to create test.tar archive: %v", err)
@@ -2958,7 +2959,7 @@ func (s *DockerSuite) TestBuildAddTarXz(c *check.C) {
 			ADD test.tar.xz /
 			RUN cat /test/foo | grep Hi`
 		tmpDir, err := ioutil.TempDir("", "fake-context")
-		c.Assert(err, check.IsNil)
+		assert.NilError(c, err)
 		testTar, err := os.Create(filepath.Join(tmpDir, "test.tar"))
 		if err != nil {
 			c.Fatalf("failed to create test.tar archive: %v", err)
@@ -3005,7 +3006,7 @@ func (s *DockerSuite) TestBuildAddTarXzGz(c *check.C) {
 			ADD test.tar.xz.gz /
 			RUN ls /test.tar.xz.gz`
 		tmpDir, err := ioutil.TempDir("", "fake-context")
-		c.Assert(err, check.IsNil)
+		assert.NilError(c, err)
 		testTar, err := os.Create(filepath.Join(tmpDir, "test.tar"))
 		if err != nil {
 			c.Fatalf("failed to create test.tar archive: %v", err)
@@ -3598,11 +3599,11 @@ RUN [ $(ls -l /test | awk '{print $3":"$4}') = 'root:root' ]
 func (s *DockerSuite) TestBuildSymlinkBreakout(c *check.C) {
 	name := "testbuildsymlinkbreakout"
 	tmpdir, err := ioutil.TempDir("", name)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	// See https://github.com/moby/moby/pull/37770 for reason for next line.
 	tmpdir, err = system.GetLongPathName(tmpdir)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	defer os.RemoveAll(tmpdir)
 	ctx := filepath.Join(tmpdir, "context")
@@ -3991,7 +3992,7 @@ RUN cat /proc/self/cgroup
 `))
 	result.Assert(c, icmd.Success)
 	m, err := regexp.MatchString(fmt.Sprintf("memory:.*/%s/.*", cgroupParent), result.Combined())
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	if !m {
 		c.Fatalf("There is no expected memory cgroup with parent /%s/: %s", cgroupParent, result.Combined())
 	}
@@ -4769,14 +4770,14 @@ func (s *DockerSuite) TestBuildCacheBrokenSymlink(c *check.C) {
 	defer ctx.Close()
 
 	err := os.Symlink(filepath.Join(ctx.Dir, "nosuchfile"), filepath.Join(ctx.Dir, "asymlink"))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	// warm up cache
 	cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx))
 
 	// add new file to context, should invalidate cache
 	err = ioutil.WriteFile(filepath.Join(ctx.Dir, "newfile"), []byte("foo"), 0644)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	result := cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx))
 	if strings.Contains(result.Combined(), "Using cache") {
@@ -4796,7 +4797,7 @@ func (s *DockerSuite) TestBuildFollowSymlinkToFile(c *check.C) {
 	defer ctx.Close()
 
 	err := os.Symlink("foo", filepath.Join(ctx.Dir, "asymlink"))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx))
 
@@ -4805,7 +4806,7 @@ func (s *DockerSuite) TestBuildFollowSymlinkToFile(c *check.C) {
 
 	// change target file should invalidate cache
 	err = ioutil.WriteFile(filepath.Join(ctx.Dir, "foo"), []byte("baz"), 0644)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	result := cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx))
 	c.Assert(result.Combined(), checker.Not(checker.Contains), "Using cache")
@@ -4827,7 +4828,7 @@ func (s *DockerSuite) TestBuildFollowSymlinkToDir(c *check.C) {
 	defer ctx.Close()
 
 	err := os.Symlink("foo", filepath.Join(ctx.Dir, "asymlink"))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx))
 
@@ -4836,7 +4837,7 @@ func (s *DockerSuite) TestBuildFollowSymlinkToDir(c *check.C) {
 
 	// change target file should invalidate cache
 	err = ioutil.WriteFile(filepath.Join(ctx.Dir, "foo/def"), []byte("bax"), 0644)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	result := cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx))
 	c.Assert(result.Combined(), checker.Not(checker.Contains), "Using cache")
@@ -4860,7 +4861,7 @@ func (s *DockerSuite) TestBuildSymlinkBasename(c *check.C) {
 	defer ctx.Close()
 
 	err := os.Symlink("foo", filepath.Join(ctx.Dir, "asymlink"))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx))
 
@@ -4885,7 +4886,7 @@ func (s *DockerSuite) TestBuildCacheRootSource(c *check.C) {
 
 	// change file, should invalidate cache
 	err := ioutil.WriteFile(filepath.Join(ctx.Dir, "foo"), []byte("baz"), 0644)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	result := cli.BuildCmd(c, name, build.WithExternalBuildContext(ctx))
 
@@ -5021,9 +5022,9 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestBuildWithExternalAuth(c *check.C)
 	defer os.Setenv("PATH", osPath)
 
 	workingDir, err := os.Getwd()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	absolute, err := filepath.Abs(filepath.Join(workingDir, "fixtures", "auth"))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	testPath := fmt.Sprintf("%s%c%s", osPath, filepath.ListSeparator, absolute)
 
 	os.Setenv("PATH", testPath)
@@ -5031,18 +5032,18 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestBuildWithExternalAuth(c *check.C)
 	repoName := fmt.Sprintf("%v/dockercli/busybox:authtest", privateRegistryURL)
 
 	tmp, err := ioutil.TempDir("", "integration-cli-")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	externalAuthConfig := `{ "credsStore": "shell-test" }`
 
 	configPath := filepath.Join(tmp, "config.json")
 	err = ioutil.WriteFile(configPath, []byte(externalAuthConfig), 0644)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	dockerCmd(c, "--config", tmp, "login", "-u", s.reg.Username(), "-p", s.reg.Password(), privateRegistryURL)
 
 	b, err := ioutil.ReadFile(configPath)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(string(b), checker.Not(checker.Contains), "\"auth\":")
 
 	dockerCmd(c, "--config", tmp, "tag", "busybox", repoName)
@@ -5500,7 +5501,7 @@ func (s *DockerSuite) TestBuildCacheFrom(c *check.C) {
 		ADD baz /
 		RUN touch newfile`
 	err = ioutil.WriteFile(filepath.Join(ctx.Dir, "Dockerfile"), []byte(dockerfile), 0644)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	result = cli.BuildCmd(c, "build2", cli.WithFlags("--cache-from=build1"), build.WithExternalBuildContext(ctx))
 	id2 = getIDByName(c, "build2")
@@ -5684,14 +5685,14 @@ func (s *DockerSuite) TestBuildMultiStageCopyFromSyntax(c *check.C) {
 	c.Assert(getIDByName(c, "build1"), checker.Equals, getIDByName(c, "build2"))
 
 	err := ioutil.WriteFile(filepath.Join(ctx.Dir, "Dockerfile"), []byte(fmt.Sprintf(dockerfile, "COPY baz/aa foo")), 0644)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	// changing file in parent block should not affect last block
 	result = cli.BuildCmd(c, "build3", build.WithExternalBuildContext(ctx))
 	c.Assert(strings.Count(result.Combined(), "Using cache"), checker.Equals, 5)
 
 	err = ioutil.WriteFile(filepath.Join(ctx.Dir, "foo"), []byte("pqr"), 0644)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	// changing file in parent block should affect both first and last block
 	result = cli.BuildCmd(c, "build4", build.WithExternalBuildContext(ctx))
@@ -5802,9 +5803,9 @@ func (s *DockerSuite) TestBuildMultiStageImplicitFrom(c *check.C) {
 
 	if DaemonIsWindows() {
 		out := cli.DockerCmd(c, "run", "build1", "cat", "License.txt").Combined()
-		c.Assert(len(out), checker.GreaterThan, 10)
+		assert.Assert(c, len(out) > 10)
 		out2 := cli.DockerCmd(c, "run", "build1", "cat", "foo").Combined()
-		c.Assert(out, check.Equals, out2)
+		assert.Equal(c, out, out2)
 	}
 }
 
@@ -6075,7 +6076,7 @@ FROM busybox
 WORKDIR /foo/bar
 `))
 	out, _ := dockerCmd(c, "inspect", "--format", "{{ json .Config.Cmd }}", image)
-	c.Assert(strings.TrimSpace(out), checker.Equals, `["sh"]`)
+	assert.Equal(c, strings.TrimSpace(out), `["sh"]`)
 
 	image = "testworkdirlabelimagecmd"
 	buildImageSuccessfully(c, image, build.WithDockerfile(`
@@ -6085,7 +6086,7 @@ LABEL a=b
 `))
 
 	out, _ = dockerCmd(c, "inspect", "--format", "{{ json .Config.Cmd }}", image)
-	c.Assert(strings.TrimSpace(out), checker.Equals, `["sh"]`)
+	assert.Equal(c, strings.TrimSpace(out), `["sh"]`)
 }
 
 // Test case for 28902/28909
@@ -6174,7 +6175,7 @@ CMD echo foo
 	if testEnv.OSType == "windows" {
 		expected = `["/bin/sh -c echo foo"]`
 	}
-	c.Assert(strings.TrimSpace(out), checker.Equals, expected)
+	assert.Equal(c, strings.TrimSpace(out), expected)
 }
 
 // FIXME(vdemeester) should migrate to docker/cli tests
@@ -6196,9 +6197,9 @@ ENV BAR BAZ`),
 		cli.WithFlags("--iidfile", tmpIidFile))
 
 	id, err := ioutil.ReadFile(tmpIidFile)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	d, err := digest.Parse(string(id))
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	c.Assert(d.String(), checker.Equals, getIDByName(c, name))
 }
 
@@ -6212,7 +6213,7 @@ func (s *DockerSuite) TestBuildIidFileCleanupOnFail(c *check.C) {
 	tmpIidFile := filepath.Join(tmpDir, "iid")
 
 	err = ioutil.WriteFile(tmpIidFile, []byte("Dummy"), 0666)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	cli.Docker(cli.Build("testbuildiidfilecleanuponfail"),
 		build.WithDockerfile(`FROM `+minimalBaseImage()+`
@@ -6221,6 +6222,6 @@ func (s *DockerSuite) TestBuildIidFileCleanupOnFail(c *check.C) {
 		ExitCode: 1,
 	})
 	_, err = os.Stat(tmpIidFile)
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(os.IsNotExist(err), check.Equals, true)
 }

+ 5 - 4
integration-cli/docker_cli_build_unix_test.go

@@ -21,6 +21,7 @@ import (
 	"github.com/docker/docker/internal/test/fakecontext"
 	"github.com/docker/go-units"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 	"gotest.tools/icmd"
 )
 
@@ -96,7 +97,7 @@ func (s *DockerSuite) TestBuildAddChangeOwnership(c *check.C) {
 			RUN [ $(stat -c %U:%G "/bar/foo") = 'root:root' ]
 			`
 		tmpDir, err := ioutil.TempDir("", "fake-context")
-		c.Assert(err, check.IsNil)
+		assert.NilError(c, err)
 		testFile, err := os.Create(filepath.Join(tmpDir, "foo"))
 		if err != nil {
 			c.Fatalf("failed to create foo file: %v", err)
@@ -135,9 +136,9 @@ func (s *DockerSuite) TestBuildCancellationKillsSleep(c *check.C) {
 	name := "testbuildcancellation"
 
 	observer, err := newEventObserver(c)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	err = observer.Start()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer observer.Stop()
 
 	// (Note: one year, will never finish)
@@ -148,7 +149,7 @@ func (s *DockerSuite) TestBuildCancellationKillsSleep(c *check.C) {
 	buildCmd.Dir = ctx.Dir
 
 	stdoutBuild, err := buildCmd.StdoutPipe()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	if err := buildCmd.Start(); err != nil {
 		c.Fatalf("failed to run build: %s", err)

+ 37 - 39
integration-cli/docker_cli_by_digest_test.go

@@ -50,7 +50,7 @@ func setupImageWithTag(c *check.C, tag string) (digest.Digest, error) {
 	cli.DockerCmd(c, "rmi", repoAndTag)
 
 	matches := pushDigestRegex.FindStringSubmatch(out)
-	c.Assert(matches, checker.HasLen, 2, check.Commentf("unable to parse digest from push output: %s", out))
+	assert.Equal(c, len(matches), 2, "unable to parse digest from push output: %s", out)
 	pushDigest := matches[1]
 
 	return digest.Digest(pushDigest), nil
@@ -59,14 +59,14 @@ func setupImageWithTag(c *check.C, tag string) (digest.Digest, error) {
 func testPullByTagDisplaysDigest(c *check.C) {
 	testRequires(c, DaemonIsLinux)
 	pushDigest, err := setupImage(c)
-	c.Assert(err, checker.IsNil, check.Commentf("error setting up image"))
+	assert.NilError(c, err, "error setting up image")
 
 	// pull from the registry using the tag
 	out, _ := dockerCmd(c, "pull", repoName)
 
 	// the pull output includes "Digest: <digest>", so find that
 	matches := digestRegex.FindStringSubmatch(out)
-	c.Assert(matches, checker.HasLen, 2, check.Commentf("unable to parse digest from pull output: %s", out))
+	assert.Equal(c, len(matches), 2, "unable to parse digest from push output: %s", out)
 	pullDigest := matches[1]
 
 	// make sure the pushed and pull digests match
@@ -80,7 +80,7 @@ func (s *DockerRegistrySuite) TestPullByTagDisplaysDigest(c *check.C) {
 func testPullByDigest(c *check.C) {
 	testRequires(c, DaemonIsLinux)
 	pushDigest, err := setupImage(c)
-	c.Assert(err, checker.IsNil, check.Commentf("error setting up image"))
+	assert.NilError(c, err, "error setting up image")
 
 	// pull from the registry using the <name>@<digest> reference
 	imageReference := fmt.Sprintf("%s@%s", repoName, pushDigest)
@@ -88,7 +88,7 @@ func testPullByDigest(c *check.C) {
 
 	// the pull output includes "Digest: <digest>", so find that
 	matches := digestRegex.FindStringSubmatch(out)
-	c.Assert(matches, checker.HasLen, 2, check.Commentf("unable to parse digest from pull output: %s", out))
+	assert.Equal(c, len(matches), 2, "unable to parse digest from push output: %s", out)
 	pullDigest := matches[1]
 
 	// make sure the pushed and pull digests match
@@ -114,7 +114,7 @@ func (s *DockerRegistrySuite) TestPullByDigestNoFallback(c *check.C) {
 
 func (s *DockerRegistrySuite) TestCreateByDigest(c *check.C) {
 	pushDigest, err := setupImage(c)
-	c.Assert(err, checker.IsNil, check.Commentf("error setting up image"))
+	assert.NilError(c, err, "error setting up image")
 
 	imageReference := fmt.Sprintf("%s@%s", repoName, pushDigest)
 
@@ -122,12 +122,12 @@ func (s *DockerRegistrySuite) TestCreateByDigest(c *check.C) {
 	dockerCmd(c, "create", "--name", containerName, imageReference)
 
 	res := inspectField(c, containerName, "Config.Image")
-	c.Assert(res, checker.Equals, imageReference)
+	assert.Equal(c, res, imageReference)
 }
 
 func (s *DockerRegistrySuite) TestRunByDigest(c *check.C) {
 	pushDigest, err := setupImage(c)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	imageReference := fmt.Sprintf("%s@%s", repoName, pushDigest)
 
@@ -140,12 +140,12 @@ func (s *DockerRegistrySuite) TestRunByDigest(c *check.C) {
 	c.Assert(matches[1], checker.Equals, "1", check.Commentf("Expected %q, got %q", "1", matches[1]))
 
 	res := inspectField(c, containerName, "Config.Image")
-	c.Assert(res, checker.Equals, imageReference)
+	assert.Equal(c, res, imageReference)
 }
 
 func (s *DockerRegistrySuite) TestRemoveImageByDigest(c *check.C) {
 	digest, err := setupImage(c)
-	c.Assert(err, checker.IsNil, check.Commentf("error setting up image"))
+	assert.NilError(c, err, "error setting up image")
 
 	imageReference := fmt.Sprintf("%s@%s", repoName, digest)
 
@@ -157,18 +157,17 @@ func (s *DockerRegistrySuite) TestRemoveImageByDigest(c *check.C) {
 
 	// do the delete
 	err = deleteImages(imageReference)
-	c.Assert(err, checker.IsNil, check.Commentf("unexpected error deleting image"))
+	assert.NilError(c, err, "unexpected error deleting image")
 
 	// try to inspect again - it should error this time
 	_, err = inspectFieldWithError(imageReference, "Id")
 	//unexpected nil err trying to inspect what should be a non-existent image
-	c.Assert(err, checker.NotNil)
-	c.Assert(err.Error(), checker.Contains, "No such object")
+	assert.ErrorContains(c, err, "No such object")
 }
 
 func (s *DockerRegistrySuite) TestBuildByDigest(c *check.C) {
 	digest, err := setupImage(c)
-	c.Assert(err, checker.IsNil, check.Commentf("error setting up image"))
+	assert.NilError(c, err, "error setting up image")
 
 	imageReference := fmt.Sprintf("%s@%s", repoName, digest)
 
@@ -183,17 +182,17 @@ func (s *DockerRegistrySuite) TestBuildByDigest(c *check.C) {
 	buildImageSuccessfully(c, name, build.WithDockerfile(fmt.Sprintf(
 		`FROM %s
      CMD ["/bin/echo", "Hello World"]`, imageReference)))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	// get the build's image id
 	res := inspectField(c, name, "Config.Image")
 	// make sure they match
-	c.Assert(res, checker.Equals, imageID)
+	assert.Equal(c, res, imageID)
 }
 
 func (s *DockerRegistrySuite) TestTagByDigest(c *check.C) {
 	digest, err := setupImage(c)
-	c.Assert(err, checker.IsNil, check.Commentf("error setting up image"))
+	assert.NilError(c, err, "error setting up image")
 
 	imageReference := fmt.Sprintf("%s@%s", repoName, digest)
 
@@ -207,12 +206,12 @@ func (s *DockerRegistrySuite) TestTagByDigest(c *check.C) {
 	expectedID := inspectField(c, imageReference, "Id")
 
 	tagID := inspectField(c, tag, "Id")
-	c.Assert(tagID, checker.Equals, expectedID)
+	assert.Equal(c, tagID, expectedID)
 }
 
 func (s *DockerRegistrySuite) TestListImagesWithoutDigests(c *check.C) {
 	digest, err := setupImage(c)
-	c.Assert(err, checker.IsNil, check.Commentf("error setting up image"))
+	assert.NilError(c, err, "error setting up image")
 
 	imageReference := fmt.Sprintf("%s@%s", repoName, digest)
 
@@ -227,7 +226,7 @@ func (s *DockerRegistrySuite) TestListImagesWithDigests(c *check.C) {
 
 	// setup image1
 	digest1, err := setupImageWithTag(c, "tag1")
-	c.Assert(err, checker.IsNil, check.Commentf("error setting up image"))
+	assert.NilError(c, err, "error setting up image")
 	imageReference1 := fmt.Sprintf("%s@%s", repoName, digest1)
 	c.Logf("imageReference1 = %s", imageReference1)
 
@@ -243,7 +242,7 @@ func (s *DockerRegistrySuite) TestListImagesWithDigests(c *check.C) {
 	// setup image2
 	digest2, err := setupImageWithTag(c, "tag2")
 	//error setting up image
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	imageReference2 := fmt.Sprintf("%s@%s", repoName, digest2)
 	c.Logf("imageReference2 = %s", imageReference2)
 
@@ -303,7 +302,7 @@ func (s *DockerRegistrySuite) TestListImagesWithDigests(c *check.C) {
 func (s *DockerRegistrySuite) TestListDanglingImagesWithDigests(c *check.C) {
 	// setup image1
 	digest1, err := setupImageWithTag(c, "dangle1")
-	c.Assert(err, checker.IsNil, check.Commentf("error setting up image"))
+	assert.NilError(c, err, "error setting up image")
 	imageReference1 := fmt.Sprintf("%s@%s", repoName, digest1)
 	c.Logf("imageReference1 = %s", imageReference1)
 
@@ -319,7 +318,7 @@ func (s *DockerRegistrySuite) TestListDanglingImagesWithDigests(c *check.C) {
 	// setup image2
 	digest2, err := setupImageWithTag(c, "dangle2")
 	//error setting up image
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	imageReference2 := fmt.Sprintf("%s@%s", repoName, digest2)
 	c.Logf("imageReference2 = %s", imageReference2)
 
@@ -386,7 +385,7 @@ func (s *DockerRegistrySuite) TestInspectImageWithDigests(c *check.C) {
 
 	var imageJSON []types.ImageInspect
 	err = json.Unmarshal([]byte(out), &imageJSON)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(imageJSON, checker.HasLen, 1)
 	c.Assert(imageJSON[0].RepoDigests, checker.HasLen, 1)
 	assert.Check(c, is.Contains(imageJSON[0].RepoDigests, imageReference))
@@ -396,7 +395,7 @@ func (s *DockerRegistrySuite) TestPsListContainersFilterAncestorImageByDigest(c
 	existingContainers := ExistingContainerIDs(c)
 
 	digest, err := setupImage(c)
-	c.Assert(err, checker.IsNil, check.Commentf("error setting up image"))
+	assert.NilError(c, err, "error setting up image")
 
 	imageReference := fmt.Sprintf("%s@%s", repoName, digest)
 
@@ -421,8 +420,7 @@ func (s *DockerRegistrySuite) TestPsListContainersFilterAncestorImageByDigest(c
 
 	// Invalid imageReference
 	out, _ := dockerCmd(c, "ps", "-a", "-q", "--no-trunc", fmt.Sprintf("--filter=ancestor=busybox@%s", digest))
-	// Filter container for ancestor filter should be empty
-	c.Assert(strings.TrimSpace(out), checker.Equals, "")
+	assert.Equal(c, strings.TrimSpace(out), "", "Filter container for ancestor filter should be empty")
 
 	// Valid imageReference
 	out, _ = dockerCmd(c, "ps", "-a", "-q", "--no-trunc", "--filter=ancestor="+imageReference)
@@ -431,7 +429,7 @@ func (s *DockerRegistrySuite) TestPsListContainersFilterAncestorImageByDigest(c
 
 func (s *DockerRegistrySuite) TestDeleteImageByIDOnlyPulledByDigest(c *check.C) {
 	pushDigest, err := setupImage(c)
-	c.Assert(err, checker.IsNil, check.Commentf("error setting up image"))
+	assert.NilError(c, err, "error setting up image")
 
 	// pull from the registry using the <name>@<digest> reference
 	imageReference := fmt.Sprintf("%s@%s", repoName, pushDigest)
@@ -445,12 +443,12 @@ func (s *DockerRegistrySuite) TestDeleteImageByIDOnlyPulledByDigest(c *check.C)
 	dockerCmd(c, "rmi", imageID)
 
 	_, err = inspectFieldWithError(imageID, "Id")
-	c.Assert(err, checker.NotNil, check.Commentf("image should have been deleted"))
+	assert.ErrorContains(c, err, "", "image should have been deleted")
 }
 
 func (s *DockerRegistrySuite) TestDeleteImageWithDigestAndTag(c *check.C) {
 	pushDigest, err := setupImage(c)
-	c.Assert(err, checker.IsNil, check.Commentf("error setting up image"))
+	assert.NilError(c, err, "error setting up image")
 
 	// pull from the registry using the <name>@<digest> reference
 	imageReference := fmt.Sprintf("%s@%s", repoName, pushDigest)
@@ -472,12 +470,12 @@ func (s *DockerRegistrySuite) TestDeleteImageWithDigestAndTag(c *check.C) {
 
 	// rmi should have deleted the tag, the digest reference, and the image itself
 	_, err = inspectFieldWithError(imageID, "Id")
-	c.Assert(err, checker.NotNil, check.Commentf("image should have been deleted"))
+	assert.ErrorContains(c, err, "", "image should have been deleted")
 }
 
 func (s *DockerRegistrySuite) TestDeleteImageWithDigestAndMultiRepoTag(c *check.C) {
 	pushDigest, err := setupImage(c)
-	c.Assert(err, checker.IsNil, check.Commentf("error setting up image"))
+	assert.NilError(c, err, "error setting up image")
 
 	repo2 := fmt.Sprintf("%s/%s", repoName, "repo2")
 
@@ -497,16 +495,16 @@ func (s *DockerRegistrySuite) TestDeleteImageWithDigestAndMultiRepoTag(c *check.
 	// rmi should have deleted repoTag and image reference, but left repoTag2
 	inspectField(c, repoTag2, "Id")
 	_, err = inspectFieldWithError(imageReference, "Id")
-	c.Assert(err, checker.NotNil, check.Commentf("image digest reference should have been removed"))
+	assert.ErrorContains(c, err, "", "image digest reference should have been removed")
 
 	_, err = inspectFieldWithError(repoTag, "Id")
-	c.Assert(err, checker.NotNil, check.Commentf("image tag reference should have been removed"))
+	assert.ErrorContains(c, err, "", "image tag reference should have been removed")
 
 	dockerCmd(c, "rmi", repoTag2)
 
 	// rmi should have deleted the tag, the digest reference, and the image itself
 	_, err = inspectFieldWithError(imageID, "Id")
-	c.Assert(err, checker.NotNil, check.Commentf("image should have been deleted"))
+	assert.ErrorContains(c, err, "", "image should have been deleted")
 }
 
 // TestPullFailsWithAlteredManifest tests that a `docker pull` fails when
@@ -515,14 +513,14 @@ func (s *DockerRegistrySuite) TestDeleteImageWithDigestAndMultiRepoTag(c *check.
 func (s *DockerRegistrySuite) TestPullFailsWithAlteredManifest(c *check.C) {
 	testRequires(c, DaemonIsLinux)
 	manifestDigest, err := setupImage(c)
-	c.Assert(err, checker.IsNil, check.Commentf("error setting up image"))
+	assert.NilError(c, err, "error setting up image")
 
 	// Load the target manifest blob.
 	manifestBlob := s.reg.ReadBlobContents(c, manifestDigest)
 
 	var imgManifest schema2.Manifest
 	err = json.Unmarshal(manifestBlob, &imgManifest)
-	c.Assert(err, checker.IsNil, check.Commentf("unable to decode image manifest from blob"))
+	assert.NilError(c, err, "unable to decode image manifest from blob")
 
 	// Change a layer in the manifest.
 	imgManifest.Layers[0].Digest = digest.Digest("sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef")
@@ -533,7 +531,7 @@ func (s *DockerRegistrySuite) TestPullFailsWithAlteredManifest(c *check.C) {
 	defer undo()
 
 	alteredManifestBlob, err := json.MarshalIndent(imgManifest, "", "   ")
-	c.Assert(err, checker.IsNil, check.Commentf("unable to encode altered image manifest to JSON"))
+	assert.NilError(c, err, "unable to encode altered image manifest to JSON")
 
 	s.reg.WriteBlobContents(c, manifestDigest, alteredManifestBlob)
 
@@ -546,5 +544,5 @@ func (s *DockerRegistrySuite) TestPullFailsWithAlteredManifest(c *check.C) {
 	c.Assert(exitStatus, checker.Not(check.Equals), 0)
 
 	expectedErrorMsg := fmt.Sprintf("manifest verification failed for digest %s", manifestDigest)
-	c.Assert(out, checker.Contains, expectedErrorMsg)
+	assert.Assert(c, is.Contains(out, expectedErrorMsg))
 }

+ 4 - 3
integration-cli/docker_cli_cp_from_container_test.go

@@ -6,6 +6,7 @@ import (
 
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 // Try all of the test cases from the archive package which implements the
@@ -147,7 +148,7 @@ func (s *DockerSuite) TestCpFromCaseB(c *check.C) {
 	dstDir := cpPathTrailingSep(tmpDir, "testDir")
 
 	err := runDockerCp(c, srcPath, dstDir, nil)
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 
 	c.Assert(isCpDirNotExist(err), checker.True, check.Commentf("expected DirNotExists error, but got %T: %s", err, err))
 }
@@ -263,7 +264,7 @@ func (s *DockerSuite) TestCpFromCaseF(c *check.C) {
 	dstFile := cpPath(tmpDir, "file1")
 
 	err := runDockerCp(c, srcDir, dstFile, nil)
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 
 	c.Assert(isCpCannotCopyDir(err), checker.True, check.Commentf("expected ErrCannotCopyDir error, but got %T: %s", err, err))
 }
@@ -355,7 +356,7 @@ func (s *DockerSuite) TestCpFromCaseI(c *check.C) {
 	dstFile := cpPath(tmpDir, "file1")
 
 	err := runDockerCp(c, srcDir, dstFile, nil)
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 
 	c.Assert(isCpCannotCopyDir(err), checker.True, check.Commentf("expected ErrCannotCopyDir error, but got %T: %s", err, err))
 }

+ 116 - 176
integration-cli/docker_cli_cp_test.go

@@ -10,8 +10,9 @@ import (
 	"path/filepath"
 	"strings"
 
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
+	is "gotest.tools/assert/cmp"
 	"gotest.tools/icmd"
 )
 
@@ -28,9 +29,7 @@ const (
 // Ensure that an all-local path case returns an error.
 func (s *DockerSuite) TestCpLocalOnly(c *check.C) {
 	err := runDockerCp(c, "foo", "bar", nil)
-	c.Assert(err, checker.NotNil)
-
-	c.Assert(err.Error(), checker.Contains, "must specify at least one container source")
+	assert.ErrorContains(c, err, "must specify at least one container source")
 }
 
 // Test for #5656
@@ -41,20 +40,18 @@ func (s *DockerSuite) TestCpGarbagePath(c *check.C) {
 	containerID := strings.TrimSpace(out)
 
 	out, _ = dockerCmd(c, "wait", containerID)
-	// failed to set up container
-	c.Assert(strings.TrimSpace(out), checker.Equals, "0")
-
-	c.Assert(os.MkdirAll(cpTestPath, os.ModeDir), checker.IsNil)
+	assert.Equal(c, strings.TrimSpace(out), "0", "failed to set up container")
+	assert.NilError(c, os.MkdirAll(cpTestPath, os.ModeDir))
 
 	hostFile, err := os.Create(cpFullPath)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer hostFile.Close()
 	defer os.RemoveAll(cpTestPathParent)
 
 	fmt.Fprintf(hostFile, "%s", cpHostContents)
 
 	tmpdir, err := ioutil.TempDir("", "docker-integration")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	tmpname := filepath.Join(tmpdir, cpTestName)
 	defer os.RemoveAll(tmpdir)
@@ -67,13 +64,9 @@ func (s *DockerSuite) TestCpGarbagePath(c *check.C) {
 	defer file.Close()
 
 	test, err := ioutil.ReadAll(file)
-	c.Assert(err, checker.IsNil)
-
-	// output matched host file -- garbage path can escape container rootfs
-	c.Assert(string(test), checker.Not(checker.Equals), cpHostContents)
-
-	// output doesn't match the input for garbage path
-	c.Assert(string(test), checker.Equals, cpContainerContents)
+	assert.NilError(c, err)
+	assert.Assert(c, string(test) != cpHostContents, "output matched host file -- garbage path can escape container rootfs")
+	assert.Assert(c, string(test) == cpContainerContents, "output doesn't match the input for garbage path")
 }
 
 // Check that relative paths are relative to the container's rootfs
@@ -83,20 +76,18 @@ func (s *DockerSuite) TestCpRelativePath(c *check.C) {
 	containerID := strings.TrimSpace(out)
 
 	out, _ = dockerCmd(c, "wait", containerID)
-	// failed to set up container
-	c.Assert(strings.TrimSpace(out), checker.Equals, "0")
-
-	c.Assert(os.MkdirAll(cpTestPath, os.ModeDir), checker.IsNil)
+	assert.Equal(c, strings.TrimSpace(out), "0", "failed to set up container")
+	assert.NilError(c, os.MkdirAll(cpTestPath, os.ModeDir))
 
 	hostFile, err := os.Create(cpFullPath)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer hostFile.Close()
 	defer os.RemoveAll(cpTestPathParent)
 
 	fmt.Fprintf(hostFile, "%s", cpHostContents)
 
 	tmpdir, err := ioutil.TempDir("", "docker-integration")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	tmpname := filepath.Join(tmpdir, cpTestName)
 	defer os.RemoveAll(tmpdir)
@@ -107,7 +98,7 @@ func (s *DockerSuite) TestCpRelativePath(c *check.C) {
 		// get this unix-path manipulation on windows with filepath.
 		relPath = cpFullPath[1:]
 	}
-	c.Assert(path.IsAbs(cpFullPath), checker.True, check.Commentf("path %s was assumed to be an absolute path", cpFullPath))
+	assert.Assert(c, path.IsAbs(cpFullPath), "path %s was assumed to be an absolute path", cpFullPath)
 
 	dockerCmd(c, "cp", containerID+":"+relPath, tmpdir)
 
@@ -115,13 +106,9 @@ func (s *DockerSuite) TestCpRelativePath(c *check.C) {
 	defer file.Close()
 
 	test, err := ioutil.ReadAll(file)
-	c.Assert(err, checker.IsNil)
-
-	// output matched host file -- relative path can escape container rootfs
-	c.Assert(string(test), checker.Not(checker.Equals), cpHostContents)
-
-	// output doesn't match the input for relative path
-	c.Assert(string(test), checker.Equals, cpContainerContents)
+	assert.NilError(c, err)
+	assert.Assert(c, string(test) != cpHostContents, "output matched host file -- relative path can escape container rootfs")
+	assert.Assert(c, string(test) == cpContainerContents, "output doesn't match the input for relative path")
 }
 
 // Check that absolute paths are relative to the container's rootfs
@@ -131,20 +118,18 @@ func (s *DockerSuite) TestCpAbsolutePath(c *check.C) {
 	containerID := strings.TrimSpace(out)
 
 	out, _ = dockerCmd(c, "wait", containerID)
-	// failed to set up container
-	c.Assert(strings.TrimSpace(out), checker.Equals, "0")
-
-	c.Assert(os.MkdirAll(cpTestPath, os.ModeDir), checker.IsNil)
+	assert.Equal(c, strings.TrimSpace(out), "0", "failed to set up container")
+	assert.NilError(c, os.MkdirAll(cpTestPath, os.ModeDir))
 
 	hostFile, err := os.Create(cpFullPath)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer hostFile.Close()
 	defer os.RemoveAll(cpTestPathParent)
 
 	fmt.Fprintf(hostFile, "%s", cpHostContents)
 
 	tmpdir, err := ioutil.TempDir("", "docker-integration")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	tmpname := filepath.Join(tmpdir, cpTestName)
 	defer os.RemoveAll(tmpdir)
@@ -157,13 +142,9 @@ func (s *DockerSuite) TestCpAbsolutePath(c *check.C) {
 	defer file.Close()
 
 	test, err := ioutil.ReadAll(file)
-	c.Assert(err, checker.IsNil)
-
-	// output matched host file -- absolute path can escape container rootfs
-	c.Assert(string(test), checker.Not(checker.Equals), cpHostContents)
-
-	// output doesn't match the input for absolute path
-	c.Assert(string(test), checker.Equals, cpContainerContents)
+	assert.NilError(c, err)
+	assert.Assert(c, string(test) != cpHostContents, "output matched host file -- absolute path can escape container rootfs")
+	assert.Assert(c, string(test) == cpContainerContents, "output doesn't match the input for absolute path")
 }
 
 // Test for #5619
@@ -175,20 +156,19 @@ func (s *DockerSuite) TestCpAbsoluteSymlink(c *check.C) {
 	containerID := strings.TrimSpace(out)
 
 	out, _ = dockerCmd(c, "wait", containerID)
-	// failed to set up container
-	c.Assert(strings.TrimSpace(out), checker.Equals, "0")
+	assert.Equal(c, strings.TrimSpace(out), "0", "failed to set up container")
 
-	c.Assert(os.MkdirAll(cpTestPath, os.ModeDir), checker.IsNil)
+	assert.NilError(c, os.MkdirAll(cpTestPath, os.ModeDir))
 
 	hostFile, err := os.Create(cpFullPath)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer hostFile.Close()
 	defer os.RemoveAll(cpTestPathParent)
 
 	fmt.Fprintf(hostFile, "%s", cpHostContents)
 
 	tmpdir, err := ioutil.TempDir("", "docker-integration")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	tmpname := filepath.Join(tmpdir, "container_path")
 	defer os.RemoveAll(tmpdir)
@@ -199,9 +179,8 @@ func (s *DockerSuite) TestCpAbsoluteSymlink(c *check.C) {
 
 	// We should have copied a symlink *NOT* the file itself!
 	linkTarget, err := os.Readlink(tmpname)
-	c.Assert(err, checker.IsNil)
-
-	c.Assert(linkTarget, checker.Equals, filepath.FromSlash(cpFullPath))
+	assert.NilError(c, err)
+	assert.Equal(c, linkTarget, filepath.FromSlash(cpFullPath))
 }
 
 // Check that symlinks to a directory behave as expected when copying one from
@@ -213,11 +192,10 @@ func (s *DockerSuite) TestCpFromSymlinkToDirectory(c *check.C) {
 	containerID := strings.TrimSpace(out)
 
 	out, _ = dockerCmd(c, "wait", containerID)
-	// failed to set up container
-	c.Assert(strings.TrimSpace(out), checker.Equals, "0")
+	assert.Equal(c, strings.TrimSpace(out), "0", "failed to set up container")
 
 	testDir, err := ioutil.TempDir("", "test-cp-from-symlink-to-dir-")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer os.RemoveAll(testDir)
 
 	// This copy command should copy the symlink, not the target, into the
@@ -226,9 +204,9 @@ func (s *DockerSuite) TestCpFromSymlinkToDirectory(c *check.C) {
 
 	expectedPath := filepath.Join(testDir, "dir_link")
 	linkTarget, err := os.Readlink(expectedPath)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
-	c.Assert(linkTarget, checker.Equals, filepath.FromSlash(cpTestPathParent))
+	assert.Equal(c, linkTarget, filepath.FromSlash(cpTestPathParent))
 
 	os.Remove(expectedPath)
 
@@ -243,13 +221,12 @@ func (s *DockerSuite) TestCpFromSymlinkToDirectory(c *check.C) {
 	if err == nil {
 		out = fmt.Sprintf("target name was copied: %q - %q", stat.Mode(), stat.Name())
 	}
-	c.Assert(err, checker.NotNil, check.Commentf("%s", out))
+	assert.ErrorContains(c, err, "", out)
 
 	// It *should* have copied the directory using the asked name "dir_link".
 	stat, err = os.Lstat(expectedPath)
-	c.Assert(err, checker.IsNil, check.Commentf("unable to stat resource at %q", expectedPath))
-
-	c.Assert(stat.IsDir(), checker.True, check.Commentf("should have copied a directory but got %q instead", stat.Mode()))
+	assert.NilError(c, err, "unable to stat resource at %q", expectedPath)
+	assert.Assert(c, stat.IsDir(), "should have copied a directory but got %q instead", stat.Mode())
 }
 
 // Check that symlinks to a directory behave as expected when copying one to a
@@ -259,7 +236,7 @@ func (s *DockerSuite) TestCpToSymlinkToDirectory(c *check.C) {
 	testRequires(c, testEnv.IsLocalDaemon) // Requires local volume mount bind.
 
 	testVol, err := ioutil.TempDir("", "test-cp-to-symlink-to-dir-")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer os.RemoveAll(testVol)
 
 	// Create a test container with a local volume. We will test by copying
@@ -270,25 +247,25 @@ func (s *DockerSuite) TestCpToSymlinkToDirectory(c *check.C) {
 
 	// Create a temp directory to hold a test file nested in a directory.
 	testDir, err := ioutil.TempDir("", "test-cp-to-symlink-to-dir-")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer os.RemoveAll(testDir)
 
 	// This file will be at "/testDir/some/path/test" and will be copied into
 	// the test volume later.
 	hostTestFilename := filepath.Join(testDir, cpFullPath)
-	c.Assert(os.MkdirAll(filepath.Dir(hostTestFilename), os.FileMode(0700)), checker.IsNil)
-	c.Assert(ioutil.WriteFile(hostTestFilename, []byte(cpHostContents), os.FileMode(0600)), checker.IsNil)
+	assert.NilError(c, os.MkdirAll(filepath.Dir(hostTestFilename), os.FileMode(0700)))
+	assert.NilError(c, ioutil.WriteFile(hostTestFilename, []byte(cpHostContents), os.FileMode(0600)))
 
 	// Now create another temp directory to hold a symlink to the
 	// "/testDir/some" directory.
 	linkDir, err := ioutil.TempDir("", "test-cp-to-symlink-to-dir-")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer os.RemoveAll(linkDir)
 
 	// Then symlink "/linkDir/dir_link" to "/testdir/some".
 	linkTarget := filepath.Join(testDir, cpTestPathParent)
 	localLink := filepath.Join(linkDir, "dir_link")
-	c.Assert(os.Symlink(linkTarget, localLink), checker.IsNil)
+	assert.NilError(c, os.Symlink(linkTarget, localLink))
 
 	// Now copy that symlink into the test volume in the container.
 	dockerCmd(c, "cp", localLink, containerID+":/testVol")
@@ -296,9 +273,8 @@ func (s *DockerSuite) TestCpToSymlinkToDirectory(c *check.C) {
 	// This copy command should have copied the symlink *not* the target.
 	expectedPath := filepath.Join(testVol, "dir_link")
 	actualLinkTarget, err := os.Readlink(expectedPath)
-	c.Assert(err, checker.IsNil, check.Commentf("unable to read symlink at %q", expectedPath))
-
-	c.Assert(actualLinkTarget, checker.Equals, linkTarget)
+	assert.NilError(c, err, "unable to read symlink at %q", expectedPath)
+	assert.Equal(c, actualLinkTarget, linkTarget)
 
 	// Good, now remove that copied link for the next test.
 	os.Remove(expectedPath)
@@ -315,21 +291,19 @@ func (s *DockerSuite) TestCpToSymlinkToDirectory(c *check.C) {
 	if err == nil {
 		out = fmt.Sprintf("target name was copied: %q - %q", stat.Mode(), stat.Name())
 	}
-	c.Assert(err, checker.NotNil, check.Commentf("%s", out))
+	assert.ErrorContains(c, err, "", out)
 
 	// It *should* have copied the directory using the asked name "dir_link".
 	stat, err = os.Lstat(expectedPath)
-	c.Assert(err, checker.IsNil, check.Commentf("unable to stat resource at %q", expectedPath))
-
-	c.Assert(stat.IsDir(), checker.True, check.Commentf("should have copied a directory but got %q instead", stat.Mode()))
+	assert.NilError(c, err, "unable to stat resource at %q", expectedPath)
+	assert.Assert(c, stat.IsDir(), "should have copied a directory but got %q instead", stat.Mode())
 
 	// And this directory should contain the file copied from the host at the
 	// expected location: "/testVol/dir_link/path/test"
 	expectedFilepath := filepath.Join(testVol, "dir_link/path/test")
 	fileContents, err := ioutil.ReadFile(expectedFilepath)
-	c.Assert(err, checker.IsNil)
-
-	c.Assert(string(fileContents), checker.Equals, cpHostContents)
+	assert.NilError(c, err)
+	assert.Equal(c, string(fileContents), cpHostContents)
 }
 
 // Test for #5619
@@ -341,13 +315,12 @@ func (s *DockerSuite) TestCpSymlinkComponent(c *check.C) {
 	containerID := strings.TrimSpace(out)
 
 	out, _ = dockerCmd(c, "wait", containerID)
-	// failed to set up container
-	c.Assert(strings.TrimSpace(out), checker.Equals, "0")
+	assert.Equal(c, strings.TrimSpace(out), "0", "failed to set up container")
 
-	c.Assert(os.MkdirAll(cpTestPath, os.ModeDir), checker.IsNil)
+	assert.NilError(c, os.MkdirAll(cpTestPath, os.ModeDir))
 
 	hostFile, err := os.Create(cpFullPath)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer hostFile.Close()
 	defer os.RemoveAll(cpTestPathParent)
 
@@ -355,7 +328,7 @@ func (s *DockerSuite) TestCpSymlinkComponent(c *check.C) {
 
 	tmpdir, err := ioutil.TempDir("", "docker-integration")
 
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	tmpname := filepath.Join(tmpdir, cpTestName)
 	defer os.RemoveAll(tmpdir)
@@ -368,13 +341,9 @@ func (s *DockerSuite) TestCpSymlinkComponent(c *check.C) {
 	defer file.Close()
 
 	test, err := ioutil.ReadAll(file)
-	c.Assert(err, checker.IsNil)
-
-	// output matched host file -- symlink path component can escape container rootfs
-	c.Assert(string(test), checker.Not(checker.Equals), cpHostContents)
-
-	// output doesn't match the input for symlink path component
-	c.Assert(string(test), checker.Equals, cpContainerContents)
+	assert.NilError(c, err)
+	assert.Assert(c, string(test) != cpHostContents, "output matched host file -- symlink path component can escape container rootfs")
+	assert.Equal(c, string(test), cpContainerContents, "output doesn't match the input for symlink path component")
 }
 
 // Check that cp with unprivileged user doesn't return any error
@@ -387,15 +356,15 @@ func (s *DockerSuite) TestCpUnprivilegedUser(c *check.C) {
 	containerID := strings.TrimSpace(out)
 
 	out, _ = dockerCmd(c, "wait", containerID)
-	// failed to set up container
-	c.Assert(strings.TrimSpace(out), checker.Equals, "0")
+	assert.Equal(c, strings.TrimSpace(out), "0", "failed to set up container")
 
 	tmpdir, err := ioutil.TempDir("", "docker-integration")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	defer os.RemoveAll(tmpdir)
 
-	c.Assert(os.Chmod(tmpdir, 0777), checker.IsNil)
+	err = os.Chmod(tmpdir, 0777)
+	assert.NilError(c, err)
 
 	result := icmd.RunCommand("su", "unprivilegeduser", "-c",
 		fmt.Sprintf("%s cp %s:%s %s", dockerBinary, containerID, cpTestName, tmpdir))
@@ -407,7 +376,7 @@ func (s *DockerSuite) TestCpSpecialFiles(c *check.C) {
 	testRequires(c, testEnv.IsLocalDaemon)
 
 	outDir, err := ioutil.TempDir("", "cp-test-special-files")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer os.RemoveAll(outDir)
 
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "touch /foo")
@@ -415,38 +384,31 @@ func (s *DockerSuite) TestCpSpecialFiles(c *check.C) {
 	containerID := strings.TrimSpace(out)
 
 	out, _ = dockerCmd(c, "wait", containerID)
-	// failed to set up container
-	c.Assert(strings.TrimSpace(out), checker.Equals, "0")
+	assert.Equal(c, strings.TrimSpace(out), "0", "failed to set up container")
 
 	// Copy actual /etc/resolv.conf
 	dockerCmd(c, "cp", containerID+":/etc/resolv.conf", outDir)
 
 	expected := readContainerFile(c, containerID, "resolv.conf")
 	actual, err := ioutil.ReadFile(outDir + "/resolv.conf")
-	c.Assert(err, checker.IsNil)
-
-	// Expected copied file to be duplicate of the container resolvconf
-	c.Assert(bytes.Equal(actual, expected), checker.True)
+	assert.NilError(c, err)
+	assert.Assert(c, bytes.Equal(actual, expected), "Expected copied file to be duplicate of the container resolvconf")
 
 	// Copy actual /etc/hosts
 	dockerCmd(c, "cp", containerID+":/etc/hosts", outDir)
 
 	expected = readContainerFile(c, containerID, "hosts")
 	actual, err = ioutil.ReadFile(outDir + "/hosts")
-	c.Assert(err, checker.IsNil)
-
-	// Expected copied file to be duplicate of the container hosts
-	c.Assert(bytes.Equal(actual, expected), checker.True)
+	assert.NilError(c, err)
+	assert.Assert(c, bytes.Equal(actual, expected), "Expected copied file to be duplicate of the container hosts")
 
 	// Copy actual /etc/resolv.conf
 	dockerCmd(c, "cp", containerID+":/etc/hostname", outDir)
 
 	expected = readContainerFile(c, containerID, "hostname")
 	actual, err = ioutil.ReadFile(outDir + "/hostname")
-	c.Assert(err, checker.IsNil)
-
-	// Expected copied file to be duplicate of the container resolvconf
-	c.Assert(bytes.Equal(actual, expected), checker.True)
+	assert.NilError(c, err)
+	assert.Assert(c, bytes.Equal(actual, expected), "Expected copied file to be duplicate of the container hostname")
 }
 
 func (s *DockerSuite) TestCpVolumePath(c *check.C) {
@@ -456,66 +418,60 @@ func (s *DockerSuite) TestCpVolumePath(c *check.C) {
 	testRequires(c, testEnv.IsLocalDaemon)
 
 	tmpDir, err := ioutil.TempDir("", "cp-test-volumepath")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer os.RemoveAll(tmpDir)
 	outDir, err := ioutil.TempDir("", "cp-test-volumepath-out")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer os.RemoveAll(outDir)
 	_, err = os.Create(tmpDir + "/test")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, _ := dockerCmd(c, "run", "-d", "-v", "/foo", "-v", tmpDir+"/test:/test", "-v", tmpDir+":/baz", "busybox", "/bin/sh", "-c", "touch /foo/bar")
 
 	containerID := strings.TrimSpace(out)
 
 	out, _ = dockerCmd(c, "wait", containerID)
-	// failed to set up container
-	c.Assert(strings.TrimSpace(out), checker.Equals, "0")
+	assert.Equal(c, strings.TrimSpace(out), "0", "failed to set up container")
 
 	// Copy actual volume path
 	dockerCmd(c, "cp", containerID+":/foo", outDir)
 
 	stat, err := os.Stat(outDir + "/foo")
-	c.Assert(err, checker.IsNil)
-	// expected copied content to be dir
-	c.Assert(stat.IsDir(), checker.True)
+	assert.NilError(c, err)
+	assert.Assert(c, stat.IsDir(), "Expected copied content to be dir")
+
 	stat, err = os.Stat(outDir + "/foo/bar")
-	c.Assert(err, checker.IsNil)
-	// Expected file `bar` to be a file
-	c.Assert(stat.IsDir(), checker.False)
+	assert.NilError(c, err)
+	assert.Assert(c, !stat.IsDir(), "Expected file `bar` to be a file")
 
 	// Copy file nested in volume
 	dockerCmd(c, "cp", containerID+":/foo/bar", outDir)
 
 	stat, err = os.Stat(outDir + "/bar")
-	c.Assert(err, checker.IsNil)
-	// Expected file `bar` to be a file
-	c.Assert(stat.IsDir(), checker.False)
+	assert.NilError(c, err)
+	assert.Assert(c, !stat.IsDir(), "Expected file `bar` to be a file")
 
 	// Copy Bind-mounted dir
 	dockerCmd(c, "cp", containerID+":/baz", outDir)
 	stat, err = os.Stat(outDir + "/baz")
-	c.Assert(err, checker.IsNil)
-	// Expected `baz` to be a dir
-	c.Assert(stat.IsDir(), checker.True)
+	assert.NilError(c, err)
+	assert.Assert(c, stat.IsDir(), "Expected `baz` to be a dir")
 
 	// Copy file nested in bind-mounted dir
 	dockerCmd(c, "cp", containerID+":/baz/test", outDir)
 	fb, err := ioutil.ReadFile(outDir + "/baz/test")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	fb2, err := ioutil.ReadFile(tmpDir + "/test")
-	c.Assert(err, checker.IsNil)
-	// Expected copied file to be duplicate of bind-mounted file
-	c.Assert(bytes.Equal(fb, fb2), checker.True)
+	assert.NilError(c, err)
+	assert.Assert(c, bytes.Equal(fb, fb2), "Expected copied file to be duplicate of bind-mounted file")
 
 	// Copy bind-mounted file
 	dockerCmd(c, "cp", containerID+":/test", outDir)
 	fb, err = ioutil.ReadFile(outDir + "/test")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	fb2, err = ioutil.ReadFile(tmpDir + "/test")
-	c.Assert(err, checker.IsNil)
-	// Expected copied file to be duplicate of bind-mounted file
-	c.Assert(bytes.Equal(fb, fb2), checker.True)
+	assert.NilError(c, err)
+	assert.Assert(c, bytes.Equal(fb, fb2), "Expected copied file to be duplicate of bind-mounted file")
 }
 
 func (s *DockerSuite) TestCpToDot(c *check.C) {
@@ -524,20 +480,21 @@ func (s *DockerSuite) TestCpToDot(c *check.C) {
 	containerID := strings.TrimSpace(out)
 
 	out, _ = dockerCmd(c, "wait", containerID)
-	// failed to set up container
-	c.Assert(strings.TrimSpace(out), checker.Equals, "0")
+	assert.Equal(c, strings.TrimSpace(out), "0", "failed to set up container")
 
 	tmpdir, err := ioutil.TempDir("", "docker-integration")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer os.RemoveAll(tmpdir)
 	cwd, err := os.Getwd()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer os.Chdir(cwd)
-	c.Assert(os.Chdir(tmpdir), checker.IsNil)
+	err = os.Chdir(tmpdir)
+	assert.NilError(c, err)
+
 	dockerCmd(c, "cp", containerID+":/test", ".")
 	content, err := ioutil.ReadFile("./test")
-	c.Assert(err, checker.IsNil)
-	c.Assert(string(content), checker.Equals, "lololol\n")
+	assert.NilError(c, err)
+	assert.Equal(c, string(content), "lololol\n")
 }
 
 func (s *DockerSuite) TestCpToStdout(c *check.C) {
@@ -546,17 +503,15 @@ func (s *DockerSuite) TestCpToStdout(c *check.C) {
 	containerID := strings.TrimSpace(out)
 
 	out, _ = dockerCmd(c, "wait", containerID)
-	// failed to set up container
-	c.Assert(strings.TrimSpace(out), checker.Equals, "0")
+	assert.Equal(c, strings.TrimSpace(out), "0", "failed to set up container")
 
 	out, err := RunCommandPipelineWithOutput(
 		exec.Command(dockerBinary, "cp", containerID+":/test", "-"),
 		exec.Command("tar", "-vtf", "-"))
 
-	c.Assert(err, checker.IsNil)
-
-	c.Assert(out, checker.Contains, "test")
-	c.Assert(out, checker.Contains, "-rw")
+	assert.NilError(c, err)
+	assert.Check(c, is.Contains(out, "test"))
+	assert.Check(c, is.Contains(out, "-rw"))
 }
 
 func (s *DockerSuite) TestCpNameHasColon(c *check.C) {
@@ -567,16 +522,15 @@ func (s *DockerSuite) TestCpNameHasColon(c *check.C) {
 	containerID := strings.TrimSpace(out)
 
 	out, _ = dockerCmd(c, "wait", containerID)
-	// failed to set up container
-	c.Assert(strings.TrimSpace(out), checker.Equals, "0")
+	assert.Equal(c, strings.TrimSpace(out), "0", "failed to set up container")
 
 	tmpdir, err := ioutil.TempDir("", "docker-integration")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer os.RemoveAll(tmpdir)
 	dockerCmd(c, "cp", containerID+":/te:s:t", tmpdir)
 	content, err := ioutil.ReadFile(tmpdir + "/te:s:t")
-	c.Assert(err, checker.IsNil)
-	c.Assert(string(content), checker.Equals, "lololol\n")
+	assert.NilError(c, err)
+	assert.Equal(c, string(content), "lololol\n")
 }
 
 func (s *DockerSuite) TestCopyAndRestart(c *check.C) {
@@ -586,18 +540,16 @@ func (s *DockerSuite) TestCopyAndRestart(c *check.C) {
 	containerID := strings.TrimSpace(out)
 
 	out, _ = dockerCmd(c, "wait", containerID)
-	// failed to set up container
-	c.Assert(strings.TrimSpace(out), checker.Equals, "0")
+	assert.Equal(c, strings.TrimSpace(out), "0", "failed to set up container")
 
 	tmpDir, err := ioutil.TempDir("", "test-docker-restart-after-copy-")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer os.RemoveAll(tmpDir)
 
 	dockerCmd(c, "cp", fmt.Sprintf("%s:/etc/group", containerID), tmpDir)
 
 	out, _ = dockerCmd(c, "start", "-a", containerID)
-
-	c.Assert(strings.TrimSpace(out), checker.Equals, expectedMsg)
+	assert.Equal(c, strings.TrimSpace(out), expectedMsg)
 }
 
 func (s *DockerSuite) TestCopyCreatedContainer(c *check.C) {
@@ -605,7 +557,7 @@ func (s *DockerSuite) TestCopyCreatedContainer(c *check.C) {
 	dockerCmd(c, "create", "--name", "test_cp", "-v", "/test", "busybox")
 
 	tmpDir, err := ioutil.TempDir("", "test")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer os.RemoveAll(tmpDir)
 	dockerCmd(c, "cp", "test_cp:/bin/sh", tmpDir)
 }
@@ -616,21 +568,15 @@ func (s *DockerSuite) TestCopyCreatedContainer(c *check.C) {
 func (s *DockerSuite) TestCpSymlinkFromConToHostFollowSymlink(c *check.C) {
 	testRequires(c, DaemonIsLinux)
 	out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath+" && ln -s "+cpFullPath+" /dir_link")
-	if exitCode != 0 {
-		c.Fatal("failed to create a container", out)
-	}
+	assert.Equal(c, exitCode, 0, "failed to set up container: %s", out)
 
 	cleanedContainerID := strings.TrimSpace(out)
 
 	out, _ = dockerCmd(c, "wait", cleanedContainerID)
-	if strings.TrimSpace(out) != "0" {
-		c.Fatal("failed to set up container", out)
-	}
+	assert.Equal(c, strings.TrimSpace(out), "0", "failed to set up container")
 
 	testDir, err := ioutil.TempDir("", "test-cp-symlink-container-to-host-follow-symlink")
-	if err != nil {
-		c.Fatal(err)
-	}
+	assert.NilError(c, err)
 	defer os.RemoveAll(testDir)
 
 	// This copy command should copy the symlink, not the target, into the
@@ -641,12 +587,9 @@ func (s *DockerSuite) TestCpSymlinkFromConToHostFollowSymlink(c *check.C) {
 
 	expected := []byte(cpContainerContents)
 	actual, err := ioutil.ReadFile(expectedPath)
-	c.Assert(err, checker.IsNil)
-
-	if !bytes.Equal(actual, expected) {
-		c.Fatalf("Expected copied file to be duplicate of the container symbol link target")
-	}
+	assert.NilError(c, err)
 	os.Remove(expectedPath)
+	assert.Assert(c, bytes.Equal(actual, expected), "Expected copied file to be duplicate of the container symbol link target")
 
 	// now test copy symbol link to a non-existing file in host
 	expectedPath = filepath.Join(testDir, "somefile_host")
@@ -658,10 +601,7 @@ func (s *DockerSuite) TestCpSymlinkFromConToHostFollowSymlink(c *check.C) {
 	dockerCmd(c, "cp", "-L", cleanedContainerID+":"+"/dir_link", expectedPath)
 
 	actual, err = ioutil.ReadFile(expectedPath)
-	c.Assert(err, checker.IsNil)
-
-	if !bytes.Equal(actual, expected) {
-		c.Fatalf("Expected copied file to be duplicate of the container symbol link target")
-	}
+	assert.NilError(c, err)
 	defer os.Remove(expectedPath)
+	assert.Assert(c, bytes.Equal(actual, expected), "Expected copied file to be duplicate of the container symbol link target")
 }

+ 6 - 5
integration-cli/docker_cli_cp_to_container_test.go

@@ -5,6 +5,7 @@ import (
 
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 // Try all of the test cases from the archive package which implements the
@@ -155,7 +156,7 @@ func (s *DockerSuite) TestCpToCaseB(c *check.C) {
 	dstDir := containerCpPathTrailingSep(containerID, "testDir")
 
 	err := runDockerCp(c, srcPath, dstDir, nil)
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 
 	c.Assert(isCpDirNotExist(err), checker.True, check.Commentf("expected DirNotExists error, but got %T: %s", err, err))
 }
@@ -285,7 +286,7 @@ func (s *DockerSuite) TestCpToCaseF(c *check.C) {
 	dstFile := containerCpPath(containerID, "/root/file1")
 
 	err := runDockerCp(c, srcDir, dstFile, nil)
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 
 	c.Assert(isCpCannotCopyDir(err), checker.True, check.Commentf("expected ErrCannotCopyDir error, but got %T: %s", err, err))
 }
@@ -390,7 +391,7 @@ func (s *DockerSuite) TestCpToCaseI(c *check.C) {
 	dstFile := containerCpPath(containerID, "/root/file1")
 
 	err := runDockerCp(c, srcDir, dstFile, nil)
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 
 	c.Assert(isCpCannotCopyDir(err), checker.True, check.Commentf("expected ErrCannotCopyDir error, but got %T: %s", err, err))
 }
@@ -459,7 +460,7 @@ func (s *DockerSuite) TestCpToErrReadOnlyRootfs(c *check.C) {
 	dstPath := containerCpPath(containerID, "/root/shouldNotExist")
 
 	err := runDockerCp(c, srcPath, dstPath, nil)
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 
 	c.Assert(isCpCannotCopyReadOnly(err), checker.True, check.Commentf("expected ErrContainerRootfsReadonly error, but got %T: %s", err, err))
 
@@ -486,7 +487,7 @@ func (s *DockerSuite) TestCpToErrReadOnlyVolume(c *check.C) {
 	dstPath := containerCpPath(containerID, "/vol_ro/shouldNotExist")
 
 	err := runDockerCp(c, srcPath, dstPath, nil)
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 
 	c.Assert(isCpCannotCopyReadOnly(err), checker.True, check.Commentf("expected ErrVolumeReadonly error, but got %T: %s", err, err))
 

+ 10 - 10
integration-cli/docker_cli_cp_to_container_unix_test.go

@@ -9,9 +9,9 @@ import (
 	"strconv"
 	"strings"
 
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/pkg/system"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 func (s *DockerSuite) TestCpToContainerWithPermissions(c *check.C) {
@@ -25,16 +25,16 @@ func (s *DockerSuite) TestCpToContainerWithPermissions(c *check.C) {
 	containerName := "permtest"
 
 	_, exc := dockerCmd(c, "create", "--name", containerName, "debian:jessie", "/bin/bash", "-c", "stat -c '%u %g %a' /permdirtest /permdirtest/permtest")
-	c.Assert(exc, checker.Equals, 0)
+	assert.Equal(c, exc, 0)
 	defer dockerCmd(c, "rm", "-f", containerName)
 
 	srcPath := cpPath(tmpDir, "permdirtest")
 	dstPath := containerCpPath(containerName, "/")
-	c.Assert(runDockerCp(c, srcPath, dstPath, []string{"-a"}), checker.IsNil)
+	assert.NilError(c, runDockerCp(c, srcPath, dstPath, []string{"-a"}))
 
 	out, err := startContainerGetOutput(c, containerName)
-	c.Assert(err, checker.IsNil, check.Commentf("output: %v", out))
-	c.Assert(strings.TrimSpace(out), checker.Equals, "2 2 700\n65534 65534 400", check.Commentf("output: %v", out))
+	assert.NilError(c, err, "output: %v", out)
+	assert.Equal(c, strings.TrimSpace(out), "2 2 700\n65534 65534 400", "output: %v", out)
 }
 
 // Check ownership is root, both in non-userns and userns enabled modes
@@ -53,14 +53,14 @@ func (s *DockerSuite) TestCpCheckDestOwnership(c *check.C) {
 	dstPath := containerCpPath(containerID, "/tmpvol", "file1")
 
 	err := runDockerCp(c, srcPath, dstPath, nil)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	stat, err := system.Stat(filepath.Join(tmpVolDir, "file1"))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	uid, gid, err := getRootUIDGID()
-	c.Assert(err, checker.IsNil)
-	c.Assert(stat.UID(), checker.Equals, uint32(uid), check.Commentf("Copied file not owned by container root UID"))
-	c.Assert(stat.GID(), checker.Equals, uint32(gid), check.Commentf("Copied file not owned by container root GID"))
+	assert.NilError(c, err)
+	assert.Equal(c, stat.UID(), uint32(uid), "Copied file not owned by container root UID")
+	assert.Equal(c, stat.GID(), uint32(gid), "Copied file not owned by container root GID")
 }
 
 func getRootUIDGID() (int, int, error) {

+ 7 - 7
integration-cli/docker_cli_cp_utils_test.go

@@ -10,9 +10,9 @@ import (
 	"runtime"
 	"strings"
 
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/pkg/archive"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 type fileType uint32
@@ -97,15 +97,15 @@ func makeTestContentInDir(c *check.C, dir string) {
 		path := filepath.Join(dir, filepath.FromSlash(fd.path))
 		switch fd.filetype {
 		case ftRegular:
-			c.Assert(ioutil.WriteFile(path, []byte(fd.contents+"\n"), os.FileMode(fd.mode)), checker.IsNil)
+			assert.NilError(c, ioutil.WriteFile(path, []byte(fd.contents+"\n"), os.FileMode(fd.mode)))
 		case ftDir:
-			c.Assert(os.Mkdir(path, os.FileMode(fd.mode)), checker.IsNil)
+			assert.NilError(c, os.Mkdir(path, os.FileMode(fd.mode)))
 		case ftSymlink:
-			c.Assert(os.Symlink(fd.contents, path), checker.IsNil)
+			assert.NilError(c, os.Symlink(fd.contents, path))
 		}
 
 		if fd.filetype != ftSymlink && runtime.GOOS != "windows" {
-			c.Assert(os.Chown(path, fd.uid, fd.gid), checker.IsNil)
+			assert.NilError(c, os.Chown(path, fd.uid, fd.gid))
 		}
 	}
 }
@@ -158,7 +158,7 @@ func makeTestContainer(c *check.C, options testContainerOptions) (containerID st
 	if exitCode != "0" {
 		out, _ = dockerCmd(c, "logs", containerID)
 	}
-	c.Assert(exitCode, checker.Equals, "0", check.Commentf("failed to make test container: %s", out))
+	assert.Equal(c, exitCode, "0", "failed to make test container: %s", out)
 
 	return
 }
@@ -223,7 +223,7 @@ func getTestDir(c *check.C, label string) (tmpDir string) {
 
 	tmpDir, err = ioutil.TempDir("", label)
 	// unable to make temporary directory
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	return
 }

+ 11 - 10
integration-cli/docker_cli_create_test.go

@@ -15,6 +15,8 @@ import (
 	"github.com/docker/docker/pkg/stringid"
 	"github.com/docker/go-connections/nat"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
+	is "gotest.tools/assert/cmp"
 )
 
 // Make sure we can create a simple container with some args
@@ -36,7 +38,7 @@ func (s *DockerSuite) TestCreateArgs(c *check.C) {
 
 	err := json.Unmarshal([]byte(out), &containers)
 	c.Assert(err, check.IsNil, check.Commentf("Error inspecting the container: %s", err))
-	c.Assert(containers, checker.HasLen, 1)
+	assert.Equal(c, len(containers), 1)
 
 	cont := containers[0]
 	c.Assert(string(cont.Path), checker.Equals, "command", check.Commentf("Unexpected container path. Expected command, received: %s", cont.Path))
@@ -75,7 +77,7 @@ func (s *DockerSuite) TestCreateShrinkRootfs(c *check.C) {
 
 	// Ensure this fails because of the defaultBaseFsSize is 10G
 	out, _, err := dockerCmdWithError("create", "--storage-opt", "size=5G", "busybox")
-	c.Assert(err, check.NotNil, check.Commentf("%s", out))
+	assert.ErrorContains(c, err, "", out)
 	c.Assert(out, checker.Contains, "Container size cannot be smaller than")
 }
 
@@ -95,7 +97,7 @@ func (s *DockerSuite) TestCreateHostConfig(c *check.C) {
 
 	err := json.Unmarshal([]byte(out), &containers)
 	c.Assert(err, check.IsNil, check.Commentf("Error inspecting the container: %s", err))
-	c.Assert(containers, checker.HasLen, 1)
+	assert.Equal(c, len(containers), 1)
 
 	cont := containers[0]
 	c.Assert(cont.HostConfig, check.NotNil, check.Commentf("Expected HostConfig, got none"))
@@ -116,7 +118,7 @@ func (s *DockerSuite) TestCreateWithPortRange(c *check.C) {
 	}
 	err := json.Unmarshal([]byte(out), &containers)
 	c.Assert(err, check.IsNil, check.Commentf("Error inspecting the container: %s", err))
-	c.Assert(containers, checker.HasLen, 1)
+	assert.Equal(c, len(containers), 1)
 
 	cont := containers[0]
 
@@ -146,7 +148,7 @@ func (s *DockerSuite) TestCreateWithLargePortRange(c *check.C) {
 
 	err := json.Unmarshal([]byte(out), &containers)
 	c.Assert(err, check.IsNil, check.Commentf("Error inspecting the container: %s", err))
-	c.Assert(containers, checker.HasLen, 1)
+	assert.Equal(c, len(containers), 1)
 
 	cont := containers[0]
 	c.Assert(cont.HostConfig, check.NotNil, check.Commentf("Expected HostConfig, got none"))
@@ -166,8 +168,7 @@ func (s *DockerSuite) TestCreateEchoStdout(c *check.C) {
 	cleanedContainerID := strings.TrimSpace(out)
 
 	out, _ = dockerCmd(c, "start", "-ai", cleanedContainerID)
-	c.Assert(out, checker.Equals, "test123\n", check.Commentf("container should've printed 'test123', got %q", out))
-
+	assert.Equal(c, out, "test123\n", "container should've printed 'test123', got %q", out)
 }
 
 func (s *DockerSuite) TestCreateVolumesCreated(c *check.C) {
@@ -226,8 +227,7 @@ func (s *DockerSuite) TestCreateHostnameWithNumber(c *check.C) {
 		image = testEnv.PlatformDefaults.BaseImage
 	}
 	out, _ := dockerCmd(c, "run", "-h", "web.0", image, "hostname")
-	c.Assert(strings.TrimSpace(out), checker.Equals, "web.0", check.Commentf("hostname not set, expected `web.0`, got: %s", out))
-
+	assert.Equal(c, strings.TrimSpace(out), "web.0", "hostname not set, expected `web.0`, got: %s", out)
 }
 
 func (s *DockerSuite) TestCreateRM(c *check.C) {
@@ -316,8 +316,9 @@ func (s *DockerSuite) TestCreateWithWorkdir(c *check.C) {
 func (s *DockerSuite) TestCreateWithInvalidLogOpts(c *check.C) {
 	name := "test-invalidate-log-opts"
 	out, _, err := dockerCmdWithError("create", "--name", name, "--log-opt", "invalid=true", "busybox")
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(out, checker.Contains, "unknown log opt")
+	assert.Assert(c, is.Contains(out, "unknown log opt"))
 
 	out, _ = dockerCmd(c, "ps", "-a")
 	c.Assert(out, checker.Not(checker.Contains), name)

+ 32 - 32
integration-cli/docker_cli_daemon_plugins_test.go

@@ -5,10 +5,10 @@ package main
 import (
 	"strings"
 
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/pkg/mount"
 	"github.com/go-check/check"
 	"golang.org/x/sys/unix"
+	"gotest.tools/assert"
 	"gotest.tools/icmd"
 )
 
@@ -37,8 +37,8 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithPluginEnabled(c *check.C) {
 	if err != nil {
 		c.Fatalf("Could not list plugins: %v %s", err, out)
 	}
-	c.Assert(out, checker.Contains, pName)
-	c.Assert(out, checker.Contains, "true")
+	assert.Assert(c, strings.Contains(out, pName))
+	assert.Assert(c, strings.Contains(out, "true"))
 }
 
 // TestDaemonRestartWithPluginDisabled tests state restore for a disabled plugin
@@ -63,8 +63,8 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithPluginDisabled(c *check.C) {
 	if err != nil {
 		c.Fatalf("Could not list plugins: %v %s", err, out)
 	}
-	c.Assert(out, checker.Contains, pName)
-	c.Assert(out, checker.Contains, "false")
+	assert.Assert(c, strings.Contains(out, pName))
+	assert.Assert(c, strings.Contains(out, "false"))
 }
 
 // TestDaemonKillLiveRestoreWithPlugins SIGKILLs daemon started with --live-restore.
@@ -221,14 +221,14 @@ func (s *DockerDaemonSuite) TestVolumePlugin(c *check.C) {
 	if err != nil {
 		c.Fatalf("Could not list volume: %v %s", err, out)
 	}
-	c.Assert(out, checker.Contains, volName)
-	c.Assert(out, checker.Contains, pName)
+	assert.Assert(c, strings.Contains(out, volName))
+	assert.Assert(c, strings.Contains(out, pName))
 
 	out, err = s.d.Cmd("run", "--rm", "-v", volName+":"+destDir, "busybox", "touch", destDir+destFile)
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	out, err = s.d.Cmd("run", "--rm", "-v", volName+":"+destDir, "busybox", "ls", destDir+destFile)
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 }
 
 func (s *DockerDaemonSuite) TestPluginVolumeRemoveOnRestart(c *check.C) {
@@ -237,26 +237,26 @@ func (s *DockerDaemonSuite) TestPluginVolumeRemoveOnRestart(c *check.C) {
 	s.d.Start(c, "--live-restore=true")
 
 	out, err := s.d.Cmd("plugin", "install", "--grant-all-permissions", pName)
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
-	c.Assert(strings.TrimSpace(out), checker.Contains, pName)
+	assert.NilError(c, err, out)
+	assert.Assert(c, strings.Contains(out, pName))
 
 	out, err = s.d.Cmd("volume", "create", "--driver", pName, "test")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	s.d.Restart(c, "--live-restore=true")
 
 	out, err = s.d.Cmd("plugin", "disable", pName)
-	c.Assert(err, checker.NotNil, check.Commentf("%s", out))
-	c.Assert(out, checker.Contains, "in use")
+	assert.ErrorContains(c, err, "", out)
+	assert.Assert(c, strings.Contains(out, "in use"))
 
 	out, err = s.d.Cmd("volume", "rm", "test")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	out, err = s.d.Cmd("plugin", "disable", pName)
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	out, err = s.d.Cmd("plugin", "rm", pName)
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 }
 
 func existsMountpointWithPrefix(mountpointPrefix string) (bool, error) {
@@ -278,7 +278,7 @@ func (s *DockerDaemonSuite) TestPluginListFilterEnabled(c *check.C) {
 	s.d.Start(c)
 
 	out, err := s.d.Cmd("plugin", "install", "--grant-all-permissions", pNameWithTag, "--disable")
-	c.Assert(err, check.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	defer func() {
 		if out, err := s.d.Cmd("plugin", "remove", pNameWithTag); err != nil {
@@ -287,17 +287,17 @@ func (s *DockerDaemonSuite) TestPluginListFilterEnabled(c *check.C) {
 	}()
 
 	out, err = s.d.Cmd("plugin", "ls", "--filter", "enabled=true")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
-	c.Assert(out, checker.Not(checker.Contains), pName)
+	assert.NilError(c, err, out)
+	assert.Assert(c, !strings.Contains(out, pName))
 
 	out, err = s.d.Cmd("plugin", "ls", "--filter", "enabled=false")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
-	c.Assert(out, checker.Contains, pName)
-	c.Assert(out, checker.Contains, "false")
+	assert.NilError(c, err, out)
+	assert.Assert(c, strings.Contains(out, pName))
+	assert.Assert(c, strings.Contains(out, "false"))
 
 	out, err = s.d.Cmd("plugin", "ls")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
-	c.Assert(out, checker.Contains, pName)
+	assert.NilError(c, err, out)
+	assert.Assert(c, strings.Contains(out, pName))
 }
 
 func (s *DockerDaemonSuite) TestPluginListFilterCapability(c *check.C) {
@@ -306,7 +306,7 @@ func (s *DockerDaemonSuite) TestPluginListFilterCapability(c *check.C) {
 	s.d.Start(c)
 
 	out, err := s.d.Cmd("plugin", "install", "--grant-all-permissions", pNameWithTag, "--disable")
-	c.Assert(err, check.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	defer func() {
 		if out, err := s.d.Cmd("plugin", "remove", pNameWithTag); err != nil {
@@ -315,14 +315,14 @@ func (s *DockerDaemonSuite) TestPluginListFilterCapability(c *check.C) {
 	}()
 
 	out, err = s.d.Cmd("plugin", "ls", "--filter", "capability=volumedriver")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
-	c.Assert(out, checker.Contains, pName)
+	assert.NilError(c, err, out)
+	assert.Assert(c, strings.Contains(out, pName))
 
 	out, err = s.d.Cmd("plugin", "ls", "--filter", "capability=authz")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
-	c.Assert(out, checker.Not(checker.Contains), pName)
+	assert.NilError(c, err, out)
+	assert.Assert(c, !strings.Contains(out, pName))
 
 	out, err = s.d.Cmd("plugin", "ls")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
-	c.Assert(out, checker.Contains, pName)
+	assert.NilError(c, err, out)
+	assert.Assert(c, strings.Contains(out, pName))
 }

File diff ditekan karena terlalu besar
+ 152 - 156
integration-cli/docker_cli_daemon_test.go


+ 87 - 113
integration-cli/docker_cli_events_test.go

@@ -17,10 +17,11 @@ import (
 	eventtypes "github.com/docker/docker/api/types/events"
 	"github.com/docker/docker/client"
 	eventstestutils "github.com/docker/docker/daemon/events/testutils"
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli"
 	"github.com/docker/docker/integration-cli/cli/build"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
+	is "gotest.tools/assert/cmp"
 	"gotest.tools/icmd"
 )
 
@@ -47,15 +48,9 @@ func (s *DockerSuite) TestEventsTimestampFormats(c *check.C) {
 		events = events[:len(events)-1]
 
 		nEvents := len(events)
-		c.Assert(nEvents, checker.GreaterOrEqualThan, 5) //Missing expected event
+		assert.Assert(c, nEvents >= 5) //Missing expected event
 		containerEvents := eventActionsByIDAndType(c, events, name, "container")
-		c.Assert(containerEvents, checker.HasLen, 5, check.Commentf("events: %v", events))
-
-		c.Assert(containerEvents[0], checker.Equals, "create", check.Commentf("%s", out))
-		c.Assert(containerEvents[1], checker.Equals, "attach", check.Commentf("%s", out))
-		c.Assert(containerEvents[2], checker.Equals, "start", check.Commentf("%s", out))
-		c.Assert(containerEvents[3], checker.Equals, "die", check.Commentf("%s", out))
-		c.Assert(containerEvents[4], checker.Equals, "destroy", check.Commentf("%s", out))
+		assert.Assert(c, is.DeepEqual(containerEvents, []string{"create", "attach", "start", "die", "destroy"}), out)
 	}
 }
 
@@ -78,7 +73,7 @@ func (s *DockerSuite) TestEventsUntag(c *check.C) {
 	// get the two elements before the last, which are the untags we're
 	// looking for.
 	for _, v := range events[nEvents-3 : nEvents-1] {
-		c.Assert(v, checker.Contains, "untag", check.Commentf("event should be untag"))
+		assert.Check(c, strings.Contains(v, "untag"), "event should be untag")
 	}
 }
 
@@ -89,16 +84,9 @@ func (s *DockerSuite) TestEventsContainerEvents(c *check.C) {
 	events := strings.Split(out, "\n")
 	events = events[:len(events)-1]
 
-	nEvents := len(events)
-	c.Assert(nEvents, checker.GreaterOrEqualThan, 5) //Missing expected event
+	assert.Assert(c, len(events) >= 5) //Missing expected event
 	containerEvents := eventActionsByIDAndType(c, events, "container-events-test", "container")
-	c.Assert(containerEvents, checker.HasLen, 5, check.Commentf("events: %v", events))
-
-	c.Assert(containerEvents[0], checker.Equals, "create", check.Commentf("%s", out))
-	c.Assert(containerEvents[1], checker.Equals, "attach", check.Commentf("%s", out))
-	c.Assert(containerEvents[2], checker.Equals, "start", check.Commentf("%s", out))
-	c.Assert(containerEvents[3], checker.Equals, "die", check.Commentf("%s", out))
-	c.Assert(containerEvents[4], checker.Equals, "destroy", check.Commentf("%s", out))
+	assert.Assert(c, is.DeepEqual(containerEvents[:5], []string{"create", "attach", "start", "die", "destroy"}), out)
 }
 
 func (s *DockerSuite) TestEventsContainerEventsAttrSort(c *check.C) {
@@ -109,19 +97,20 @@ func (s *DockerSuite) TestEventsContainerEventsAttrSort(c *check.C) {
 	events := strings.Split(out, "\n")
 
 	nEvents := len(events)
-	c.Assert(nEvents, checker.GreaterOrEqualThan, 3) //Missing expected event
+	assert.Assert(c, nEvents >= 3) //Missing expected event
 	matchedEvents := 0
 	for _, event := range events {
 		matches := eventstestutils.ScanMap(event)
 		if matches["eventType"] == "container" && matches["action"] == "create" {
 			matchedEvents++
-			c.Assert(out, checker.Contains, "(image=busybox, name=container-events-test)", check.Commentf("Event attributes not sorted"))
+			assert.Check(c, strings.Contains(out, "(image=busybox, name=container-events-test)"), "Event attributes not sorted")
+
 		} else if matches["eventType"] == "container" && matches["action"] == "start" {
 			matchedEvents++
-			c.Assert(out, checker.Contains, "(image=busybox, name=container-events-test)", check.Commentf("Event attributes not sorted"))
+			assert.Check(c, strings.Contains(out, "(image=busybox, name=container-events-test)"), "Event attributes not sorted")
 		}
 	}
-	c.Assert(matchedEvents, checker.Equals, 2, check.Commentf("missing events for container container-events-test:\n%s", out))
+	assert.Equal(c, matchedEvents, 2, "missing events for container container-events-test:\n%s", out)
 }
 
 func (s *DockerSuite) TestEventsContainerEventsSinceUnixEpoch(c *check.C) {
@@ -133,15 +122,9 @@ func (s *DockerSuite) TestEventsContainerEventsSinceUnixEpoch(c *check.C) {
 	events = events[:len(events)-1]
 
 	nEvents := len(events)
-	c.Assert(nEvents, checker.GreaterOrEqualThan, 5) //Missing expected event
+	assert.Assert(c, nEvents >= 5) //Missing expected event
 	containerEvents := eventActionsByIDAndType(c, events, "since-epoch-test", "container")
-	c.Assert(containerEvents, checker.HasLen, 5, check.Commentf("events: %v", events))
-
-	c.Assert(containerEvents[0], checker.Equals, "create", check.Commentf("%s", out))
-	c.Assert(containerEvents[1], checker.Equals, "attach", check.Commentf("%s", out))
-	c.Assert(containerEvents[2], checker.Equals, "start", check.Commentf("%s", out))
-	c.Assert(containerEvents[3], checker.Equals, "die", check.Commentf("%s", out))
-	c.Assert(containerEvents[4], checker.Equals, "destroy", check.Commentf("%s", out))
+	assert.Assert(c, is.DeepEqual(containerEvents, []string{"create", "attach", "start", "die", "destroy"}), out)
 }
 
 func (s *DockerSuite) TestEventsImageTag(c *check.C) {
@@ -154,12 +137,12 @@ func (s *DockerSuite) TestEventsImageTag(c *check.C) {
 		"--since", since, "--until", daemonUnixTime(c))
 
 	events := strings.Split(strings.TrimSpace(out), "\n")
-	c.Assert(events, checker.HasLen, 1, check.Commentf("was expecting 1 event. out=%s", out))
+	assert.Equal(c, len(events), 1, "was expecting 1 event. out=%s", out)
 	event := strings.TrimSpace(events[0])
 
 	matches := eventstestutils.ScanMap(event)
-	c.Assert(matchEventID(matches, image), checker.True, check.Commentf("matches: %v\nout:\n%s", matches, out))
-	c.Assert(matches["action"], checker.Equals, "tag")
+	assert.Assert(c, matchEventID(matches, image), "matches: %v\nout:\n%s", matches, out)
+	assert.Equal(c, matches["action"], "tag")
 }
 
 func (s *DockerSuite) TestEventsImagePull(c *check.C) {
@@ -176,9 +159,8 @@ func (s *DockerSuite) TestEventsImagePull(c *check.C) {
 	events := strings.Split(strings.TrimSpace(out), "\n")
 	event := strings.TrimSpace(events[len(events)-1])
 	matches := eventstestutils.ScanMap(event)
-	c.Assert(matches["id"], checker.Equals, "hello-world:latest")
-	c.Assert(matches["action"], checker.Equals, "pull")
-
+	assert.Equal(c, matches["id"], "hello-world:latest")
+	assert.Equal(c, matches["action"], "pull")
 }
 
 func (s *DockerSuite) TestEventsImageImport(c *check.C) {
@@ -194,15 +176,15 @@ func (s *DockerSuite) TestEventsImageImport(c *check.C) {
 		exec.Command(dockerBinary, "export", cleanedContainerID),
 		exec.Command(dockerBinary, "import", "-"),
 	)
-	c.Assert(err, checker.IsNil, check.Commentf("import failed with output: %q", out))
+	assert.NilError(c, err, "import failed with output: %q", out)
 	imageRef := strings.TrimSpace(out)
 
 	out, _ = dockerCmd(c, "events", "--since", since, "--until", daemonUnixTime(c), "--filter", "event=import")
 	events := strings.Split(strings.TrimSpace(out), "\n")
-	c.Assert(events, checker.HasLen, 1)
+	assert.Equal(c, len(events), 1)
 	matches := eventstestutils.ScanMap(events[0])
-	c.Assert(matches["id"], checker.Equals, imageRef, check.Commentf("matches: %v\nout:\n%s\n", matches, out))
-	c.Assert(matches["action"], checker.Equals, "import", check.Commentf("matches: %v\nout:\n%s\n", matches, out))
+	assert.Equal(c, matches["id"], imageRef, "matches: %v\nout:\n%s\n", matches, out)
+	assert.Equal(c, matches["action"], "import", "matches: %v\nout:\n%s\n", matches, out)
 }
 
 func (s *DockerSuite) TestEventsImageLoad(c *check.C) {
@@ -213,13 +195,13 @@ func (s *DockerSuite) TestEventsImageLoad(c *check.C) {
 
 	out, _ := dockerCmd(c, "images", "-q", "--no-trunc", myImageName)
 	longImageID := strings.TrimSpace(out)
-	c.Assert(longImageID, checker.Not(check.Equals), "", check.Commentf("Id should not be empty"))
+	assert.Assert(c, longImageID != "", "Id should not be empty")
 
 	dockerCmd(c, "save", "-o", "saveimg.tar", myImageName)
 	dockerCmd(c, "rmi", myImageName)
 	out, _ = dockerCmd(c, "images", "-q", myImageName)
 	noImageID := strings.TrimSpace(out)
-	c.Assert(noImageID, checker.Equals, "", check.Commentf("Should not have any image"))
+	assert.Equal(c, noImageID, "", "Should not have any image")
 	dockerCmd(c, "load", "-i", "saveimg.tar")
 
 	result := icmd.RunCommand("rm", "-rf", "saveimg.tar")
@@ -227,21 +209,21 @@ func (s *DockerSuite) TestEventsImageLoad(c *check.C) {
 
 	out, _ = dockerCmd(c, "images", "-q", "--no-trunc", myImageName)
 	imageID := strings.TrimSpace(out)
-	c.Assert(imageID, checker.Equals, longImageID, check.Commentf("Should have same image id as before"))
+	assert.Equal(c, imageID, longImageID, "Should have same image id as before")
 
 	out, _ = dockerCmd(c, "events", "--since", since, "--until", daemonUnixTime(c), "--filter", "event=load")
 	events := strings.Split(strings.TrimSpace(out), "\n")
-	c.Assert(events, checker.HasLen, 1)
+	assert.Equal(c, len(events), 1)
 	matches := eventstestutils.ScanMap(events[0])
-	c.Assert(matches["id"], checker.Equals, imageID, check.Commentf("matches: %v\nout:\n%s\n", matches, out))
-	c.Assert(matches["action"], checker.Equals, "load", check.Commentf("matches: %v\nout:\n%s\n", matches, out))
+	assert.Equal(c, matches["id"], imageID, "matches: %v\nout:\n%s\n", matches, out)
+	assert.Equal(c, matches["action"], "load", "matches: %v\nout:\n%s\n", matches, out)
 
 	out, _ = dockerCmd(c, "events", "--since", since, "--until", daemonUnixTime(c), "--filter", "event=save")
 	events = strings.Split(strings.TrimSpace(out), "\n")
-	c.Assert(events, checker.HasLen, 1)
+	assert.Equal(c, len(events), 1)
 	matches = eventstestutils.ScanMap(events[0])
-	c.Assert(matches["id"], checker.Equals, imageID, check.Commentf("matches: %v\nout:\n%s\n", matches, out))
-	c.Assert(matches["action"], checker.Equals, "save", check.Commentf("matches: %v\nout:\n%s\n", matches, out))
+	assert.Equal(c, matches["id"], imageID, "matches: %v\nout:\n%s\n", matches, out)
+	assert.Equal(c, matches["action"], "save", "matches: %v\nout:\n%s\n", matches, out)
 }
 
 func (s *DockerSuite) TestEventsPluginOps(c *check.C) {
@@ -257,16 +239,10 @@ func (s *DockerSuite) TestEventsPluginOps(c *check.C) {
 	events := strings.Split(out, "\n")
 	events = events[:len(events)-1]
 
-	nEvents := len(events)
-	c.Assert(nEvents, checker.GreaterOrEqualThan, 4)
+	assert.Assert(c, len(events) >= 4)
 
 	pluginEvents := eventActionsByIDAndType(c, events, pNameWithTag, "plugin")
-	c.Assert(pluginEvents, checker.HasLen, 4, check.Commentf("events: %v", events))
-
-	c.Assert(pluginEvents[0], checker.Equals, "pull", check.Commentf("%s", out))
-	c.Assert(pluginEvents[1], checker.Equals, "enable", check.Commentf("%s", out))
-	c.Assert(pluginEvents[2], checker.Equals, "disable", check.Commentf("%s", out))
-	c.Assert(pluginEvents[3], checker.Equals, "remove", check.Commentf("%s", out))
+	assert.Assert(c, is.DeepEqual(pluginEvents, []string{"pull", "enable", "disable", "remove"}), out)
 }
 
 func (s *DockerSuite) TestEventsFilters(c *check.C) {
@@ -281,8 +257,7 @@ func (s *DockerSuite) TestEventsFilters(c *check.C) {
 
 	// make sure we at least got 2 start events
 	count := strings.Count(out, "start")
-	c.Assert(strings.Count(out, "start"), checker.GreaterOrEqualThan, 2, check.Commentf("should have had 2 start events but had %d, out: %s", count, out))
-
+	assert.Assert(c, count >= 2, "should have had 2 start events but had %d, out: %s", count, out)
 }
 
 func (s *DockerSuite) TestEventsFilterImageName(c *check.C) {
@@ -298,7 +273,7 @@ func (s *DockerSuite) TestEventsFilterImageName(c *check.C) {
 	out, _ = dockerCmd(c, "events", "--since", since, "--until", daemonUnixTime(c), "--filter", fmt.Sprintf("image=%s", name))
 	events := strings.Split(out, "\n")
 	events = events[:len(events)-1]
-	c.Assert(events, checker.Not(checker.HasLen), 0) //Expected events but found none for the image busybox:latest
+	assert.Assert(c, len(events) != 0, "Expected events but found none for the image busybox:latest")
 	count1 := 0
 	count2 := 0
 
@@ -309,9 +284,8 @@ func (s *DockerSuite) TestEventsFilterImageName(c *check.C) {
 			count2++
 		}
 	}
-	c.Assert(count1, checker.Not(checker.Equals), 0, check.Commentf("Expected event from container but got %d from %s", count1, container1))
-	c.Assert(count2, checker.Not(checker.Equals), 0, check.Commentf("Expected event from container but got %d from %s", count2, container2))
-
+	assert.Assert(c, count1 != 0, "Expected event from container but got %d from %s", count1, container1)
+	assert.Assert(c, count2 != 0, "Expected event from container but got %d from %s", count2, container2)
 }
 
 func (s *DockerSuite) TestEventsFilterLabels(c *check.C) {
@@ -319,11 +293,11 @@ func (s *DockerSuite) TestEventsFilterLabels(c *check.C) {
 	label := "io.docker.testing=foo"
 
 	out, exit := dockerCmd(c, "create", "-l", label, "busybox")
-	c.Assert(exit, checker.Equals, 0)
+	assert.Equal(c, exit, 0)
 	container1 := strings.TrimSpace(out)
 
 	out, exit = dockerCmd(c, "create", "busybox")
-	c.Assert(exit, checker.Equals, 0)
+	assert.Equal(c, exit, 0)
 	container2 := strings.TrimSpace(out)
 
 	// fetch events with `--until`, so that the client detaches after a second
@@ -337,16 +311,16 @@ func (s *DockerSuite) TestEventsFilterLabels(c *check.C) {
 	)
 
 	events := strings.Split(strings.TrimSpace(out), "\n")
-	c.Assert(len(events), checker.GreaterThan, 0)
+	assert.Assert(c, len(events) > 0)
 
 	var found bool
 	for _, e := range events {
 		if strings.Contains(e, container1) {
 			found = true
 		}
-		c.Assert(e, checker.Not(checker.Contains), container2)
+		assert.Assert(c, !strings.Contains(e, container2))
 	}
-	c.Assert(found, checker.Equals, true)
+	assert.Assert(c, found)
 }
 
 func (s *DockerSuite) TestEventsFilterImageLabels(c *check.C) {
@@ -373,9 +347,9 @@ func (s *DockerSuite) TestEventsFilterImageLabels(c *check.C) {
 	events := strings.Split(strings.TrimSpace(out), "\n")
 
 	// 2 events from the "docker tag" command, another one is from "docker build"
-	c.Assert(events, checker.HasLen, 3, check.Commentf("Events == %s", events))
+	assert.Equal(c, len(events), 3, "Events == %s", events)
 	for _, e := range events {
-		c.Assert(e, checker.Contains, "labelfiltertest")
+		assert.Check(c, strings.Contains(e, "labelfiltertest"))
 	}
 }
 
@@ -408,12 +382,12 @@ func (s *DockerSuite) TestEventsFilterContainer(c *check.C) {
 		// filter by names
 		out, _ := dockerCmd(c, "events", "--since", since, "--until", until, "--filter", "container="+name)
 		events := strings.Split(strings.TrimSuffix(out, "\n"), "\n")
-		c.Assert(checkEvents(ID, events), checker.IsNil)
+		assert.NilError(c, checkEvents(ID, events))
 
 		// filter by ID's
 		out, _ = dockerCmd(c, "events", "--since", since, "--until", until, "--filter", "container="+ID)
 		events = strings.Split(strings.TrimSuffix(out, "\n"), "\n")
-		c.Assert(checkEvents(ID, events), checker.IsNil)
+		assert.NilError(c, checkEvents(ID, events))
 	}
 }
 
@@ -431,7 +405,7 @@ func (s *DockerSuite) TestEventsCommit(c *check.C) {
 
 	until := daemonUnixTime(c)
 	out = cli.DockerCmd(c, "events", "-f", "container="+cID, "--until="+until).Combined()
-	c.Assert(out, checker.Contains, "commit", check.Commentf("Missing 'commit' log event"))
+	assert.Assert(c, strings.Contains(out, "commit"), "Missing 'commit' log event")
 }
 
 func (s *DockerSuite) TestEventsCopy(c *check.C) {
@@ -443,10 +417,10 @@ func (s *DockerSuite) TestEventsCopy(c *check.C) {
 
 	// Create an empty test file.
 	tempFile, err := ioutil.TempFile("", "test-events-copy-")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer os.Remove(tempFile.Name())
 
-	c.Assert(tempFile.Close(), checker.IsNil)
+	assert.NilError(c, tempFile.Close())
 
 	dockerCmd(c, "create", "--name=cptest", id)
 
@@ -454,22 +428,22 @@ func (s *DockerSuite) TestEventsCopy(c *check.C) {
 
 	until := daemonUnixTime(c)
 	out, _ := dockerCmd(c, "events", "--since=0", "-f", "container=cptest", "--until="+until)
-	c.Assert(out, checker.Contains, "archive-path", check.Commentf("Missing 'archive-path' log event\n"))
+	assert.Assert(c, strings.Contains(out, "archive-path"), "Missing 'archive-path' log event")
 
 	dockerCmd(c, "cp", tempFile.Name(), "cptest:/filecopy")
 
 	until = daemonUnixTime(c)
 	out, _ = dockerCmd(c, "events", "-f", "container=cptest", "--until="+until)
-	c.Assert(out, checker.Contains, "extract-to-dir", check.Commentf("Missing 'extract-to-dir' log event"))
+	assert.Assert(c, strings.Contains(out, "extract-to-dir"), "Missing 'extract-to-dir' log event")
 }
 
 func (s *DockerSuite) TestEventsResize(c *check.C) {
 	out := runSleepingContainer(c, "-d")
 	cID := strings.TrimSpace(out)
-	c.Assert(waitRun(cID), checker.IsNil)
+	assert.NilError(c, waitRun(cID))
 
 	cli, err := client.NewClientWithOpts(client.FromEnv)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer cli.Close()
 
 	options := types.ResizeOptions{
@@ -477,13 +451,13 @@ func (s *DockerSuite) TestEventsResize(c *check.C) {
 		Width:  24,
 	}
 	err = cli.ContainerResize(context.Background(), cID, options)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	dockerCmd(c, "stop", cID)
 
 	until := daemonUnixTime(c)
 	out, _ = dockerCmd(c, "events", "-f", "container="+cID, "--until="+until)
-	c.Assert(out, checker.Contains, "resize", check.Commentf("Missing 'resize' log event"))
+	assert.Assert(c, strings.Contains(out, "resize"), "Missing 'resize' log event")
 }
 
 func (s *DockerSuite) TestEventsAttach(c *check.C) {
@@ -496,12 +470,12 @@ func (s *DockerSuite) TestEventsAttach(c *check.C) {
 
 	cmd := exec.Command(dockerBinary, "attach", cID)
 	stdin, err := cmd.StdinPipe()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer stdin.Close()
 	stdout, err := cmd.StdoutPipe()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer stdout.Close()
-	c.Assert(cmd.Start(), checker.IsNil)
+	assert.NilError(c, cmd.Start())
 	defer func() {
 		cmd.Process.Kill()
 		cmd.Wait()
@@ -509,19 +483,19 @@ func (s *DockerSuite) TestEventsAttach(c *check.C) {
 
 	// Make sure we're done attaching by writing/reading some stuff
 	_, err = stdin.Write([]byte("hello\n"))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	out, err = bufio.NewReader(stdout).ReadString('\n')
-	c.Assert(err, checker.IsNil)
-	c.Assert(strings.TrimSpace(out), checker.Equals, "hello", check.Commentf("expected 'hello'"))
+	assert.NilError(c, err)
+	assert.Equal(c, strings.TrimSpace(out), "hello")
 
-	c.Assert(stdin.Close(), checker.IsNil)
+	assert.NilError(c, stdin.Close())
 
 	cli.DockerCmd(c, "kill", cID)
 	cli.WaitExited(c, cID, 5*time.Second)
 
 	until := daemonUnixTime(c)
 	out = cli.DockerCmd(c, "events", "-f", "container="+cID, "--until="+until).Combined()
-	c.Assert(out, checker.Contains, "attach", check.Commentf("Missing 'attach' log event"))
+	assert.Assert(c, strings.Contains(out, "attach"), "Missing 'attach' log event")
 }
 
 func (s *DockerSuite) TestEventsRename(c *check.C) {
@@ -532,7 +506,7 @@ func (s *DockerSuite) TestEventsRename(c *check.C) {
 	until := daemonUnixTime(c)
 	// filter by the container id because the name in the event will be the new name.
 	out, _ = dockerCmd(c, "events", "-f", "container="+cID, "--until", until)
-	c.Assert(out, checker.Contains, "rename", check.Commentf("Missing 'rename' log event\n"))
+	assert.Assert(c, strings.Contains(out, "rename"), "Missing 'rename' log event")
 }
 
 func (s *DockerSuite) TestEventsTop(c *check.C) {
@@ -541,14 +515,14 @@ func (s *DockerSuite) TestEventsTop(c *check.C) {
 
 	out := runSleepingContainer(c, "-d")
 	cID := strings.TrimSpace(out)
-	c.Assert(waitRun(cID), checker.IsNil)
+	assert.NilError(c, waitRun(cID))
 
 	dockerCmd(c, "top", cID)
 	dockerCmd(c, "stop", cID)
 
 	until := daemonUnixTime(c)
 	out, _ = dockerCmd(c, "events", "-f", "container="+cID, "--until="+until)
-	c.Assert(out, checker.Contains, " top", check.Commentf("Missing 'top' log event"))
+	assert.Assert(c, strings.Contains(out, "top"), "Missing 'top' log event")
 }
 
 // #14316
@@ -561,7 +535,7 @@ func (s *DockerRegistrySuite) TestEventsImageFilterPush(c *check.C) {
 
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 	cID := strings.TrimSpace(out)
-	c.Assert(waitRun(cID), checker.IsNil)
+	assert.NilError(c, waitRun(cID))
 
 	dockerCmd(c, "commit", cID, repoName)
 	dockerCmd(c, "stop", cID)
@@ -569,7 +543,7 @@ func (s *DockerRegistrySuite) TestEventsImageFilterPush(c *check.C) {
 
 	until := daemonUnixTime(c)
 	out, _ = dockerCmd(c, "events", "-f", "image="+repoName, "-f", "event=push", "--until", until)
-	c.Assert(out, checker.Contains, repoName, check.Commentf("Missing 'push' log event for %s", repoName))
+	assert.Assert(c, strings.Contains(out, repoName), "Missing 'push' log event for %s", repoName)
 }
 
 func (s *DockerSuite) TestEventsFilterType(c *check.C) {
@@ -598,9 +572,9 @@ func (s *DockerSuite) TestEventsFilterType(c *check.C) {
 	events := strings.Split(strings.TrimSpace(out), "\n")
 
 	// 2 events from the "docker tag" command, another one is from "docker build"
-	c.Assert(events, checker.HasLen, 3, check.Commentf("Events == %s", events))
+	assert.Equal(c, len(events), 3, "Events == %s", events)
 	for _, e := range events {
-		c.Assert(e, checker.Contains, "labelfiltertest")
+		assert.Check(c, strings.Contains(e, "labelfiltertest"))
 	}
 
 	out, _ = dockerCmd(
@@ -613,7 +587,7 @@ func (s *DockerSuite) TestEventsFilterType(c *check.C) {
 	events = strings.Split(strings.TrimSpace(out), "\n")
 
 	// Events generated by the container that builds the image
-	c.Assert(events, checker.HasLen, 2, check.Commentf("Events == %s", events))
+	assert.Equal(c, len(events), 2, "Events == %s", events)
 
 	out, _ = dockerCmd(
 		c,
@@ -622,7 +596,7 @@ func (s *DockerSuite) TestEventsFilterType(c *check.C) {
 		"--until", daemonUnixTime(c),
 		"--filter", "type=network")
 	events = strings.Split(strings.TrimSpace(out), "\n")
-	c.Assert(len(events), checker.GreaterOrEqualThan, 1, check.Commentf("Events == %s", events))
+	assert.Assert(c, len(events) >= 1, "Events == %s", events)
 }
 
 // #25798
@@ -643,7 +617,7 @@ func (s *DockerSuite) TestEventsSpecialFiltersWithExecCreate(c *check.C) {
 	)
 
 	events := strings.Split(strings.TrimSpace(out), "\n")
-	c.Assert(len(events), checker.Equals, 1, check.Commentf("%s", out))
+	assert.Equal(c, len(events), 1, out)
 
 	out, _ = dockerCmd(
 		c,
@@ -653,7 +627,7 @@ func (s *DockerSuite) TestEventsSpecialFiltersWithExecCreate(c *check.C) {
 		"--filter",
 		"event=exec_create",
 	)
-	c.Assert(len(events), checker.Equals, 1, check.Commentf("%s", out))
+	assert.Equal(c, len(events), 1, out)
 }
 
 func (s *DockerSuite) TestEventsFilterImageInContainerAction(c *check.C) {
@@ -663,7 +637,7 @@ func (s *DockerSuite) TestEventsFilterImageInContainerAction(c *check.C) {
 
 	out, _ := dockerCmd(c, "events", "--filter", "image=busybox", "--since", since, "--until", daemonUnixTime(c))
 	events := strings.Split(strings.TrimSpace(out), "\n")
-	c.Assert(len(events), checker.GreaterThan, 1, check.Commentf("%s", out))
+	assert.Assert(c, len(events) > 1, out)
 }
 
 func (s *DockerSuite) TestEventsContainerRestart(c *check.C) {
@@ -677,7 +651,7 @@ func (s *DockerSuite) TestEventsContainerRestart(c *check.C) {
 	}
 
 	err := waitInspect("testEvent", "{{ .State.Restarting }} {{ .State.Running }}", "false false", waitTime)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	var (
 		createCount int
@@ -688,7 +662,7 @@ func (s *DockerSuite) TestEventsContainerRestart(c *check.C) {
 	events := strings.Split(strings.TrimSpace(out), "\n")
 
 	nEvents := len(events)
-	c.Assert(nEvents, checker.GreaterOrEqualThan, 1) //Missing expected event
+	assert.Assert(c, nEvents >= 1) //Missing expected event
 	actions := eventActionsByIDAndType(c, events, "testEvent", "container")
 
 	for _, a := range actions {
@@ -701,9 +675,9 @@ func (s *DockerSuite) TestEventsContainerRestart(c *check.C) {
 			dieCount++
 		}
 	}
-	c.Assert(createCount, checker.Equals, 1, check.Commentf("testEvent should be created 1 times: %v", actions))
-	c.Assert(startCount, checker.Equals, 4, check.Commentf("testEvent should start 4 times: %v", actions))
-	c.Assert(dieCount, checker.Equals, 4, check.Commentf("testEvent should die 4 times: %v", actions))
+	assert.Equal(c, createCount, 1, "testEvent should be created 1 times: %v", actions)
+	assert.Equal(c, startCount, 4, "testEvent should start 4 times: %v", actions)
+	assert.Equal(c, dieCount, 4, "testEvent should die 4 times: %v", actions)
 }
 
 func (s *DockerSuite) TestEventsSinceInTheFuture(c *check.C) {
@@ -714,8 +688,8 @@ func (s *DockerSuite) TestEventsSinceInTheFuture(c *check.C) {
 	until := since.Add(time.Duration(-24) * time.Hour)
 	out, _, err := dockerCmdWithError("events", "--filter", "image=busybox", "--since", parseEventTime(since), "--until", parseEventTime(until))
 
-	c.Assert(err, checker.NotNil)
-	c.Assert(out, checker.Contains, "cannot be after `until`")
+	assert.ErrorContains(c, err, "")
+	assert.Assert(c, strings.Contains(out, "cannot be after `until`"))
 }
 
 func (s *DockerSuite) TestEventsUntilInThePast(c *check.C) {
@@ -731,8 +705,8 @@ func (s *DockerSuite) TestEventsUntilInThePast(c *check.C) {
 
 	out, _ := dockerCmd(c, "events", "--filter", "image=busybox", "--since", since, "--until", until)
 
-	c.Assert(out, checker.Not(checker.Contains), "test-container2")
-	c.Assert(out, checker.Contains, "test-container")
+	assert.Assert(c, !strings.Contains(out, "test-container2"))
+	assert.Assert(c, strings.Contains(out, "test-container"))
 }
 
 func (s *DockerSuite) TestEventsFormat(c *check.C) {
@@ -749,13 +723,13 @@ func (s *DockerSuite) TestEventsFormat(c *check.C) {
 		if err = dec.Decode(&ev); err == io.EOF {
 			break
 		}
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 		if ev.Status == "start" {
 			startCount++
 		}
 	}
 
-	c.Assert(startCount, checker.Equals, 2, check.Commentf("should have had 2 start events but had %d, out: %s", startCount, out))
+	assert.Equal(c, startCount, 2, "should have had 2 start events but had %d, out: %s", startCount, out)
 }
 
 func (s *DockerSuite) TestEventsFormatBadFunc(c *check.C) {

+ 74 - 76
integration-cli/docker_cli_events_unix_test.go

@@ -13,11 +13,11 @@ import (
 	"time"
 	"unicode"
 
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli/build"
 	"github.com/go-check/check"
 	"github.com/kr/pty"
 	"golang.org/x/sys/unix"
+	"gotest.tools/assert"
 )
 
 // #5979
@@ -26,26 +26,25 @@ func (s *DockerSuite) TestEventsRedirectStdout(c *check.C) {
 	dockerCmd(c, "run", "busybox", "true")
 
 	file, err := ioutil.TempFile("", "")
-	c.Assert(err, checker.IsNil, check.Commentf("could not create temp file"))
+	assert.NilError(c, err, "could not create temp file")
 	defer os.Remove(file.Name())
 
 	command := fmt.Sprintf("%s events --since=%s --until=%s > %s", dockerBinary, since, daemonUnixTime(c), file.Name())
 	_, tty, err := pty.Open()
-	c.Assert(err, checker.IsNil, check.Commentf("Could not open pty"))
+	assert.NilError(c, err, "Could not open pty")
 	cmd := exec.Command("sh", "-c", command)
 	cmd.Stdin = tty
 	cmd.Stdout = tty
 	cmd.Stderr = tty
-	c.Assert(cmd.Run(), checker.IsNil, check.Commentf("run err for command %q", command))
+	assert.NilError(c, cmd.Run(), "run err for command %q", command)
 
 	scanner := bufio.NewScanner(file)
 	for scanner.Scan() {
 		for _, ch := range scanner.Text() {
-			c.Assert(unicode.IsControl(ch), checker.False, check.Commentf("found control character %v", []byte(string(ch))))
+			assert.Check(c, unicode.IsControl(ch) == false, "found control character %v", []byte(string(ch)))
 		}
 	}
-	c.Assert(scanner.Err(), checker.IsNil, check.Commentf("Scan err for command %q", command))
-
+	assert.NilError(c, scanner.Err(), "Scan err for command %q", command)
 }
 
 func (s *DockerSuite) TestEventsOOMDisableFalse(c *check.C) {
@@ -61,7 +60,7 @@ func (s *DockerSuite) TestEventsOOMDisableFalse(c *check.C) {
 	}()
 	select {
 	case err := <-errChan:
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 	case <-time.After(30 * time.Second):
 		c.Fatal("Timeout waiting for container to die on OOM")
 	}
@@ -70,12 +69,12 @@ func (s *DockerSuite) TestEventsOOMDisableFalse(c *check.C) {
 	events := strings.Split(strings.TrimSuffix(out, "\n"), "\n")
 	nEvents := len(events)
 
-	c.Assert(nEvents, checker.GreaterOrEqualThan, 5) //Missing expected event
-	c.Assert(parseEventAction(c, events[nEvents-5]), checker.Equals, "create")
-	c.Assert(parseEventAction(c, events[nEvents-4]), checker.Equals, "attach")
-	c.Assert(parseEventAction(c, events[nEvents-3]), checker.Equals, "start")
-	c.Assert(parseEventAction(c, events[nEvents-2]), checker.Equals, "oom")
-	c.Assert(parseEventAction(c, events[nEvents-1]), checker.Equals, "die")
+	assert.Assert(c, nEvents >= 5)
+	assert.Equal(c, parseEventAction(c, events[nEvents-5]), "create")
+	assert.Equal(c, parseEventAction(c, events[nEvents-4]), "attach")
+	assert.Equal(c, parseEventAction(c, events[nEvents-3]), "start")
+	assert.Equal(c, parseEventAction(c, events[nEvents-2]), "oom")
+	assert.Equal(c, parseEventAction(c, events[nEvents-1]), "die")
 }
 
 func (s *DockerSuite) TestEventsOOMDisableTrue(c *check.C) {
@@ -83,9 +82,9 @@ func (s *DockerSuite) TestEventsOOMDisableTrue(c *check.C) {
 
 	errChan := make(chan error)
 	observer, err := newEventObserver(c)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	err = observer.Start()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer observer.Stop()
 
 	go func() {
@@ -96,7 +95,7 @@ func (s *DockerSuite) TestEventsOOMDisableTrue(c *check.C) {
 		}
 	}()
 
-	c.Assert(waitRun("oomTrue"), checker.IsNil)
+	assert.NilError(c, waitRun("oomTrue"))
 	defer dockerCmdWithResult("kill", "oomTrue")
 	containerID := inspectField(c, "oomTrue", "Id")
 
@@ -122,7 +121,7 @@ func (s *DockerSuite) TestEventsOOMDisableTrue(c *check.C) {
 	}
 
 	status := inspectField(c, "oomTrue", "State.Status")
-	c.Assert(strings.TrimSpace(status), checker.Equals, "running", check.Commentf("container should be still running"))
+	assert.Equal(c, strings.TrimSpace(status), "running", "container should be still running")
 }
 
 // #18453
@@ -135,8 +134,8 @@ func (s *DockerSuite) TestEventsContainerFilterByName(c *check.C) {
 	c2 := strings.TrimSpace(cOut)
 	waitRun("bar")
 	out, _ := dockerCmd(c, "events", "-f", "container=foo", "--since=0", "--until", daemonUnixTime(c))
-	c.Assert(out, checker.Contains, c1, check.Commentf("%s", out))
-	c.Assert(out, checker.Not(checker.Contains), c2, check.Commentf("%s", out))
+	assert.Assert(c, strings.Contains(out, c1), out)
+	assert.Assert(c, !strings.Contains(out, c2), out)
 }
 
 // #18453
@@ -145,7 +144,7 @@ func (s *DockerSuite) TestEventsContainerFilterBeforeCreate(c *check.C) {
 	buf := &bytes.Buffer{}
 	cmd := exec.Command(dockerBinary, "events", "-f", "container=foo", "--since=0")
 	cmd.Stdout = buf
-	c.Assert(cmd.Start(), check.IsNil)
+	assert.NilError(c, cmd.Start())
 	defer cmd.Wait()
 	defer cmd.Process.Kill()
 
@@ -182,15 +181,15 @@ func (s *DockerSuite) TestVolumeEvents(c *check.C) {
 	until := daemonUnixTime(c)
 	out, _ := dockerCmd(c, "events", "--since", since, "--until", until)
 	events := strings.Split(strings.TrimSpace(out), "\n")
-	c.Assert(len(events), checker.GreaterThan, 4)
+	assert.Assert(c, len(events) > 4)
 
 	volumeEvents := eventActionsByIDAndType(c, events, "test-event-volume-local", "volume")
-	c.Assert(volumeEvents, checker.HasLen, 5)
-	c.Assert(volumeEvents[0], checker.Equals, "create")
-	c.Assert(volumeEvents[1], checker.Equals, "create")
-	c.Assert(volumeEvents[2], checker.Equals, "mount")
-	c.Assert(volumeEvents[3], checker.Equals, "unmount")
-	c.Assert(volumeEvents[4], checker.Equals, "destroy")
+	assert.Equal(c, len(volumeEvents), 5)
+	assert.Equal(c, volumeEvents[0], "create")
+	assert.Equal(c, volumeEvents[1], "create")
+	assert.Equal(c, volumeEvents[2], "mount")
+	assert.Equal(c, volumeEvents[3], "unmount")
+	assert.Equal(c, volumeEvents[4], "destroy")
 }
 
 func (s *DockerSuite) TestNetworkEvents(c *check.C) {
@@ -210,14 +209,14 @@ func (s *DockerSuite) TestNetworkEvents(c *check.C) {
 	until := daemonUnixTime(c)
 	out, _ := dockerCmd(c, "events", "--since", since, "--until", until)
 	events := strings.Split(strings.TrimSpace(out), "\n")
-	c.Assert(len(events), checker.GreaterThan, 4)
+	assert.Assert(c, len(events) > 4)
 
 	netEvents := eventActionsByIDAndType(c, events, "test-event-network-local", "network")
-	c.Assert(netEvents, checker.HasLen, 4)
-	c.Assert(netEvents[0], checker.Equals, "create")
-	c.Assert(netEvents[1], checker.Equals, "connect")
-	c.Assert(netEvents[2], checker.Equals, "disconnect")
-	c.Assert(netEvents[3], checker.Equals, "destroy")
+	assert.Equal(c, len(netEvents), 4)
+	assert.Equal(c, netEvents[0], "create")
+	assert.Equal(c, netEvents[1], "connect")
+	assert.Equal(c, netEvents[2], "disconnect")
+	assert.Equal(c, netEvents[3], "destroy")
 }
 
 func (s *DockerSuite) TestEventsContainerWithMultiNetwork(c *check.C) {
@@ -239,22 +238,22 @@ func (s *DockerSuite) TestEventsContainerWithMultiNetwork(c *check.C) {
 	netEvents := strings.Split(strings.TrimSpace(out), "\n")
 
 	// received two network disconnect events
-	c.Assert(len(netEvents), checker.Equals, 2)
-	c.Assert(netEvents[0], checker.Contains, "disconnect")
-	c.Assert(netEvents[1], checker.Contains, "disconnect")
+	assert.Equal(c, len(netEvents), 2)
+	assert.Assert(c, strings.Contains(netEvents[0], "disconnect"))
+	assert.Assert(c, strings.Contains(netEvents[1], "disconnect"))
 
 	//both networks appeared in the network event output
-	c.Assert(out, checker.Contains, "test-event-network-local-1")
-	c.Assert(out, checker.Contains, "test-event-network-local-2")
+	assert.Assert(c, strings.Contains(out, "test-event-network-local-1"))
+	assert.Assert(c, strings.Contains(out, "test-event-network-local-2"))
 }
 
 func (s *DockerSuite) TestEventsStreaming(c *check.C) {
 	testRequires(c, DaemonIsLinux)
 
 	observer, err := newEventObserver(c)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	err = observer.Start()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer observer.Stop()
 
 	out, _ := dockerCmd(c, "run", "-d", "busybox:latest", "true")
@@ -306,16 +305,16 @@ func (s *DockerSuite) TestEventsImageUntagDelete(c *check.C) {
 	testRequires(c, DaemonIsLinux)
 
 	observer, err := newEventObserver(c)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	err = observer.Start()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer observer.Stop()
 
 	name := "testimageevents"
 	buildImageSuccessfully(c, name, build.WithDockerfile(`FROM scratch
 		MAINTAINER "docker"`))
 	imageID := getIDByName(c, name)
-	c.Assert(deleteImages(name), checker.IsNil)
+	assert.NilError(c, deleteImages(name))
 
 	testActions := map[string]chan bool{
 		"untag":  make(chan bool, 1),
@@ -351,13 +350,13 @@ func (s *DockerSuite) TestEventsFilterVolumeAndNetworkType(c *check.C) {
 
 	out, _ := dockerCmd(c, "events", "--filter", "type=volume", "--filter", "type=network", "--since", since, "--until", daemonUnixTime(c))
 	events := strings.Split(strings.TrimSpace(out), "\n")
-	c.Assert(len(events), checker.GreaterOrEqualThan, 2, check.Commentf("%s", out))
+	assert.Assert(c, len(events) >= 2, out)
 
 	networkActions := eventActionsByIDAndType(c, events, "test-event-network-type", "network")
 	volumeActions := eventActionsByIDAndType(c, events, "test-event-volume-type", "volume")
 
-	c.Assert(volumeActions[0], checker.Equals, "create")
-	c.Assert(networkActions[0], checker.Equals, "create")
+	assert.Equal(c, volumeActions[0], "create")
+	assert.Equal(c, networkActions[0], "create")
 }
 
 func (s *DockerSuite) TestEventsFilterVolumeID(c *check.C) {
@@ -368,10 +367,11 @@ func (s *DockerSuite) TestEventsFilterVolumeID(c *check.C) {
 	dockerCmd(c, "volume", "create", "test-event-volume-id")
 	out, _ := dockerCmd(c, "events", "--filter", "volume=test-event-volume-id", "--since", since, "--until", daemonUnixTime(c))
 	events := strings.Split(strings.TrimSpace(out), "\n")
-	c.Assert(events, checker.HasLen, 1)
+	assert.Equal(c, len(events), 1)
 
-	c.Assert(events[0], checker.Contains, "test-event-volume-id")
-	c.Assert(events[0], checker.Contains, "driver=local")
+	assert.Equal(c, len(events), 1)
+	assert.Assert(c, strings.Contains(events[0], "test-event-volume-id"))
+	assert.Assert(c, strings.Contains(events[0], "driver=local"))
 }
 
 func (s *DockerSuite) TestEventsFilterNetworkID(c *check.C) {
@@ -382,10 +382,9 @@ func (s *DockerSuite) TestEventsFilterNetworkID(c *check.C) {
 	dockerCmd(c, "network", "create", "test-event-network-local")
 	out, _ := dockerCmd(c, "events", "--filter", "network=test-event-network-local", "--since", since, "--until", daemonUnixTime(c))
 	events := strings.Split(strings.TrimSpace(out), "\n")
-	c.Assert(events, checker.HasLen, 1)
-
-	c.Assert(events[0], checker.Contains, "test-event-network-local")
-	c.Assert(events[0], checker.Contains, "type=bridge")
+	assert.Equal(c, len(events), 1)
+	assert.Assert(c, strings.Contains(events[0], "test-event-network-local"))
+	assert.Assert(c, strings.Contains(events[0], "type=bridge"))
 }
 
 func (s *DockerDaemonSuite) TestDaemonEvents(c *check.C) {
@@ -394,7 +393,7 @@ func (s *DockerDaemonSuite) TestDaemonEvents(c *check.C) {
 	// daemon config file
 	configFilePath := "test.json"
 	configFile, err := os.Create(configFilePath)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer os.Remove(configFilePath)
 
 	daemonConfig := `{"labels":["foo=bar"]}`
@@ -404,7 +403,7 @@ func (s *DockerDaemonSuite) TestDaemonEvents(c *check.C) {
 
 	// Get daemon ID
 	out, err := s.d.Cmd("info")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	daemonID := ""
 	daemonName := ""
 	for _, line := range strings.Split(out, "\n") {
@@ -414,20 +413,20 @@ func (s *DockerDaemonSuite) TestDaemonEvents(c *check.C) {
 			daemonName = strings.TrimPrefix(line, "Name: ")
 		}
 	}
-	c.Assert(daemonID, checker.Not(checker.Equals), "")
+	assert.Assert(c, daemonID != "")
 
 	configFile, err = os.Create(configFilePath)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	daemonConfig = `{"max-concurrent-downloads":1,"labels":["bar=foo"], "shutdown-timeout": 10}`
 	fmt.Fprintf(configFile, "%s", daemonConfig)
 	configFile.Close()
 
-	c.Assert(s.d.Signal(unix.SIGHUP), checker.IsNil)
+	assert.NilError(c, s.d.Signal(unix.SIGHUP))
 
 	time.Sleep(3 * time.Second)
 
 	out, err = s.d.Cmd("events", "--since=0", "--until", daemonUnixTime(c))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	// only check for values known (daemon ID/name) or explicitly set above,
 	// otherwise just check for names being present.
@@ -453,7 +452,7 @@ func (s *DockerDaemonSuite) TestDaemonEvents(c *check.C) {
 	}
 
 	for _, s := range expectedSubstrings {
-		c.Assert(out, checker.Contains, s)
+		assert.Check(c, strings.Contains(out, s))
 	}
 }
 
@@ -463,7 +462,7 @@ func (s *DockerDaemonSuite) TestDaemonEventsWithFilters(c *check.C) {
 	// daemon config file
 	configFilePath := "test.json"
 	configFile, err := os.Create(configFilePath)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer os.Remove(configFilePath)
 
 	daemonConfig := `{"labels":["foo=bar"]}`
@@ -473,7 +472,7 @@ func (s *DockerDaemonSuite) TestDaemonEventsWithFilters(c *check.C) {
 
 	// Get daemon ID
 	out, err := s.d.Cmd("info")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	daemonID := ""
 	daemonName := ""
 	for _, line := range strings.Split(out, "\n") {
@@ -483,29 +482,28 @@ func (s *DockerDaemonSuite) TestDaemonEventsWithFilters(c *check.C) {
 			daemonName = strings.TrimPrefix(line, "Name: ")
 		}
 	}
-	c.Assert(daemonID, checker.Not(checker.Equals), "")
-
-	c.Assert(s.d.Signal(unix.SIGHUP), checker.IsNil)
+	assert.Assert(c, daemonID != "")
+	assert.NilError(c, s.d.Signal(unix.SIGHUP))
 
 	time.Sleep(3 * time.Second)
 
 	out, err = s.d.Cmd("events", "--since=0", "--until", daemonUnixTime(c), "--filter", fmt.Sprintf("daemon=%s", daemonID))
-	c.Assert(err, checker.IsNil)
-	c.Assert(out, checker.Contains, fmt.Sprintf("daemon reload %s", daemonID))
+	assert.NilError(c, err)
+	assert.Assert(c, strings.Contains(out, fmt.Sprintf("daemon reload %s", daemonID)))
 
 	out, err = s.d.Cmd("events", "--since=0", "--until", daemonUnixTime(c), "--filter", fmt.Sprintf("daemon=%s", daemonName))
-	c.Assert(err, checker.IsNil)
-	c.Assert(out, checker.Contains, fmt.Sprintf("daemon reload %s", daemonID))
+	assert.NilError(c, err)
+	assert.Assert(c, strings.Contains(out, fmt.Sprintf("daemon reload %s", daemonID)))
 
 	out, err = s.d.Cmd("events", "--since=0", "--until", daemonUnixTime(c), "--filter", "daemon=foo")
-	c.Assert(err, checker.IsNil)
-	c.Assert(out, checker.Not(checker.Contains), fmt.Sprintf("daemon reload %s", daemonID))
+	assert.NilError(c, err)
+	assert.Assert(c, !strings.Contains(out, fmt.Sprintf("daemon reload %s", daemonID)))
 
 	out, err = s.d.Cmd("events", "--since=0", "--until", daemonUnixTime(c), "--filter", "type=daemon")
-	c.Assert(err, checker.IsNil)
-	c.Assert(out, checker.Contains, fmt.Sprintf("daemon reload %s", daemonID))
+	assert.NilError(c, err)
+	assert.Assert(c, strings.Contains(out, fmt.Sprintf("daemon reload %s", daemonID)))
 
 	out, err = s.d.Cmd("events", "--since=0", "--until", daemonUnixTime(c), "--filter", "type=container")
-	c.Assert(err, checker.IsNil)
-	c.Assert(out, checker.Not(checker.Contains), fmt.Sprintf("daemon reload %s", daemonID))
+	assert.NilError(c, err)
+	assert.Assert(c, !strings.Contains(out, fmt.Sprintf("daemon reload %s", daemonID)))
 }

+ 71 - 79
integration-cli/docker_cli_exec_test.go

@@ -17,23 +17,22 @@ import (
 	"time"
 
 	"github.com/docker/docker/client"
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli"
 	"github.com/docker/docker/integration-cli/cli/build"
 	"github.com/docker/docker/pkg/parsers/kernel"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
+	is "gotest.tools/assert/cmp"
 	"gotest.tools/icmd"
 )
 
 func (s *DockerSuite) TestExec(c *check.C) {
 	testRequires(c, DaemonIsLinux)
 	out, _ := dockerCmd(c, "run", "-d", "--name", "testing", "busybox", "sh", "-c", "echo test > /tmp/file && top")
-	c.Assert(waitRun(strings.TrimSpace(out)), check.IsNil)
+	assert.NilError(c, waitRun(strings.TrimSpace(out)))
 
 	out, _ = dockerCmd(c, "exec", "testing", "cat", "/tmp/file")
-	out = strings.Trim(out, "\r\n")
-	c.Assert(out, checker.Equals, "test")
-
+	assert.Equal(c, strings.Trim(out, "\r\n"), "test")
 }
 
 func (s *DockerSuite) TestExecInteractive(c *check.C) {
@@ -42,22 +41,22 @@ func (s *DockerSuite) TestExecInteractive(c *check.C) {
 
 	execCmd := exec.Command(dockerBinary, "exec", "-i", "testing", "sh")
 	stdin, err := execCmd.StdinPipe()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	stdout, err := execCmd.StdoutPipe()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	err = execCmd.Start()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	_, err = stdin.Write([]byte("cat /tmp/file\n"))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	r := bufio.NewReader(stdout)
 	line, err := r.ReadString('\n')
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	line = strings.TrimSpace(line)
-	c.Assert(line, checker.Equals, "test")
+	assert.Equal(c, line, "test")
 	err = stdin.Close()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	errChan := make(chan error)
 	go func() {
 		errChan <- execCmd.Wait()
@@ -65,7 +64,7 @@ func (s *DockerSuite) TestExecInteractive(c *check.C) {
 	}()
 	select {
 	case err := <-errChan:
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 	case <-time.After(1 * time.Second):
 		c.Fatal("docker exec failed to exit on stdin close")
 	}
@@ -75,13 +74,12 @@ func (s *DockerSuite) TestExecInteractive(c *check.C) {
 func (s *DockerSuite) TestExecAfterContainerRestart(c *check.C) {
 	out := runSleepingContainer(c)
 	cleanedContainerID := strings.TrimSpace(out)
-	c.Assert(waitRun(cleanedContainerID), check.IsNil)
+	assert.NilError(c, waitRun(cleanedContainerID))
 	dockerCmd(c, "restart", cleanedContainerID)
-	c.Assert(waitRun(cleanedContainerID), check.IsNil)
+	assert.NilError(c, waitRun(cleanedContainerID))
 
 	out, _ = dockerCmd(c, "exec", cleanedContainerID, "echo", "hello")
-	outStr := strings.TrimSpace(out)
-	c.Assert(outStr, checker.Equals, "hello")
+	assert.Equal(c, strings.TrimSpace(out), "hello")
 }
 
 func (s *DockerDaemonSuite) TestExecAfterDaemonRestart(c *check.C) {
@@ -90,18 +88,16 @@ func (s *DockerDaemonSuite) TestExecAfterDaemonRestart(c *check.C) {
 	s.d.StartWithBusybox(c)
 
 	out, err := s.d.Cmd("run", "-d", "--name", "top", "-p", "80", "busybox:latest", "top")
-	c.Assert(err, checker.IsNil, check.Commentf("Could not run top: %s", out))
+	assert.NilError(c, err, "Could not run top: %s", out)
 
 	s.d.Restart(c)
 
 	out, err = s.d.Cmd("start", "top")
-	c.Assert(err, checker.IsNil, check.Commentf("Could not start top after daemon restart: %s", out))
+	assert.NilError(c, err, "Could not start top after daemon restart: %s", out)
 
 	out, err = s.d.Cmd("exec", "top", "echo", "hello")
-	c.Assert(err, checker.IsNil, check.Commentf("Could not exec on container top: %s", out))
-
-	outStr := strings.TrimSpace(string(out))
-	c.Assert(outStr, checker.Equals, "hello")
+	assert.NilError(c, err, "Could not exec on container top: %s", out)
+	assert.Equal(c, strings.TrimSpace(out), "hello")
 }
 
 // Regression test for #9155, #9044
@@ -112,23 +108,23 @@ func (s *DockerSuite) TestExecEnv(c *check.C) {
 	// a subsequent exec will not have LALA set/
 	testRequires(c, DaemonIsLinux)
 	runSleepingContainer(c, "-e", "LALA=value1", "-e", "LALA=value2", "-d", "--name", "testing")
-	c.Assert(waitRun("testing"), check.IsNil)
+	assert.NilError(c, waitRun("testing"))
 
 	out, _ := dockerCmd(c, "exec", "testing", "env")
-	c.Assert(out, checker.Not(checker.Contains), "LALA=value1")
-	c.Assert(out, checker.Contains, "LALA=value2")
-	c.Assert(out, checker.Contains, "HOME=/root")
+	assert.Check(c, !strings.Contains(out, "LALA=value1"))
+	assert.Check(c, strings.Contains(out, "LALA=value2"))
+	assert.Check(c, strings.Contains(out, "HOME=/root"))
 }
 
 func (s *DockerSuite) TestExecSetEnv(c *check.C) {
 	testRequires(c, DaemonIsLinux)
 	runSleepingContainer(c, "-e", "HOME=/root", "-d", "--name", "testing")
-	c.Assert(waitRun("testing"), check.IsNil)
+	assert.NilError(c, waitRun("testing"))
 
 	out, _ := dockerCmd(c, "exec", "-e", "HOME=/another", "-e", "ABC=xyz", "testing", "env")
-	c.Assert(out, checker.Not(checker.Contains), "HOME=/root")
-	c.Assert(out, checker.Contains, "HOME=/another")
-	c.Assert(out, checker.Contains, "ABC=xyz")
+	assert.Check(c, !strings.Contains(out, "HOME=/root"))
+	assert.Check(c, strings.Contains(out, "HOME=/another"))
+	assert.Check(c, strings.Contains(out, "ABC=xyz"))
 }
 
 func (s *DockerSuite) TestExecExitStatus(c *check.C) {
@@ -146,10 +142,10 @@ func (s *DockerSuite) TestExecPausedContainer(c *check.C) {
 
 	dockerCmd(c, "pause", "testing")
 	out, _, err := dockerCmdWithError("exec", ContainerID, "echo", "hello")
-	c.Assert(err, checker.NotNil, check.Commentf("container should fail to exec new command if it is paused"))
+	assert.ErrorContains(c, err, "", "container should fail to exec new command if it is paused")
 
 	expected := ContainerID + " is paused, unpause the container before exec"
-	c.Assert(out, checker.Contains, expected, check.Commentf("container should not exec new command if it is paused"))
+	assert.Assert(c, is.Contains(out, expected), "container should not exec new command if it is paused")
 }
 
 // regression test for #9476
@@ -160,24 +156,24 @@ func (s *DockerSuite) TestExecTTYCloseStdin(c *check.C) {
 
 	cmd := exec.Command(dockerBinary, "exec", "-i", "exec_tty_stdin", "cat")
 	stdinRw, err := cmd.StdinPipe()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	stdinRw.Write([]byte("test"))
 	stdinRw.Close()
 
 	out, _, err := runCommandWithOutput(cmd)
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	out, _ = dockerCmd(c, "top", "exec_tty_stdin")
 	outArr := strings.Split(out, "\n")
-	c.Assert(len(outArr), checker.LessOrEqualThan, 3, check.Commentf("exec process left running"))
-	c.Assert(out, checker.Not(checker.Contains), "nsenter-exec")
+	assert.Assert(c, len(outArr) <= 3, "exec process left running")
+	assert.Assert(c, !strings.Contains(out, "nsenter-exec"))
 }
 
 func (s *DockerSuite) TestExecTTYWithoutStdin(c *check.C) {
 	out, _ := dockerCmd(c, "run", "-d", "-ti", "busybox")
 	id := strings.TrimSpace(out)
-	c.Assert(waitRun(id), checker.IsNil)
+	assert.NilError(c, waitRun(id))
 
 	errChan := make(chan error)
 	go func() {
@@ -204,7 +200,7 @@ func (s *DockerSuite) TestExecTTYWithoutStdin(c *check.C) {
 
 	select {
 	case err := <-errChan:
-		c.Assert(err, check.IsNil)
+		assert.NilError(c, err)
 	case <-time.After(3 * time.Second):
 		c.Fatal("exec is running but should have failed")
 	}
@@ -249,7 +245,7 @@ func (s *DockerSuite) TestExecStopNotHanging(c *check.C) {
 	case <-time.After(3 * time.Second):
 		c.Fatal("Container stop timed out")
 	case s := <-ch:
-		c.Assert(s.err, check.IsNil)
+		assert.NilError(c, s.err)
 	}
 }
 
@@ -287,7 +283,7 @@ func (s *DockerSuite) TestExecCgroup(c *check.C) {
 	close(errChan)
 
 	for err := range errChan {
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 	}
 
 	for _, cg := range execCgroups {
@@ -311,14 +307,14 @@ func (s *DockerSuite) TestExecInspectID(c *check.C) {
 	id := strings.TrimSuffix(out, "\n")
 
 	out = inspectField(c, id, "ExecIDs")
-	c.Assert(out, checker.Equals, "[]", check.Commentf("ExecIDs should be empty, got: %s", out))
+	assert.Equal(c, out, "[]", "ExecIDs should be empty, got: %s", out)
 
 	// Start an exec, have it block waiting so we can do some checking
 	cmd := exec.Command(dockerBinary, "exec", id, "sh", "-c",
 		"while ! test -e /execid1; do sleep 1; done")
 
 	err := cmd.Start()
-	c.Assert(err, checker.IsNil, check.Commentf("failed to start the exec cmd"))
+	assert.NilError(c, err, "failed to start the exec cmd")
 
 	// Give the exec 10 chances/seconds to start then give up and stop the test
 	tries := 10
@@ -329,19 +325,17 @@ func (s *DockerSuite) TestExecInspectID(c *check.C) {
 		if out != "[]" && out != "<no value>" {
 			break
 		}
-		c.Assert(i+1, checker.Not(checker.Equals), tries, check.Commentf("ExecIDs still empty after 10 second"))
+		assert.Check(c, i+1 != tries, "ExecIDs still empty after 10 second")
 		time.Sleep(1 * time.Second)
 	}
 
 	// Save execID for later
 	execID, err := inspectFilter(id, "index .ExecIDs 0")
-	c.Assert(err, checker.IsNil, check.Commentf("failed to get the exec id"))
+	assert.NilError(c, err, "failed to get the exec id")
 
 	// End the exec by creating the missing file
-	err = exec.Command(dockerBinary, "exec", id,
-		"sh", "-c", "touch /execid1").Run()
-
-	c.Assert(err, checker.IsNil, check.Commentf("failed to run the 2nd exec cmd"))
+	err = exec.Command(dockerBinary, "exec", id, "sh", "-c", "touch /execid1").Run()
+	assert.NilError(c, err, "failed to run the 2nd exec cmd")
 
 	// Wait for 1st exec to complete
 	cmd.Wait()
@@ -354,26 +348,25 @@ func (s *DockerSuite) TestExecInspectID(c *check.C) {
 		if out == "[]" {
 			break
 		}
-		c.Assert(i+1, checker.Not(checker.Equals), tries, check.Commentf("ExecIDs still not empty after 10 second"))
+		assert.Check(c, i+1 != tries, "ExecIDs still empty after 10 second")
 		time.Sleep(1 * time.Second)
 	}
 
 	// But we should still be able to query the execID
 	cli, err := client.NewClientWithOpts(client.FromEnv)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer cli.Close()
 
 	_, err = cli.ContainerExecInspect(context.Background(), execID)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	// Now delete the container and then an 'inspect' on the exec should
 	// result in a 404 (not 'container not running')
 	out, ec := dockerCmd(c, "rm", "-f", id)
-	c.Assert(ec, checker.Equals, 0, check.Commentf("error removing container: %s", out))
+	assert.Equal(c, ec, 0, "error removing container: %s", out)
 
 	_, err = cli.ContainerExecInspect(context.Background(), execID)
-	expected := "No such exec instance"
-	c.Assert(err.Error(), checker.Contains, expected)
+	assert.ErrorContains(c, err, "No such exec instance")
 }
 
 func (s *DockerSuite) TestLinksPingLinkedContainersOnRename(c *check.C) {
@@ -382,10 +375,10 @@ func (s *DockerSuite) TestLinksPingLinkedContainersOnRename(c *check.C) {
 	var out string
 	out, _ = dockerCmd(c, "run", "-d", "--name", "container1", "busybox", "top")
 	idA := strings.TrimSpace(out)
-	c.Assert(idA, checker.Not(checker.Equals), "", check.Commentf("%s, id should not be nil", out))
+	assert.Assert(c, idA != "", "%s, id should not be nil", out)
 	out, _ = dockerCmd(c, "run", "-d", "--link", "container1:alias1", "--name", "container2", "busybox", "top")
 	idB := strings.TrimSpace(out)
-	c.Assert(idB, checker.Not(checker.Equals), "", check.Commentf("%s, id should not be nil", out))
+	assert.Assert(c, idB != "", "%s, id should not be nil", out)
 
 	dockerCmd(c, "exec", "container2", "ping", "-c", "1", "alias1", "-W", "1")
 	dockerCmd(c, "rename", "container1", "container_new")
@@ -403,14 +396,14 @@ func (s *DockerSuite) TestRunMutableNetworkFiles(c *check.C) {
 
 		content := runCommandAndReadContainerFile(c, fn, dockerBinary, "run", "-d", "--name", "c1", "busybox", "sh", "-c", fmt.Sprintf("echo success >/etc/%s && top", fn))
 
-		c.Assert(strings.TrimSpace(string(content)), checker.Equals, "success", check.Commentf("Content was not what was modified in the container", string(content)))
+		assert.Equal(c, strings.TrimSpace(string(content)), "success", "Content was not what was modified in the container", string(content))
 
 		out, _ := dockerCmd(c, "run", "-d", "--name", "c2", "busybox", "top")
 		contID := strings.TrimSpace(out)
 		netFilePath := containerStorageFile(contID, fn)
 
 		f, err := os.OpenFile(netFilePath, os.O_WRONLY|os.O_SYNC|os.O_APPEND, 0644)
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 
 		if _, err := f.Seek(0, 0); err != nil {
 			f.Close()
@@ -429,7 +422,7 @@ func (s *DockerSuite) TestRunMutableNetworkFiles(c *check.C) {
 		f.Close()
 
 		res, _ := dockerCmd(c, "exec", contID, "cat", "/etc/"+fn)
-		c.Assert(res, checker.Equals, "success2\n")
+		assert.Equal(c, res, "success2\n")
 	}
 }
 
@@ -440,10 +433,10 @@ func (s *DockerSuite) TestExecWithUser(c *check.C) {
 	dockerCmd(c, "run", "-d", "--name", "parent", "busybox", "top")
 
 	out, _ := dockerCmd(c, "exec", "-u", "1", "parent", "id")
-	c.Assert(out, checker.Contains, "uid=1(daemon) gid=1(daemon)")
+	assert.Assert(c, strings.Contains(out, "uid=1(daemon) gid=1(daemon)"))
 
 	out, _ = dockerCmd(c, "exec", "-u", "root", "parent", "id")
-	c.Assert(out, checker.Contains, "uid=0(root) gid=0(root)", check.Commentf("exec with user by id expected daemon user got %s", out))
+	assert.Assert(c, strings.Contains(out, "uid=0(root) gid=0(root)"), "exec with user by id expected daemon user got %s", out)
 }
 
 func (s *DockerSuite) TestExecWithPrivileged(c *check.C) {
@@ -463,7 +456,7 @@ func (s *DockerSuite) TestExecWithPrivileged(c *check.C) {
 	result.Assert(c, icmd.Success)
 
 	actual := strings.TrimSpace(result.Combined())
-	c.Assert(actual, checker.Equals, "ok", check.Commentf("exec mknod in --cap-drop=ALL container with --privileged failed, output: %q", result.Combined()))
+	assert.Equal(c, actual, "ok", "exec mknod in --cap-drop=ALL container with --privileged failed, output: %q", result.Combined())
 
 	// Check subsequent unprivileged exec cannot mknod
 	icmd.RunCommand(dockerBinary, "exec", "parent", "sh", "-c", "mknod /tmp/sdc b 8 32").Assert(c, icmd.Expected{
@@ -473,8 +466,7 @@ func (s *DockerSuite) TestExecWithPrivileged(c *check.C) {
 	// Confirm at no point was mknod allowed
 	result = icmd.RunCommand(dockerBinary, "logs", "parent")
 	result.Assert(c, icmd.Success)
-	c.Assert(result.Combined(), checker.Not(checker.Contains), "Success")
-
+	assert.Assert(c, !strings.Contains(result.Combined(), "Success"))
 }
 
 func (s *DockerSuite) TestExecWithImageUser(c *check.C) {
@@ -487,7 +479,7 @@ func (s *DockerSuite) TestExecWithImageUser(c *check.C) {
 	dockerCmd(c, "run", "-d", "--name", "dockerioexec", name, "top")
 
 	out, _ := dockerCmd(c, "exec", "dockerioexec", "whoami")
-	c.Assert(out, checker.Contains, "dockerio", check.Commentf("exec with user by id expected dockerio user got %s", out))
+	assert.Assert(c, strings.Contains(out, "dockerio"), "exec with user by id expected dockerio user got %s", out)
 }
 
 func (s *DockerSuite) TestExecOnReadonlyContainer(c *check.C) {
@@ -502,11 +494,11 @@ func (s *DockerSuite) TestExecUlimits(c *check.C) {
 	testRequires(c, DaemonIsLinux)
 	name := "testexeculimits"
 	runSleepingContainer(c, "-d", "--ulimit", "nofile=511:511", "--name", name)
-	c.Assert(waitRun(name), checker.IsNil)
+	assert.NilError(c, waitRun(name))
 
 	out, _, err := dockerCmdWithError("exec", name, "sh", "-c", "ulimit -n")
-	c.Assert(err, checker.IsNil)
-	c.Assert(strings.TrimSpace(out), checker.Equals, "511")
+	assert.NilError(c, err)
+	assert.Equal(c, strings.TrimSpace(out), "511")
 }
 
 // #15750
@@ -516,22 +508,22 @@ func (s *DockerSuite) TestExecStartFails(c *check.C) {
 	testRequires(c, DaemonIsLinux)
 	name := "exec-15750"
 	runSleepingContainer(c, "-d", "--name", name)
-	c.Assert(waitRun(name), checker.IsNil)
+	assert.NilError(c, waitRun(name))
 
 	out, _, err := dockerCmdWithError("exec", name, "no-such-cmd")
-	c.Assert(err, checker.NotNil, check.Commentf("%s", out))
-	c.Assert(out, checker.Contains, "executable file not found")
+	assert.ErrorContains(c, err, "", out)
+	assert.Assert(c, strings.Contains(out, "executable file not found"))
 }
 
 // Fix regression in https://github.com/docker/docker/pull/26461#issuecomment-250287297
 func (s *DockerSuite) TestExecWindowsPathNotWiped(c *check.C) {
 	testRequires(c, DaemonIsWindows)
 	out, _ := dockerCmd(c, "run", "-d", "--name", "testing", minimalBaseImage(), "powershell", "start-sleep", "60")
-	c.Assert(waitRun(strings.TrimSpace(out)), check.IsNil)
+	assert.NilError(c, waitRun(strings.TrimSpace(out)))
 
 	out, _ = dockerCmd(c, "exec", "testing", "powershell", "write-host", "$env:PATH")
 	out = strings.ToLower(strings.Trim(out, "\r\n"))
-	c.Assert(out, checker.Contains, `windowspowershell\v1.0`)
+	assert.Assert(c, strings.Contains(out, `windowspowershell\v1.0`))
 }
 
 func (s *DockerSuite) TestExecEnvLinksHost(c *check.C) {
@@ -539,8 +531,8 @@ func (s *DockerSuite) TestExecEnvLinksHost(c *check.C) {
 	runSleepingContainer(c, "-d", "--name", "foo")
 	runSleepingContainer(c, "-d", "--link", "foo:db", "--hostname", "myhost", "--name", "bar")
 	out, _ := dockerCmd(c, "exec", "bar", "env")
-	c.Assert(out, checker.Contains, "HOSTNAME=myhost")
-	c.Assert(out, checker.Contains, "DB_NAME=/bar/db")
+	assert.Check(c, is.Contains(out, "HOSTNAME=myhost"))
+	assert.Check(c, is.Contains(out, "DB_NAME=/bar/db"))
 }
 
 func (s *DockerSuite) TestExecWindowsOpenHandles(c *check.C) {
@@ -548,7 +540,7 @@ func (s *DockerSuite) TestExecWindowsOpenHandles(c *check.C) {
 
 	if runtime.GOOS == "windows" {
 		v, err := kernel.GetKernelVersion()
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 		build, _ := strconv.Atoi(strings.Split(strings.SplitN(v.String(), " ", 3)[2][1:], ".")[0])
 		if build >= 17743 {
 			c.Skip("Temporarily disabled on RS5 17743+ builds due to platform bug")
@@ -626,7 +618,7 @@ func (s *DockerSuite) TestExecWindowsOpenHandles(c *check.C) {
 
 	// Ensure the background sleep is still running
 	out, _ := dockerCmd(c, "top", "test")
-	c.Assert(strings.Count(out, "busybox.exe"), checker.Equals, 2)
+	assert.Equal(c, strings.Count(out, "busybox.exe"), 2)
 
 	// The exec should exit when the background sleep exits
 	select {
@@ -635,7 +627,7 @@ func (s *DockerSuite) TestExecWindowsOpenHandles(c *check.C) {
 	case <-exec:
 		// Ensure the background sleep has actually exited
 		out, _ := dockerCmd(c, "top", "test")
-		c.Assert(strings.Count(out, "busybox.exe"), checker.Equals, 1)
+		assert.Equal(c, strings.Count(out, "busybox.exe"), 1)
 		break
 	}
 }

+ 11 - 11
integration-cli/docker_cli_exec_unix_test.go

@@ -9,9 +9,9 @@ import (
 	"strings"
 	"time"
 
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/go-check/check"
 	"github.com/kr/pty"
+	"gotest.tools/assert"
 )
 
 // regression test for #12546
@@ -22,7 +22,7 @@ func (s *DockerSuite) TestExecInteractiveStdinClose(c *check.C) {
 
 	cmd := exec.Command(dockerBinary, "exec", "-i", contID, "echo", "-n", "hello")
 	p, err := pty.Start(cmd)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	b := bytes.NewBuffer(nil)
 
@@ -31,13 +31,13 @@ func (s *DockerSuite) TestExecInteractiveStdinClose(c *check.C) {
 
 	select {
 	case err := <-ch:
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 		io.Copy(b, p)
 		p.Close()
 		bs := b.Bytes()
 		bs = bytes.Trim(bs, "\x00")
 		output := string(bs[:])
-		c.Assert(strings.TrimSpace(output), checker.Equals, "hello")
+		assert.Equal(c, strings.TrimSpace(output), "hello")
 	case <-time.After(5 * time.Second):
 		p.Close()
 		c.Fatal("timed out running docker exec")
@@ -50,11 +50,11 @@ func (s *DockerSuite) TestExecTTY(c *check.C) {
 
 	cmd := exec.Command(dockerBinary, "exec", "-it", "test", "sh")
 	p, err := pty.Start(cmd)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer p.Close()
 
 	_, err = p.Write([]byte("cat /foo && exit\n"))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	chErr := make(chan error)
 	go func() {
@@ -62,15 +62,15 @@ func (s *DockerSuite) TestExecTTY(c *check.C) {
 	}()
 	select {
 	case err := <-chErr:
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 	case <-time.After(3 * time.Second):
 		c.Fatal("timeout waiting for exec to exit")
 	}
 
 	buf := make([]byte, 256)
 	read, err := p.Read(buf)
-	c.Assert(err, checker.IsNil)
-	c.Assert(bytes.Contains(buf, []byte("hello")), checker.Equals, true, check.Commentf(string(buf[:read])))
+	assert.NilError(c, err)
+	assert.Assert(c, bytes.Contains(buf, []byte("hello")), string(buf[:read]))
 }
 
 // Test the TERM env var is set when -t is provided on exec
@@ -80,7 +80,7 @@ func (s *DockerSuite) TestExecWithTERM(c *check.C) {
 	contID := strings.TrimSpace(out)
 	cmd := exec.Command(dockerBinary, "exec", "-t", contID, "sh", "-c", "if [ -z $TERM ]; then exit 1; else exit 0; fi")
 	if err := cmd.Run(); err != nil {
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 	}
 }
 
@@ -92,6 +92,6 @@ func (s *DockerSuite) TestExecWithNoTERM(c *check.C) {
 	contID := strings.TrimSpace(out)
 	cmd := exec.Command(dockerBinary, "exec", contID, "sh", "-c", "if [ -z $TERM ]; then exit 0; else exit 1; fi")
 	if err := cmd.Run(); err != nil {
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 	}
 }

+ 36 - 35
integration-cli/docker_cli_external_volume_driver_unix_test.go

@@ -22,6 +22,7 @@ import (
 	"github.com/docker/docker/pkg/stringid"
 	"github.com/docker/docker/volume"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 const volumePluginName = "test-external-volume-driver"
@@ -268,10 +269,10 @@ func newVolumePlugin(c *check.C, name string) *volumePlugin {
 	})
 
 	err := os.MkdirAll("/etc/docker/plugins", 0755)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	err = ioutil.WriteFile("/etc/docker/plugins/"+name+".spec", []byte(s.Server.URL), 0644)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	return s
 }
 
@@ -279,7 +280,7 @@ func (s *DockerExternalVolumeSuite) TearDownSuite(c *check.C) {
 	s.volumePlugin.Close()
 
 	err := os.RemoveAll("/etc/docker/plugins")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 }
 
 func (s *DockerExternalVolumeSuite) TestVolumeCLICreateOptionConflict(c *check.C) {
@@ -291,22 +292,22 @@ func (s *DockerExternalVolumeSuite) TestVolumeCLICreateOptionConflict(c *check.C
 
 	out, _ = dockerCmd(c, "volume", "inspect", "--format={{ .Driver }}", "test")
 	_, _, err = dockerCmdWithError("volume", "create", "test", "--driver", strings.TrimSpace(out))
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 }
 
 func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverNamed(c *check.C) {
 	s.d.StartWithBusybox(c)
 
 	out, err := s.d.Cmd("run", "--rm", "--name", "test-data", "-v", "external-volume-test:/tmp/external-volume-test", "--volume-driver", volumePluginName, "busybox:latest", "cat", "/tmp/external-volume-test/test")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 	c.Assert(out, checker.Contains, s.Server.URL)
 
 	_, err = s.d.Cmd("volume", "rm", "external-volume-test")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	p := hostVolumePath("external-volume-test")
 	_, err = os.Lstat(p)
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(os.IsNotExist(err), checker.True, check.Commentf("Expected volume path in host to not exist: %s, %v\n", p, err))
 
 	c.Assert(s.ec.activations, checker.Equals, 1)
@@ -320,7 +321,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverUnnamed(c *check.C)
 	s.d.StartWithBusybox(c)
 
 	out, err := s.d.Cmd("run", "--rm", "--name", "test-data", "-v", "/tmp/external-volume-test", "--volume-driver", volumePluginName, "busybox:latest", "cat", "/tmp/external-volume-test/test")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 	c.Assert(out, checker.Contains, s.Server.URL)
 
 	c.Assert(s.ec.activations, checker.Equals, 1)
@@ -334,13 +335,13 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverVolumesFrom(c *check
 	s.d.StartWithBusybox(c)
 
 	out, err := s.d.Cmd("run", "--name", "vol-test1", "-v", "/foo", "--volume-driver", volumePluginName, "busybox:latest")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	out, err = s.d.Cmd("run", "--rm", "--volumes-from", "vol-test1", "--name", "vol-test2", "busybox", "ls", "/tmp")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	out, err = s.d.Cmd("rm", "-fv", "vol-test1")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	c.Assert(s.ec.activations, checker.Equals, 1)
 	c.Assert(s.ec.creations, checker.Equals, 1)
@@ -353,10 +354,10 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverDeleteContainer(c *c
 	s.d.StartWithBusybox(c)
 
 	out, err := s.d.Cmd("run", "--name", "vol-test1", "-v", "/foo", "--volume-driver", volumePluginName, "busybox:latest")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	out, err = s.d.Cmd("rm", "-fv", "vol-test1")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	c.Assert(s.ec.activations, checker.Equals, 1)
 	c.Assert(s.ec.creations, checker.Equals, 1)
@@ -373,7 +374,7 @@ func hostVolumePath(name string) string {
 func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverLookupNotBlocked(c *check.C) {
 	specPath := "/etc/docker/plugins/down-driver.spec"
 	err := ioutil.WriteFile(specPath, []byte("tcp://127.0.0.7:9999"), 0644)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	defer os.RemoveAll(specPath)
 
 	chCmd1 := make(chan struct{})
@@ -399,7 +400,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverLookupNotBlocked(c *
 		cmd2.Process.Kill()
 		c.Fatalf("volume create with down driver finished unexpectedly")
 	case err := <-chCmd2:
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 	case <-time.After(5 * time.Second):
 		cmd2.Process.Kill()
 		c.Fatal("volume creates are blocked by previous create requests when previous driver is down")
@@ -428,13 +429,13 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverRetryNotImmediatelyE
 
 	select {
 	case err := <-errchan:
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 	case <-time.After(8 * time.Second):
 		c.Fatal("volume creates fail when plugin not immediately available")
 	}
 
 	_, err := s.d.Cmd("volume", "rm", "external-volume-test")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	c.Assert(p.ec.activations, checker.Equals, 1)
 	c.Assert(p.ec.creations, checker.Equals, 1)
@@ -474,7 +475,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverList(c *check.C) {
 
 func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverGet(c *check.C) {
 	out, _, err := dockerCmdWithError("volume", "inspect", "dummy")
-	c.Assert(err, check.NotNil, check.Commentf("%s", out))
+	assert.ErrorContains(c, err, "", out)
 	c.Assert(out, checker.Contains, "No such volume")
 	c.Assert(s.ec.gets, check.Equals, 1)
 
@@ -509,10 +510,10 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverGetEmptyResponse(c *
 	s.d.Start(c)
 
 	out, err := s.d.Cmd("volume", "create", "-d", volumePluginName, "abc2", "--opt", "ninja=1")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	out, err = s.d.Cmd("volume", "inspect", "abc2")
-	c.Assert(err, checker.NotNil, check.Commentf("%s", out))
+	assert.ErrorContains(c, err, "", out)
 	c.Assert(out, checker.Contains, "No such volume")
 }
 
@@ -525,11 +526,11 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverPathCalls(c *check.C
 	c.Assert(s.ec.paths, checker.Equals, 0)
 
 	out, err := s.d.Cmd("volume", "create", "test", "--driver=test-external-volume-driver")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 	c.Assert(s.ec.paths, checker.Equals, 0)
 
 	out, err = s.d.Cmd("volume", "ls")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 	c.Assert(s.ec.paths, checker.Equals, 0)
 }
 
@@ -537,8 +538,8 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverMountID(c *check.C)
 	s.d.StartWithBusybox(c)
 
 	out, err := s.d.Cmd("run", "--rm", "-v", "external-volume-test:/tmp/external-volume-test", "--volume-driver", volumePluginName, "busybox:latest", "cat", "/tmp/external-volume-test/test")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
-	c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
+	assert.NilError(c, err, out)
+	assert.Assert(c, strings.TrimSpace(out) != "")
 }
 
 // Check that VolumeDriver.Capabilities gets called, and only called once
@@ -548,11 +549,11 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverCapabilities(c *chec
 
 	for i := 0; i < 3; i++ {
 		out, err := s.d.Cmd("volume", "create", "-d", volumePluginName, fmt.Sprintf("test%d", i))
-		c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+		assert.NilError(c, err, out)
 		c.Assert(s.ec.caps, checker.Equals, 1)
 		out, err = s.d.Cmd("volume", "inspect", "--format={{.Scope}}", fmt.Sprintf("test%d", i))
-		c.Assert(err, checker.IsNil)
-		c.Assert(strings.TrimSpace(out), checker.Equals, volume.GlobalScope)
+		assert.NilError(c, err)
+		assert.Equal(c, strings.TrimSpace(out), volume.GlobalScope)
 	}
 }
 
@@ -564,10 +565,10 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverOutOfBandDelete(c *c
 	s.d.StartWithBusybox(c)
 
 	out, err := s.d.Cmd("volume", "create", "-d", driverName, "--name", "test")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	out, err = s.d.Cmd("volume", "create", "-d", "local", "--name", "test")
-	c.Assert(err, checker.NotNil, check.Commentf("%s", out))
+	assert.ErrorContains(c, err, "", out)
 	c.Assert(out, checker.Contains, "must be unique")
 
 	// simulate out of band volume deletion on plugin level
@@ -575,13 +576,13 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverOutOfBandDelete(c *c
 
 	// test re-create with same driver
 	out, err = s.d.Cmd("volume", "create", "-d", driverName, "--opt", "foo=bar", "--name", "test")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 	out, err = s.d.Cmd("volume", "inspect", "test")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	var vs []types.Volume
 	err = json.Unmarshal([]byte(out), &vs)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(vs, checker.HasLen, 1)
 	c.Assert(vs[0].Driver, checker.Equals, driverName)
 	c.Assert(vs[0].Options, checker.NotNil)
@@ -593,13 +594,13 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverOutOfBandDelete(c *c
 
 	// test create with different driver
 	out, err = s.d.Cmd("volume", "create", "-d", "local", "--name", "test")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	out, err = s.d.Cmd("volume", "inspect", "test")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 	vs = nil
 	err = json.Unmarshal([]byte(out), &vs)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(vs, checker.HasLen, 1)
 	c.Assert(vs[0].Options, checker.HasLen, 0)
 	c.Assert(vs[0].Driver, checker.Equals, "local")

+ 10 - 8
integration-cli/docker_cli_images_test.go

@@ -14,6 +14,8 @@ import (
 	"github.com/docker/docker/integration-cli/cli/build"
 	"github.com/docker/docker/pkg/stringid"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
+	is "gotest.tools/assert/cmp"
 	"gotest.tools/icmd"
 )
 
@@ -68,7 +70,7 @@ func (s *DockerSuite) TestImagesOrderedByCreationDate(c *check.C) {
 
 func (s *DockerSuite) TestImagesErrorWithInvalidFilterNameTest(c *check.C) {
 	out, _, err := dockerCmdWithError("images", "-f", "FOO=123")
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(out, checker.Contains, "Invalid filter")
 }
 
@@ -96,7 +98,7 @@ func (s *DockerSuite) TestImagesFilterLabelMatch(c *check.C) {
 
 	out, _ = dockerCmd(c, "images", "--no-trunc", "-q", "-f", "label=match=me too")
 	out = strings.TrimSpace(out)
-	c.Assert(out, check.Equals, image2ID)
+	assert.Equal(c, out, image2ID)
 }
 
 // Regression : #15659
@@ -109,7 +111,7 @@ func (s *DockerSuite) TestCommitWithFilterLabel(c *check.C) {
 
 	out, _ = dockerCmd(c, "images", "--no-trunc", "-q", "-f", "label=foo.version=1.0.0-1")
 	out = strings.TrimSpace(out)
-	c.Assert(out, check.Equals, imageID)
+	assert.Equal(c, out, imageID)
 }
 
 func (s *DockerSuite) TestImagesFilterSinceAndBefore(c *check.C) {
@@ -252,7 +254,7 @@ func (s *DockerSuite) TestImagesEnsureDanglingImageOnlyListedOnce(c *check.C) {
 // FIXME(vdemeester) should be a unit test for `docker image ls`
 func (s *DockerSuite) TestImagesWithIncorrectFilter(c *check.C) {
 	out, _, err := dockerCmdWithError("images", "-f", "dangling=invalid")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(out, checker.Contains, "Invalid filter")
 }
 
@@ -336,7 +338,7 @@ func (s *DockerSuite) TestImagesFormat(c *check.C) {
 	expected := []string{"myimage", "myimage"}
 	var names []string
 	names = append(names, lines...)
-	c.Assert(names, checker.DeepEquals, expected, check.Commentf("Expected array with truncated names: %v, got: %v", expected, names))
+	assert.Assert(c, is.DeepEqual(names, expected), "Expected array with truncated names: %v, got: %v", expected, names)
 }
 
 // ImagesDefaultFormatAndQuiet
@@ -355,12 +357,12 @@ func (s *DockerSuite) TestImagesFormatDefaultFormat(c *check.C) {
 		"imagesFormat": "{{ .ID }} default"
 }`
 	d, err := ioutil.TempDir("", "integration-cli-")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer os.RemoveAll(d)
 
 	err = ioutil.WriteFile(filepath.Join(d, "config.json"), []byte(config), 0644)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, _ = dockerCmd(c, "--config", d, "images", "-q", "myimage")
-	c.Assert(out, checker.Equals, imageID+"\n", check.Commentf("Expected to print only the image id, got %v\n", out))
+	assert.Equal(c, out, imageID+"\n", "Expected to print only the image id, got %v\n", out)
 }

+ 10 - 9
integration-cli/docker_cli_import_test.go

@@ -12,6 +12,7 @@ import (
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 	"gotest.tools/icmd"
 )
 
@@ -24,13 +25,13 @@ func (s *DockerSuite) TestImportDisplay(c *check.C) {
 		exec.Command(dockerBinary, "export", cleanedContainerID),
 		exec.Command(dockerBinary, "import", "-"),
 	)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
-	c.Assert(out, checker.Count, "\n", 1, check.Commentf("display is expected 1 '\\n' but didn't"))
+	assert.Assert(c, strings.Count(out, "\n") == 1, "display is expected 1 '\\n' but didn't")
 
 	image := strings.TrimSpace(out)
 	out, _ = dockerCmd(c, "run", "--rm", image, "true")
-	c.Assert(out, checker.Equals, "", check.Commentf("command output should've been nothing."))
+	assert.Equal(c, out, "", "command output should've been nothing.")
 }
 
 func (s *DockerSuite) TestImportBadURL(c *check.C) {
@@ -58,11 +59,11 @@ func (s *DockerSuite) TestImportFile(c *check.C) {
 	}).Assert(c, icmd.Success)
 
 	out, _ := dockerCmd(c, "import", temporaryFile.Name())
-	c.Assert(out, checker.Count, "\n", 1, check.Commentf("display is expected 1 '\\n' but didn't"))
+	assert.Assert(c, strings.Count(out, "\n") == 1, "display is expected 1 '\\n' but didn't")
 	image := strings.TrimSpace(out)
 
 	out, _ = dockerCmd(c, "run", "--rm", image, "true")
-	c.Assert(out, checker.Equals, "", check.Commentf("command output should've been nothing."))
+	assert.Equal(c, out, "", "command output should've been nothing.")
 }
 
 func (s *DockerSuite) TestImportGzipped(c *check.C) {
@@ -81,11 +82,11 @@ func (s *DockerSuite) TestImportGzipped(c *check.C) {
 	c.Assert(w.Close(), checker.IsNil, check.Commentf("failed to close gzip writer"))
 	temporaryFile.Close()
 	out, _ := dockerCmd(c, "import", temporaryFile.Name())
-	c.Assert(out, checker.Count, "\n", 1, check.Commentf("display is expected 1 '\\n' but didn't"))
+	assert.Assert(c, strings.Count(out, "\n") == 1, "display is expected 1 '\\n' but didn't")
 	image := strings.TrimSpace(out)
 
 	out, _ = dockerCmd(c, "run", "--rm", image, "true")
-	c.Assert(out, checker.Equals, "", check.Commentf("command output should've been nothing."))
+	assert.Equal(c, out, "", "command output should've been nothing.")
 }
 
 func (s *DockerSuite) TestImportFileWithMessage(c *check.C) {
@@ -103,7 +104,7 @@ func (s *DockerSuite) TestImportFileWithMessage(c *check.C) {
 
 	message := "Testing commit message"
 	out, _ := dockerCmd(c, "import", "-m", message, temporaryFile.Name())
-	c.Assert(out, checker.Count, "\n", 1, check.Commentf("display is expected 1 '\\n' but didn't"))
+	assert.Assert(c, strings.Count(out, "\n") == 1, "display is expected 1 '\\n' but didn't")
 	image := strings.TrimSpace(out)
 
 	out, _ = dockerCmd(c, "history", image)
@@ -116,7 +117,7 @@ func (s *DockerSuite) TestImportFileWithMessage(c *check.C) {
 	c.Assert(message, checker.Equals, split[3], check.Commentf("didn't get expected value in commit message"))
 
 	out, _ = dockerCmd(c, "run", "--rm", image, "true")
-	c.Assert(out, checker.Equals, "", check.Commentf("command output should've been nothing"))
+	assert.Equal(c, out, "", "command output should've been nothing")
 }
 
 func (s *DockerSuite) TestImportFileNonExistentFile(c *check.C) {

+ 15 - 14
integration-cli/docker_cli_info_test.go

@@ -10,6 +10,7 @@ import (
 	"github.com/docker/docker/integration-cli/daemon"
 	testdaemon "github.com/docker/docker/internal/test/daemon"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 // ensure docker info succeeds
@@ -62,9 +63,9 @@ func (s *DockerSuite) TestInfoFormat(c *check.C) {
 	c.Assert(status, checker.Equals, 0)
 	var m map[string]interface{}
 	err := json.Unmarshal([]byte(out), &m)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	_, _, err = dockerCmdWithError("info", "--format", "{{.badString}}")
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 }
 
 // TestInfoDiscoveryBackend verifies that a daemon run with `--cluster-advertise` and
@@ -79,7 +80,7 @@ func (s *DockerSuite) TestInfoDiscoveryBackend(c *check.C) {
 	defer d.Stop(c)
 
 	out, err := d.Cmd("info")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(out, checker.Contains, fmt.Sprintf("Cluster Store: %s\n", discoveryBackend))
 	c.Assert(out, checker.Contains, fmt.Sprintf("Cluster Advertise: %s\n", discoveryAdvertise))
 }
@@ -94,11 +95,11 @@ func (s *DockerSuite) TestInfoDiscoveryInvalidAdvertise(c *check.C) {
 
 	// --cluster-advertise with an invalid string is an error
 	err := d.StartWithError(fmt.Sprintf("--cluster-store=%s", discoveryBackend), "--cluster-advertise=invalid")
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 
 	// --cluster-advertise without --cluster-store is also an error
 	err = d.StartWithError("--cluster-advertise=1.1.1.1:2375")
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 }
 
 // TestInfoDiscoveryAdvertiseInterfaceName verifies that a daemon run with `--cluster-advertise`
@@ -114,15 +115,15 @@ func (s *DockerSuite) TestInfoDiscoveryAdvertiseInterfaceName(c *check.C) {
 	defer d.Stop(c)
 
 	iface, err := net.InterfaceByName(discoveryAdvertise)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	addrs, err := iface.Addrs()
-	c.Assert(err, checker.IsNil)
-	c.Assert(len(addrs), checker.GreaterThan, 0)
+	assert.NilError(c, err)
+	assert.Assert(c, len(addrs) > 0)
 	ip, _, err := net.ParseCIDR(addrs[0].String())
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, err := d.Cmd("info")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(out, checker.Contains, fmt.Sprintf("Cluster Store: %s\n", discoveryBackend))
 	c.Assert(out, checker.Contains, fmt.Sprintf("Cluster Advertise: %s:2375\n", ip.String()))
 }
@@ -182,7 +183,7 @@ func (s *DockerSuite) TestInfoDebug(c *check.C) {
 	defer d.Stop(c)
 
 	out, err := d.Cmd("--debug", "info")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(out, checker.Contains, "Debug Mode (client): true\n")
 	c.Assert(out, checker.Contains, "Debug Mode (server): true\n")
 	c.Assert(out, checker.Contains, "File Descriptors")
@@ -203,7 +204,7 @@ func (s *DockerSuite) TestInsecureRegistries(c *check.C) {
 	defer d.Stop(c)
 
 	out, err := d.Cmd("info")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(out, checker.Contains, "Insecure Registries:\n")
 	c.Assert(out, checker.Contains, fmt.Sprintf(" %s\n", registryHost))
 	c.Assert(out, checker.Contains, fmt.Sprintf(" %s\n", registryCIDR))
@@ -218,7 +219,7 @@ func (s *DockerDaemonSuite) TestRegistryMirrors(c *check.C) {
 	s.d.Start(c, "--registry-mirror="+registryMirror1, "--registry-mirror="+registryMirror2)
 
 	out, err := s.d.Cmd("info")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(out, checker.Contains, "Registry Mirrors:\n")
 	c.Assert(out, checker.Contains, fmt.Sprintf(" %s", registryMirror1))
 	c.Assert(out, checker.Contains, fmt.Sprintf(" %s", registryMirror2))
@@ -228,7 +229,7 @@ func existingContainerStates(c *check.C) map[string]int {
 	out, _ := dockerCmd(c, "info", "--format", "{{json .}}")
 	var m map[string]interface{}
 	err := json.Unmarshal([]byte(out), &m)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	res := map[string]int{}
 	res["Containers"] = int(m["Containers"].(float64))
 	res["ContainersRunning"] = int(m["ContainersRunning"].(float64))

+ 33 - 33
integration-cli/docker_cli_inspect_test.go

@@ -12,6 +12,7 @@ import (
 	"github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 	"gotest.tools/icmd"
 )
 
@@ -84,7 +85,7 @@ func (s *DockerSuite) TestInspectTypeFlagContainer(c *check.C) {
 
 	formatStr := "--format={{.State.Running}}"
 	out, _ := dockerCmd(c, "inspect", "--type=container", formatStr, "busybox")
-	c.Assert(out, checker.Equals, "true\n") // not a container JSON
+	assert.Equal(c, out, "true\n") // not a container JSON
 }
 
 func (s *DockerSuite) TestInspectTypeFlagWithNoContainer(c *check.C) {
@@ -96,7 +97,7 @@ func (s *DockerSuite) TestInspectTypeFlagWithNoContainer(c *check.C) {
 
 	_, _, err := dockerCmdWithError("inspect", "--type=container", "busybox")
 	// docker inspect should fail, as there is no container named busybox
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 }
 
 func (s *DockerSuite) TestInspectTypeFlagWithImage(c *check.C) {
@@ -134,7 +135,7 @@ func (s *DockerSuite) TestInspectImageFilterInt(c *check.C) {
 	formatStr := fmt.Sprintf("--format={{eq .Size %d}}", size)
 	out, _ = dockerCmd(c, "inspect", formatStr, imageTest)
 	result, err := strconv.ParseBool(strings.TrimSuffix(out, "\n"))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(result, checker.Equals, true)
 }
 
@@ -156,7 +157,7 @@ func (s *DockerSuite) TestInspectContainerFilterInt(c *check.C) {
 	formatStr := fmt.Sprintf("--format={{eq .State.ExitCode %d}}", exitCode)
 	out, _ = dockerCmd(c, "inspect", formatStr, id)
 	inspectResult, err := strconv.ParseBool(strings.TrimSuffix(out, "\n"))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(inspectResult, checker.Equals, true)
 }
 
@@ -218,7 +219,7 @@ func (s *DockerSuite) TestInspectBindMountPoint(c *check.C) {
 
 	var mp []types.MountPoint
 	err := json.Unmarshal([]byte(vol), &mp)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	// check that there is only one mountpoint
 	c.Assert(mp, check.HasLen, 1)
@@ -244,7 +245,7 @@ func (s *DockerSuite) TestInspectNamedMountPoint(c *check.C) {
 
 	var mp []types.MountPoint
 	err := json.Unmarshal([]byte(vol), &mp)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	// check that there is only one mountpoint
 	c.Assert(mp, checker.HasLen, 1)
@@ -267,16 +268,16 @@ func (s *DockerSuite) TestInspectTimesAsRFC3339Nano(c *check.C) {
 	created := inspectField(c, id, "Created")
 
 	_, err := time.Parse(time.RFC3339Nano, startedAt)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	_, err = time.Parse(time.RFC3339Nano, finishedAt)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	_, err = time.Parse(time.RFC3339Nano, created)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	created = inspectField(c, "busybox", "Created")
 
 	_, err = time.Parse(time.RFC3339Nano, created)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 }
 
 // #15633
@@ -334,13 +335,13 @@ func (s *DockerSuite) TestInspectJSONFields(c *check.C) {
 	runSleepingContainer(c, "--name=busybox", "-d")
 	out, _, err := dockerCmdWithError("inspect", "--type=container", "--format={{.HostConfig.Dns}}", "busybox")
 
-	c.Assert(err, check.IsNil)
-	c.Assert(out, checker.Equals, "[]\n")
+	assert.NilError(c, err)
+	assert.Equal(c, out, "[]\n")
 }
 
 func (s *DockerSuite) TestInspectByPrefix(c *check.C) {
 	id := inspectField(c, "busybox", "Id")
-	c.Assert(id, checker.HasPrefix, "sha256:")
+	assert.Assert(c, strings.HasPrefix(id, "sha256:"))
 
 	id2 := inspectField(c, id[:12], "Id")
 	c.Assert(id, checker.Equals, id2)
@@ -372,7 +373,7 @@ func (s *DockerSuite) TestInspectHistory(c *check.C) {
 	dockerCmd(c, "run", "--name=testcont", "busybox", "echo", "hello")
 	dockerCmd(c, "commit", "-m", "test comment", "testcont", "testimg")
 	out, _, err := dockerCmdWithError("inspect", "--format='{{.Comment}}'", "testimg")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	c.Assert(out, checker.Contains, "test comment")
 }
 
@@ -385,7 +386,7 @@ func (s *DockerSuite) TestInspectContainerNetworkDefault(c *check.C) {
 	out := inspectField(c, contName, "NetworkSettings.Networks")
 	c.Assert(out, checker.Contains, "bridge")
 	out = inspectField(c, contName, "NetworkSettings.Networks.bridge.NetworkID")
-	c.Assert(strings.TrimSpace(out), checker.Equals, strings.TrimSpace(netOut))
+	assert.Equal(c, strings.TrimSpace(out), strings.TrimSpace(netOut))
 }
 
 func (s *DockerSuite) TestInspectContainerNetworkCustom(c *check.C) {
@@ -396,18 +397,17 @@ func (s *DockerSuite) TestInspectContainerNetworkCustom(c *check.C) {
 	out := inspectField(c, "container1", "NetworkSettings.Networks")
 	c.Assert(out, checker.Contains, "net1")
 	out = inspectField(c, "container1", "NetworkSettings.Networks.net1.NetworkID")
-	c.Assert(strings.TrimSpace(out), checker.Equals, strings.TrimSpace(netOut))
+	assert.Equal(c, strings.TrimSpace(out), strings.TrimSpace(netOut))
 }
 
 func (s *DockerSuite) TestInspectRootFS(c *check.C) {
 	out, _, err := dockerCmdWithError("inspect", "busybox")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	var imageJSON []types.ImageInspect
 	err = json.Unmarshal([]byte(out), &imageJSON)
-	c.Assert(err, checker.IsNil)
-
-	c.Assert(len(imageJSON[0].RootFS.Layers), checker.GreaterOrEqualThan, 1)
+	assert.NilError(c, err)
+	assert.Assert(c, len(imageJSON[0].RootFS.Layers) >= 1)
 }
 
 func (s *DockerSuite) TestInspectAmpersand(c *check.C) {
@@ -423,30 +423,30 @@ func (s *DockerSuite) TestInspectAmpersand(c *check.C) {
 func (s *DockerSuite) TestInspectPlugin(c *check.C) {
 	testRequires(c, DaemonIsLinux, IsAmd64, Network)
 	_, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", pNameWithTag)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, _, err := dockerCmdWithError("inspect", "--type", "plugin", "--format", "{{.Name}}", pNameWithTag)
-	c.Assert(err, checker.IsNil)
-	c.Assert(strings.TrimSpace(out), checker.Equals, pNameWithTag)
+	assert.NilError(c, err)
+	assert.Equal(c, strings.TrimSpace(out), pNameWithTag)
 
 	out, _, err = dockerCmdWithError("inspect", "--format", "{{.Name}}", pNameWithTag)
-	c.Assert(err, checker.IsNil)
-	c.Assert(strings.TrimSpace(out), checker.Equals, pNameWithTag)
+	assert.NilError(c, err)
+	assert.Equal(c, strings.TrimSpace(out), pNameWithTag)
 
 	// Even without tag the inspect still work
 	out, _, err = dockerCmdWithError("inspect", "--type", "plugin", "--format", "{{.Name}}", pNameWithTag)
-	c.Assert(err, checker.IsNil)
-	c.Assert(strings.TrimSpace(out), checker.Equals, pNameWithTag)
+	assert.NilError(c, err)
+	assert.Equal(c, strings.TrimSpace(out), pNameWithTag)
 
 	out, _, err = dockerCmdWithError("inspect", "--format", "{{.Name}}", pNameWithTag)
-	c.Assert(err, checker.IsNil)
-	c.Assert(strings.TrimSpace(out), checker.Equals, pNameWithTag)
+	assert.NilError(c, err)
+	assert.Equal(c, strings.TrimSpace(out), pNameWithTag)
 
 	_, _, err = dockerCmdWithError("plugin", "disable", pNameWithTag)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, _, err = dockerCmdWithError("plugin", "remove", pNameWithTag)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(out, checker.Contains, pNameWithTag)
 }
 
@@ -454,7 +454,7 @@ func (s *DockerSuite) TestInspectPlugin(c *check.C) {
 func (s *DockerSuite) TestInspectUnknownObject(c *check.C) {
 	// This test should work on both Windows and Linux
 	out, _, err := dockerCmdWithError("inspect", "foobar")
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(out, checker.Contains, "Error: No such object: foobar")
-	c.Assert(err.Error(), checker.Contains, "Error: No such object: foobar")
+	assert.ErrorContains(c, err, "Error: No such object: foobar")
 }

+ 5 - 4
integration-cli/docker_cli_links_test.go

@@ -10,6 +10,7 @@ import (
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/runconfig"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 func (s *DockerSuite) TestLinksPingUnlinkedContainers(c *check.C) {
@@ -99,14 +100,14 @@ func (s *DockerSuite) TestLinksInspectLinksStarted(c *check.C) {
 
 	var result []string
 	err := json.Unmarshal([]byte(links), &result)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	var expected = []string{
 		"/container1:/testinspectlink/alias1",
 		"/container2:/testinspectlink/alias2",
 	}
 	sort.Strings(result)
-	c.Assert(result, checker.DeepEquals, expected)
+	assert.DeepEqual(c, result, expected)
 }
 
 func (s *DockerSuite) TestLinksInspectLinksStopped(c *check.C) {
@@ -119,14 +120,14 @@ func (s *DockerSuite) TestLinksInspectLinksStopped(c *check.C) {
 
 	var result []string
 	err := json.Unmarshal([]byte(links), &result)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	var expected = []string{
 		"/container1:/testinspectlink/alias1",
 		"/container2:/testinspectlink/alias2",
 	}
 	sort.Strings(result)
-	c.Assert(result, checker.DeepEquals, expected)
+	assert.DeepEqual(c, result, expected)
 }
 
 func (s *DockerSuite) TestLinksNotStartedParentNotFail(c *check.C) {

+ 5 - 4
integration-cli/docker_cli_login_test.go

@@ -3,9 +3,10 @@ package main
 import (
 	"bytes"
 	"os/exec"
+	"strings"
 
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 func (s *DockerSuite) TestLoginWithoutTTY(c *check.C) {
@@ -16,14 +17,14 @@ func (s *DockerSuite) TestLoginWithoutTTY(c *check.C) {
 
 	// run the command and block until it's done
 	err := cmd.Run()
-	c.Assert(err, checker.NotNil) //"Expected non nil err when logging in & TTY not available"
+	assert.ErrorContains(c, err, "") //"Expected non nil err when logging in & TTY not available"
 }
 
 func (s *DockerRegistryAuthHtpasswdSuite) TestLoginToPrivateRegistry(c *check.C) {
 	// wrong credentials
 	out, _, err := dockerCmdWithError("login", "-u", s.reg.Username(), "-p", "WRONGPASSWORD", privateRegistryURL)
-	c.Assert(err, checker.NotNil, check.Commentf("%s", out))
-	c.Assert(out, checker.Contains, "401 Unauthorized")
+	assert.ErrorContains(c, err, "", out)
+	assert.Assert(c, strings.Contains(out, "401 Unauthorized"))
 
 	// now it's fine
 	dockerCmd(c, "login", "-u", s.reg.Username(), "-p", s.reg.Password(), privateRegistryURL)

+ 28 - 27
integration-cli/docker_cli_logout_test.go

@@ -7,9 +7,10 @@ import (
 	"os"
 	"os/exec"
 	"path/filepath"
+	"strings"
 
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 func (s *DockerRegistryAuthHtpasswdSuite) TestLogoutWithExternalAuth(c *check.C) {
@@ -19,9 +20,9 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestLogoutWithExternalAuth(c *check.C)
 	defer os.Setenv("PATH", osPath)
 
 	workingDir, err := os.Getwd()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	absolute, err := filepath.Abs(filepath.Join(workingDir, "fixtures", "auth"))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	testPath := fmt.Sprintf("%s%c%s", osPath, filepath.ListSeparator, absolute)
 
 	os.Setenv("PATH", testPath)
@@ -29,38 +30,38 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestLogoutWithExternalAuth(c *check.C)
 	repoName := fmt.Sprintf("%v/dockercli/busybox:authtest", privateRegistryURL)
 
 	tmp, err := ioutil.TempDir("", "integration-cli-")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer os.RemoveAll(tmp)
 
 	externalAuthConfig := `{ "credsStore": "shell-test" }`
 
 	configPath := filepath.Join(tmp, "config.json")
 	err = ioutil.WriteFile(configPath, []byte(externalAuthConfig), 0644)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	_, err = s.d.Cmd("--config", tmp, "login", "-u", s.reg.Username(), "-p", s.reg.Password(), privateRegistryURL)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	b, err := ioutil.ReadFile(configPath)
-	c.Assert(err, checker.IsNil)
-	c.Assert(string(b), checker.Not(checker.Contains), "\"auth\":")
-	c.Assert(string(b), checker.Contains, privateRegistryURL)
+	assert.NilError(c, err)
+	assert.Assert(c, !strings.Contains(string(b), `"auth":`))
+	assert.Assert(c, strings.Contains(string(b), privateRegistryURL))
 
 	_, err = s.d.Cmd("--config", tmp, "tag", "busybox", repoName)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	_, err = s.d.Cmd("--config", tmp, "push", repoName)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	_, err = s.d.Cmd("--config", tmp, "logout", privateRegistryURL)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	b, err = ioutil.ReadFile(configPath)
-	c.Assert(err, checker.IsNil)
-	c.Assert(string(b), checker.Not(checker.Contains), privateRegistryURL)
+	assert.NilError(c, err)
+	assert.Assert(c, !strings.Contains(string(b), privateRegistryURL))
 
 	// check I cannot pull anymore
 	out, err := s.d.Cmd("--config", tmp, "pull", repoName)
-	c.Assert(err, check.NotNil, check.Commentf("%s", out))
-	c.Assert(out, checker.Contains, "no basic auth credentials")
+	assert.ErrorContains(c, err, "", out)
+	assert.Assert(c, strings.Contains(out, "no basic auth credentials"))
 }
 
 // #23100
@@ -69,9 +70,9 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestLogoutWithWrongHostnamesStored(c *
 	defer os.Setenv("PATH", osPath)
 
 	workingDir, err := os.Getwd()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	absolute, err := filepath.Abs(filepath.Join(workingDir, "fixtures", "auth"))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	testPath := fmt.Sprintf("%s%c%s", osPath, filepath.ListSeparator, absolute)
 
 	os.Setenv("PATH", testPath)
@@ -79,28 +80,28 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestLogoutWithWrongHostnamesStored(c *
 	cmd := exec.Command("docker-credential-shell-test", "store")
 	stdin := bytes.NewReader([]byte(fmt.Sprintf(`{"ServerURL": "https://%s", "Username": "%s", "Secret": "%s"}`, privateRegistryURL, s.reg.Username(), s.reg.Password())))
 	cmd.Stdin = stdin
-	c.Assert(cmd.Run(), checker.IsNil)
+	assert.NilError(c, cmd.Run())
 
 	tmp, err := ioutil.TempDir("", "integration-cli-")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	externalAuthConfig := fmt.Sprintf(`{ "auths": {"https://%s": {}}, "credsStore": "shell-test" }`, privateRegistryURL)
 
 	configPath := filepath.Join(tmp, "config.json")
 	err = ioutil.WriteFile(configPath, []byte(externalAuthConfig), 0644)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	dockerCmd(c, "--config", tmp, "login", "-u", s.reg.Username(), "-p", s.reg.Password(), privateRegistryURL)
 
 	b, err := ioutil.ReadFile(configPath)
-	c.Assert(err, checker.IsNil)
-	c.Assert(string(b), checker.Contains, fmt.Sprintf("\"https://%s\": {}", privateRegistryURL))
-	c.Assert(string(b), checker.Contains, fmt.Sprintf("\"%s\": {}", privateRegistryURL))
+	assert.NilError(c, err)
+	assert.Assert(c, strings.Contains(string(b), fmt.Sprintf(`"https://%s": {}`, privateRegistryURL)))
+	assert.Assert(c, strings.Contains(string(b), fmt.Sprintf(`"%s": {}`, privateRegistryURL)))
 
 	dockerCmd(c, "--config", tmp, "logout", privateRegistryURL)
 
 	b, err = ioutil.ReadFile(configPath)
-	c.Assert(err, checker.IsNil)
-	c.Assert(string(b), checker.Not(checker.Contains), fmt.Sprintf("\"https://%s\": {}", privateRegistryURL))
-	c.Assert(string(b), checker.Not(checker.Contains), fmt.Sprintf("\"%s\": {}", privateRegistryURL))
+	assert.NilError(c, err)
+	assert.Assert(c, !strings.Contains(string(b), fmt.Sprintf(`"https://%s": {}`, privateRegistryURL)))
+	assert.Assert(c, !strings.Contains(string(b), fmt.Sprintf(`"%s": {}`, privateRegistryURL)))
 }

+ 44 - 44
integration-cli/docker_cli_logs_test.go

@@ -8,10 +8,10 @@ import (
 	"strings"
 	"time"
 
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli"
 	"github.com/docker/docker/pkg/jsonmessage"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 	"gotest.tools/icmd"
 )
 
@@ -35,7 +35,7 @@ func testLogsContainerPagination(c *check.C, testLen int) {
 	id := strings.TrimSpace(out)
 	dockerCmd(c, "wait", id)
 	out, _ = dockerCmd(c, "logs", id)
-	c.Assert(out, checker.HasLen, testLen+1)
+	assert.Equal(c, len(out), testLen+1)
 }
 
 func (s *DockerSuite) TestLogsTimestamps(c *check.C) {
@@ -49,16 +49,16 @@ func (s *DockerSuite) TestLogsTimestamps(c *check.C) {
 
 	lines := strings.Split(out, "\n")
 
-	c.Assert(lines, checker.HasLen, testLen+1)
+	assert.Equal(c, len(lines), testLen+1)
 
 	ts := regexp.MustCompile(`^.* `)
 
 	for _, l := range lines {
 		if l != "" {
 			_, err := time.Parse(jsonmessage.RFC3339NanoFixed+" ", ts.FindString(l))
-			c.Assert(err, checker.IsNil, check.Commentf("Failed to parse timestamp from %v", l))
+			assert.NilError(c, err, "Failed to parse timestamp from %v", l)
 			// ensure we have padded 0's
-			c.Assert(l[29], checker.Equals, uint8('Z'))
+			assert.Equal(c, l[29], uint8('Z'))
 		}
 	}
 }
@@ -98,27 +98,27 @@ func (s *DockerSuite) TestLogsTail(c *check.C) {
 
 	out = cli.DockerCmd(c, "logs", "--tail", "0", id).Combined()
 	lines := strings.Split(out, "\n")
-	c.Assert(lines, checker.HasLen, 1)
+	assert.Equal(c, len(lines), 1)
 
 	out = cli.DockerCmd(c, "logs", "--tail", "5", id).Combined()
 	lines = strings.Split(out, "\n")
-	c.Assert(lines, checker.HasLen, 6)
+	assert.Equal(c, len(lines), 6)
 
 	out = cli.DockerCmd(c, "logs", "--tail", "99", id).Combined()
 	lines = strings.Split(out, "\n")
-	c.Assert(lines, checker.HasLen, 100)
+	assert.Equal(c, len(lines), 100)
 
 	out = cli.DockerCmd(c, "logs", "--tail", "all", id).Combined()
 	lines = strings.Split(out, "\n")
-	c.Assert(lines, checker.HasLen, testLen+1)
+	assert.Equal(c, len(lines), testLen+1)
 
 	out = cli.DockerCmd(c, "logs", "--tail", "-1", id).Combined()
 	lines = strings.Split(out, "\n")
-	c.Assert(lines, checker.HasLen, testLen+1)
+	assert.Equal(c, len(lines), testLen+1)
 
 	out = cli.DockerCmd(c, "logs", "--tail", "random", id).Combined()
 	lines = strings.Split(out, "\n")
-	c.Assert(lines, checker.HasLen, testLen+1)
+	assert.Equal(c, len(lines), testLen+1)
 }
 
 func (s *DockerSuite) TestLogsFollowStopped(c *check.C) {
@@ -126,7 +126,7 @@ func (s *DockerSuite) TestLogsFollowStopped(c *check.C) {
 	id := getIDByName(c, "test")
 
 	logsCmd := exec.Command(dockerBinary, "logs", "-f", id)
-	c.Assert(logsCmd.Start(), checker.IsNil)
+	assert.NilError(c, logsCmd.Start())
 
 	errChan := make(chan error)
 	go func() {
@@ -136,7 +136,7 @@ func (s *DockerSuite) TestLogsFollowStopped(c *check.C) {
 
 	select {
 	case err := <-errChan:
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 	case <-time.After(30 * time.Second):
 		c.Fatal("Following logs is hanged")
 	}
@@ -149,19 +149,19 @@ func (s *DockerSuite) TestLogsSince(c *check.C) {
 
 	log2Line := strings.Split(strings.Split(out, "\n")[1], " ")
 	t, err := time.Parse(time.RFC3339Nano, log2Line[0]) // the timestamp log2 is written
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	since := t.Unix() + 1 // add 1s so log1 & log2 doesn't show up
 	out, _ = dockerCmd(c, "logs", "-t", fmt.Sprintf("--since=%v", since), name)
 
 	// Skip 2 seconds
 	unexpected := []string{"log1", "log2"}
 	for _, v := range unexpected {
-		c.Assert(out, checker.Not(checker.Contains), v, check.Commentf("unexpected log message returned, since=%v", since))
+		assert.Check(c, !strings.Contains(out, v), "unexpected log message returned, since=%v", since)
 	}
 
 	// Test to make sure a bad since format is caught by the client
 	out, _, _ = dockerCmdWithError("logs", "-t", "--since=2006-01-02T15:04:0Z", name)
-	c.Assert(out, checker.Contains, "cannot parse \"0Z\" as \"05\"", check.Commentf("bad since format passed to server"))
+	assert.Assert(c, strings.Contains(out, `cannot parse "0Z" as "05"`), "bad since format passed to server")
 
 	// Test with default value specified and parameter omitted
 	expected := []string{"log1", "log2", "log3"}
@@ -172,7 +172,7 @@ func (s *DockerSuite) TestLogsSince(c *check.C) {
 		result := icmd.RunCommand(dockerBinary, cmd...)
 		result.Assert(c, icmd.Success)
 		for _, v := range expected {
-			c.Assert(result.Combined(), checker.Contains, v)
+			assert.Check(c, strings.Contains(result.Combined(), v))
 		}
 	}
 }
@@ -195,18 +195,18 @@ func (s *DockerSuite) TestLogsSinceFutureFollow(c *check.C) {
 		}
 	}
 
-	c.Assert(timestamp, checker.Not(checker.Equals), "")
+	assert.Assert(c, timestamp != "")
 	t, err := time.Parse(time.RFC3339Nano, timestamp)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	since := t.Unix() + 2
 	out, _ := dockerCmd(c, "logs", "-t", "-f", fmt.Sprintf("--since=%v", since), name)
-	c.Assert(out, checker.Not(checker.HasLen), 0, check.Commentf("cannot read from empty log"))
+	assert.Assert(c, len(out) != 0, "cannot read from empty log")
 	lines := strings.Split(strings.TrimSpace(out), "\n")
 	for _, v := range lines {
 		ts, err := time.Parse(time.RFC3339Nano, strings.Split(v, " ")[0])
-		c.Assert(err, checker.IsNil, check.Commentf("cannot parse timestamp output from log: '%v'", v))
-		c.Assert(ts.Unix() >= since, checker.Equals, true, check.Commentf("earlier log found. since=%v logdate=%v", since, ts))
+		assert.NilError(c, err, "cannot parse timestamp output from log: '%v'", v)
+		assert.Assert(c, ts.Unix() >= since, "earlier log found. since=%v logdate=%v", since, ts)
 	}
 }
 
@@ -228,22 +228,22 @@ func (s *DockerSuite) TestLogsFollowSlowStdoutConsumer(c *check.C) {
 
 	logCmd := exec.Command(dockerBinary, "logs", "-f", id)
 	stdout, err := logCmd.StdoutPipe()
-	c.Assert(err, checker.IsNil)
-	c.Assert(logCmd.Start(), checker.IsNil)
+	assert.NilError(c, err)
+	assert.NilError(c, logCmd.Start())
 	defer func() { go logCmd.Wait() }()
 
 	// First read slowly
 	bytes1, err := ConsumeWithSpeed(stdout, 10, 50*time.Millisecond, stopSlowRead)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	// After the container has finished we can continue reading fast
 	bytes2, err := ConsumeWithSpeed(stdout, 32*1024, 0, nil)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
-	c.Assert(logCmd.Wait(), checker.IsNil)
+	assert.NilError(c, logCmd.Wait())
 
 	actual := bytes1 + bytes2
-	c.Assert(actual, checker.Equals, expected)
+	assert.Equal(c, actual, expected)
 }
 
 // ConsumeWithSpeed reads chunkSize bytes from reader before sleeping
@@ -272,14 +272,14 @@ func ConsumeWithSpeed(reader io.Reader, chunkSize int, interval time.Duration, s
 func (s *DockerSuite) TestLogsFollowGoroutinesWithStdout(c *check.C) {
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "while true; do echo hello; sleep 2; done")
 	id := strings.TrimSpace(out)
-	c.Assert(waitRun(id), checker.IsNil)
+	assert.NilError(c, waitRun(id))
 
 	nroutines, err := getGoroutineNumber()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	cmd := exec.Command(dockerBinary, "logs", "-f", id)
 	r, w := io.Pipe()
 	cmd.Stdout = w
-	c.Assert(cmd.Start(), checker.IsNil)
+	assert.NilError(c, cmd.Start())
 	go cmd.Wait()
 
 	// Make sure pipe is written to
@@ -289,37 +289,37 @@ func (s *DockerSuite) TestLogsFollowGoroutinesWithStdout(c *check.C) {
 		_, err := r.Read(b)
 		chErr <- err
 	}()
-	c.Assert(<-chErr, checker.IsNil)
-	c.Assert(cmd.Process.Kill(), checker.IsNil)
+	assert.NilError(c, <-chErr)
+	assert.NilError(c, cmd.Process.Kill())
 	r.Close()
 	cmd.Wait()
 	// NGoroutines is not updated right away, so we need to wait before failing
-	c.Assert(waitForGoroutines(nroutines), checker.IsNil)
+	assert.NilError(c, waitForGoroutines(nroutines))
 }
 
 func (s *DockerSuite) TestLogsFollowGoroutinesNoOutput(c *check.C) {
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "while true; do sleep 2; done")
 	id := strings.TrimSpace(out)
-	c.Assert(waitRun(id), checker.IsNil)
+	assert.NilError(c, waitRun(id))
 
 	nroutines, err := getGoroutineNumber()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	cmd := exec.Command(dockerBinary, "logs", "-f", id)
-	c.Assert(cmd.Start(), checker.IsNil)
+	assert.NilError(c, cmd.Start())
 	go cmd.Wait()
 	time.Sleep(200 * time.Millisecond)
-	c.Assert(cmd.Process.Kill(), checker.IsNil)
+	assert.NilError(c, cmd.Process.Kill())
 	cmd.Wait()
 
 	// NGoroutines is not updated right away, so we need to wait before failing
-	c.Assert(waitForGoroutines(nroutines), checker.IsNil)
+	assert.NilError(c, waitForGoroutines(nroutines))
 }
 
 func (s *DockerSuite) TestLogsCLIContainerNotFound(c *check.C) {
 	name := "testlogsnocontainer"
 	out, _, _ := dockerCmdWithError("logs", name)
 	message := fmt.Sprintf("No such container: %s\n", name)
-	c.Assert(out, checker.Contains, message)
+	assert.Assert(c, strings.Contains(out, message))
 }
 
 func (s *DockerSuite) TestLogsWithDetails(c *check.C) {
@@ -327,10 +327,10 @@ func (s *DockerSuite) TestLogsWithDetails(c *check.C) {
 	out, _ := dockerCmd(c, "logs", "--details", "--timestamps", "test")
 
 	logFields := strings.Fields(strings.TrimSpace(out))
-	c.Assert(len(logFields), checker.Equals, 3, check.Commentf("%s", out))
+	assert.Equal(c, len(logFields), 3, out)
 
 	details := strings.Split(logFields[1], ",")
-	c.Assert(details, checker.HasLen, 2)
-	c.Assert(details[0], checker.Equals, "baz=qux")
-	c.Assert(details[1], checker.Equals, "foo=bar")
+	assert.Equal(c, len(details), 2)
+	assert.Equal(c, details[0], "baz=qux")
+	assert.Equal(c, details[1], "foo=bar")
 }

+ 104 - 103
integration-cli/docker_cli_network_unix_test.go

@@ -29,6 +29,7 @@ import (
 	"github.com/go-check/check"
 	"github.com/vishvananda/netlink"
 	"golang.org/x/sys/unix"
+	"gotest.tools/assert"
 	"gotest.tools/icmd"
 )
 
@@ -209,15 +210,15 @@ func setupRemoteNetworkDrivers(c *check.C, mux *http.ServeMux, url, netDrv, ipam
 	})
 
 	err := os.MkdirAll("/etc/docker/plugins", 0755)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	fileName := fmt.Sprintf("/etc/docker/plugins/%s.spec", netDrv)
 	err = ioutil.WriteFile(fileName, []byte(url), 0644)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	ipamFileName := fmt.Sprintf("/etc/docker/plugins/%s.spec", ipamDrv)
 	err = ioutil.WriteFile(ipamFileName, []byte(url), 0644)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 }
 
 func (s *DockerNetworkSuite) TearDownSuite(c *check.C) {
@@ -228,7 +229,7 @@ func (s *DockerNetworkSuite) TearDownSuite(c *check.C) {
 	s.server.Close()
 
 	err := os.RemoveAll("/etc/docker/plugins")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 }
 
 func assertNwIsAvailable(c *check.C, name string) {
@@ -268,14 +269,14 @@ func assertNwList(c *check.C, out string, expectNws []string) {
 	}
 
 	// network ls should contains all expected networks
-	c.Assert(nwList, checker.DeepEquals, expectNws)
+	assert.DeepEqual(c, nwList, expectNws)
 }
 
 func getNwResource(c *check.C, name string) *types.NetworkResource {
 	out, _ := dockerCmd(c, "network", "inspect", name)
 	var nr []types.NetworkResource
 	err := json.Unmarshal([]byte(out), &nr)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	return &nr[0]
 }
 
@@ -291,7 +292,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkCreatePredefined(c *check.C) {
 	for _, net := range predefined {
 		// predefined networks can't be created again
 		out, _, err := dockerCmdWithError("network", "create", net)
-		c.Assert(err, checker.NotNil, check.Commentf("%v", out))
+		assert.ErrorContains(c, err, "", out)
 	}
 }
 
@@ -301,7 +302,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkCreateHostBind(c *check.C) {
 
 	out := runSleepingContainer(c, "--net=testbind", "-p", "5000:5000")
 	id := strings.TrimSpace(out)
-	c.Assert(waitRun(id), checker.IsNil)
+	assert.NilError(c, waitRun(id))
 	out, _ = dockerCmd(c, "ps")
 	c.Assert(out, checker.Contains, "192.168.10.1:5000->5000/tcp")
 }
@@ -311,7 +312,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkRmPredefined(c *check.C) {
 	for _, net := range predefined {
 		// predefined networks can't be removed
 		out, _, err := dockerCmdWithError("network", "rm", net)
-		c.Assert(err, checker.NotNil, check.Commentf("%v", out))
+		assert.ErrorContains(c, err, "", out)
 	}
 }
 
@@ -388,7 +389,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkCreateLabel(c *check.C) {
 	assertNwIsAvailable(c, testNet)
 
 	out, _, err := dockerCmdWithError("network", "inspect", "--format={{ .Labels."+testLabel+" }}", testNet)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	c.Assert(strings.TrimSpace(out), check.Equals, testValue)
 
 	dockerCmd(c, "network", "rm", testNet)
@@ -397,7 +398,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkCreateLabel(c *check.C) {
 
 func (s *DockerSuite) TestDockerNetworkDeleteNotExists(c *check.C) {
 	out, _, err := dockerCmdWithError("network", "rm", "test")
-	c.Assert(err, checker.NotNil, check.Commentf("%v", out))
+	assert.ErrorContains(c, err, "", out)
 }
 
 func (s *DockerSuite) TestDockerNetworkDeleteMultiple(c *check.C) {
@@ -428,8 +429,8 @@ func (s *DockerSuite) TestDockerNetworkInspect(c *check.C) {
 	out, _ := dockerCmd(c, "network", "inspect", "host")
 	var networkResources []types.NetworkResource
 	err := json.Unmarshal([]byte(out), &networkResources)
-	c.Assert(err, check.IsNil)
-	c.Assert(networkResources, checker.HasLen, 1)
+	assert.NilError(c, err)
+	assert.Equal(c, len(networkResources), 1)
 
 	out, _ = dockerCmd(c, "network", "inspect", "--format={{ .Name }}", "host")
 	c.Assert(strings.TrimSpace(out), check.Equals, "host")
@@ -452,8 +453,8 @@ func (s *DockerSuite) TestDockerInspectMultipleNetwork(c *check.C) {
 
 	var networkResources []types.NetworkResource
 	err := json.Unmarshal([]byte(result.Stdout()), &networkResources)
-	c.Assert(err, check.IsNil)
-	c.Assert(networkResources, checker.HasLen, 2)
+	assert.NilError(c, err)
+	assert.Equal(c, len(networkResources), 2)
 }
 
 func (s *DockerSuite) TestDockerInspectMultipleNetworksIncludingNonexistent(c *check.C) {
@@ -468,8 +469,8 @@ func (s *DockerSuite) TestDockerInspectMultipleNetworksIncludingNonexistent(c *c
 
 	var networkResources []types.NetworkResource
 	err := json.Unmarshal([]byte(result.Stdout()), &networkResources)
-	c.Assert(err, check.IsNil)
-	c.Assert(networkResources, checker.HasLen, 1)
+	assert.NilError(c, err)
+	assert.Equal(c, len(networkResources), 1)
 
 	// Only one non-existent network to inspect
 	// Should print an error and return an exitCode, nothing else
@@ -491,8 +492,8 @@ func (s *DockerSuite) TestDockerInspectMultipleNetworksIncludingNonexistent(c *c
 
 	networkResources = []types.NetworkResource{}
 	err = json.Unmarshal([]byte(result.Stdout()), &networkResources)
-	c.Assert(err, check.IsNil)
-	c.Assert(networkResources, checker.HasLen, 1)
+	assert.NilError(c, err)
+	assert.Equal(c, len(networkResources), 1)
 }
 
 func (s *DockerSuite) TestDockerInspectNetworkWithContainerName(c *check.C) {
@@ -514,11 +515,11 @@ func (s *DockerSuite) TestDockerInspectNetworkWithContainerName(c *check.C) {
 	out, _ = dockerCmd(c, "network", "inspect", "brNetForInspect")
 	var networkResources []types.NetworkResource
 	err := json.Unmarshal([]byte(out), &networkResources)
-	c.Assert(err, check.IsNil)
-	c.Assert(networkResources, checker.HasLen, 1)
+	assert.NilError(c, err)
+	assert.Equal(c, len(networkResources), 1)
 	container, ok := networkResources[0].Containers[containerID]
-	c.Assert(ok, checker.True)
-	c.Assert(container.Name, checker.Equals, "testNetInspect1")
+	assert.Assert(c, ok)
+	assert.Equal(c, container.Name, "testNetInspect1")
 
 	// rename container and check docker inspect output update
 	newName := "HappyNewName"
@@ -528,12 +529,11 @@ func (s *DockerSuite) TestDockerInspectNetworkWithContainerName(c *check.C) {
 	out, _ = dockerCmd(c, "network", "inspect", "brNetForInspect")
 	var newNetRes []types.NetworkResource
 	err = json.Unmarshal([]byte(out), &newNetRes)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	c.Assert(newNetRes, checker.HasLen, 1)
 	container1, ok := newNetRes[0].Containers[containerID]
-	c.Assert(ok, checker.True)
-	c.Assert(container1.Name, checker.Equals, newName)
-
+	assert.Assert(c, ok)
+	assert.Equal(c, container1.Name, newName)
 }
 
 func (s *DockerNetworkSuite) TestDockerNetworkConnectDisconnect(c *check.C) {
@@ -559,7 +559,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectDisconnect(c *check.C) {
 
 	// check if container IP matches network inspect
 	ip, _, err := net.ParseCIDR(nr.Containers[containerID].IPv4Address)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	containerIP := findContainerIP(c, "test", "test")
 	c.Assert(ip.String(), checker.Equals, containerIP)
 
@@ -663,7 +663,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkNullIPAMDriver(c *check.C) {
 	testRequires(c, testEnv.IsLocalDaemon)
 	// Create a network with null ipam driver
 	_, _, err := dockerCmdWithError("network", "create", "-d", dummyNetworkDriver, "--ipam-driver", "null", "test000")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	assertNwIsAvailable(c, "test000")
 
 	// Verify the inspect data contains the default subnet provided by the null
@@ -736,7 +736,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkInspectCustomSpecified(c *check.C)
 	c.Assert(nr.IPAM.Config[0].Subnet, checker.Equals, "172.28.0.0/16")
 	c.Assert(nr.IPAM.Config[0].IPRange, checker.Equals, "172.28.5.0/24")
 	c.Assert(nr.IPAM.Config[0].Gateway, checker.Equals, "172.28.5.254")
-	c.Assert(nr.Internal, checker.False)
+	assert.Equal(c, nr.Internal, false)
 	dockerCmd(c, "network", "rm", "br0")
 	assertNwNotAvailable(c, "br0")
 }
@@ -744,15 +744,15 @@ func (s *DockerNetworkSuite) TestDockerNetworkInspectCustomSpecified(c *check.C)
 func (s *DockerNetworkSuite) TestDockerNetworkIPAMInvalidCombinations(c *check.C) {
 	// network with ip-range out of subnet range
 	_, _, err := dockerCmdWithError("network", "create", "--subnet=192.168.0.0/16", "--ip-range=192.170.0.0/16", "test")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 
 	// network with multiple gateways for a single subnet
 	_, _, err = dockerCmdWithError("network", "create", "--subnet=192.168.0.0/16", "--gateway=192.168.0.1", "--gateway=192.168.0.2", "test")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 
 	// Multiple overlapping subnets in the same network must fail
 	_, _, err = dockerCmdWithError("network", "create", "--subnet=192.168.0.0/16", "--subnet=192.168.1.0/16", "test")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 
 	// overlapping subnets across networks must fail
 	// create a valid test0 network
@@ -760,7 +760,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkIPAMInvalidCombinations(c *check.C
 	assertNwIsAvailable(c, "test0")
 	// create an overlapping test1 network
 	_, _, err = dockerCmdWithError("network", "create", "--subnet=192.168.128.0/17", "test1")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	dockerCmd(c, "network", "rm", "test0")
 	assertNwNotAvailable(c, "test0")
 }
@@ -789,10 +789,10 @@ func (s *DockerNetworkSuite) TestDockerPluginV2NetworkDriver(c *check.C) {
 		npNameWithTag = npName + ":" + npTag
 	)
 	_, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", npNameWithTag)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, _, err := dockerCmdWithError("plugin", "ls")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(out, checker.Contains, npName)
 	c.Assert(out, checker.Contains, npTag)
 	c.Assert(out, checker.Contains, "true")
@@ -818,46 +818,46 @@ func (s *DockerDaemonSuite) TestDockerNetworkNoDiscoveryDefaultBridgeNetwork(c *
 
 	// run two containers and store first container's etc/hosts content
 	out, err := s.d.Cmd("run", "-d", "busybox", "top")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	cid1 := strings.TrimSpace(out)
 	defer s.d.Cmd("stop", cid1)
 
 	hosts, err := s.d.Cmd("exec", cid1, "cat", hostsFile)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, err = s.d.Cmd("run", "-d", "--name", "container2", "busybox", "top")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	cid2 := strings.TrimSpace(out)
 
 	// verify first container's etc/hosts file has not changed after spawning the second named container
 	hostsPost, err := s.d.Cmd("exec", cid1, "cat", hostsFile)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(string(hosts), checker.Equals, string(hostsPost),
 		check.Commentf("Unexpected %s change on second container creation", hostsFile))
 
 	// stop container 2 and verify first container's etc/hosts has not changed
 	_, err = s.d.Cmd("stop", cid2)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	hostsPost, err = s.d.Cmd("exec", cid1, "cat", hostsFile)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(string(hosts), checker.Equals, string(hostsPost),
 		check.Commentf("Unexpected %s change on second container creation", hostsFile))
 
 	// but discovery is on when connecting to non default bridge network
 	network := "anotherbridge"
 	out, err = s.d.Cmd("network", "create", network)
-	c.Assert(err, check.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 	defer s.d.Cmd("network", "rm", network)
 
 	out, err = s.d.Cmd("network", "connect", network, cid1)
-	c.Assert(err, check.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	hosts, err = s.d.Cmd("exec", cid1, "cat", hostsFile)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	hostsPost, err = s.d.Cmd("exec", cid1, "cat", hostsFile)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(string(hosts), checker.Equals, string(hostsPost),
 		check.Commentf("Unexpected %s change on second network connection", hostsFile))
 }
@@ -918,9 +918,9 @@ func (s *DockerNetworkSuite) TestDockerNetworkAnonymousEndpoint(c *check.C) {
 
 	// verify that container 1 and 2 can't ping the named container now
 	_, _, err := dockerCmdWithError("exec", cid1, "ping", "-c", "1", cName)
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	_, _, err = dockerCmdWithError("exec", cid2, "ping", "-c", "1", cName)
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 }
 
 func (s *DockerNetworkSuite) TestDockerNetworkLinkOnDefaultNetworkOnly(c *check.C) {
@@ -942,7 +942,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkLinkOnDefaultNetworkOnly(c *check.
 
 	// Try launching a container on default network, linking to the second container. Must fail
 	_, _, err := dockerCmdWithError("run", "-d", "--link", fmt.Sprintf("%s:%s", cnt2, cnt2), "busybox", "top")
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 
 	// Connect second container to default network. Now a container on default network can link to it
 	dockerCmd(c, "network", "connect", "bridge", cnt2)
@@ -987,10 +987,10 @@ func (s *DockerNetworkSuite) TestDockerNetworkDriverUngracefulRestart(c *check.C
 
 	s.d.StartWithBusybox(c)
 	_, err := s.d.Cmd("network", "create", "-d", dnd, "--subnet", "1.1.1.0/24", "net1")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	_, err = s.d.Cmd("run", "-itd", "--net", "net1", "--name", "foo", "--ip", "1.1.1.10", "busybox", "sh")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	// Kill daemon and restart
 	c.Assert(s.d.Kill(), checker.IsNil)
@@ -1014,7 +1014,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkDriverUngracefulRestart(c *check.C
 
 	// trying to reuse the same ip must succeed
 	_, err = s.d.Cmd("run", "-itd", "--net", "net1", "--name", "bar", "--ip", "1.1.1.10", "busybox", "sh")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 }
 
 func (s *DockerNetworkSuite) TestDockerNetworkMacInspect(c *check.C) {
@@ -1037,7 +1037,7 @@ func (s *DockerSuite) TestInspectAPIMultipleNetworks(c *check.C) {
 	dockerCmd(c, "network", "create", "mybridge2")
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 	id := strings.TrimSpace(out)
-	c.Assert(waitRun(id), check.IsNil)
+	assert.NilError(c, waitRun(id))
 
 	dockerCmd(c, "network", "connect", "mybridge1", id)
 	dockerCmd(c, "network", "connect", "mybridge2", id)
@@ -1045,14 +1045,14 @@ func (s *DockerSuite) TestInspectAPIMultipleNetworks(c *check.C) {
 	body := getInspectBody(c, "v1.20", id)
 	var inspect120 v1p20.ContainerJSON
 	err := json.Unmarshal(body, &inspect120)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	versionedIP := inspect120.NetworkSettings.IPAddress
 
 	body = getInspectBody(c, "v1.21", id)
 	var inspect121 types.ContainerJSON
 	err = json.Unmarshal(body, &inspect121)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(inspect121.NetworkSettings.Networks, checker.HasLen, 3)
 
 	bridge := inspect121.NetworkSettings.Networks["bridge"]
@@ -1063,14 +1063,14 @@ func (s *DockerSuite) TestInspectAPIMultipleNetworks(c *check.C) {
 func connectContainerToNetworks(c *check.C, d *daemon.Daemon, cName string, nws []string) {
 	// Run a container on the default network
 	out, err := d.Cmd("run", "-d", "--name", cName, "busybox", "top")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	// Attach the container to other networks
 	for _, nw := range nws {
 		out, err = d.Cmd("network", "create", nw)
-		c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+		assert.NilError(c, err, out)
 		out, err = d.Cmd("network", "connect", nw, cName)
-		c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+		assert.NilError(c, err, out)
 	}
 }
 
@@ -1078,7 +1078,7 @@ func verifyContainerIsConnectedToNetworks(c *check.C, d *daemon.Daemon, cName st
 	// Verify container is connected to all the networks
 	for _, nw := range nws {
 		out, err := d.Cmd("inspect", "-f", fmt.Sprintf("{{.NetworkSettings.Networks.%s}}", nw), cName)
-		c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+		assert.NilError(c, err, out)
 		c.Assert(out, checker.Not(checker.Equals), "<no value>\n")
 	}
 }
@@ -1097,7 +1097,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkMultipleNetworksGracefulDaemonRest
 	s.d.Restart(c)
 
 	_, err := s.d.Cmd("start", cName)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	verifyContainerIsConnectedToNetworks(c, s.d, cName, nwList)
 }
@@ -1118,7 +1118,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkMultipleNetworksUngracefulDaemonRe
 
 	// Restart container
 	_, err := s.d.Cmd("start", cName)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	verifyContainerIsConnectedToNetworks(c, s.d, cName, nwList)
 }
@@ -1137,11 +1137,11 @@ func (s *DockerNetworkSuite) TestDockerNetworkHostModeUngracefulDaemonRestart(c
 	for i := 0; i < 10; i++ {
 		cName := fmt.Sprintf("hostc-%d", i)
 		out, err := s.d.Cmd("run", "-d", "--name", cName, "--net=host", "--restart=always", "busybox", "top")
-		c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+		assert.NilError(c, err, out)
 
 		// verify container has finished starting before killing daemon
 		err = s.d.WaitRun(cName)
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 	}
 
 	// Kill daemon ungracefully and restart
@@ -1151,7 +1151,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkHostModeUngracefulDaemonRestart(c
 	// make sure all the containers are up and running
 	for i := 0; i < 10; i++ {
 		err := s.d.WaitRun(fmt.Sprintf("hostc-%d", i))
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 	}
 }
 
@@ -1160,7 +1160,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectToHostFromOtherNetwork(c *c
 	c.Assert(waitRun("container1"), check.IsNil)
 	dockerCmd(c, "network", "disconnect", "bridge", "container1")
 	out, _, err := dockerCmdWithError("network", "connect", "host", "container1")
-	c.Assert(err, checker.NotNil, check.Commentf("%s", out))
+	assert.ErrorContains(c, err, "", out)
 	c.Assert(out, checker.Contains, runconfig.ErrConflictHostNetwork.Error())
 }
 
@@ -1419,9 +1419,9 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectLinkLocalIP(c *check.C) {
 
 	// run a container with incorrect link-local address
 	_, _, err := dockerCmdWithError("run", "--link-local-ip", "169.253.5.5", "busybox", "top")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	_, _, err = dockerCmdWithError("run", "--link-local-ip", "2001:db8::89", "busybox", "top")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 
 	// run two containers with link-local ip on the test network
 	dockerCmd(c, "run", "-d", "--name", "c0", "--net=n0", "--link-local-ip", "169.254.7.7", "--link-local-ip", "fe80::254:77", "busybox", "top")
@@ -1436,11 +1436,11 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectLinkLocalIP(c *check.C) {
 
 	// verify the three containers can ping each other via the link-local addresses
 	_, _, err = dockerCmdWithError("exec", "c0", "ping", "-c", "1", "169.254.8.8")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	_, _, err = dockerCmdWithError("exec", "c1", "ping", "-c", "1", "169.254.9.9")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	_, _, err = dockerCmdWithError("exec", "c2", "ping", "-c", "1", "169.254.7.7")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	// Stop and restart the three containers
 	dockerCmd(c, "stop", "c0")
@@ -1452,11 +1452,11 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectLinkLocalIP(c *check.C) {
 
 	// verify the ping again
 	_, _, err = dockerCmdWithError("exec", "c0", "ping", "-c", "1", "169.254.8.8")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	_, _, err = dockerCmdWithError("exec", "c1", "ping", "-c", "1", "169.254.9.9")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	_, _, err = dockerCmdWithError("exec", "c2", "ping", "-c", "1", "169.254.7.7")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 }
 
 func (s *DockerSuite) TestUserDefinedNetworkConnectDisconnectLink(c *check.C) {
@@ -1475,9 +1475,9 @@ func (s *DockerSuite) TestUserDefinedNetworkConnectDisconnectLink(c *check.C) {
 
 	// ping to first and its alias FirstInFoo1 must succeed
 	_, _, err := dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "FirstInFoo1")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	// connect first container to foo2 network
 	dockerCmd(c, "network", "connect", "foo2", "first")
@@ -1486,18 +1486,18 @@ func (s *DockerSuite) TestUserDefinedNetworkConnectDisconnectLink(c *check.C) {
 
 	// ping the new alias in network foo2
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "FirstInFoo2")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	// disconnect first container from foo1 network
 	dockerCmd(c, "network", "disconnect", "foo1", "first")
 
 	// link in foo1 network must fail
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "FirstInFoo1")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 
 	// link in foo2 network must succeed
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "FirstInFoo2")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 }
 
 func (s *DockerNetworkSuite) TestDockerNetworkDisconnectDefault(c *check.C) {
@@ -1528,7 +1528,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectWithAliasOnDefaultNetworks(
 	containerID := strings.TrimSpace(out)
 	for _, net := range defaults {
 		res, _, err := dockerCmdWithError("network", "connect", "--alias", "alias"+net, net, containerID)
-		c.Assert(err, checker.NotNil)
+		assert.ErrorContains(c, err, "")
 		c.Assert(res, checker.Contains, runconfig.ErrUnsupportedNetworkAndAlias.Error())
 	}
 }
@@ -1546,13 +1546,13 @@ func (s *DockerSuite) TestUserDefinedNetworkConnectDisconnectAlias(c *check.C) {
 
 	// ping first container and its alias
 	_, _, err := dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "foo")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	// ping first container's short-id alias
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", stringid.TruncateID(cid))
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	// connect first container to net2 network
 	dockerCmd(c, "network", "connect", "--alias=bar", "net2", "first")
@@ -1561,21 +1561,21 @@ func (s *DockerSuite) TestUserDefinedNetworkConnectDisconnectAlias(c *check.C) {
 
 	// ping the new alias in network foo2
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "bar")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	// disconnect first container from net1 network
 	dockerCmd(c, "network", "disconnect", "net1", "first")
 
 	// ping to net1 scoped alias "foo" must fail
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "foo")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 
 	// ping to net2 scoped alias "bar" must still succeed
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "bar")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	// ping to net2 scoped alias short-id must still succeed
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", stringid.TruncateID(cid))
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	// verify the alias option is rejected when running on predefined network
 	out, _, err := dockerCmdWithError("run", "--rm", "--name=any", "--net-alias=any", "busybox:glibc", "top")
@@ -1600,15 +1600,15 @@ func (s *DockerSuite) TestUserDefinedNetworkConnectivity(c *check.C) {
 
 	// ping first container by its unqualified name
 	_, _, err := dockerCmdWithError("exec", "c2.net1", "ping", "-c", "1", "c1.net1")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	// ping first container by its qualified name
 	_, _, err = dockerCmdWithError("exec", "c2.net1", "ping", "-c", "1", "c1.net1.br.net1")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	// ping with first qualified name masked by an additional domain. should fail
 	_, _, err = dockerCmdWithError("exec", "c2.net1", "ping", "-c", "1", "c1.net1.br.net1.google.com")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 }
 
 func (s *DockerSuite) TestEmbeddedDNSInvalidInput(c *check.C) {
@@ -1628,7 +1628,7 @@ func (s *DockerSuite) TestDockerNetworkConnectFailsNoInspectChange(c *check.C) {
 
 	// A failing redundant network connect should not alter current container's endpoint settings
 	_, _, err := dockerCmdWithError("network", "connect", "bridge", "bb")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 
 	ns1 := inspectField(c, "bb", "NetworkSettings.Networks.bridge")
 	c.Assert(ns1, check.Equals, ns0)
@@ -1645,10 +1645,10 @@ func (s *DockerSuite) TestDockerNetworkInternalMode(c *check.C) {
 	dockerCmd(c, "run", "-d", "--net=internal", "--name=second", "busybox:glibc", "top")
 	c.Assert(waitRun("second"), check.IsNil)
 	out, _, err := dockerCmdWithError("exec", "first", "ping", "-W", "4", "-c", "1", "8.8.8.8")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(out, checker.Contains, "100% packet loss")
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 }
 
 // Test for #21401
@@ -1748,25 +1748,26 @@ func (s *DockerNetworkSuite) TestDockerNetworkFlagAlias(c *check.C) {
 
 func (s *DockerNetworkSuite) TestDockerNetworkValidateIP(c *check.C) {
 	_, _, err := dockerCmdWithError("network", "create", "--ipv6", "--subnet=172.28.0.0/16", "--subnet=2001:db8:1234::/64", "mynet")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	assertNwIsAvailable(c, "mynet")
 
 	_, _, err = dockerCmdWithError("run", "-d", "--name", "mynet0", "--net=mynet", "--ip", "172.28.99.88", "--ip6", "2001:db8:1234::9988", "busybox", "top")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	c.Assert(waitRun("mynet0"), check.IsNil)
 	verifyIPAddressConfig(c, "mynet0", "mynet", "172.28.99.88", "2001:db8:1234::9988")
 	verifyIPAddresses(c, "mynet0", "mynet", "172.28.99.88", "2001:db8:1234::9988")
 
 	_, _, err = dockerCmdWithError("run", "--net=mynet", "--ip", "mynet_ip", "--ip6", "2001:db8:1234::9999", "busybox", "top")
-	c.Assert(err.Error(), checker.Contains, "invalid IPv4 address")
+	assert.ErrorContains(c, err, "invalid IPv4 address")
 	_, _, err = dockerCmdWithError("run", "--net=mynet", "--ip", "172.28.99.99", "--ip6", "mynet_ip6", "busybox", "top")
-	c.Assert(err.Error(), checker.Contains, "invalid IPv6 address")
+	assert.ErrorContains(c, err, "invalid IPv6 address")
+
 	// This is a case of IPv4 address to `--ip6`
 	_, _, err = dockerCmdWithError("run", "--net=mynet", "--ip6", "172.28.99.99", "busybox", "top")
-	c.Assert(err.Error(), checker.Contains, "invalid IPv6 address")
+	assert.ErrorContains(c, err, "invalid IPv6 address")
 	// This is a special case of an IPv4-mapped IPv6 address
 	_, _, err = dockerCmdWithError("run", "--net=mynet", "--ip6", "::ffff:172.28.99.99", "busybox", "top")
-	c.Assert(err.Error(), checker.Contains, "invalid IPv6 address")
+	assert.ErrorContains(c, err, "invalid IPv6 address")
 }
 
 // Test case for 26220
@@ -1779,7 +1780,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkDisconnectFromBridge(c *check.C) {
 	dockerCmd(c, "create", "--name", name, "busybox", "top")
 
 	_, _, err := dockerCmdWithError("network", "disconnect", network, name)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 }
 
 // TestConntrackFlowsLeak covers the failure scenario of ticket: https://github.com/docker/docker/issues/8795
@@ -1801,7 +1802,7 @@ func (s *DockerNetworkSuite) TestConntrackFlowsLeak(c *check.C) {
 
 	// Get all the flows using netlink
 	flows, err := netlink.ConntrackTableList(netlink.ConntrackTable, unix.AF_INET)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	var flowMatch int
 	for _, flow := range flows {
 		// count only the flows that we are interested in, skipping others that can be laying around the host
@@ -1812,14 +1813,14 @@ func (s *DockerNetworkSuite) TestConntrackFlowsLeak(c *check.C) {
 		}
 	}
 	// The client should have created only 1 flow
-	c.Assert(flowMatch, checker.Equals, 1)
+	assert.Equal(c, flowMatch, 1)
 
 	// Now delete the server, this will trigger the conntrack cleanup
 	cli.DockerCmd(c, "rm", "-fv", "server")
 
 	// Fetch again all the flows and validate that there is no server flow in the conntrack laying around
 	flows, err = netlink.ConntrackTableList(netlink.ConntrackTable, unix.AF_INET)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	flowMatch = 0
 	for _, flow := range flows {
 		if flow.Forward.Protocol == unix.IPPROTO_UDP &&
@@ -1829,5 +1830,5 @@ func (s *DockerNetworkSuite) TestConntrackFlowsLeak(c *check.C) {
 		}
 	}
 	// All the flows have to be gone
-	c.Assert(flowMatch, checker.Equals, 0)
+	assert.Equal(c, flowMatch, 0)
 }

+ 7 - 7
integration-cli/docker_cli_plugins_logdriver_test.go

@@ -5,8 +5,8 @@ import (
 	"strings"
 
 	"github.com/docker/docker/client"
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 func (s *DockerSuite) TestPluginLogDriver(c *check.C) {
@@ -17,11 +17,11 @@ func (s *DockerSuite) TestPluginLogDriver(c *check.C) {
 	dockerCmd(c, "plugin", "install", pluginName)
 	dockerCmd(c, "run", "--log-driver", pluginName, "--name=test", "busybox", "echo", "hello")
 	out, _ := dockerCmd(c, "logs", "test")
-	c.Assert(strings.TrimSpace(out), checker.Equals, "hello")
+	assert.Equal(c, strings.TrimSpace(out), "hello")
 
 	dockerCmd(c, "start", "-a", "test")
 	out, _ = dockerCmd(c, "logs", "test")
-	c.Assert(strings.TrimSpace(out), checker.Equals, "hello\nhello")
+	assert.Equal(c, strings.TrimSpace(out), "hello\nhello")
 
 	dockerCmd(c, "rm", "test")
 	dockerCmd(c, "plugin", "disable", pluginName)
@@ -36,13 +36,13 @@ func (s *DockerSuite) TestPluginLogDriverInfoList(c *check.C) {
 	dockerCmd(c, "plugin", "install", pluginName)
 
 	cli, err := client.NewClientWithOpts(client.FromEnv)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer cli.Close()
 
 	info, err := cli.Info(context.Background())
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	drivers := strings.Join(info.Plugins.Log, " ")
-	c.Assert(drivers, checker.Contains, "json-file")
-	c.Assert(drivers, checker.Not(checker.Contains), pluginName)
+	assert.Assert(c, strings.Contains(drivers, "json-file"))
+	assert.Assert(c, !strings.Contains(drivers, pluginName))
 }

+ 71 - 70
integration-cli/docker_cli_plugins_test.go

@@ -17,6 +17,7 @@ import (
 	"github.com/docker/docker/integration-cli/daemon"
 	"github.com/docker/docker/internal/test/fixtures/plugin"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 var (
@@ -31,26 +32,26 @@ var (
 func (ps *DockerPluginSuite) TestPluginBasicOps(c *check.C) {
 	plugin := ps.getPluginRepoWithTag()
 	_, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", plugin)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, _, err := dockerCmdWithError("plugin", "ls")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(out, checker.Contains, plugin)
 	c.Assert(out, checker.Contains, "true")
 
 	id, _, err := dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", plugin)
 	id = strings.TrimSpace(id)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, _, err = dockerCmdWithError("plugin", "remove", plugin)
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(out, checker.Contains, "is enabled")
 
 	_, _, err = dockerCmdWithError("plugin", "disable", plugin)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, _, err = dockerCmdWithError("plugin", "remove", plugin)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(out, checker.Contains, plugin)
 
 	_, err = os.Stat(filepath.Join(testEnv.DaemonInfo.DockerRootDir, "plugins", id))
@@ -63,13 +64,13 @@ func (ps *DockerPluginSuite) TestPluginForceRemove(c *check.C) {
 	pNameWithTag := ps.getPluginRepoWithTag()
 
 	_, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", pNameWithTag)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, _, _ := dockerCmdWithError("plugin", "remove", pNameWithTag)
 	c.Assert(out, checker.Contains, "is enabled")
 
 	out, _, err = dockerCmdWithError("plugin", "remove", "--force", pNameWithTag)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(out, checker.Contains, pNameWithTag)
 }
 
@@ -77,32 +78,32 @@ func (s *DockerSuite) TestPluginActive(c *check.C) {
 	testRequires(c, DaemonIsLinux, IsAmd64, Network)
 
 	_, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", pNameWithTag)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	_, _, err = dockerCmdWithError("volume", "create", "-d", pNameWithTag, "--name", "testvol1")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, _, _ := dockerCmdWithError("plugin", "disable", pNameWithTag)
 	c.Assert(out, checker.Contains, "in use")
 
 	_, _, err = dockerCmdWithError("volume", "rm", "testvol1")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	_, _, err = dockerCmdWithError("plugin", "disable", pNameWithTag)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, _, err = dockerCmdWithError("plugin", "remove", pNameWithTag)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(out, checker.Contains, pNameWithTag)
 }
 
 func (s *DockerSuite) TestPluginActiveNetwork(c *check.C) {
 	testRequires(c, DaemonIsLinux, IsAmd64, Network)
 	_, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", npNameWithTag)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, _, err := dockerCmdWithError("network", "create", "-d", npNameWithTag, "test")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	nID := strings.TrimSpace(out)
 
@@ -110,16 +111,16 @@ func (s *DockerSuite) TestPluginActiveNetwork(c *check.C) {
 	c.Assert(out, checker.Contains, "is in use")
 
 	_, _, err = dockerCmdWithError("network", "rm", nID)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, _, _ = dockerCmdWithError("plugin", "remove", npNameWithTag)
 	c.Assert(out, checker.Contains, "is enabled")
 
 	_, _, err = dockerCmdWithError("plugin", "disable", npNameWithTag)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, _, err = dockerCmdWithError("plugin", "remove", npNameWithTag)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(out, checker.Contains, npNameWithTag)
 }
 
@@ -127,30 +128,30 @@ func (ps *DockerPluginSuite) TestPluginInstallDisable(c *check.C) {
 	pName := ps.getPluginRepoWithTag()
 
 	out, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", "--disable", pName)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(strings.TrimSpace(out), checker.Contains, pName)
 
 	out, _, err = dockerCmdWithError("plugin", "ls")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(out, checker.Contains, "false")
 
 	out, _, err = dockerCmdWithError("plugin", "enable", pName)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(strings.TrimSpace(out), checker.Contains, pName)
 
 	out, _, err = dockerCmdWithError("plugin", "disable", pName)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(strings.TrimSpace(out), checker.Contains, pName)
 
 	out, _, err = dockerCmdWithError("plugin", "remove", pName)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(strings.TrimSpace(out), checker.Contains, pName)
 }
 
 func (s *DockerSuite) TestPluginInstallDisableVolumeLs(c *check.C) {
 	testRequires(c, DaemonIsLinux, IsAmd64, Network)
 	out, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", "--disable", pName)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(strings.TrimSpace(out), checker.Contains, pName)
 
 	dockerCmd(c, "volume", "ls")
@@ -198,11 +199,11 @@ func (ps *DockerPluginSuite) TestPluginSet(c *check.C) {
 	c.Assert(strings.TrimSpace(env), checker.Contains, "bar")
 
 	out, _, err := dockerCmdWithError("plugin", "set", name, "pmount2.source=bar2")
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(out, checker.Contains, "Plugin config has no mount source")
 
 	out, _, err = dockerCmdWithError("plugin", "set", name, "pdev2.path=/dev/bar2")
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(out, checker.Contains, "Plugin config has no device path")
 
 }
@@ -233,7 +234,7 @@ func (ps *DockerPluginSuite) TestPluginInstallImage(c *check.C) {
 	dockerCmd(c, "push", repoName)
 
 	out, _, err := dockerCmdWithError("plugin", "install", repoName)
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(out, checker.Contains, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`)
 }
 
@@ -241,51 +242,51 @@ func (ps *DockerPluginSuite) TestPluginEnableDisableNegative(c *check.C) {
 	pName := ps.getPluginRepoWithTag()
 
 	out, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", pName)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(strings.TrimSpace(out), checker.Contains, pName)
 
 	out, _, err = dockerCmdWithError("plugin", "enable", pName)
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(strings.TrimSpace(out), checker.Contains, "already enabled")
 
 	_, _, err = dockerCmdWithError("plugin", "disable", pName)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, _, err = dockerCmdWithError("plugin", "disable", pName)
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(strings.TrimSpace(out), checker.Contains, "already disabled")
 
 	_, _, err = dockerCmdWithError("plugin", "remove", pName)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 }
 
 func (ps *DockerPluginSuite) TestPluginCreate(c *check.C) {
 	name := "foo/bar-driver"
 	temp, err := ioutil.TempDir("", "foo")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer os.RemoveAll(temp)
 
 	data := `{"description": "foo plugin"}`
 	err = ioutil.WriteFile(filepath.Join(temp, "config.json"), []byte(data), 0644)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	err = os.MkdirAll(filepath.Join(temp, "rootfs"), 0700)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, _, err := dockerCmdWithError("plugin", "create", name, temp)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(out, checker.Contains, name)
 
 	out, _, err = dockerCmdWithError("plugin", "ls")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(out, checker.Contains, name)
 
 	out, _, err = dockerCmdWithError("plugin", "create", name, temp)
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(out, checker.Contains, "already exist")
 
 	out, _, err = dockerCmdWithError("plugin", "ls")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(out, checker.Contains, name)
 	// The output will consists of one HEADER line and one line of foo/bar-driver
 	c.Assert(len(strings.Split(strings.TrimSpace(out), "\n")), checker.Equals, 2)
@@ -295,49 +296,49 @@ func (ps *DockerPluginSuite) TestPluginInspect(c *check.C) {
 	pNameWithTag := ps.getPluginRepoWithTag()
 
 	_, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", pNameWithTag)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, _, err := dockerCmdWithError("plugin", "ls")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(out, checker.Contains, pNameWithTag)
 	c.Assert(out, checker.Contains, "true")
 
 	// Find the ID first
 	out, _, err = dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", pNameWithTag)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	id := strings.TrimSpace(out)
-	c.Assert(id, checker.Not(checker.Equals), "")
+	assert.Assert(c, id != "")
 
 	// Long form
 	out, _, err = dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", id)
-	c.Assert(err, checker.IsNil)
-	c.Assert(strings.TrimSpace(out), checker.Equals, id)
+	assert.NilError(c, err)
+	assert.Equal(c, strings.TrimSpace(out), id)
 
 	// Short form
 	out, _, err = dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", id[:5])
-	c.Assert(err, checker.IsNil)
-	c.Assert(strings.TrimSpace(out), checker.Equals, id)
+	assert.NilError(c, err)
+	assert.Equal(c, strings.TrimSpace(out), id)
 
 	// Name with tag form
 	out, _, err = dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", pNameWithTag)
-	c.Assert(err, checker.IsNil)
-	c.Assert(strings.TrimSpace(out), checker.Equals, id)
+	assert.NilError(c, err)
+	assert.Equal(c, strings.TrimSpace(out), id)
 
 	// Name without tag form
 	out, _, err = dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", ps.getPluginRepo())
-	c.Assert(err, checker.IsNil)
-	c.Assert(strings.TrimSpace(out), checker.Equals, id)
+	assert.NilError(c, err)
+	assert.Equal(c, strings.TrimSpace(out), id)
 
 	_, _, err = dockerCmdWithError("plugin", "disable", pNameWithTag)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, _, err = dockerCmdWithError("plugin", "remove", pNameWithTag)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(out, checker.Contains, pNameWithTag)
 
 	// After remove nothing should be found
 	_, _, err = dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", id[:5])
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 }
 
 // Test case for https://github.com/docker/docker/pull/29186#discussion_r91277345
@@ -346,9 +347,9 @@ func (s *DockerSuite) TestPluginInspectOnWindows(c *check.C) {
 	testRequires(c, DaemonIsWindows)
 
 	out, _, err := dockerCmdWithError("plugin", "inspect", "foobar")
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(out, checker.Contains, "plugins are not supported on this platform")
-	c.Assert(err.Error(), checker.Contains, "plugins are not supported on this platform")
+	assert.ErrorContains(c, err, "plugins are not supported on this platform")
 }
 
 func (ps *DockerPluginSuite) TestPluginIDPrefix(c *check.C) {
@@ -367,11 +368,11 @@ func (ps *DockerPluginSuite) TestPluginIDPrefix(c *check.C) {
 	// Find ID first
 	id, _, err := dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", name)
 	id = strings.TrimSpace(id)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	// List current state
 	out, _, err := dockerCmdWithError("plugin", "ls")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(out, checker.Contains, name)
 	c.Assert(out, checker.Contains, "false")
 
@@ -385,36 +386,36 @@ func (ps *DockerPluginSuite) TestPluginIDPrefix(c *check.C) {
 
 	// Enable
 	_, _, err = dockerCmdWithError("plugin", "enable", id[:5])
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	out, _, err = dockerCmdWithError("plugin", "ls")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(out, checker.Contains, name)
 	c.Assert(out, checker.Contains, "true")
 
 	// Disable
 	_, _, err = dockerCmdWithError("plugin", "disable", id[:5])
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	out, _, err = dockerCmdWithError("plugin", "ls")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(out, checker.Contains, name)
 	c.Assert(out, checker.Contains, "false")
 
 	// Remove
 	_, _, err = dockerCmdWithError("plugin", "remove", id[:5])
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	// List returns none
 	out, _, err = dockerCmdWithError("plugin", "ls")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(out, checker.Not(checker.Contains), name)
 }
 
 func (ps *DockerPluginSuite) TestPluginListDefaultFormat(c *check.C) {
 	config, err := ioutil.TempDir("", "config-file-")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	defer os.RemoveAll(config)
 
 	err = ioutil.WriteFile(filepath.Join(config, "config.json"), []byte(`{"pluginsFormat": "raw"}`), 0644)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	name := "test:latest"
 	client := testEnv.APIClient()
@@ -449,7 +450,7 @@ func (s *DockerSuite) TestPluginUpgrade(c *check.C) {
 	dockerCmd(c, "run", "--rm", "-v", "bananas:/apple", "busybox", "sh", "-c", "touch /apple/core")
 
 	out, _, err := dockerCmdWithError("plugin", "upgrade", "--grant-all-permissions", plugin, pluginV2)
-	c.Assert(err, checker.NotNil, check.Commentf("%s", out))
+	assert.ErrorContains(c, err, "", out)
 	c.Assert(out, checker.Contains, "disabled before upgrading")
 
 	out, _ = dockerCmd(c, "plugin", "inspect", "--format={{.ID}}", plugin)
@@ -464,7 +465,7 @@ func (s *DockerSuite) TestPluginUpgrade(c *check.C) {
 
 	// make sure "v2" file exists
 	_, err = os.Stat(filepath.Join(testEnv.DaemonInfo.DockerRootDir, "plugins", id, "rootfs", "v2"))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	dockerCmd(c, "plugin", "enable", plugin)
 	dockerCmd(c, "volume", "inspect", "bananas")
@@ -483,11 +484,11 @@ func (s *DockerSuite) TestPluginMetricsCollector(c *check.C) {
 
 	// plugin lisens on localhost:19393 and proxies the metrics
 	resp, err := http.Get("http://localhost:19393/metrics")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer resp.Body.Close()
 
 	b, err := ioutil.ReadAll(resp.Body)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	// check that a known metric is there... don't expect this metric to change over time.. probably safe
 	c.Assert(string(b), checker.Contains, "container_actions")
 }

+ 11 - 10
integration-cli/docker_cli_port_test.go

@@ -10,6 +10,7 @@ import (
 
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 func (s *DockerSuite) TestPortList(c *check.C) {
@@ -22,13 +23,13 @@ func (s *DockerSuite) TestPortList(c *check.C) {
 
 	err := assertPortList(c, out, []string{"0.0.0.0:9876"})
 	// Port list is not correct
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, _ = dockerCmd(c, "port", firstID)
 
 	err = assertPortList(c, out, []string{"80/tcp -> 0.0.0.0:9876"})
 	// Port list is not correct
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	dockerCmd(c, "rm", "-f", firstID)
 
@@ -44,7 +45,7 @@ func (s *DockerSuite) TestPortList(c *check.C) {
 
 	err = assertPortList(c, out, []string{"0.0.0.0:9876"})
 	// Port list is not correct
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, _ = dockerCmd(c, "port", ID)
 
@@ -53,7 +54,7 @@ func (s *DockerSuite) TestPortList(c *check.C) {
 		"81/tcp -> 0.0.0.0:9877",
 		"82/tcp -> 0.0.0.0:9878"})
 	// Port list is not correct
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	dockerCmd(c, "rm", "-f", ID)
 
@@ -70,7 +71,7 @@ func (s *DockerSuite) TestPortList(c *check.C) {
 
 	err = assertPortList(c, out, []string{"0.0.0.0:9876", "0.0.0.0:9999"})
 	// Port list is not correct
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, _ = dockerCmd(c, "port", ID)
 
@@ -80,7 +81,7 @@ func (s *DockerSuite) TestPortList(c *check.C) {
 		"81/tcp -> 0.0.0.0:9877",
 		"82/tcp -> 0.0.0.0:9878"})
 	// Port list is not correct
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	dockerCmd(c, "rm", "-f", ID)
 
 	testRange := func() {
@@ -96,7 +97,7 @@ func (s *DockerSuite) TestPortList(c *check.C) {
 
 			err = assertPortList(c, out, []string{fmt.Sprintf("80/tcp -> 0.0.0.0:%d", 9090+i)})
 			// Port list is not correct
-			c.Assert(err, checker.IsNil)
+			assert.NilError(c, err)
 		}
 
 		// test port range exhaustion
@@ -137,7 +138,7 @@ func (s *DockerSuite) TestPortList(c *check.C) {
 		"82/tcp -> 0.0.0.0:9802",
 		"83/tcp -> 0.0.0.0:9803"})
 	// Port list is not correct
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	dockerCmd(c, "rm", "-f", ID)
 
 	// test mixing protocols in same port range
@@ -152,7 +153,7 @@ func (s *DockerSuite) TestPortList(c *check.C) {
 	// Running this test multiple times causes the TCP port to increment.
 	err = assertPortRange(c, out, []int{8000, 8080}, []int{8000, 8080})
 	// Port list is not correct
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	dockerCmd(c, "rm", "-f", ID)
 }
 
@@ -292,7 +293,7 @@ func (s *DockerSuite) TestPortHostBinding(c *check.C) {
 
 	err := assertPortList(c, out, []string{"0.0.0.0:9876"})
 	// Port list is not correct
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	dockerCmd(c, "run", "--net=host", "busybox",
 		"nc", "localhost", "9876")

+ 3 - 3
integration-cli/docker_cli_proxy_test.go

@@ -4,8 +4,8 @@ import (
 	"net"
 	"strings"
 
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 	"gotest.tools/icmd"
 )
 
@@ -24,7 +24,7 @@ func (s *DockerDaemonSuite) TestCLIProxyProxyTCPSock(c *check.C) {
 	testRequires(c, testEnv.IsLocalDaemon)
 	// get the IP to use to connect since we can't use localhost
 	addrs, err := net.InterfaceAddrs()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	var ip string
 	for _, addr := range addrs {
 		sAddr := addr.String()
@@ -35,7 +35,7 @@ func (s *DockerDaemonSuite) TestCLIProxyProxyTCPSock(c *check.C) {
 		}
 	}
 
-	c.Assert(ip, checker.Not(checker.Equals), "")
+	assert.Assert(c, ip != "")
 
 	s.d.Start(c, "-H", "tcp://"+ip+":2375")
 

+ 27 - 26
integration-cli/docker_cli_prune_unix_test.go

@@ -15,17 +15,18 @@ import (
 	"github.com/docker/docker/integration-cli/cli/build"
 	"github.com/docker/docker/integration-cli/daemon"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 	"gotest.tools/icmd"
 )
 
 func pruneNetworkAndVerify(c *check.C, d *daemon.Daemon, kept, pruned []string) {
 	_, err := d.Cmd("network", "prune", "--force")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	for _, s := range kept {
 		waitAndAssert(c, defaultReconciliationTimeout, func(*check.C) (interface{}, check.CommentInterface) {
 			out, err := d.Cmd("network", "ls", "--format", "{{.Name}}")
-			c.Assert(err, checker.IsNil)
+			assert.NilError(c, err)
 			return out, nil
 		}, checker.Contains, s)
 	}
@@ -33,7 +34,7 @@ func pruneNetworkAndVerify(c *check.C, d *daemon.Daemon, kept, pruned []string)
 	for _, s := range pruned {
 		waitAndAssert(c, defaultReconciliationTimeout, func(*check.C) (interface{}, check.CommentInterface) {
 			out, err := d.Cmd("network", "ls", "--format", "{{.Name}}")
-			c.Assert(err, checker.IsNil)
+			assert.NilError(c, err)
 			return out, nil
 		}, checker.Not(checker.Contains), s)
 	}
@@ -42,17 +43,17 @@ func pruneNetworkAndVerify(c *check.C, d *daemon.Daemon, kept, pruned []string)
 func (s *DockerSwarmSuite) TestPruneNetwork(c *check.C) {
 	d := s.AddDaemon(c, true, true)
 	_, err := d.Cmd("network", "create", "n1") // used by container (testprune)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	_, err = d.Cmd("network", "create", "n2")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	_, err = d.Cmd("network", "create", "n3", "--driver", "overlay") // used by service (testprunesvc)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	_, err = d.Cmd("network", "create", "n4", "--driver", "overlay")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	cName := "testprune"
 	_, err = d.Cmd("run", "-d", "--name", cName, "--net", "n1", "busybox", "top")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	serviceName := "testprunesvc"
 	replicas := 1
@@ -61,8 +62,8 @@ func (s *DockerSwarmSuite) TestPruneNetwork(c *check.C) {
 		"--replicas", strconv.Itoa(replicas),
 		"--network", "n3",
 		"busybox", "top")
-	c.Assert(err, checker.IsNil)
-	c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
+	assert.NilError(c, err)
+	assert.Assert(c, strings.TrimSpace(out) != "")
 	waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, replicas+1)
 
 	// prune and verify
@@ -70,9 +71,9 @@ func (s *DockerSwarmSuite) TestPruneNetwork(c *check.C) {
 
 	// remove containers, then prune and verify again
 	_, err = d.Cmd("rm", "-f", cName)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	_, err = d.Cmd("service", "rm", serviceName)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 0)
 
 	pruneNetworkAndVerify(c, d, []string{}, []string{"n1", "n3"})
@@ -90,23 +91,23 @@ func (s *DockerDaemonSuite) TestPruneImageDangling(c *check.C) {
 	id := strings.TrimSpace(result.Combined())
 
 	out, err := s.d.Cmd("images", "-q", "--no-trunc")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(strings.TrimSpace(out), checker.Contains, id)
 
 	out, err = s.d.Cmd("image", "prune", "--force")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id)
 
 	out, err = s.d.Cmd("images", "-q", "--no-trunc")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(strings.TrimSpace(out), checker.Contains, id)
 
 	out, err = s.d.Cmd("image", "prune", "--force", "--all")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(strings.TrimSpace(out), checker.Contains, id)
 
 	out, err = s.d.Cmd("images", "-q", "--no-trunc")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id)
 }
 
@@ -150,10 +151,10 @@ func (s *DockerSuite) TestPruneContainerLabel(c *check.C) {
 	// Add a config file of label=foobar, that will have no impact if cli is label!=foobar
 	config := `{"pruneFilters": ["label=foobar"]}`
 	d, err := ioutil.TempDir("", "integration-cli-")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer os.RemoveAll(d)
 	err = ioutil.WriteFile(filepath.Join(d, "config.json"), []byte(config), 0644)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	// With config.json only, prune based on label=foobar
 	out = cli.DockerCmd(c, "--config", d, "container", "prune", "--force").Combined()
@@ -208,10 +209,10 @@ func (s *DockerSuite) TestPruneVolumeLabel(c *check.C) {
 	// Add a config file of label=foobar, that will have no impact if cli is label!=foobar
 	config := `{"pruneFilters": ["label=foobar"]}`
 	d, err := ioutil.TempDir("", "integration-cli-")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer os.RemoveAll(d)
 	err = ioutil.WriteFile(filepath.Join(d, "config.json"), []byte(config), 0644)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	// With config.json only, prune based on label=foobar
 	out, _ = dockerCmd(c, "--config", d, "volume", "prune", "--force")
@@ -278,7 +279,7 @@ func (s *DockerDaemonSuite) TestPruneImageLabel(c *check.C) {
 	result.Assert(c, icmd.Success)
 	id1 := strings.TrimSpace(result.Combined())
 	out, err := s.d.Cmd("images", "-q", "--no-trunc")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(strings.TrimSpace(out), checker.Contains, id1)
 
 	result = cli.BuildCmd(c, "test2", cli.Daemon(s.d),
@@ -289,21 +290,21 @@ func (s *DockerDaemonSuite) TestPruneImageLabel(c *check.C) {
 	result.Assert(c, icmd.Success)
 	id2 := strings.TrimSpace(result.Combined())
 	out, err = s.d.Cmd("images", "-q", "--no-trunc")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(strings.TrimSpace(out), checker.Contains, id2)
 
 	out, err = s.d.Cmd("image", "prune", "--force", "--all", "--filter", "label=foo=bar")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(strings.TrimSpace(out), checker.Contains, id1)
 	c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id2)
 
 	out, err = s.d.Cmd("image", "prune", "--force", "--all", "--filter", "label!=bar=foo")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id1)
 	c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id2)
 
 	out, err = s.d.Cmd("image", "prune", "--force", "--all", "--filter", "label=bar=foo")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), id1)
 	c.Assert(strings.TrimSpace(out), checker.Contains, id2)
 }

+ 27 - 25
integration-cli/docker_cli_ps_test.go

@@ -13,6 +13,8 @@ import (
 	"github.com/docker/docker/integration-cli/cli/build"
 	"github.com/docker/docker/pkg/stringid"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
+	is "gotest.tools/assert/cmp"
 	"gotest.tools/icmd"
 )
 
@@ -147,7 +149,7 @@ func (s *DockerSuite) TestPsListContainersSize(c *check.C) {
 	baseSizeIndex := strings.Index(baseLines[0], "SIZE")
 	baseFoundsize := baseLines[1][baseSizeIndex:]
 	baseBytes, err := strconv.Atoi(strings.Split(baseFoundsize, "B")[0])
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	name := "test_size"
 	dockerCmd(c, "run", "--name", name, "busybox", "sh", "-c", "echo 1 > test")
@@ -167,7 +169,7 @@ func (s *DockerSuite) TestPsListContainersSize(c *check.C) {
 	}
 	result.Assert(c, icmd.Success)
 	lines := strings.Split(strings.Trim(result.Combined(), "\n "), "\n")
-	c.Assert(lines, checker.HasLen, 2, check.Commentf("Expected 2 lines for 'ps -s -n=1' output, got %d", len(lines)))
+	assert.Equal(c, len(lines), 2, "Expected 2 lines for 'ps -s -n=1' output, got %d", len(lines))
 	sizeIndex := strings.Index(lines[0], "SIZE")
 	idIndex := strings.Index(lines[0], "CONTAINER ID")
 	foundID := lines[1][idIndex : idIndex+12]
@@ -497,7 +499,7 @@ func (s *DockerSuite) TestPsRightTagName(c *check.C) {
 	lines = RemoveLinesForExistingElements(lines, existingContainers)
 	// skip header
 	lines = lines[1:]
-	c.Assert(lines, checker.HasLen, 3, check.Commentf("There should be 3 running container, got %d", len(lines)))
+	assert.Equal(c, len(lines), 3, "There should be 3 running container, got %d", len(lines))
 	for _, line := range lines {
 		f := strings.Fields(line)
 		switch f[0] {
@@ -540,7 +542,7 @@ func (s *DockerSuite) TestPsListContainersFilterCreated(c *check.C) {
 	// filter containers by 'create' - note, no -a needed
 	out, _ = dockerCmd(c, "ps", "-q", "-f", "status=created")
 	containerOut := strings.TrimSpace(out)
-	c.Assert(cID, checker.HasPrefix, containerOut)
+	assert.Assert(c, strings.HasPrefix(cID, containerOut))
 }
 
 // Test for GitHub issue #12595
@@ -641,15 +643,15 @@ func (s *DockerSuite) TestPsShowMounts(c *check.C) {
 
 	lines := strings.Split(strings.TrimSpace(string(out)), "\n")
 	lines = RemoveLinesForExistingElements(lines, existingContainers)
-	c.Assert(lines, checker.HasLen, 3)
+	assert.Equal(c, len(lines), 3)
 
 	fields := strings.Fields(lines[0])
-	c.Assert(fields, checker.HasLen, 2)
+	assert.Equal(c, len(fields), 2)
 	c.Assert(fields[0], checker.Equals, "bind-mount-test")
 	c.Assert(fields[1], checker.Equals, bindMountSource)
 
 	fields = strings.Fields(lines[1])
-	c.Assert(fields, checker.HasLen, 2)
+	assert.Equal(c, len(fields), 2)
 
 	anonymousVolumeID := fields[1]
 
@@ -661,7 +663,7 @@ func (s *DockerSuite) TestPsShowMounts(c *check.C) {
 
 	lines = strings.Split(strings.TrimSpace(string(out)), "\n")
 	lines = RemoveLinesForExistingElements(lines, existingContainers)
-	c.Assert(lines, checker.HasLen, 1)
+	assert.Equal(c, len(lines), 1)
 
 	fields = strings.Fields(lines[0])
 	c.Assert(fields[1], checker.Equals, "ps-volume-test")
@@ -675,7 +677,7 @@ func (s *DockerSuite) TestPsShowMounts(c *check.C) {
 
 	lines = strings.Split(strings.TrimSpace(string(out)), "\n")
 	lines = RemoveLinesForExistingElements(lines, existingContainers)
-	c.Assert(lines, checker.HasLen, 2)
+	assert.Equal(c, len(lines), 2)
 
 	fields = strings.Fields(lines[0])
 	c.Assert(fields[1], checker.Equals, anonymousVolumeID)
@@ -687,10 +689,10 @@ func (s *DockerSuite) TestPsShowMounts(c *check.C) {
 
 	lines = strings.Split(strings.TrimSpace(string(out)), "\n")
 	lines = RemoveLinesForExistingElements(lines, existingContainers)
-	c.Assert(lines, checker.HasLen, 1)
+	assert.Equal(c, len(lines), 1)
 
 	fields = strings.Fields(lines[0])
-	c.Assert(fields, checker.HasLen, 2)
+	assert.Equal(c, len(fields), 2)
 	c.Assert(fields[0], checker.Equals, "bind-mount-test")
 	c.Assert(fields[1], checker.Equals, bindMountSource)
 
@@ -699,10 +701,10 @@ func (s *DockerSuite) TestPsShowMounts(c *check.C) {
 
 	lines = strings.Split(strings.TrimSpace(string(out)), "\n")
 	lines = RemoveLinesForExistingElements(lines, existingContainers)
-	c.Assert(lines, checker.HasLen, 1)
+	assert.Equal(c, len(lines), 1)
 
 	fields = strings.Fields(lines[0])
-	c.Assert(fields, checker.HasLen, 2)
+	assert.Equal(c, len(fields), 2)
 	c.Assert(fields[0], checker.Equals, "bind-mount-test")
 	c.Assert(fields[1], checker.Equals, bindMountSource)
 
@@ -731,7 +733,7 @@ func (s *DockerSuite) TestPsListContainersFilterNetwork(c *check.C) {
 	lines = lines[1:]
 
 	// ps output should have no containers
-	c.Assert(RemoveLinesForExistingElements(lines, existing), checker.HasLen, 0)
+	assert.Equal(c, len(RemoveLinesForExistingElements(lines, existing)), 0)
 
 	// Filter docker ps on network bridge
 	out, _ = dockerCmd(c, "ps", "--filter", "network=bridge")
@@ -743,7 +745,7 @@ func (s *DockerSuite) TestPsListContainersFilterNetwork(c *check.C) {
 	lines = lines[1:]
 
 	// ps output should have only one container
-	c.Assert(RemoveLinesForExistingElements(lines, existing), checker.HasLen, 1)
+	assert.Equal(c, len(RemoveLinesForExistingElements(lines, existing)), 1)
 
 	// Making sure onbridgenetwork is on the output
 	c.Assert(containerOut, checker.Contains, "onbridgenetwork", check.Commentf("Missing the container on network\n"))
@@ -758,7 +760,7 @@ func (s *DockerSuite) TestPsListContainersFilterNetwork(c *check.C) {
 	lines = lines[1:]
 
 	//ps output should have both the containers
-	c.Assert(RemoveLinesForExistingElements(lines, existing), checker.HasLen, 2)
+	assert.Equal(c, len(RemoveLinesForExistingElements(lines, existing)), 2)
 
 	// Making sure onbridgenetwork and onnonenetwork is on the output
 	c.Assert(containerOut, checker.Contains, "onnonenetwork", check.Commentf("Missing the container on none network\n"))
@@ -770,7 +772,7 @@ func (s *DockerSuite) TestPsListContainersFilterNetwork(c *check.C) {
 	out, _ = dockerCmd(c, "ps", "--filter", "network="+nwID)
 	containerOut = strings.TrimSpace(string(out))
 
-	c.Assert(containerOut, checker.Contains, "onbridgenetwork")
+	assert.Assert(c, is.Contains(containerOut, "onbridgenetwork"))
 
 	// Filter by partial network ID
 	partialnwID := string(nwID[0:4])
@@ -784,7 +786,7 @@ func (s *DockerSuite) TestPsListContainersFilterNetwork(c *check.C) {
 	lines = lines[1:]
 
 	// ps output should have only one container
-	c.Assert(RemoveLinesForExistingElements(lines, existing), checker.HasLen, 1)
+	assert.Equal(c, len(RemoveLinesForExistingElements(lines, existing)), 1)
 
 	// Making sure onbridgenetwork is on the output
 	c.Assert(containerOut, checker.Contains, "onbridgenetwork", check.Commentf("Missing the container on network\n"))
@@ -803,11 +805,11 @@ func (s *DockerSuite) TestPsByOrder(c *check.C) {
 
 	// Run multiple time should have the same result
 	out = cli.DockerCmd(c, "ps", "--no-trunc", "-q", "-f", "name=xyz").Combined()
-	c.Assert(strings.TrimSpace(out), checker.Equals, fmt.Sprintf("%s\n%s", container2, container1))
+	assert.Equal(c, strings.TrimSpace(out), fmt.Sprintf("%s\n%s", container2, container1))
 
 	// Run multiple time should have the same result
 	out = cli.DockerCmd(c, "ps", "--no-trunc", "-q", "-f", "name=xyz").Combined()
-	c.Assert(strings.TrimSpace(out), checker.Equals, fmt.Sprintf("%s\n%s", container2, container1))
+	assert.Equal(c, strings.TrimSpace(out), fmt.Sprintf("%s\n%s", container2, container1))
 }
 
 func (s *DockerSuite) TestPsListContainersFilterPorts(c *check.C) {
@@ -833,17 +835,17 @@ func (s *DockerSuite) TestPsListContainersFilterPorts(c *check.C) {
 	c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), id2)
 
 	out, _ = dockerCmd(c, "ps", "--no-trunc", "-q", "--filter", "publish=80-81")
-	c.Assert(strings.TrimSpace(out), checker.Equals, id1)
+	assert.Equal(c, strings.TrimSpace(out), id1)
 	c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), id2)
 
 	out, _ = dockerCmd(c, "ps", "--no-trunc", "-q", "--filter", "expose=80/tcp")
-	c.Assert(strings.TrimSpace(out), checker.Equals, id1)
+	assert.Equal(c, strings.TrimSpace(out), id1)
 	c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), id2)
 
 	out, _ = dockerCmd(c, "ps", "--no-trunc", "-q", "--filter", "expose=8080/tcp")
 	out = RemoveOutputForExistingElements(out, existingContainers)
 	c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), id1)
-	c.Assert(strings.TrimSpace(out), checker.Equals, id2)
+	assert.Equal(c, strings.TrimSpace(out), id2)
 }
 
 func (s *DockerSuite) TestPsNotShowLinknamesOfDeletedContainer(c *check.C) {
@@ -859,11 +861,11 @@ func (s *DockerSuite) TestPsNotShowLinknamesOfDeletedContainer(c *check.C) {
 	expected := []string{"bbb", "aaa,bbb/aaa"}
 	var names []string
 	names = append(names, lines...)
-	c.Assert(expected, checker.DeepEquals, names, check.Commentf("Expected array with non-truncated names: %v, got: %v", expected, names))
+	assert.Assert(c, is.DeepEqual(names, expected), "Expected array with non-truncated names: %v, got: %v", expected, names)
 
 	dockerCmd(c, "rm", "bbb")
 
 	out, _ = dockerCmd(c, "ps", "--no-trunc", "-a", "--format", "{{.Names}}")
 	out = RemoveOutputForExistingElements(out, existingContainers)
-	c.Assert(strings.TrimSpace(out), checker.Equals, "aaa")
+	assert.Equal(c, strings.TrimSpace(out), "aaa")
 }

+ 23 - 22
integration-cli/docker_cli_pull_local_test.go

@@ -17,6 +17,7 @@ import (
 	"github.com/docker/docker/integration-cli/cli/build"
 	"github.com/go-check/check"
 	"github.com/opencontainers/go-digest"
+	"gotest.tools/assert"
 	"gotest.tools/icmd"
 )
 
@@ -47,7 +48,7 @@ func testPullImageWithAliases(c *check.C) {
 	dockerCmd(c, "inspect", repos[0])
 	for _, repo := range repos[1:] {
 		_, _, err := dockerCmdWithError("inspect", repo)
-		c.Assert(err, checker.NotNil, check.Commentf("Image %v shouldn't have been pulled down", repo))
+		assert.ErrorContains(c, err, "", "Image %v shouldn't have been pulled down", repo)
 	}
 }
 
@@ -92,14 +93,14 @@ func testConcurrentPullWholeRepo(c *check.C) {
 	// package is not goroutine-safe.
 	for i := 0; i != numPulls; i++ {
 		err := <-results
-		c.Assert(err, checker.IsNil, check.Commentf("concurrent pull failed with error: %v", err))
+		assert.NilError(c, err, "concurrent pull failed with error: %v", err)
 	}
 
 	// Ensure all tags were pulled successfully
 	for _, repo := range repos {
 		dockerCmd(c, "inspect", repo)
 		out, _ := dockerCmd(c, "run", "--rm", repo)
-		c.Assert(strings.TrimSpace(out), checker.Equals, "/bin/sh -c echo "+repo)
+		assert.Equal(c, strings.TrimSpace(out), "/bin/sh -c echo "+repo)
 	}
 }
 
@@ -126,7 +127,7 @@ func testConcurrentFailingPull(c *check.C) {
 	// package is not goroutine-safe.
 	for i := 0; i != numPulls; i++ {
 		err := <-results
-		c.Assert(err, checker.NotNil, check.Commentf("expected pull to fail"))
+		assert.ErrorContains(c, err, "", "expected pull to fail")
 	}
 }
 
@@ -171,14 +172,14 @@ func testConcurrentPullMultipleTags(c *check.C) {
 	// package is not goroutine-safe.
 	for range repos {
 		err := <-results
-		c.Assert(err, checker.IsNil, check.Commentf("concurrent pull failed with error: %v", err))
+		assert.NilError(c, err, "concurrent pull failed with error: %v", err)
 	}
 
 	// Ensure all tags were pulled successfully
 	for _, repo := range repos {
 		dockerCmd(c, "inspect", repo)
 		out, _ := dockerCmd(c, "run", "--rm", repo)
-		c.Assert(strings.TrimSpace(out), checker.Equals, "/bin/sh -c echo "+repo)
+		assert.Equal(c, strings.TrimSpace(out), "/bin/sh -c echo "+repo)
 	}
 }
 
@@ -262,7 +263,7 @@ func (s *DockerRegistrySuite) TestPullNoLayers(c *check.C) {
 func (s *DockerRegistrySuite) TestPullManifestList(c *check.C) {
 	testRequires(c, NotArm)
 	pushDigest, err := setupImage(c)
-	c.Assert(err, checker.IsNil, check.Commentf("error setting up image"))
+	assert.NilError(c, err, "error setting up image")
 
 	// Inject a manifest list into the registry
 	manifestList := &manifestlist.ManifestList{
@@ -297,7 +298,7 @@ func (s *DockerRegistrySuite) TestPullManifestList(c *check.C) {
 	}
 
 	manifestListJSON, err := json.MarshalIndent(manifestList, "", "   ")
-	c.Assert(err, checker.IsNil, check.Commentf("error marshalling manifest list"))
+	assert.NilError(c, err, "error marshalling manifest list")
 
 	manifestListDigest := digest.FromBytes(manifestListJSON)
 	hexDigest := manifestListDigest.Hex()
@@ -307,10 +308,10 @@ func (s *DockerRegistrySuite) TestPullManifestList(c *check.C) {
 	// Write manifest list to blob store
 	blobDir := filepath.Join(registryV2Path, "blobs", "sha256", hexDigest[:2], hexDigest)
 	err = os.MkdirAll(blobDir, 0755)
-	c.Assert(err, checker.IsNil, check.Commentf("error creating blob dir"))
+	assert.NilError(c, err, "error creating blob dir")
 	blobPath := filepath.Join(blobDir, "data")
 	err = ioutil.WriteFile(blobPath, []byte(manifestListJSON), 0644)
-	c.Assert(err, checker.IsNil, check.Commentf("error writing manifest list"))
+	assert.NilError(c, err, "error writing manifest list")
 
 	// Add to revision store
 	revisionDir := filepath.Join(registryV2Path, "repositories", remoteRepoName, "_manifests", "revisions", "sha256", hexDigest)
@@ -323,7 +324,7 @@ func (s *DockerRegistrySuite) TestPullManifestList(c *check.C) {
 	// Update tag
 	tagPath := filepath.Join(registryV2Path, "repositories", remoteRepoName, "_manifests", "tags", "latest", "current", "link")
 	err = ioutil.WriteFile(tagPath, []byte(manifestListDigest.String()), 0644)
-	c.Assert(err, checker.IsNil, check.Commentf("error writing tag link"))
+	assert.NilError(c, err, "error writing tag link")
 
 	// Verify that the image can be pulled through the manifest list.
 	out, _ := dockerCmd(c, "pull", repoName)
@@ -334,7 +335,7 @@ func (s *DockerRegistrySuite) TestPullManifestList(c *check.C) {
 	pullDigest := matches[1]
 
 	// Make sure the pushed and pull digests match
-	c.Assert(manifestListDigest.String(), checker.Equals, pullDigest)
+	assert.Equal(c, manifestListDigest.String(), pullDigest)
 
 	// Was the image actually created?
 	dockerCmd(c, "inspect", repoName)
@@ -348,9 +349,9 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestPullWithExternalAuthLoginWithSchem
 	defer os.Setenv("PATH", osPath)
 
 	workingDir, err := os.Getwd()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	absolute, err := filepath.Abs(filepath.Join(workingDir, "fixtures", "auth"))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	testPath := fmt.Sprintf("%s%c%s", osPath, filepath.ListSeparator, absolute)
 
 	os.Setenv("PATH", testPath)
@@ -358,18 +359,18 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestPullWithExternalAuthLoginWithSchem
 	repoName := fmt.Sprintf("%v/dockercli/busybox:authtest", privateRegistryURL)
 
 	tmp, err := ioutil.TempDir("", "integration-cli-")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	externalAuthConfig := `{ "credsStore": "shell-test" }`
 
 	configPath := filepath.Join(tmp, "config.json")
 	err = ioutil.WriteFile(configPath, []byte(externalAuthConfig), 0644)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	dockerCmd(c, "--config", tmp, "login", "-u", s.reg.Username(), "-p", s.reg.Password(), privateRegistryURL)
 
 	b, err := ioutil.ReadFile(configPath)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(string(b), checker.Not(checker.Contains), "\"auth\":")
 
 	dockerCmd(c, "--config", tmp, "tag", "busybox", repoName)
@@ -393,9 +394,9 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestPullWithExternalAuth(c *check.C) {
 	defer os.Setenv("PATH", osPath)
 
 	workingDir, err := os.Getwd()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	absolute, err := filepath.Abs(filepath.Join(workingDir, "fixtures", "auth"))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	testPath := fmt.Sprintf("%s%c%s", osPath, filepath.ListSeparator, absolute)
 
 	os.Setenv("PATH", testPath)
@@ -403,18 +404,18 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestPullWithExternalAuth(c *check.C) {
 	repoName := fmt.Sprintf("%v/dockercli/busybox:authtest", privateRegistryURL)
 
 	tmp, err := ioutil.TempDir("", "integration-cli-")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	externalAuthConfig := `{ "credsStore": "shell-test" }`
 
 	configPath := filepath.Join(tmp, "config.json")
 	err = ioutil.WriteFile(configPath, []byte(externalAuthConfig), 0644)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	dockerCmd(c, "--config", tmp, "login", "-u", s.reg.Username(), "-p", s.reg.Password(), privateRegistryURL)
 
 	b, err := ioutil.ReadFile(configPath)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(string(b), checker.Not(checker.Contains), "\"auth\":")
 
 	dockerCmd(c, "--config", tmp, "tag", "busybox", repoName)

+ 34 - 31
integration-cli/docker_cli_pull_test.go

@@ -7,9 +7,10 @@ import (
 	"sync"
 	"time"
 
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/go-check/check"
 	"github.com/opencontainers/go-digest"
+	"gotest.tools/assert"
+	is "gotest.tools/assert/cmp"
 )
 
 // TestPullFromCentralRegistry pulls an image from the central registry and verifies that the client
@@ -19,21 +20,22 @@ func (s *DockerHubPullSuite) TestPullFromCentralRegistry(c *check.C) {
 	out := s.Cmd(c, "pull", "hello-world")
 	defer deleteImages("hello-world")
 
-	c.Assert(out, checker.Contains, "Using default tag: latest", check.Commentf("expected the 'latest' tag to be automatically assumed"))
-	c.Assert(out, checker.Contains, "Pulling from library/hello-world", check.Commentf("expected the 'library/' prefix to be automatically assumed"))
-	c.Assert(out, checker.Contains, "Downloaded newer image for hello-world:latest")
+	assert.Assert(c, strings.Contains(out, "Using default tag: latest"), "expected the 'latest' tag to be automatically assumed")
+	assert.Assert(c, strings.Contains(out, "Pulling from library/hello-world"), "expected the 'library/' prefix to be automatically assumed")
+	assert.Assert(c, strings.Contains(out, "Downloaded newer image for hello-world:latest"))
 
 	matches := regexp.MustCompile(`Digest: (.+)\n`).FindAllStringSubmatch(out, -1)
-	c.Assert(len(matches), checker.Equals, 1, check.Commentf("expected exactly one image digest in the output"))
-	c.Assert(len(matches[0]), checker.Equals, 2, check.Commentf("unexpected number of submatches for the digest"))
+	assert.Equal(c, len(matches), 1, "expected exactly one image digest in the output")
+	assert.Equal(c, len(matches[0]), 2, "unexpected number of submatches for the digest")
 	_, err := digest.Parse(matches[0][1])
-	c.Check(err, checker.IsNil, check.Commentf("invalid digest %q in output", matches[0][1]))
+	assert.NilError(c, err, "invalid digest %q in output", matches[0][1])
 
 	// We should have a single entry in images.
 	img := strings.TrimSpace(s.Cmd(c, "images"))
 	splitImg := strings.Split(img, "\n")
-	c.Assert(splitImg, checker.HasLen, 2)
-	c.Assert(splitImg[1], checker.Matches, `hello-world\s+latest.*?`, check.Commentf("invalid output for `docker images` (expected image and tag name"))
+	assert.Equal(c, len(splitImg), 2)
+	match, _ := regexp.MatchString(`hello-world\s+latest.*?`, splitImg[1])
+	assert.Assert(c, match, "invalid output for `docker images` (expected image and tag name)")
 }
 
 // TestPullNonExistingImage pulls non-existing images from the central registry, with different
@@ -97,13 +99,13 @@ func (s *DockerHubPullSuite) TestPullNonExistingImage(c *check.C) {
 	// Process the results (out, err).
 	for record := range recordChan {
 		if len(record.option) == 0 {
-			c.Assert(record.err, checker.NotNil, check.Commentf("expected non-zero exit status when pulling non-existing image: %s", record.out))
-			c.Assert(record.out, checker.Contains, fmt.Sprintf("pull access denied for %s, repository does not exist or may require 'docker login'", record.e.repo), check.Commentf("expected image not found error messages"))
+			assert.ErrorContains(c, record.err, "", "expected non-zero exit status when pulling non-existing image: %s", record.out)
+			assert.Assert(c, strings.Contains(record.out, fmt.Sprintf("pull access denied for %s, repository does not exist or may require 'docker login'", record.e.repo)), "expected image not found error messages")
 		} else {
 			// pull -a on a nonexistent registry should fall back as well
-			c.Assert(record.err, checker.NotNil, check.Commentf("expected non-zero exit status when pulling non-existing image: %s", record.out))
-			c.Assert(record.out, checker.Contains, fmt.Sprintf("pull access denied for %s, repository does not exist or may require 'docker login'", record.e.repo), check.Commentf("expected image not found error messages"))
-			c.Assert(record.out, checker.Not(checker.Contains), "unauthorized", check.Commentf(`message should not contain "unauthorized"`))
+			assert.ErrorContains(c, record.err, "", "expected non-zero exit status when pulling non-existing image: %s", record.out)
+			assert.Assert(c, strings.Contains(record.out, fmt.Sprintf("pull access denied for %s, repository does not exist or may require 'docker login'", record.e.repo)), "expected image not found error messages")
+			assert.Assert(c, !strings.Contains(record.out, "unauthorized"), `message should not contain "unauthorized"`)
 		}
 	}
 
@@ -168,7 +170,7 @@ func (s *DockerHubPullSuite) TestPullFromCentralRegistryImplicitRefParts(c *chec
 			s.Cmd(c, "rmi", ref)
 			s.Cmd(c, "tag", "hello-world-backup", "hello-world")
 		}
-		c.Assert(out, checker.Contains, "Image is up to date for hello-world:latest")
+		assert.Assert(c, strings.Contains(out, "Image is up to date for hello-world:latest"))
 	}
 
 	s.Cmd(c, "rmi", "hello-world-backup")
@@ -176,17 +178,18 @@ func (s *DockerHubPullSuite) TestPullFromCentralRegistryImplicitRefParts(c *chec
 	// We should have a single entry in images.
 	img := strings.TrimSpace(s.Cmd(c, "images"))
 	splitImg := strings.Split(img, "\n")
-	c.Assert(splitImg, checker.HasLen, 2)
-	c.Assert(splitImg[1], checker.Matches, `hello-world\s+latest.*?`, check.Commentf("invalid output for `docker images` (expected image and tag name"))
+	assert.Equal(c, len(splitImg), 2)
+	match, _ := regexp.MatchString(`hello-world\s+latest.*?`, splitImg[1])
+	assert.Assert(c, match, "invalid output for `docker images` (expected image and tag name)")
 }
 
 // TestPullScratchNotAllowed verifies that pulling 'scratch' is rejected.
 func (s *DockerHubPullSuite) TestPullScratchNotAllowed(c *check.C) {
 	testRequires(c, DaemonIsLinux)
 	out, err := s.CmdWithError("pull", "scratch")
-	c.Assert(err, checker.NotNil, check.Commentf("expected pull of scratch to fail"))
-	c.Assert(out, checker.Contains, "'scratch' is a reserved name")
-	c.Assert(out, checker.Not(checker.Contains), "Pulling repository scratch")
+	assert.ErrorContains(c, err, "", "expected pull of scratch to fail")
+	assert.Assert(c, strings.Contains(out, "'scratch' is a reserved name"))
+	assert.Assert(c, !strings.Contains(out, "Pulling repository scratch"))
 }
 
 // TestPullAllTagsFromCentralRegistry pulls using `all-tags` for a given image and verifies that it
@@ -196,12 +199,12 @@ func (s *DockerHubPullSuite) TestPullAllTagsFromCentralRegistry(c *check.C) {
 	s.Cmd(c, "pull", "dockercore/engine-pull-all-test-fixture")
 	outImageCmd := s.Cmd(c, "images", "dockercore/engine-pull-all-test-fixture")
 	splitOutImageCmd := strings.Split(strings.TrimSpace(outImageCmd), "\n")
-	c.Assert(splitOutImageCmd, checker.HasLen, 2)
+	assert.Equal(c, len(splitOutImageCmd), 2)
 
 	s.Cmd(c, "pull", "--all-tags=true", "dockercore/engine-pull-all-test-fixture")
 	outImageAllTagCmd := s.Cmd(c, "images", "dockercore/engine-pull-all-test-fixture")
 	linesCount := strings.Count(outImageAllTagCmd, "\n")
-	c.Assert(linesCount, checker.GreaterThan, 2, check.Commentf("pulling all tags should provide more than two images, got %s", outImageAllTagCmd))
+	assert.Assert(c, linesCount > 2, "pulling all tags should provide more than two images, got %s", outImageAllTagCmd)
 
 	// Verify that the line for 'dockercore/engine-pull-all-test-fixture:latest' is left unchanged.
 	var latestLine string
@@ -211,7 +214,7 @@ func (s *DockerHubPullSuite) TestPullAllTagsFromCentralRegistry(c *check.C) {
 			break
 		}
 	}
-	c.Assert(latestLine, checker.Not(checker.Equals), "", check.Commentf("no entry for dockercore/engine-pull-all-test-fixture:latest found after pulling all tags"))
+	assert.Assert(c, latestLine != "", "no entry for dockercore/engine-pull-all-test-fixture:latest found after pulling all tags")
 
 	splitLatest := strings.Fields(latestLine)
 	splitCurrent := strings.Fields(splitOutImageCmd[1])
@@ -228,7 +231,7 @@ func (s *DockerHubPullSuite) TestPullAllTagsFromCentralRegistry(c *check.C) {
 	splitCurrent[4] = ""
 	splitCurrent[5] = ""
 
-	c.Assert(splitLatest, checker.DeepEquals, splitCurrent, check.Commentf("dockercore/engine-pull-all-test-fixture:latest was changed after pulling all tags"))
+	assert.Assert(c, is.DeepEqual(splitLatest, splitCurrent), "dockercore/engine-pull-all-test-fixture:latest was changed after pulling all tags")
 }
 
 // TestPullClientDisconnect kills the client during a pull operation and verifies that the operation
@@ -241,34 +244,34 @@ func (s *DockerHubPullSuite) TestPullClientDisconnect(c *check.C) {
 
 	pullCmd := s.MakeCmd("pull", repoName)
 	stdout, err := pullCmd.StdoutPipe()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	err = pullCmd.Start()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	go pullCmd.Wait()
 
 	// Cancel as soon as we get some output.
 	buf := make([]byte, 10)
 	_, err = stdout.Read(buf)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	err = pullCmd.Process.Kill()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	time.Sleep(2 * time.Second)
 	_, err = s.CmdWithError("inspect", repoName)
-	c.Assert(err, checker.NotNil, check.Commentf("image was pulled after client disconnected"))
+	assert.ErrorContains(c, err, "", "image was pulled after client disconnected")
 }
 
 // Regression test for https://github.com/docker/docker/issues/26429
 func (s *DockerSuite) TestPullLinuxImageFailsOnWindows(c *check.C) {
 	testRequires(c, DaemonIsWindows, Network)
 	_, _, err := dockerCmdWithError("pull", "ubuntu")
-	c.Assert(err.Error(), checker.Contains, "no matching manifest")
+	assert.ErrorContains(c, err, "no matching manifest")
 }
 
 // Regression test for https://github.com/docker/docker/issues/28892
 func (s *DockerSuite) TestPullWindowsImageFailsOnLinux(c *check.C) {
 	testRequires(c, DaemonIsLinux, Network)
 	_, _, err := dockerCmdWithError("pull", "microsoft/nanoserver")
-	c.Assert(err.Error(), checker.Contains, "cannot be used on this platform")
+	assert.ErrorContains(c, err, "cannot be used on this platform")
 }

+ 47 - 46
integration-cli/docker_cli_push_test.go

@@ -11,9 +11,9 @@ import (
 	"sync"
 
 	"github.com/docker/distribution/reference"
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli/build"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 	"gotest.tools/icmd"
 )
 
@@ -33,7 +33,7 @@ func (s *DockerRegistrySuite) TestPushBusyboxImage(c *check.C) {
 // pushing an image without a prefix should throw an error
 func (s *DockerSuite) TestPushUnprefixedRepo(c *check.C) {
 	out, _, err := dockerCmdWithError("push", "busybox")
-	c.Assert(err, check.NotNil, check.Commentf("pushing an unprefixed repo didn't result in a non-zero exit status: %s", out))
+	assert.ErrorContains(c, err, "", "pushing an unprefixed repo didn't result in a non-zero exit status: %s", out)
 }
 
 func testPushUntagged(c *check.C) {
@@ -41,8 +41,8 @@ func testPushUntagged(c *check.C) {
 	expected := "An image does not exist locally with the tag"
 
 	out, _, err := dockerCmdWithError("push", repoName)
-	c.Assert(err, check.NotNil, check.Commentf("pushing the image to the private registry should have failed: output %q", out))
-	c.Assert(out, checker.Contains, expected, check.Commentf("pushing the image failed"))
+	assert.ErrorContains(c, err, "", "pushing the image to the private registry should have failed: output %q", out)
+	assert.Assert(c, strings.Contains(out, expected), "pushing the image failed")
 }
 
 func (s *DockerRegistrySuite) TestPushUntagged(c *check.C) {
@@ -54,8 +54,8 @@ func testPushBadTag(c *check.C) {
 	expected := "does not exist"
 
 	out, _, err := dockerCmdWithError("push", repoName)
-	c.Assert(err, check.NotNil, check.Commentf("pushing the image to the private registry should have failed: output %q", out))
-	c.Assert(out, checker.Contains, expected, check.Commentf("pushing the image failed"))
+	assert.ErrorContains(c, err, "", "pushing the image to the private registry should have failed: output %q", out)
+	assert.Assert(c, strings.Contains(out, expected), "pushing the image failed")
 }
 
 func (s *DockerRegistrySuite) TestPushBadTag(c *check.C) {
@@ -92,10 +92,10 @@ func testPushMultipleTags(c *check.C) {
 			out1Lines = append(out1Lines, outputLine)
 		}
 	}
-	c.Assert(out2Lines, checker.HasLen, len(out1Lines))
+	assert.Equal(c, len(out2Lines), len(out1Lines))
 
 	for i := range out1Lines {
-		c.Assert(out1Lines[i], checker.Equals, out2Lines[i])
+		assert.Equal(c, out1Lines[i], out2Lines[i])
 	}
 }
 
@@ -106,14 +106,14 @@ func (s *DockerRegistrySuite) TestPushMultipleTags(c *check.C) {
 func testPushEmptyLayer(c *check.C) {
 	repoName := fmt.Sprintf("%v/dockercli/emptylayer", privateRegistryURL)
 	emptyTarball, err := ioutil.TempFile("", "empty_tarball")
-	c.Assert(err, check.IsNil, check.Commentf("Unable to create test file"))
+	assert.NilError(c, err, "Unable to create test file")
 
 	tw := tar.NewWriter(emptyTarball)
 	err = tw.Close()
-	c.Assert(err, check.IsNil, check.Commentf("Error creating empty tarball"))
+	assert.NilError(c, err, "Error creating empty tarball")
 
 	freader, err := os.Open(emptyTarball.Name())
-	c.Assert(err, check.IsNil, check.Commentf("Could not open test tarball"))
+	assert.NilError(c, err, "Could not open test tarball")
 	defer freader.Close()
 
 	icmd.RunCmd(icmd.Cmd{
@@ -123,7 +123,7 @@ func testPushEmptyLayer(c *check.C) {
 
 	// Now verify we can push it
 	out, _, err := dockerCmdWithError("push", repoName)
-	c.Assert(err, check.IsNil, check.Commentf("pushing the image to the private registry has failed: %s", out))
+	assert.NilError(c, err, "pushing the image to the private registry has failed: %s", out)
 }
 
 func (s *DockerRegistrySuite) TestPushEmptyLayer(c *check.C) {
@@ -160,7 +160,7 @@ func testConcurrentPush(c *check.C) {
 
 	for range repos {
 		err := <-results
-		c.Assert(err, checker.IsNil, check.Commentf("concurrent push failed with error: %v", err))
+		assert.NilError(c, err, "concurrent push failed with error: %v", err)
 	}
 
 	// Clear local images store.
@@ -172,7 +172,7 @@ func testConcurrentPush(c *check.C) {
 		dockerCmd(c, "pull", repo)
 		dockerCmd(c, "inspect", repo)
 		out, _ := dockerCmd(c, "run", "--rm", repo)
-		c.Assert(strings.TrimSpace(out), checker.Equals, "/bin/sh -c echo "+repo)
+		assert.Equal(c, strings.TrimSpace(out), "/bin/sh -c echo "+repo)
 	}
 }
 
@@ -186,48 +186,49 @@ func (s *DockerRegistrySuite) TestCrossRepositoryLayerPush(c *check.C) {
 	dockerCmd(c, "tag", "busybox", sourceRepoName)
 	// push the image to the registry
 	out1, _, err := dockerCmdWithError("push", sourceRepoName)
-	c.Assert(err, check.IsNil, check.Commentf("pushing the image to the private registry has failed: %s", out1))
+	assert.NilError(c, err, "pushing the image to the private registry has failed: %s", out1)
 	// ensure that none of the layers were mounted from another repository during push
-	c.Assert(strings.Contains(out1, "Mounted from"), check.Equals, false)
+	assert.Assert(c, !strings.Contains(out1, "Mounted from"))
 
 	digest1 := reference.DigestRegexp.FindString(out1)
-	c.Assert(len(digest1), checker.GreaterThan, 0, check.Commentf("no digest found for pushed manifest"))
+	assert.Assert(c, len(digest1) > 0, "no digest found for pushed manifest")
 
 	destRepoName := fmt.Sprintf("%v/dockercli/crossrepopush", privateRegistryURL)
 	// retag the image to upload the same layers to another repo in the same registry
 	dockerCmd(c, "tag", "busybox", destRepoName)
 	// push the image to the registry
 	out2, _, err := dockerCmdWithError("push", destRepoName)
-	c.Assert(err, check.IsNil, check.Commentf("pushing the image to the private registry has failed: %s", out2))
+	assert.NilError(c, err, "pushing the image to the private registry has failed: %s", out2)
+
 	// ensure that layers were mounted from the first repo during push
-	c.Assert(strings.Contains(out2, "Mounted from dockercli/busybox"), check.Equals, true)
+	assert.Assert(c, strings.Contains(out2, "Mounted from dockercli/busybox"))
 
 	digest2 := reference.DigestRegexp.FindString(out2)
-	c.Assert(len(digest2), checker.GreaterThan, 0, check.Commentf("no digest found for pushed manifest"))
-	c.Assert(digest1, check.Equals, digest2)
+	assert.Assert(c, len(digest2) > 0, "no digest found for pushed manifest")
+	assert.Equal(c, digest1, digest2)
 
 	// ensure that pushing again produces the same digest
 	out3, _, err := dockerCmdWithError("push", destRepoName)
-	c.Assert(err, check.IsNil, check.Commentf("pushing the image to the private registry has failed: %s", out2))
+	assert.NilError(c, err, "pushing the image to the private registry has failed: %s", out3)
 
 	digest3 := reference.DigestRegexp.FindString(out3)
-	c.Assert(len(digest2), checker.GreaterThan, 0, check.Commentf("no digest found for pushed manifest"))
-	c.Assert(digest3, check.Equals, digest2)
+	assert.Assert(c, len(digest3) > 0, "no digest found for pushed manifest")
+	assert.Equal(c, digest3, digest2)
 
 	// ensure that we can pull and run the cross-repo-pushed repository
 	dockerCmd(c, "rmi", destRepoName)
 	dockerCmd(c, "pull", destRepoName)
 	out4, _ := dockerCmd(c, "run", destRepoName, "echo", "-n", "hello world")
-	c.Assert(out4, check.Equals, "hello world")
+	assert.Equal(c, out4, "hello world")
 }
 
 func (s *DockerRegistryAuthHtpasswdSuite) TestPushNoCredentialsNoRetry(c *check.C) {
 	repoName := fmt.Sprintf("%s/busybox", privateRegistryURL)
 	dockerCmd(c, "tag", "busybox", repoName)
 	out, _, err := dockerCmdWithError("push", repoName)
-	c.Assert(err, check.NotNil, check.Commentf("%s", out))
-	c.Assert(out, check.Not(checker.Contains), "Retrying")
-	c.Assert(out, checker.Contains, "no basic auth credentials")
+	assert.ErrorContains(c, err, "", out)
+	assert.Assert(c, !strings.Contains(out, "Retrying"))
+	assert.Assert(c, strings.Contains(out, "no basic auth credentials"))
 }
 
 // This may be flaky but it's needed not to regress on unauthorized push, see #21054
@@ -236,8 +237,8 @@ func (s *DockerSuite) TestPushToCentralRegistryUnauthorized(c *check.C) {
 	repoName := "test/busybox"
 	dockerCmd(c, "tag", "busybox", repoName)
 	out, _, err := dockerCmdWithError("push", repoName)
-	c.Assert(err, check.NotNil, check.Commentf("%s", out))
-	c.Assert(out, check.Not(checker.Contains), "Retrying")
+	assert.ErrorContains(c, err, "", out)
+	assert.Assert(c, !strings.Contains(out, "Retrying"))
 }
 
 func getTestTokenService(status int, body string, retries int) *httptest.Server {
@@ -265,9 +266,9 @@ func (s *DockerRegistryAuthTokenSuite) TestPushTokenServiceUnauthResponse(c *che
 	repoName := fmt.Sprintf("%s/busybox", privateRegistryURL)
 	dockerCmd(c, "tag", "busybox", repoName)
 	out, _, err := dockerCmdWithError("push", repoName)
-	c.Assert(err, check.NotNil, check.Commentf("%s", out))
-	c.Assert(out, checker.Not(checker.Contains), "Retrying")
-	c.Assert(out, checker.Contains, "unauthorized: a message")
+	assert.ErrorContains(c, err, "", out)
+	assert.Assert(c, !strings.Contains(out, "Retrying"))
+	assert.Assert(c, strings.Contains(out, "unauthorized: a message"))
 }
 
 func (s *DockerRegistryAuthTokenSuite) TestPushMisconfiguredTokenServiceResponseUnauthorized(c *check.C) {
@@ -277,10 +278,10 @@ func (s *DockerRegistryAuthTokenSuite) TestPushMisconfiguredTokenServiceResponse
 	repoName := fmt.Sprintf("%s/busybox", privateRegistryURL)
 	dockerCmd(c, "tag", "busybox", repoName)
 	out, _, err := dockerCmdWithError("push", repoName)
-	c.Assert(err, check.NotNil, check.Commentf("%s", out))
-	c.Assert(out, checker.Not(checker.Contains), "Retrying")
+	assert.ErrorContains(c, err, "", out)
+	assert.Assert(c, !strings.Contains(out, "Retrying"))
 	split := strings.Split(out, "\n")
-	c.Assert(split[len(split)-2], check.Equals, "unauthorized: authentication required")
+	assert.Equal(c, split[len(split)-2], "unauthorized: authentication required")
 }
 
 func (s *DockerRegistryAuthTokenSuite) TestPushMisconfiguredTokenServiceResponseError(c *check.C) {
@@ -290,12 +291,12 @@ func (s *DockerRegistryAuthTokenSuite) TestPushMisconfiguredTokenServiceResponse
 	repoName := fmt.Sprintf("%s/busybox", privateRegistryURL)
 	dockerCmd(c, "tag", "busybox", repoName)
 	out, _, err := dockerCmdWithError("push", repoName)
-	c.Assert(err, check.NotNil, check.Commentf("%s", out))
+	assert.ErrorContains(c, err, "", out)
 	// TODO: isolate test so that it can be guaranteed that the 503 will trigger xfer retries
-	//c.Assert(out, checker.Contains, "Retrying")
-	//c.Assert(out, checker.Not(checker.Contains), "Retrying in 15")
+	//assert.Assert(c, strings.Contains(out, "Retrying"))
+	//assert.Assert(c, !strings.Contains(out, "Retrying in 15"))
 	split := strings.Split(out, "\n")
-	c.Assert(split[len(split)-2], check.Equals, "toomanyrequests: out of tokens")
+	assert.Equal(c, split[len(split)-2], "toomanyrequests: out of tokens")
 }
 
 func (s *DockerRegistryAuthTokenSuite) TestPushMisconfiguredTokenServiceResponseUnparsable(c *check.C) {
@@ -305,10 +306,10 @@ func (s *DockerRegistryAuthTokenSuite) TestPushMisconfiguredTokenServiceResponse
 	repoName := fmt.Sprintf("%s/busybox", privateRegistryURL)
 	dockerCmd(c, "tag", "busybox", repoName)
 	out, _, err := dockerCmdWithError("push", repoName)
-	c.Assert(err, check.NotNil, check.Commentf("%s", out))
-	c.Assert(out, checker.Not(checker.Contains), "Retrying")
+	assert.ErrorContains(c, err, "", out)
+	assert.Assert(c, !strings.Contains(out, "Retrying"))
 	split := strings.Split(out, "\n")
-	c.Assert(split[len(split)-2], checker.Contains, "error parsing HTTP 403 response body: ")
+	assert.Assert(c, strings.Contains(split[len(split)-2], "error parsing HTTP 403 response body: "))
 }
 
 func (s *DockerRegistryAuthTokenSuite) TestPushMisconfiguredTokenServiceResponseNoToken(c *check.C) {
@@ -318,8 +319,8 @@ func (s *DockerRegistryAuthTokenSuite) TestPushMisconfiguredTokenServiceResponse
 	repoName := fmt.Sprintf("%s/busybox", privateRegistryURL)
 	dockerCmd(c, "tag", "busybox", repoName)
 	out, _, err := dockerCmdWithError("push", repoName)
-	c.Assert(err, check.NotNil, check.Commentf("%s", out))
-	c.Assert(out, checker.Not(checker.Contains), "Retrying")
+	assert.ErrorContains(c, err, "", out)
+	assert.Assert(c, !strings.Contains(out, "Retrying"))
 	split := strings.Split(out, "\n")
-	c.Assert(split[len(split)-2], check.Equals, "authorization server did not include a token in the response")
+	assert.Equal(c, split[len(split)-2], "authorization server did not include a token in the response")
 }

+ 7 - 6
integration-cli/docker_cli_registry_user_agent_test.go

@@ -9,6 +9,7 @@ import (
 
 	"github.com/docker/docker/internal/test/registry"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 // unescapeBackslashSemicolonParens unescapes \;()
@@ -32,21 +33,21 @@ func regexpCheckUA(c *check.C, ua string) {
 	re := regexp.MustCompile("(?P<dockerUA>.+) UpstreamClient(?P<upstreamUA>.+)")
 	substrArr := re.FindStringSubmatch(ua)
 
-	c.Assert(substrArr, check.HasLen, 3, check.Commentf("Expected 'UpstreamClient()' with upstream client UA"))
+	assert.Equal(c, len(substrArr), 3, "Expected 'UpstreamClient()' with upstream client UA")
 	dockerUA := substrArr[1]
 	upstreamUAEscaped := substrArr[2]
 
 	// check dockerUA looks correct
 	reDockerUA := regexp.MustCompile("^docker/[0-9A-Za-z+]")
 	bMatchDockerUA := reDockerUA.MatchString(dockerUA)
-	c.Assert(bMatchDockerUA, check.Equals, true, check.Commentf("Docker Engine User-Agent malformed"))
+	assert.Assert(c, bMatchDockerUA, "Docker Engine User-Agent malformed")
 
 	// check upstreamUA looks correct
 	// Expecting something like:  Docker-Client/1.11.0-dev (linux)
 	upstreamUA := unescapeBackslashSemicolonParens(upstreamUAEscaped)
 	reUpstreamUA := regexp.MustCompile("^\\(Docker-Client/[0-9A-Za-z+]")
 	bMatchUpstreamUA := reUpstreamUA.MatchString(upstreamUA)
-	c.Assert(bMatchUpstreamUA, check.Equals, true, check.Commentf("(Upstream) Docker Client User-Agent malformed"))
+	assert.Assert(c, bMatchUpstreamUA, "(Upstream) Docker Client User-Agent malformed")
 }
 
 // registerUserAgentHandler registers a handler for the `/v2/*` endpoint.
@@ -75,18 +76,18 @@ func (s *DockerRegistrySuite) TestUserAgentPassThrough(c *check.C) {
 
 	reg, err := registry.NewMock(c)
 	defer reg.Close()
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	registerUserAgentHandler(reg, &ua)
 	repoName := fmt.Sprintf("%s/busybox", reg.URL())
 
 	s.d.StartWithBusybox(c, "--insecure-registry", reg.URL())
 
 	tmp, err := ioutil.TempDir("", "integration-cli-")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	defer os.RemoveAll(tmp)
 
 	dockerfile, err := makefile(tmp, fmt.Sprintf("FROM %s", repoName))
-	c.Assert(err, check.IsNil, check.Commentf("Unable to create test dockerfile"))
+	assert.NilError(c, err, "Unable to create test dockerfile")
 
 	s.d.Cmd("build", "--file", dockerfile, tmp)
 	regexpCheckUA(c, ua)

+ 65 - 64
integration-cli/docker_cli_restart_test.go

@@ -8,6 +8,8 @@ import (
 
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
+	is "gotest.tools/assert/cmp"
 )
 
 func (s *DockerSuite) TestRestartStoppedContainer(c *check.C) {
@@ -15,16 +17,16 @@ func (s *DockerSuite) TestRestartStoppedContainer(c *check.C) {
 	cleanedContainerID := getIDByName(c, "test")
 
 	out, _ := dockerCmd(c, "logs", cleanedContainerID)
-	c.Assert(out, checker.Equals, "foobar\n")
+	assert.Equal(c, out, "foobar\n")
 
 	dockerCmd(c, "restart", cleanedContainerID)
 
 	// Wait until the container has stopped
 	err := waitInspect(cleanedContainerID, "{{.State.Running}}", "false", 20*time.Second)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, _ = dockerCmd(c, "logs", cleanedContainerID)
-	c.Assert(out, checker.Equals, "foobar\nfoobar\n")
+	assert.Equal(c, out, "foobar\nfoobar\n")
 }
 
 func (s *DockerSuite) TestRestartRunningContainer(c *check.C) {
@@ -32,7 +34,7 @@ func (s *DockerSuite) TestRestartRunningContainer(c *check.C) {
 
 	cleanedContainerID := strings.TrimSpace(out)
 
-	c.Assert(waitRun(cleanedContainerID), checker.IsNil)
+	assert.NilError(c, waitRun(cleanedContainerID))
 
 	getLogs := func(c *check.C) (interface{}, check.CommentInterface) {
 		out, _ := dockerCmd(c, "logs", cleanedContainerID)
@@ -43,7 +45,7 @@ func (s *DockerSuite) TestRestartRunningContainer(c *check.C) {
 	waitAndAssert(c, 10*time.Second, getLogs, checker.Equals, "foobar\n")
 
 	dockerCmd(c, "restart", "-t", "1", cleanedContainerID)
-	c.Assert(waitRun(cleanedContainerID), checker.IsNil)
+	assert.NilError(c, waitRun(cleanedContainerID))
 
 	// Wait 10 seconds for first 'echo' appear (again) in the logs
 	waitAndAssert(c, 10*time.Second, getLogs, checker.Equals, "foobar\nfoobar\n")
@@ -56,23 +58,23 @@ func (s *DockerSuite) TestRestartWithVolumes(c *check.C) {
 
 	cleanedContainerID := strings.TrimSpace(out)
 	out, err := inspectFilter(cleanedContainerID, "len .Mounts")
-	c.Assert(err, check.IsNil, check.Commentf("failed to inspect %s: %s", cleanedContainerID, out))
+	assert.NilError(c, err, "failed to inspect %s: %s", cleanedContainerID, out)
 	out = strings.Trim(out, " \n\r")
-	c.Assert(out, checker.Equals, "1")
+	assert.Equal(c, out, "1")
 
 	source, err := inspectMountSourceField(cleanedContainerID, prefix+slash+"test")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	dockerCmd(c, "restart", cleanedContainerID)
 
 	out, err = inspectFilter(cleanedContainerID, "len .Mounts")
-	c.Assert(err, check.IsNil, check.Commentf("failed to inspect %s: %s", cleanedContainerID, out))
+	assert.NilError(c, err, "failed to inspect %s: %s", cleanedContainerID, out)
 	out = strings.Trim(out, " \n\r")
-	c.Assert(out, checker.Equals, "1")
+	assert.Equal(c, out, "1")
 
 	sourceAfterRestart, err := inspectMountSourceField(cleanedContainerID, prefix+slash+"test")
-	c.Assert(err, checker.IsNil)
-	c.Assert(source, checker.Equals, sourceAfterRestart)
+	assert.NilError(c, err)
+	assert.Equal(c, source, sourceAfterRestart)
 }
 
 func (s *DockerSuite) TestRestartDisconnectedContainer(c *check.C) {
@@ -81,15 +83,15 @@ func (s *DockerSuite) TestRestartDisconnectedContainer(c *check.C) {
 	// Run a container on the default bridge network
 	out, _ := dockerCmd(c, "run", "-d", "--name", "c0", "busybox", "top")
 	cleanedContainerID := strings.TrimSpace(out)
-	c.Assert(waitRun(cleanedContainerID), checker.IsNil)
+	assert.NilError(c, waitRun(cleanedContainerID))
 
 	// Disconnect the container from the network
-	out, err := dockerCmd(c, "network", "disconnect", "bridge", "c0")
-	c.Assert(err, check.NotNil, check.Commentf("%s", out))
+	out, exitCode := dockerCmd(c, "network", "disconnect", "bridge", "c0")
+	assert.Assert(c, exitCode == 0, out)
 
 	// Restart the container
-	dockerCmd(c, "restart", "c0")
-	c.Assert(err, check.NotNil, check.Commentf("%s", out))
+	out, exitCode = dockerCmd(c, "restart", "c0")
+	assert.Assert(c, exitCode == 0, out)
 }
 
 func (s *DockerSuite) TestRestartPolicyNO(c *check.C) {
@@ -97,7 +99,7 @@ func (s *DockerSuite) TestRestartPolicyNO(c *check.C) {
 
 	id := strings.TrimSpace(string(out))
 	name := inspectField(c, id, "HostConfig.RestartPolicy.Name")
-	c.Assert(name, checker.Equals, "no")
+	assert.Equal(c, name, "no")
 }
 
 func (s *DockerSuite) TestRestartPolicyAlways(c *check.C) {
@@ -105,18 +107,18 @@ func (s *DockerSuite) TestRestartPolicyAlways(c *check.C) {
 
 	id := strings.TrimSpace(string(out))
 	name := inspectField(c, id, "HostConfig.RestartPolicy.Name")
-	c.Assert(name, checker.Equals, "always")
+	assert.Equal(c, name, "always")
 
 	MaximumRetryCount := inspectField(c, id, "HostConfig.RestartPolicy.MaximumRetryCount")
 
 	// MaximumRetryCount=0 if the restart policy is always
-	c.Assert(MaximumRetryCount, checker.Equals, "0")
+	assert.Equal(c, MaximumRetryCount, "0")
 }
 
 func (s *DockerSuite) TestRestartPolicyOnFailure(c *check.C) {
 	out, _, err := dockerCmdWithError("create", "--restart=on-failure:-1", "busybox")
-	c.Assert(err, check.NotNil, check.Commentf("%s", out))
-	c.Assert(out, checker.Contains, "maximum retry count cannot be negative")
+	assert.ErrorContains(c, err, "", out)
+	assert.Assert(c, strings.Contains(out, "maximum retry count cannot be negative"))
 
 	out, _ = dockerCmd(c, "create", "--restart=on-failure:1", "busybox")
 
@@ -124,8 +126,8 @@ func (s *DockerSuite) TestRestartPolicyOnFailure(c *check.C) {
 	name := inspectField(c, id, "HostConfig.RestartPolicy.Name")
 	maxRetry := inspectField(c, id, "HostConfig.RestartPolicy.MaximumRetryCount")
 
-	c.Assert(name, checker.Equals, "on-failure")
-	c.Assert(maxRetry, checker.Equals, "1")
+	assert.Equal(c, name, "on-failure")
+	assert.Equal(c, maxRetry, "1")
 
 	out, _ = dockerCmd(c, "create", "--restart=on-failure:0", "busybox")
 
@@ -133,8 +135,8 @@ func (s *DockerSuite) TestRestartPolicyOnFailure(c *check.C) {
 	name = inspectField(c, id, "HostConfig.RestartPolicy.Name")
 	maxRetry = inspectField(c, id, "HostConfig.RestartPolicy.MaximumRetryCount")
 
-	c.Assert(name, checker.Equals, "on-failure")
-	c.Assert(maxRetry, checker.Equals, "0")
+	assert.Equal(c, name, "on-failure")
+	assert.Equal(c, maxRetry, "0")
 
 	out, _ = dockerCmd(c, "create", "--restart=on-failure", "busybox")
 
@@ -142,8 +144,8 @@ func (s *DockerSuite) TestRestartPolicyOnFailure(c *check.C) {
 	name = inspectField(c, id, "HostConfig.RestartPolicy.Name")
 	maxRetry = inspectField(c, id, "HostConfig.RestartPolicy.MaximumRetryCount")
 
-	c.Assert(name, checker.Equals, "on-failure")
-	c.Assert(maxRetry, checker.Equals, "0")
+	assert.Equal(c, name, "on-failure")
+	assert.Equal(c, maxRetry, "0")
 }
 
 // a good container with --restart=on-failure:3
@@ -153,14 +155,13 @@ func (s *DockerSuite) TestRestartContainerwithGoodContainer(c *check.C) {
 
 	id := strings.TrimSpace(string(out))
 	err := waitInspect(id, "{{ .State.Restarting }} {{ .State.Running }}", "false false", 30*time.Second)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	count := inspectField(c, id, "RestartCount")
-	c.Assert(count, checker.Equals, "0")
+	assert.Equal(c, count, "0")
 
 	MaximumRetryCount := inspectField(c, id, "HostConfig.RestartPolicy.MaximumRetryCount")
-	c.Assert(MaximumRetryCount, checker.Equals, "3")
-
+	assert.Equal(c, MaximumRetryCount, "3")
 }
 
 func (s *DockerSuite) TestRestartContainerSuccess(c *check.C) {
@@ -171,25 +172,25 @@ func (s *DockerSuite) TestRestartContainerSuccess(c *check.C) {
 
 	out := runSleepingContainer(c, "-d", "--restart=always")
 	id := strings.TrimSpace(out)
-	c.Assert(waitRun(id), check.IsNil)
+	assert.NilError(c, waitRun(id))
 
 	pidStr := inspectField(c, id, "State.Pid")
 
 	pid, err := strconv.Atoi(pidStr)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	p, err := os.FindProcess(pid)
-	c.Assert(err, check.IsNil)
-	c.Assert(p, check.NotNil)
+	assert.NilError(c, err)
+	assert.Assert(c, p != nil)
 
 	err = p.Kill()
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	err = waitInspect(id, "{{.RestartCount}}", "1", 30*time.Second)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	err = waitInspect(id, "{{.State.Status}}", "running", 30*time.Second)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 }
 
 func (s *DockerSuite) TestRestartWithPolicyUserDefinedNetwork(c *check.C) {
@@ -198,42 +199,42 @@ func (s *DockerSuite) TestRestartWithPolicyUserDefinedNetwork(c *check.C) {
 	dockerCmd(c, "network", "create", "-d", "bridge", "udNet")
 
 	dockerCmd(c, "run", "-d", "--net=udNet", "--name=first", "busybox", "top")
-	c.Assert(waitRun("first"), check.IsNil)
+	assert.NilError(c, waitRun("first"))
 
 	dockerCmd(c, "run", "-d", "--restart=always", "--net=udNet", "--name=second",
 		"--link=first:foo", "busybox", "top")
-	c.Assert(waitRun("second"), check.IsNil)
+	assert.NilError(c, waitRun("second"))
 
 	// ping to first and its alias foo must succeed
 	_, _, err := dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "foo")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	// Now kill the second container and let the restart policy kick in
 	pidStr := inspectField(c, "second", "State.Pid")
 
 	pid, err := strconv.Atoi(pidStr)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	p, err := os.FindProcess(pid)
-	c.Assert(err, check.IsNil)
-	c.Assert(p, check.NotNil)
+	assert.NilError(c, err)
+	assert.Assert(c, p != nil)
 
 	err = p.Kill()
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	err = waitInspect("second", "{{.RestartCount}}", "1", 5*time.Second)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	err = waitInspect("second", "{{.State.Status}}", "running", 5*time.Second)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	// ping to first and its alias foo must still succeed
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "foo")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 }
 
 func (s *DockerSuite) TestRestartPolicyAfterRestart(c *check.C) {
@@ -244,29 +245,29 @@ func (s *DockerSuite) TestRestartPolicyAfterRestart(c *check.C) {
 
 	out := runSleepingContainer(c, "-d", "--restart=always")
 	id := strings.TrimSpace(out)
-	c.Assert(waitRun(id), check.IsNil)
+	assert.NilError(c, waitRun(id))
 
 	dockerCmd(c, "restart", id)
 
-	c.Assert(waitRun(id), check.IsNil)
+	assert.NilError(c, waitRun(id))
 
 	pidStr := inspectField(c, id, "State.Pid")
 
 	pid, err := strconv.Atoi(pidStr)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	p, err := os.FindProcess(pid)
-	c.Assert(err, check.IsNil)
-	c.Assert(p, check.NotNil)
+	assert.NilError(c, err)
+	assert.Assert(c, p != nil)
 
 	err = p.Kill()
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	err = waitInspect(id, "{{.RestartCount}}", "1", 30*time.Second)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	err = waitInspect(id, "{{.State.Status}}", "running", 30*time.Second)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 }
 
 func (s *DockerSuite) TestRestartContainerwithRestartPolicy(c *check.C) {
@@ -280,7 +281,7 @@ func (s *DockerSuite) TestRestartContainerwithRestartPolicy(c *check.C) {
 		waitTimeout = 150 * time.Second
 	}
 	err := waitInspect(id1, "{{ .State.Restarting }} {{ .State.Running }}", "false false", waitTimeout)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	dockerCmd(c, "restart", id1)
 	dockerCmd(c, "restart", id2)
@@ -295,9 +296,9 @@ func (s *DockerSuite) TestRestartContainerwithRestartPolicy(c *check.C) {
 	dockerCmd(c, "kill", id1)
 	dockerCmd(c, "kill", id2)
 	err = waitInspect(id1, "{{ .State.Restarting }} {{ .State.Running }}", "false false", waitTimeout)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	err = waitInspect(id2, "{{ .State.Restarting }} {{ .State.Running }}", "false false", waitTimeout)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 }
 
 func (s *DockerSuite) TestRestartAutoRemoveContainer(c *check.C) {
@@ -306,10 +307,10 @@ func (s *DockerSuite) TestRestartAutoRemoveContainer(c *check.C) {
 	id := strings.TrimSpace(string(out))
 	dockerCmd(c, "restart", id)
 	err := waitInspect(id, "{{ .State.Restarting }} {{ .State.Running }}", "false true", 15*time.Second)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, _ = dockerCmd(c, "ps")
-	c.Assert(out, checker.Contains, id[:12], check.Commentf("container should be restarted instead of removed: %v", out))
+	assert.Assert(c, is.Contains(out, id[:12]), "container should be restarted instead of removed: %v", out)
 
 	// Kill the container to make sure it will be removed
 	dockerCmd(c, "kill", id)

+ 8 - 7
integration-cli/docker_cli_rmi_test.go

@@ -10,6 +10,7 @@ import (
 	"github.com/docker/docker/integration-cli/cli/build"
 	"github.com/docker/docker/pkg/stringid"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 	"gotest.tools/icmd"
 )
 
@@ -24,7 +25,7 @@ func (s *DockerSuite) TestRmiWithContainerFails(c *check.C) {
 	// try to delete the image
 	out, _, err := dockerCmdWithError("rmi", "busybox")
 	// Container is using image, should not be able to rmi
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 	// Container is using image, error message should contain errSubstr
 	c.Assert(out, checker.Contains, errSubstr, check.Commentf("Container: %q", cleanedContainerID))
 
@@ -152,7 +153,7 @@ func (s *DockerSuite) TestRmiImageIDForceWithRunningContainersAndMultipleTags(c
 
 	out, _, err := dockerCmdWithError("rmi", "-f", imgID)
 	// rmi -f should not delete image with running containers
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(out, checker.Contains, "(cannot be forced) - image is being used by running container")
 }
 
@@ -217,7 +218,7 @@ func (s *DockerSuite) TestRmiForceWithMultipleRepositories(c *check.C) {
 func (s *DockerSuite) TestRmiBlank(c *check.C) {
 	out, _, err := dockerCmdWithError("rmi", " ")
 	// Should have failed to delete ' ' image
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 	// Wrong error message generated
 	c.Assert(out, checker.Not(checker.Contains), "no such id", check.Commentf("out: %s", out))
 	// Expected error message not generated
@@ -245,7 +246,7 @@ func (s *DockerSuite) TestRmiContainerImageNotFound(c *check.C) {
 	// Try to remove the image of the running container and see if it fails as expected.
 	out, _, err := dockerCmdWithError("rmi", "-f", imageIds[0])
 	// The image of the running container should not be removed.
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(out, checker.Contains, "image is being used by running container", check.Commentf("out: %s", out))
 }
 
@@ -284,7 +285,7 @@ RUN echo 2 #layer2
 	// Try to untag "tmp2" without the -f flag.
 	out, _, err := dockerCmdWithError("rmi", newTag)
 	// should not be untagged without the -f flag
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(out, checker.Contains, cid[:12])
 	c.Assert(out, checker.Contains, "(must force)")
 
@@ -301,7 +302,7 @@ func (*DockerSuite) TestRmiParentImageFail(c *check.C) {
 
 	id := inspectField(c, "busybox", "ID")
 	out, _, err := dockerCmdWithError("rmi", id)
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	if !strings.Contains(out, "image has dependent child images") {
 		c.Fatalf("rmi should have failed because it's a parent image, got %s", out)
 	}
@@ -330,7 +331,7 @@ func (s *DockerSuite) TestRmiByIDHardConflict(c *check.C) {
 	imgID := inspectField(c, "busybox:latest", "Id")
 
 	_, _, err := dockerCmdWithError("rmi", imgID[:12])
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 
 	// check that tag was not removed
 	imgID2 := inspectField(c, "busybox:latest", "Id")

+ 113 - 112
integration-cli/docker_cli_run_test.go

@@ -36,6 +36,7 @@ import (
 	"github.com/docker/libnetwork/resolvconf"
 	"github.com/docker/libnetwork/types"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 	"gotest.tools/icmd"
 )
 
@@ -89,8 +90,8 @@ func (s *DockerSuite) TestRunExitCodeZero(c *check.C) {
 // the exit code should be 1
 func (s *DockerSuite) TestRunExitCodeOne(c *check.C) {
 	_, exitCode, err := dockerCmdWithError("run", "busybox", "false")
-	c.Assert(err, checker.NotNil)
-	c.Assert(exitCode, checker.Equals, 1)
+	assert.ErrorContains(c, err, "")
+	assert.Equal(c, exitCode, 1)
 }
 
 // it should be possible to pipe in data via stdin to a process running in a container
@@ -220,15 +221,15 @@ func (s *DockerSuite) TestUserDefinedNetworkLinks(c *check.C) {
 
 	// ping to first and its alias foo must succeed
 	_, _, err := dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "foo")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	// ping to third and its alias must fail
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "third")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "bar")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 
 	// start third container now
 	dockerCmd(c, "run", "-d", "--net=udlinkNet", "--name=third", "busybox", "top")
@@ -236,9 +237,9 @@ func (s *DockerSuite) TestUserDefinedNetworkLinks(c *check.C) {
 
 	// ping to third and its alias must succeed now
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "third")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "bar")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 }
 
 func (s *DockerSuite) TestUserDefinedNetworkLinksWithRestart(c *check.C) {
@@ -254,9 +255,9 @@ func (s *DockerSuite) TestUserDefinedNetworkLinksWithRestart(c *check.C) {
 
 	// ping to first and its alias foo must succeed
 	_, _, err := dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "foo")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	// Restart first container
 	dockerCmd(c, "restart", "first")
@@ -264,9 +265,9 @@ func (s *DockerSuite) TestUserDefinedNetworkLinksWithRestart(c *check.C) {
 
 	// ping to first and its alias foo must still succeed
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "foo")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	// Restart second container
 	dockerCmd(c, "restart", "second")
@@ -274,9 +275,9 @@ func (s *DockerSuite) TestUserDefinedNetworkLinksWithRestart(c *check.C) {
 
 	// ping to first and its alias foo must still succeed
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "foo")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 }
 
 func (s *DockerSuite) TestRunWithNetAliasOnDefaultNetworks(c *check.C) {
@@ -285,7 +286,7 @@ func (s *DockerSuite) TestRunWithNetAliasOnDefaultNetworks(c *check.C) {
 	defaults := []string{"bridge", "host", "none"}
 	for _, net := range defaults {
 		out, _, err := dockerCmdWithError("run", "-d", "--net", net, "--net-alias", "alias_"+net, "busybox", "top")
-		c.Assert(err, checker.NotNil)
+		assert.ErrorContains(c, err, "")
 		c.Assert(out, checker.Contains, runconfig.ErrUnsupportedNetworkAndAlias.Error())
 	}
 }
@@ -312,14 +313,14 @@ func (s *DockerSuite) TestUserDefinedNetworkAlias(c *check.C) {
 
 	// ping to first and its network-scoped aliases
 	_, _, err := dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "foo1")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "foo2")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	// ping first container's short-id alias
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", stringid.TruncateID(cid1))
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	// Restart first container
 	dockerCmd(c, "restart", "first")
@@ -327,20 +328,20 @@ func (s *DockerSuite) TestUserDefinedNetworkAlias(c *check.C) {
 
 	// ping to first and its network-scoped aliases must succeed
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "first")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "foo1")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", "foo2")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	// ping first container's short-id alias
 	_, _, err = dockerCmdWithError("exec", "second", "ping", "-c", "1", stringid.TruncateID(cid1))
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 }
 
 // Issue 9677.
 func (s *DockerSuite) TestRunWithDaemonFlags(c *check.C) {
 	out, _, err := dockerCmdWithError("--exec-opt", "foo=bar", "run", "-i", "busybox", "true")
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(out, checker.Contains, "unknown flag: --exec-opt")
 }
 
@@ -623,7 +624,7 @@ func (s *DockerSuite) TestRunCreateVolumeWithSymlink(c *check.C) {
 	// Cannot run on Windows as relies on Linux-specific functionality (sh -c mount...)
 	testRequires(c, DaemonIsLinux)
 	workingDirectory, err := ioutil.TempDir("", "TestRunCreateVolumeWithSymlink")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	image := "docker-test-createvolumewithsymlink"
 
 	buildCmd := exec.Command(dockerBinary, "build", "-t", image, "-")
@@ -641,7 +642,7 @@ func (s *DockerSuite) TestRunCreateVolumeWithSymlink(c *check.C) {
 	}
 
 	volPath, err := inspectMountSourceField("test-createvolumewithsymlink", "/bar/foo")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	_, exitCode, err = dockerCmdWithError("rm", "-v", "test-createvolumewithsymlink")
 	if err != nil || exitCode != 0 {
@@ -661,7 +662,7 @@ func (s *DockerSuite) TestRunVolumesFromSymlinkPath(c *check.C) {
 	testRequires(c, DaemonIsLinux)
 
 	workingDirectory, err := ioutil.TempDir("", "TestRunVolumesFromSymlinkPath")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	name := "docker-test-volumesfromsymlinkpath"
 	prefix := ""
 	dfContents := `FROM busybox
@@ -810,7 +811,7 @@ func (s *DockerSuite) TestRunTwoConcurrentContainers(c *check.C) {
 	close(errChan)
 
 	for err := range errChan {
-		c.Assert(err, check.IsNil)
+		assert.NilError(c, err)
 	}
 }
 
@@ -1776,7 +1777,7 @@ func (s *DockerSuite) TestRunExitOnStdinClose(c *check.C) {
 	}()
 	select {
 	case err := <-finish:
-		c.Assert(err, check.IsNil)
+		assert.NilError(c, err)
 	case <-time.After(time.Duration(delay) * time.Second):
 		c.Fatal("docker run failed to exit on stdin close")
 	}
@@ -1795,7 +1796,7 @@ func (s *DockerSuite) TestRunInteractiveWithRestartPolicy(c *check.C) {
 		Command: []string{dockerBinary, "run", "-i", "--name", name, "--restart=always", "busybox", "sh"},
 		Stdin:   bytes.NewBufferString("exit 11"),
 	})
-	c.Assert(result.Error, checker.IsNil)
+	assert.NilError(c, result.Error)
 	defer func() {
 		dockerCmdWithResult("stop", name).Assert(c, icmd.Success)
 	}()
@@ -2222,7 +2223,7 @@ func (s *DockerSuite) TestRunVolumesCleanPaths(c *check.C) {
 	}
 
 	out, err = inspectMountSourceField("dark_helmet", prefix+slash+`foo`)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	if !strings.Contains(strings.ToLower(out), strings.ToLower(testEnv.PlatformDefaults.VolumesConfigPath)) {
 		c.Fatalf("Volume was not defined for %s/foo\n%q", prefix, out)
 	}
@@ -2233,7 +2234,7 @@ func (s *DockerSuite) TestRunVolumesCleanPaths(c *check.C) {
 	}
 
 	out, err = inspectMountSourceField("dark_helmet", prefix+slash+"bar")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	if !strings.Contains(strings.ToLower(out), strings.ToLower(testEnv.PlatformDefaults.VolumesConfigPath)) {
 		c.Fatalf("Volume was not defined for %s/bar\n%q", prefix, out)
 	}
@@ -2396,7 +2397,7 @@ func (s *DockerSuite) TestRunMountShmMqueueFromHost(c *check.C) {
 	defer os.Remove("/dev/mqueue/toto")
 	defer os.Remove("/dev/shm/test")
 	volPath, err := inspectMountSourceField("shmfromhost", "/dev/shm")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	if volPath != "/dev/shm" {
 		c.Fatalf("volumePath should have been /dev/shm, was %s", volPath)
 	}
@@ -2418,7 +2419,7 @@ func (s *DockerSuite) TestContainerNetworkMode(c *check.C) {
 
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 	id := strings.TrimSpace(out)
-	c.Assert(waitRun(id), check.IsNil)
+	assert.NilError(c, waitRun(id))
 	pid1 := inspectField(c, id, "State.Pid")
 
 	parentContainerNet, err := os.Readlink(fmt.Sprintf("/proc/%s/ns/net", pid1))
@@ -2554,7 +2555,7 @@ func (s *DockerSuite) TestRunTTYWithPipe(c *check.C) {
 
 	select {
 	case err := <-errChan:
-		c.Assert(err, check.IsNil)
+		assert.NilError(c, err)
 	case <-time.After(30 * time.Second):
 		c.Fatal("container is running but should have failed")
 	}
@@ -2638,7 +2639,7 @@ func (s *DockerSuite) TestRunAllowPortRangeThroughPublish(c *check.C) {
 
 	var ports nat.PortMap
 	err := json.Unmarshal([]byte(portstr), &ports)
-	c.Assert(err, checker.IsNil, check.Commentf("failed to unmarshal: %v", portstr))
+	assert.NilError(c, err, "failed to unmarshal: %v", portstr)
 	for port, binding := range ports {
 		portnum, _ := strconv.Atoi(strings.Split(string(port), "/")[0])
 		if portnum < 3000 || portnum > 3003 {
@@ -2716,11 +2717,11 @@ func (s *DockerSuite) TestPermissionsPtsReadonlyRootfs(c *check.C) {
 func testReadOnlyFile(c *check.C, testPriv bool, filenames ...string) {
 	touch := "touch " + strings.Join(filenames, " ")
 	out, _, err := dockerCmdWithError("run", "--read-only", "--rm", "busybox", "sh", "-c", touch)
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 
 	for _, f := range filenames {
 		expected := "touch: " + f + ": Read-only file system"
-		c.Assert(out, checker.Contains, expected)
+		assert.Assert(c, strings.Contains(out, expected))
 	}
 
 	if !testPriv {
@@ -2728,11 +2729,11 @@ func testReadOnlyFile(c *check.C, testPriv bool, filenames ...string) {
 	}
 
 	out, _, err = dockerCmdWithError("run", "--read-only", "--privileged", "--rm", "busybox", "sh", "-c", touch)
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 
 	for _, f := range filenames {
 		expected := "touch: " + f + ": Read-only file system"
-		c.Assert(out, checker.Contains, expected)
+		assert.Assert(c, strings.Contains(out, expected))
 	}
 }
 
@@ -2825,7 +2826,7 @@ func (s *DockerSuite) TestRunPIDHostWithChildIsKillable(c *check.C) {
 	}()
 	select {
 	case err := <-errchan:
-		c.Assert(err, check.IsNil)
+		assert.NilError(c, err)
 	case <-time.After(5 * time.Second):
 		c.Fatal("Kill container timed out")
 	}
@@ -3031,14 +3032,14 @@ func (s *DockerSuite) TestVolumeFromMixedRWOptions(c *check.C) {
 
 	if testEnv.OSType != "windows" {
 		mRO, err := inspectMountPoint("test-volumes-1", prefix+slash+"test")
-		c.Assert(err, checker.IsNil, check.Commentf("failed to inspect mount point"))
+		assert.NilError(c, err, "failed to inspect mount point")
 		if mRO.RW {
 			c.Fatalf("Expected RO volume was RW")
 		}
 	}
 
 	mRW, err := inspectMountPoint("test-volumes-2", prefix+slash+"test")
-	c.Assert(err, checker.IsNil, check.Commentf("failed to inspect mount point"))
+	assert.NilError(c, err, "failed to inspect mount point")
 	if !mRW.RW {
 		c.Fatalf("Expected RW volume was RO")
 	}
@@ -3152,7 +3153,7 @@ func (s *DockerSuite) TestPtraceContainerProcsFromHost(c *check.C) {
 
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 	id := strings.TrimSpace(out)
-	c.Assert(waitRun(id), check.IsNil)
+	assert.NilError(c, waitRun(id))
 	pid1 := inspectField(c, id, "State.Pid")
 
 	_, err := os.Readlink(fmt.Sprintf("/proc/%s/ns/net", pid1))
@@ -3501,18 +3502,18 @@ func (s *DockerSuite) TestContainersNetworkIsolation(c *check.C) {
 
 	// Check Isolation between containers : ping must fail
 	_, _, err := dockerCmdWithError("exec", "first", "ping", "-c", "1", "second")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	// Connect first container to testnetwork2
 	dockerCmd(c, "network", "connect", "testnetwork2", "first")
 	// ping must succeed now
 	_, _, err = dockerCmdWithError("exec", "first", "ping", "-c", "1", "second")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	// Disconnect first container from testnetwork2
 	dockerCmd(c, "network", "disconnect", "testnetwork2", "first")
 	// ping must fail again
 	_, _, err = dockerCmdWithError("exec", "first", "ping", "-c", "1", "second")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 }
 
 func (s *DockerSuite) TestNetworkRmWithActiveContainers(c *check.C) {
@@ -3526,11 +3527,11 @@ func (s *DockerSuite) TestNetworkRmWithActiveContainers(c *check.C) {
 	c.Assert(waitRun("second"), check.IsNil)
 	// Network delete with active containers must fail
 	_, _, err := dockerCmdWithError("network", "rm", "testnetwork1")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 
 	dockerCmd(c, "stop", "first")
 	_, _, err = dockerCmdWithError("network", "rm", "testnetwork1")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 }
 
 func (s *DockerSuite) TestContainerRestartInMultipleNetworks(c *check.C) {
@@ -3555,9 +3556,9 @@ func (s *DockerSuite) TestContainerRestartInMultipleNetworks(c *check.C) {
 	// Stop second container and test ping failures on both networks
 	dockerCmd(c, "stop", "second")
 	_, _, err := dockerCmdWithError("exec", "first", "ping", "-c", "1", "second.testnetwork1")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	_, _, err = dockerCmdWithError("exec", "first", "ping", "-c", "1", "second.testnetwork2")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 
 	// Start second container and connectivity must be restored on both networks
 	dockerCmd(c, "start", "second")
@@ -3576,7 +3577,7 @@ func (s *DockerSuite) TestContainerWithConflictingHostNetworks(c *check.C) {
 
 	// Connecting to the user defined network must fail
 	_, _, err := dockerCmdWithError("network", "connect", "testnetwork1", "first")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 }
 
 func (s *DockerSuite) TestContainerWithConflictingSharedNetwork(c *check.C) {
@@ -3592,7 +3593,7 @@ func (s *DockerSuite) TestContainerWithConflictingSharedNetwork(c *check.C) {
 
 	// Connecting to the user defined network must fail
 	out, _, err := dockerCmdWithError("network", "connect", "testnetwork1", "second")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(out, checker.Contains, runconfig.ErrConflictSharedNetwork.Error())
 }
 
@@ -3606,7 +3607,7 @@ func (s *DockerSuite) TestContainerWithConflictingNoneNetwork(c *check.C) {
 
 	// Connecting to the user defined network must fail
 	out, _, err := dockerCmdWithError("network", "connect", "testnetwork1", "first")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(out, checker.Contains, runconfig.ErrConflictNoNetwork.Error())
 
 	// create a container connected to testnetwork1
@@ -3615,14 +3616,14 @@ func (s *DockerSuite) TestContainerWithConflictingNoneNetwork(c *check.C) {
 
 	// Connect second container to none network. it must fail as well
 	_, _, err = dockerCmdWithError("network", "connect", "none", "second")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 }
 
 // #11957 - stdin with no tty does not exit if stdin is not closed even though container exited
 func (s *DockerSuite) TestRunStdinBlockedAfterContainerExit(c *check.C) {
 	cmd := exec.Command(dockerBinary, "run", "-i", "--name=test", "busybox", "true")
 	in, err := cmd.StdinPipe()
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	defer in.Close()
 	stdout := bytes.NewBuffer(nil)
 	cmd.Stdout = stdout
@@ -3646,7 +3647,7 @@ func (s *DockerSuite) TestRunWrongCpusetCpusFlagValue(c *check.C) {
 	// TODO Windows: This needs validation (error out) in the daemon.
 	testRequires(c, DaemonIsLinux)
 	out, exitCode, err := dockerCmdWithError("run", "--cpuset-cpus", "1-10,11--", "busybox", "true")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	expected := "Error response from daemon: Invalid value 1-10,11-- for cpuset cpus.\n"
 	if !(strings.Contains(out, expected) || exitCode == 125) {
 		c.Fatalf("Expected output to contain %q with exitCode 125, got out: %q exitCode: %v", expected, out, exitCode)
@@ -3657,7 +3658,7 @@ func (s *DockerSuite) TestRunWrongCpusetMemsFlagValue(c *check.C) {
 	// TODO Windows: This needs validation (error out) in the daemon.
 	testRequires(c, DaemonIsLinux)
 	out, exitCode, err := dockerCmdWithError("run", "--cpuset-mems", "1-42--", "busybox", "true")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	expected := "Error response from daemon: Invalid value 1-42-- for cpuset mems.\n"
 	if !(strings.Contains(out, expected) || exitCode == 125) {
 		c.Fatalf("Expected output to contain %q with exitCode 125, got out: %q exitCode: %v", expected, out, exitCode)
@@ -3760,13 +3761,13 @@ func (s *DockerSuite) TestRunWithOomScoreAdjInvalidRange(c *check.C) {
 	testRequires(c, DaemonIsLinux)
 
 	out, _, err := dockerCmdWithError("run", "--oom-score-adj", "1001", "busybox", "true")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	expected := "Invalid value 1001, range for oom score adj is [-1000, 1000]."
 	if !strings.Contains(out, expected) {
 		c.Fatalf("Expected output to contain %q, got %q instead", expected, out)
 	}
 	out, _, err = dockerCmdWithError("run", "--oom-score-adj", "-1001", "busybox", "true")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	expected = "Invalid value -1001, range for oom score adj is [-1000, 1000]."
 	if !strings.Contains(out, expected) {
 		c.Fatalf("Expected output to contain %q, got %q instead", expected, out)
@@ -3882,13 +3883,13 @@ func (s *DockerSuite) TestRunNamedVolumeNotRemoved(c *check.C) {
 	dockerCmd(c, "run", "--rm", "-v", "test:"+prefix+"/foo", "-v", prefix+"/bar", "busybox", "true")
 	dockerCmd(c, "volume", "inspect", "test")
 	out, _ := dockerCmd(c, "volume", "ls", "-q")
-	c.Assert(strings.TrimSpace(out), checker.Contains, "test")
+	assert.Assert(c, strings.Contains(out, "test"))
 
 	dockerCmd(c, "run", "--name=test", "-v", "test:"+prefix+"/foo", "-v", prefix+"/bar", "busybox", "true")
 	dockerCmd(c, "rm", "-fv", "test")
 	dockerCmd(c, "volume", "inspect", "test")
 	out, _ = dockerCmd(c, "volume", "ls", "-q")
-	c.Assert(strings.TrimSpace(out), checker.Contains, "test")
+	assert.Assert(c, strings.Contains(out, "test"))
 }
 
 func (s *DockerSuite) TestRunNamedVolumesFromNotRemoved(c *check.C) {
@@ -3899,11 +3900,11 @@ func (s *DockerSuite) TestRunNamedVolumesFromNotRemoved(c *check.C) {
 	dockerCmd(c, "run", "--name=child", "--volumes-from=parent", "busybox", "true")
 
 	cli, err := client.NewClientWithOpts(client.FromEnv)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer cli.Close()
 
 	container, err := cli.ContainerInspect(context.Background(), strings.TrimSpace(cid))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	var vname string
 	for _, v := range container.Mounts {
 		if v.Name != "test" {
@@ -3918,7 +3919,7 @@ func (s *DockerSuite) TestRunNamedVolumesFromNotRemoved(c *check.C) {
 	dockerCmd(c, "rm", "-fv", "child")
 	dockerCmd(c, "volume", "inspect", "test")
 	out, _ := dockerCmd(c, "volume", "ls", "-q")
-	c.Assert(strings.TrimSpace(out), checker.Contains, "test")
+	assert.Assert(c, strings.Contains(out, "test"))
 	c.Assert(strings.TrimSpace(out), checker.Not(checker.Contains), vname)
 }
 
@@ -3930,7 +3931,7 @@ func (s *DockerSuite) TestRunAttachFailedNoLeak(c *check.C) {
 	// otherwise report build 9200.
 	if runtime.GOOS == "windows" {
 		v, err := kernel.GetKernelVersion()
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 		build, _ := strconv.Atoi(strings.Split(strings.SplitN(v.String(), " ", 3)[2][1:], ".")[0])
 		if build == 16299 {
 			c.Skip("Temporarily disabled on RS3 builds")
@@ -3938,7 +3939,7 @@ func (s *DockerSuite) TestRunAttachFailedNoLeak(c *check.C) {
 	}
 
 	nroutines, err := getGoroutineNumber()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	runSleepingContainer(c, "--name=test", "-p", "8000:8000")
 
@@ -3968,7 +3969,7 @@ func (s *DockerSuite) TestRunVolumeWithOneCharacter(c *check.C) {
 	testRequires(c, DaemonIsLinux)
 
 	out, _ := dockerCmd(c, "run", "-v", "/tmp/q:/foo", "busybox", "sh", "-c", "find /foo")
-	c.Assert(strings.TrimSpace(out), checker.Equals, "/foo")
+	assert.Equal(c, strings.TrimSpace(out), "/foo")
 }
 
 func (s *DockerSuite) TestRunVolumeCopyFlag(c *check.C) {
@@ -3980,29 +3981,29 @@ func (s *DockerSuite) TestRunVolumeCopyFlag(c *check.C) {
 
 	// test with the nocopy flag
 	out, _, err := dockerCmdWithError("run", "-v", "test:/foo:nocopy", "volumecopy")
-	c.Assert(err, checker.NotNil, check.Commentf("%s", out))
+	assert.ErrorContains(c, err, "", out)
 	// test default behavior which is to copy for non-binds
 	out, _ = dockerCmd(c, "run", "-v", "test:/foo", "volumecopy")
-	c.Assert(strings.TrimSpace(out), checker.Equals, "hello")
+	assert.Equal(c, strings.TrimSpace(out), "hello")
 	// error out when the volume is already populated
 	out, _, err = dockerCmdWithError("run", "-v", "test:/foo:copy", "volumecopy")
-	c.Assert(err, checker.NotNil, check.Commentf("%s", out))
+	assert.ErrorContains(c, err, "", out)
 	// do not error out when copy isn't explicitly set even though it's already populated
 	out, _ = dockerCmd(c, "run", "-v", "test:/foo", "volumecopy")
-	c.Assert(strings.TrimSpace(out), checker.Equals, "hello")
+	assert.Equal(c, strings.TrimSpace(out), "hello")
 
 	// do not allow copy modes on volumes-from
 	dockerCmd(c, "run", "--name=test", "-v", "/foo", "busybox", "true")
 	out, _, err = dockerCmdWithError("run", "--volumes-from=test:copy", "busybox", "true")
-	c.Assert(err, checker.NotNil, check.Commentf("%s", out))
+	assert.ErrorContains(c, err, "", out)
 	out, _, err = dockerCmdWithError("run", "--volumes-from=test:nocopy", "busybox", "true")
-	c.Assert(err, checker.NotNil, check.Commentf("%s", out))
+	assert.ErrorContains(c, err, "", out)
 
 	// do not allow copy modes on binds
 	out, _, err = dockerCmdWithError("run", "-v", "/foo:/bar:copy", "busybox", "true")
-	c.Assert(err, checker.NotNil, check.Commentf("%s", out))
+	assert.ErrorContains(c, err, "", out)
 	out, _, err = dockerCmdWithError("run", "-v", "/foo:/bar:nocopy", "busybox", "true")
-	c.Assert(err, checker.NotNil, check.Commentf("%s", out))
+	assert.ErrorContains(c, err, "", out)
 }
 
 // Test case for #21976
@@ -4054,7 +4055,7 @@ func (s *DockerSuite) TestRunRmAndWait(c *check.C) {
 
 	out, code, err := dockerCmdWithError("wait", "test")
 	c.Assert(err, checker.IsNil, check.Commentf("out: %s; exit code: %d", out, code))
-	c.Assert(out, checker.Equals, "2\n", check.Commentf("exit code: %d", code))
+	assert.Equal(c, out, "2\n", "exit code: %d", code)
 	c.Assert(code, checker.Equals, 0)
 }
 
@@ -4117,29 +4118,29 @@ func (s *DockerDaemonSuite) TestRunWithUlimitAndDaemonDefault(c *check.C) {
 
 	name := "test-A"
 	_, err := s.d.Cmd("run", "--name", name, "-d", "busybox", "top")
-	c.Assert(err, checker.IsNil)
-	c.Assert(s.d.WaitRun(name), check.IsNil)
+	assert.NilError(c, err)
+	assert.NilError(c, s.d.WaitRun(name))
 
 	out, err := s.d.Cmd("inspect", "--format", "{{.HostConfig.Ulimits}}", name)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(out, checker.Contains, "[nofile=65535:65535]")
 
 	name = "test-B"
 	_, err = s.d.Cmd("run", "--name", name, "--ulimit=nofile=42", "-d", "busybox", "top")
-	c.Assert(err, checker.IsNil)
-	c.Assert(s.d.WaitRun(name), check.IsNil)
+	assert.NilError(c, err)
+	assert.NilError(c, s.d.WaitRun(name))
 
 	out, err = s.d.Cmd("inspect", "--format", "{{.HostConfig.Ulimits}}", name)
-	c.Assert(err, checker.IsNil)
-	c.Assert(out, checker.Contains, "[nofile=42:42]")
+	assert.NilError(c, err)
+	assert.Assert(c, strings.Contains(out, "[nofile=42:42]"))
 }
 
 func (s *DockerSuite) TestRunStoppedLoggingDriverNoLeak(c *check.C) {
 	nroutines, err := getGoroutineNumber()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, _, err := dockerCmdWithError("run", "--name=fail", "--log-driver=splunk", "busybox", "true")
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(out, checker.Contains, "failed to initialize logging driver", check.Commentf("error should be about logging driver, got output %s", out))
 
 	// NGoroutines is not updated right away, so we need to wait before failing
@@ -4187,7 +4188,7 @@ func (s *DockerSuite) TestRunDuplicateMount(c *check.C) {
 	testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux, NotUserNamespace)
 
 	tmpFile, err := ioutil.TempFile("", "touch-me")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer tmpFile.Close()
 
 	data := "touch-me-foo-bar\n"
@@ -4208,30 +4209,30 @@ func (s *DockerSuite) TestRunWindowsWithCPUCount(c *check.C) {
 	testRequires(c, DaemonIsWindows)
 
 	out, _ := dockerCmd(c, "run", "--cpu-count=1", "--name", "test", "busybox", "echo", "testing")
-	c.Assert(strings.TrimSpace(out), checker.Equals, "testing")
+	assert.Equal(c, strings.TrimSpace(out), "testing")
 
 	out = inspectField(c, "test", "HostConfig.CPUCount")
-	c.Assert(out, check.Equals, "1")
+	assert.Equal(c, out, "1")
 }
 
 func (s *DockerSuite) TestRunWindowsWithCPUShares(c *check.C) {
 	testRequires(c, DaemonIsWindows)
 
 	out, _ := dockerCmd(c, "run", "--cpu-shares=1000", "--name", "test", "busybox", "echo", "testing")
-	c.Assert(strings.TrimSpace(out), checker.Equals, "testing")
+	assert.Equal(c, strings.TrimSpace(out), "testing")
 
 	out = inspectField(c, "test", "HostConfig.CPUShares")
-	c.Assert(out, check.Equals, "1000")
+	assert.Equal(c, out, "1000")
 }
 
 func (s *DockerSuite) TestRunWindowsWithCPUPercent(c *check.C) {
 	testRequires(c, DaemonIsWindows)
 
 	out, _ := dockerCmd(c, "run", "--cpu-percent=80", "--name", "test", "busybox", "echo", "testing")
-	c.Assert(strings.TrimSpace(out), checker.Equals, "testing")
+	assert.Equal(c, strings.TrimSpace(out), "testing")
 
 	out = inspectField(c, "test", "HostConfig.CPUPercent")
-	c.Assert(out, check.Equals, "80")
+	assert.Equal(c, out, "80")
 }
 
 func (s *DockerSuite) TestRunProcessIsolationWithCPUCountCPUSharesAndCPUPercent(c *check.C) {
@@ -4243,13 +4244,13 @@ func (s *DockerSuite) TestRunProcessIsolationWithCPUCountCPUSharesAndCPUPercent(
 	c.Assert(strings.TrimSpace(out), checker.Contains, "testing")
 
 	out = inspectField(c, "test", "HostConfig.CPUCount")
-	c.Assert(out, check.Equals, "1")
+	assert.Equal(c, out, "1")
 
 	out = inspectField(c, "test", "HostConfig.CPUShares")
-	c.Assert(out, check.Equals, "0")
+	assert.Equal(c, out, "0")
 
 	out = inspectField(c, "test", "HostConfig.CPUPercent")
-	c.Assert(out, check.Equals, "0")
+	assert.Equal(c, out, "0")
 }
 
 func (s *DockerSuite) TestRunHypervIsolationWithCPUCountCPUSharesAndCPUPercent(c *check.C) {
@@ -4259,13 +4260,13 @@ func (s *DockerSuite) TestRunHypervIsolationWithCPUCountCPUSharesAndCPUPercent(c
 	c.Assert(strings.TrimSpace(out), checker.Contains, "testing")
 
 	out = inspectField(c, "test", "HostConfig.CPUCount")
-	c.Assert(out, check.Equals, "1")
+	assert.Equal(c, out, "1")
 
 	out = inspectField(c, "test", "HostConfig.CPUShares")
-	c.Assert(out, check.Equals, "1000")
+	assert.Equal(c, out, "1000")
 
 	out = inspectField(c, "test", "HostConfig.CPUPercent")
-	c.Assert(out, check.Equals, "80")
+	assert.Equal(c, out, "80")
 }
 
 // Test for #25099
@@ -4275,16 +4276,16 @@ func (s *DockerSuite) TestRunEmptyEnv(c *check.C) {
 	expectedOutput := "invalid environment variable:"
 
 	out, _, err := dockerCmdWithError("run", "-e", "", "busybox", "true")
-	c.Assert(err, checker.NotNil)
-	c.Assert(out, checker.Contains, expectedOutput)
+	assert.ErrorContains(c, err, "")
+	assert.Assert(c, strings.Contains(out, expectedOutput))
 
 	out, _, err = dockerCmdWithError("run", "-e", "=", "busybox", "true")
-	c.Assert(err, checker.NotNil)
-	c.Assert(out, checker.Contains, expectedOutput)
+	assert.ErrorContains(c, err, "")
+	assert.Assert(c, strings.Contains(out, expectedOutput))
 
 	out, _, err = dockerCmdWithError("run", "-e", "=foo", "busybox", "true")
-	c.Assert(err, checker.NotNil)
-	c.Assert(out, checker.Contains, expectedOutput)
+	assert.ErrorContains(c, err, "")
+	assert.Assert(c, strings.Contains(out, expectedOutput))
 }
 
 // #28658
@@ -4306,7 +4307,7 @@ func (s *DockerSuite) TestSlowStdinClosing(c *check.C) {
 		case <-time.After(30 * time.Second):
 			c.Fatal("running container timed out") // cleanup in teardown
 		case err := <-done:
-			c.Assert(err, checker.IsNil)
+			assert.NilError(c, err)
 		}
 	}
 }
@@ -4322,12 +4323,12 @@ func (s *delayedReader) Read([]byte) (int, error) {
 func (s *DockerSuite) TestRunMountReadOnlyDevShm(c *check.C) {
 	testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux, NotUserNamespace)
 	emptyDir, err := ioutil.TempDir("", "test-read-only-dev-shm")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	defer os.RemoveAll(emptyDir)
 	out, _, err := dockerCmdWithError("run", "--rm", "--read-only",
 		"-v", fmt.Sprintf("%s:/dev/shm:ro", emptyDir),
 		"busybox", "touch", "/dev/shm/foo")
-	c.Assert(err, checker.NotNil, check.Commentf("%s", out))
+	assert.ErrorContains(c, err, "", out)
 	c.Assert(out, checker.Contains, "Read-only file system")
 }
 
@@ -4516,7 +4517,7 @@ func (s *DockerSuite) TestRunHostnameFQDN(c *check.C) {
 
 	expectedOutput := "foobar.example.com\nfoobar.example.com\nfoobar\nexample.com\nfoobar.example.com"
 	out, _ := dockerCmd(c, "run", "--hostname=foobar.example.com", "busybox", "sh", "-c", `cat /etc/hostname && hostname && hostname -s && hostname -d && hostname -f`)
-	c.Assert(strings.TrimSpace(out), checker.Equals, expectedOutput)
+	assert.Equal(c, strings.TrimSpace(out), expectedOutput)
 
 	out, _ = dockerCmd(c, "run", "--hostname=foobar.example.com", "busybox", "sh", "-c", `cat /etc/hosts`)
 	expectedOutput = "foobar.example.com foobar"
@@ -4529,7 +4530,7 @@ func (s *DockerSuite) TestRunHostnameInHostMode(c *check.C) {
 
 	expectedOutput := "foobar\nfoobar"
 	out, _ := dockerCmd(c, "run", "--net=host", "--hostname=foobar", "busybox", "sh", "-c", `echo $HOSTNAME && hostname`)
-	c.Assert(strings.TrimSpace(out), checker.Equals, expectedOutput)
+	assert.Equal(c, strings.TrimSpace(out), expectedOutput)
 }
 
 func (s *DockerSuite) TestRunAddDeviceCgroupRule(c *check.C) {
@@ -4543,12 +4544,12 @@ func (s *DockerSuite) TestRunAddDeviceCgroupRule(c *check.C) {
 	}
 
 	out, _ = dockerCmd(c, "run", "--rm", fmt.Sprintf("--device-cgroup-rule=%s", deviceRule), "busybox", "grep", deviceRule, "/sys/fs/cgroup/devices/devices.list")
-	c.Assert(strings.TrimSpace(out), checker.Equals, deviceRule)
+	assert.Equal(c, strings.TrimSpace(out), deviceRule)
 }
 
 // Verifies that running as local system is operating correctly on Windows
 func (s *DockerSuite) TestWindowsRunAsSystem(c *check.C) {
 	testRequires(c, DaemonIsWindowsAtLeastBuild(15000))
 	out, _ := dockerCmd(c, "run", "--net=none", `--user=nt authority\system`, "--hostname=XYZZY", minimalBaseImage(), "cmd", "/c", `@echo %USERNAME%`)
-	c.Assert(strings.TrimSpace(out), checker.Equals, "XYZZY$")
+	assert.Equal(c, strings.TrimSpace(out), "XYZZY$")
 }

+ 103 - 102
integration-cli/docker_cli_run_unix_test.go

@@ -27,6 +27,7 @@ import (
 	"github.com/docker/docker/pkg/sysinfo"
 	"github.com/go-check/check"
 	"github.com/kr/pty"
+	"gotest.tools/assert"
 	"gotest.tools/icmd"
 )
 
@@ -39,7 +40,7 @@ func (s *DockerSuite) TestRunRedirectStdout(c *check.C) {
 		cmd.Stdin = tty
 		cmd.Stdout = tty
 		cmd.Stderr = tty
-		c.Assert(cmd.Start(), checker.IsNil)
+		assert.NilError(c, cmd.Start())
 		ch := make(chan error)
 		go func() {
 			ch <- cmd.Wait()
@@ -63,7 +64,7 @@ func (s *DockerSuite) TestRunWithVolumesIsRecursive(c *check.C) {
 	// /tmp gets permission denied
 	testRequires(c, NotUserNamespace, testEnv.IsLocalDaemon)
 	tmpDir, err := ioutil.TempDir("", "docker_recursive_mount_test")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	defer os.RemoveAll(tmpDir)
 
@@ -73,7 +74,7 @@ func (s *DockerSuite) TestRunWithVolumesIsRecursive(c *check.C) {
 	c.Assert(mount.Mount("tmpfs", tmpfsDir, "tmpfs", ""), checker.IsNil, check.Commentf("failed to create a tmpfs mount at %s", tmpfsDir))
 
 	f, err := ioutil.TempFile(tmpfsDir, "touch-me")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer f.Close()
 
 	out, _ := dockerCmd(c, "run", "--name", "test-data", "--volume", fmt.Sprintf("%s:/tmp:ro", tmpDir), "busybox:latest", "ls", "/tmp/tmpfs")
@@ -101,27 +102,27 @@ func (s *DockerSuite) TestRunAttachDetach(c *check.C) {
 
 	cmd := exec.Command(dockerBinary, "attach", name)
 	stdout, err := cmd.StdoutPipe()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	cpty, tty, err := pty.Open()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer cpty.Close()
 	cmd.Stdin = tty
-	c.Assert(cmd.Start(), checker.IsNil)
+	assert.NilError(c, cmd.Start())
 	c.Assert(waitRun(name), check.IsNil)
 
 	_, err = cpty.Write([]byte("hello\n"))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, err := bufio.NewReader(stdout).ReadString('\n')
-	c.Assert(err, checker.IsNil)
-	c.Assert(strings.TrimSpace(out), checker.Equals, "hello")
+	assert.NilError(c, err)
+	assert.Equal(c, strings.TrimSpace(out), "hello")
 
 	// escape sequence
 	_, err = cpty.Write([]byte{16})
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	time.Sleep(100 * time.Millisecond)
 	_, err = cpty.Write([]byte{17})
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	ch := make(chan struct{})
 	go func() {
@@ -235,7 +236,7 @@ func (s *DockerSuite) TestRunAttachDetachFromInvalidFlag(c *check.C) {
 	}
 	// it should print a warning to indicate the detach key flag is invalid
 	errStr := "Invalid detach keys (ctrl-A,a) provided"
-	c.Assert(strings.TrimSpace(out), checker.Equals, errStr)
+	assert.Equal(c, strings.TrimSpace(out), errStr)
 }
 
 // TestRunAttachDetachFromConfig checks attaching and detaching with the escape sequence specified via config file.
@@ -247,7 +248,7 @@ func (s *DockerSuite) TestRunAttachDetachFromConfig(c *check.C) {
 	homeKey := homedir.Key()
 	homeVal := homedir.Get()
 	tmpDir, err := ioutil.TempDir("", "fake-home")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer os.RemoveAll(tmpDir)
 
 	dotDocker := filepath.Join(tmpDir, ".docker")
@@ -262,7 +263,7 @@ func (s *DockerSuite) TestRunAttachDetachFromConfig(c *check.C) {
 	}`
 
 	err = ioutil.WriteFile(tmpCfg, []byte(data), 0600)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	// Then do the work
 	name := "attach-detach"
@@ -330,7 +331,7 @@ func (s *DockerSuite) TestRunAttachDetachKeysOverrideConfig(c *check.C) {
 	homeKey := homedir.Key()
 	homeVal := homedir.Get()
 	tmpDir, err := ioutil.TempDir("", "fake-home")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer os.RemoveAll(tmpDir)
 
 	dotDocker := filepath.Join(tmpDir, ".docker")
@@ -345,7 +346,7 @@ func (s *DockerSuite) TestRunAttachDetachKeysOverrideConfig(c *check.C) {
 	}`
 
 	err = ioutil.WriteFile(tmpCfg, []byte(data), 0600)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	// Then do the work
 	name := "attach-detach"
@@ -460,10 +461,10 @@ func (s *DockerSuite) TestRunWithCPUQuota(c *check.C) {
 
 	file := "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"
 	out, _ := dockerCmd(c, "run", "--cpu-quota", "8000", "--name", "test", "busybox", "cat", file)
-	c.Assert(strings.TrimSpace(out), checker.Equals, "8000")
+	assert.Equal(c, strings.TrimSpace(out), "8000")
 
 	out = inspectField(c, "test", "HostConfig.CpuQuota")
-	c.Assert(out, checker.Equals, "8000", check.Commentf("setting the CPU CFS quota failed"))
+	assert.Equal(c, out, "8000", "setting the CPU CFS quota failed")
 }
 
 func (s *DockerSuite) TestRunWithCpuPeriod(c *check.C) {
@@ -471,29 +472,29 @@ func (s *DockerSuite) TestRunWithCpuPeriod(c *check.C) {
 
 	file := "/sys/fs/cgroup/cpu/cpu.cfs_period_us"
 	out, _ := dockerCmd(c, "run", "--cpu-period", "50000", "--name", "test", "busybox", "cat", file)
-	c.Assert(strings.TrimSpace(out), checker.Equals, "50000")
+	assert.Equal(c, strings.TrimSpace(out), "50000")
 
 	out, _ = dockerCmd(c, "run", "--cpu-period", "0", "busybox", "cat", file)
-	c.Assert(strings.TrimSpace(out), checker.Equals, "100000")
+	assert.Equal(c, strings.TrimSpace(out), "100000")
 
 	out = inspectField(c, "test", "HostConfig.CpuPeriod")
-	c.Assert(out, checker.Equals, "50000", check.Commentf("setting the CPU CFS period failed"))
+	assert.Equal(c, out, "50000", "setting the CPU CFS period failed")
 }
 
 func (s *DockerSuite) TestRunWithInvalidCpuPeriod(c *check.C) {
 	testRequires(c, cpuCfsPeriod)
 	out, _, err := dockerCmdWithError("run", "--cpu-period", "900", "busybox", "true")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	expected := "CPU cfs period can not be less than 1ms (i.e. 1000) or larger than 1s (i.e. 1000000)"
-	c.Assert(out, checker.Contains, expected)
+	assert.Assert(c, strings.Contains(out, expected))
 
 	out, _, err = dockerCmdWithError("run", "--cpu-period", "2000000", "busybox", "true")
-	c.Assert(err, check.NotNil)
-	c.Assert(out, checker.Contains, expected)
+	assert.ErrorContains(c, err, "")
+	assert.Assert(c, strings.Contains(out, expected))
 
 	out, _, err = dockerCmdWithError("run", "--cpu-period", "-3", "busybox", "true")
-	c.Assert(err, check.NotNil)
-	c.Assert(out, checker.Contains, expected)
+	assert.ErrorContains(c, err, "")
+	assert.Assert(c, strings.Contains(out, expected))
 }
 
 func (s *DockerSuite) TestRunWithKernelMemory(c *check.C) {
@@ -513,14 +514,14 @@ func (s *DockerSuite) TestRunWithInvalidKernelMemory(c *check.C) {
 	testRequires(c, DaemonIsLinux, kernelMemorySupport)
 
 	out, _, err := dockerCmdWithError("run", "--kernel-memory", "2M", "busybox", "true")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	expected := "Minimum kernel memory limit allowed is 4MB"
-	c.Assert(out, checker.Contains, expected)
+	assert.Assert(c, strings.Contains(out, expected))
 
 	out, _, err = dockerCmdWithError("run", "--kernel-memory", "-16m", "--name", "test2", "busybox", "echo", "test")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	expected = "invalid size"
-	c.Assert(out, checker.Contains, expected)
+	assert.Assert(c, strings.Contains(out, expected))
 }
 
 func (s *DockerSuite) TestRunWithCPUShares(c *check.C) {
@@ -528,10 +529,10 @@ func (s *DockerSuite) TestRunWithCPUShares(c *check.C) {
 
 	file := "/sys/fs/cgroup/cpu/cpu.shares"
 	out, _ := dockerCmd(c, "run", "--cpu-shares", "1000", "--name", "test", "busybox", "cat", file)
-	c.Assert(strings.TrimSpace(out), checker.Equals, "1000")
+	assert.Equal(c, strings.TrimSpace(out), "1000")
 
 	out = inspectField(c, "test", "HostConfig.CPUShares")
-	c.Assert(out, check.Equals, "1000")
+	assert.Equal(c, out, "1000")
 }
 
 // "test" should be printed
@@ -548,10 +549,10 @@ func (s *DockerSuite) TestRunWithCpusetCpus(c *check.C) {
 
 	file := "/sys/fs/cgroup/cpuset/cpuset.cpus"
 	out, _ := dockerCmd(c, "run", "--cpuset-cpus", "0", "--name", "test", "busybox", "cat", file)
-	c.Assert(strings.TrimSpace(out), checker.Equals, "0")
+	assert.Equal(c, strings.TrimSpace(out), "0")
 
 	out = inspectField(c, "test", "HostConfig.CpusetCpus")
-	c.Assert(out, check.Equals, "0")
+	assert.Equal(c, out, "0")
 }
 
 func (s *DockerSuite) TestRunWithCpusetMems(c *check.C) {
@@ -559,10 +560,10 @@ func (s *DockerSuite) TestRunWithCpusetMems(c *check.C) {
 
 	file := "/sys/fs/cgroup/cpuset/cpuset.mems"
 	out, _ := dockerCmd(c, "run", "--cpuset-mems", "0", "--name", "test", "busybox", "cat", file)
-	c.Assert(strings.TrimSpace(out), checker.Equals, "0")
+	assert.Equal(c, strings.TrimSpace(out), "0")
 
 	out = inspectField(c, "test", "HostConfig.CpusetMems")
-	c.Assert(out, check.Equals, "0")
+	assert.Equal(c, out, "0")
 }
 
 func (s *DockerSuite) TestRunWithBlkioWeight(c *check.C) {
@@ -570,48 +571,48 @@ func (s *DockerSuite) TestRunWithBlkioWeight(c *check.C) {
 
 	file := "/sys/fs/cgroup/blkio/blkio.weight"
 	out, _ := dockerCmd(c, "run", "--blkio-weight", "300", "--name", "test", "busybox", "cat", file)
-	c.Assert(strings.TrimSpace(out), checker.Equals, "300")
+	assert.Equal(c, strings.TrimSpace(out), "300")
 
 	out = inspectField(c, "test", "HostConfig.BlkioWeight")
-	c.Assert(out, check.Equals, "300")
+	assert.Equal(c, out, "300")
 }
 
 func (s *DockerSuite) TestRunWithInvalidBlkioWeight(c *check.C) {
 	testRequires(c, blkioWeight)
 	out, _, err := dockerCmdWithError("run", "--blkio-weight", "5", "busybox", "true")
-	c.Assert(err, check.NotNil, check.Commentf("%s", out))
+	assert.ErrorContains(c, err, "", out)
 	expected := "Range of blkio weight is from 10 to 1000"
-	c.Assert(out, checker.Contains, expected)
+	assert.Assert(c, strings.Contains(out, expected))
 }
 
 func (s *DockerSuite) TestRunWithInvalidPathforBlkioWeightDevice(c *check.C) {
 	testRequires(c, blkioWeight)
 	out, _, err := dockerCmdWithError("run", "--blkio-weight-device", "/dev/sdX:100", "busybox", "true")
-	c.Assert(err, check.NotNil, check.Commentf("%s", out))
+	assert.ErrorContains(c, err, "", out)
 }
 
 func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceReadBps(c *check.C) {
 	testRequires(c, blkioWeight)
 	out, _, err := dockerCmdWithError("run", "--device-read-bps", "/dev/sdX:500", "busybox", "true")
-	c.Assert(err, check.NotNil, check.Commentf("%s", out))
+	assert.ErrorContains(c, err, "", out)
 }
 
 func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceWriteBps(c *check.C) {
 	testRequires(c, blkioWeight)
 	out, _, err := dockerCmdWithError("run", "--device-write-bps", "/dev/sdX:500", "busybox", "true")
-	c.Assert(err, check.NotNil, check.Commentf("%s", out))
+	assert.ErrorContains(c, err, "", out)
 }
 
 func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceReadIOps(c *check.C) {
 	testRequires(c, blkioWeight)
 	out, _, err := dockerCmdWithError("run", "--device-read-iops", "/dev/sdX:500", "busybox", "true")
-	c.Assert(err, check.NotNil, check.Commentf("%s", out))
+	assert.ErrorContains(c, err, "", out)
 }
 
 func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceWriteIOps(c *check.C) {
 	testRequires(c, blkioWeight)
 	out, _, err := dockerCmdWithError("run", "--device-write-iops", "/dev/sdX:500", "busybox", "true")
-	c.Assert(err, check.NotNil, check.Commentf("%s", out))
+	assert.ErrorContains(c, err, "", out)
 }
 
 func (s *DockerSuite) TestRunOOMExitCode(c *check.C) {
@@ -628,7 +629,7 @@ func (s *DockerSuite) TestRunOOMExitCode(c *check.C) {
 
 	select {
 	case err := <-errChan:
-		c.Assert(err, check.IsNil)
+		assert.NilError(c, err)
 	case <-time.After(600 * time.Second):
 		c.Fatal("Timeout waiting for container to die on OOM")
 	}
@@ -661,21 +662,21 @@ func (s *DockerSuite) TestRunWithSwappiness(c *check.C) {
 	testRequires(c, memorySwappinessSupport)
 	file := "/sys/fs/cgroup/memory/memory.swappiness"
 	out, _ := dockerCmd(c, "run", "--memory-swappiness", "0", "--name", "test", "busybox", "cat", file)
-	c.Assert(strings.TrimSpace(out), checker.Equals, "0")
+	assert.Equal(c, strings.TrimSpace(out), "0")
 
 	out = inspectField(c, "test", "HostConfig.MemorySwappiness")
-	c.Assert(out, check.Equals, "0")
+	assert.Equal(c, out, "0")
 }
 
 func (s *DockerSuite) TestRunWithSwappinessInvalid(c *check.C) {
 	testRequires(c, memorySwappinessSupport)
 	out, _, err := dockerCmdWithError("run", "--memory-swappiness", "101", "busybox", "true")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	expected := "Valid memory swappiness range is 0-100"
 	c.Assert(out, checker.Contains, expected, check.Commentf("Expected output to contain %q, not %q", out, expected))
 
 	out, _, err = dockerCmdWithError("run", "--memory-swappiness", "-10", "busybox", "true")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(out, checker.Contains, expected, check.Commentf("Expected output to contain %q, not %q", out, expected))
 }
 
@@ -684,22 +685,22 @@ func (s *DockerSuite) TestRunWithMemoryReservation(c *check.C) {
 
 	file := "/sys/fs/cgroup/memory/memory.soft_limit_in_bytes"
 	out, _ := dockerCmd(c, "run", "--memory-reservation", "200M", "--name", "test", "busybox", "cat", file)
-	c.Assert(strings.TrimSpace(out), checker.Equals, "209715200")
+	assert.Equal(c, strings.TrimSpace(out), "209715200")
 
 	out = inspectField(c, "test", "HostConfig.MemoryReservation")
-	c.Assert(out, check.Equals, "209715200")
+	assert.Equal(c, out, "209715200")
 }
 
 func (s *DockerSuite) TestRunWithMemoryReservationInvalid(c *check.C) {
 	testRequires(c, memoryLimitSupport)
 	testRequires(c, testEnv.IsLocalDaemon, memoryReservationSupport)
 	out, _, err := dockerCmdWithError("run", "-m", "500M", "--memory-reservation", "800M", "busybox", "true")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	expected := "Minimum memory limit can not be less than memory reservation limit"
 	c.Assert(strings.TrimSpace(out), checker.Contains, expected, check.Commentf("run container should fail with invalid memory reservation"))
 
 	out, _, err = dockerCmdWithError("run", "--memory-reservation", "1k", "busybox", "true")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	expected = "Minimum memory reservation allowed is 4MB"
 	c.Assert(strings.TrimSpace(out), checker.Contains, expected, check.Commentf("run container should fail with invalid memory reservation"))
 }
@@ -721,9 +722,9 @@ func (s *DockerSuite) TestRunSwapLessThanMemoryLimit(c *check.C) {
 	testRequires(c, swapMemorySupport)
 	out, _, err := dockerCmdWithError("run", "-m", "16m", "--memory-swap", "15m", "busybox", "echo", "test")
 	expected := "Minimum memoryswap limit should be larger than memory limit"
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 
-	c.Assert(out, checker.Contains, expected)
+	assert.Assert(c, strings.Contains(out, expected))
 }
 
 func (s *DockerSuite) TestRunInvalidCpusetCpusFlagValue(c *check.C) {
@@ -731,7 +732,7 @@ func (s *DockerSuite) TestRunInvalidCpusetCpusFlagValue(c *check.C) {
 
 	sysInfo := sysinfo.New(true)
 	cpus, err := parsers.ParseUintList(sysInfo.Cpus)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	var invalid int
 	for i := 0; i <= len(cpus)+1; i++ {
 		if !cpus[i] {
@@ -740,9 +741,9 @@ func (s *DockerSuite) TestRunInvalidCpusetCpusFlagValue(c *check.C) {
 		}
 	}
 	out, _, err := dockerCmdWithError("run", "--cpuset-cpus", strconv.Itoa(invalid), "busybox", "true")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	expected := fmt.Sprintf("Error response from daemon: Requested CPUs are not available - requested %s, available: %s", strconv.Itoa(invalid), sysInfo.Cpus)
-	c.Assert(out, checker.Contains, expected)
+	assert.Assert(c, strings.Contains(out, expected))
 }
 
 func (s *DockerSuite) TestRunInvalidCpusetMemsFlagValue(c *check.C) {
@@ -750,7 +751,7 @@ func (s *DockerSuite) TestRunInvalidCpusetMemsFlagValue(c *check.C) {
 
 	sysInfo := sysinfo.New(true)
 	mems, err := parsers.ParseUintList(sysInfo.Mems)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	var invalid int
 	for i := 0; i <= len(mems)+1; i++ {
 		if !mems[i] {
@@ -759,27 +760,27 @@ func (s *DockerSuite) TestRunInvalidCpusetMemsFlagValue(c *check.C) {
 		}
 	}
 	out, _, err := dockerCmdWithError("run", "--cpuset-mems", strconv.Itoa(invalid), "busybox", "true")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	expected := fmt.Sprintf("Error response from daemon: Requested memory nodes are not available - requested %s, available: %s", strconv.Itoa(invalid), sysInfo.Mems)
-	c.Assert(out, checker.Contains, expected)
+	assert.Assert(c, strings.Contains(out, expected))
 }
 
 func (s *DockerSuite) TestRunInvalidCPUShares(c *check.C) {
 	testRequires(c, cpuShare, DaemonIsLinux)
 	out, _, err := dockerCmdWithError("run", "--cpu-shares", "1", "busybox", "echo", "test")
-	c.Assert(err, check.NotNil, check.Commentf("%s", out))
+	assert.ErrorContains(c, err, "", out)
 	expected := "The minimum allowed cpu-shares is 2"
-	c.Assert(out, checker.Contains, expected)
+	assert.Assert(c, strings.Contains(out, expected))
 
 	out, _, err = dockerCmdWithError("run", "--cpu-shares", "-1", "busybox", "echo", "test")
-	c.Assert(err, check.NotNil, check.Commentf("%s", out))
+	assert.ErrorContains(c, err, "", out)
 	expected = "shares: invalid argument"
-	c.Assert(out, checker.Contains, expected)
+	assert.Assert(c, strings.Contains(out, expected))
 
 	out, _, err = dockerCmdWithError("run", "--cpu-shares", "99999999", "busybox", "echo", "test")
-	c.Assert(err, check.NotNil, check.Commentf("%s", out))
+	assert.ErrorContains(c, err, "", out)
 	expected = "The maximum allowed cpu-shares is"
-	c.Assert(out, checker.Contains, expected)
+	assert.Assert(c, strings.Contains(out, expected))
 }
 
 func (s *DockerSuite) TestRunWithDefaultShmSize(c *check.C) {
@@ -810,7 +811,7 @@ func (s *DockerSuite) TestRunWithShmSize(c *check.C) {
 
 func (s *DockerSuite) TestRunTmpfsMountsEnsureOrdered(c *check.C) {
 	tmpFile, err := ioutil.TempFile("", "test")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	defer tmpFile.Close()
 	out, _ := dockerCmd(c, "run", "--tmpfs", "/run", "-v", tmpFile.Name()+":/run/test", "busybox", "ls", "/run")
 	c.Assert(out, checker.Contains, "test")
@@ -900,7 +901,7 @@ func (s *DockerSuite) TestRunSysctls(c *check.C) {
 
 	sysctls := make(map[string]string)
 	err = json.Unmarshal([]byte(out), &sysctls)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	c.Assert(sysctls["net.ipv4.ip_forward"], check.Equals, "1")
 
 	out, _ = dockerCmd(c, "run", "--sysctl", "net.ipv4.ip_forward=0", "--name", "test1", "busybox", "cat", "/proc/sys/net/ipv4/ip_forward")
@@ -909,7 +910,7 @@ func (s *DockerSuite) TestRunSysctls(c *check.C) {
 	out = inspectFieldJSON(c, "test1", "HostConfig.Sysctls")
 
 	err = json.Unmarshal([]byte(out), &sysctls)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	c.Assert(sysctls["net.ipv4.ip_forward"], check.Equals, "0")
 
 	icmd.RunCommand(dockerBinary, "run", "--sysctl", "kernel.foobar=1", "--name", "test2",
@@ -969,7 +970,7 @@ func (s *DockerSuite) TestRunSeccompProfileDenyChmod(c *check.C) {
 	]
 }`
 	tmpFile, err := ioutil.TempFile("", "profile.json")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	defer tmpFile.Close()
 
 	if _, err := tmpFile.Write([]byte(jsonData)); err != nil {
@@ -1349,8 +1350,8 @@ func (s *DockerSuite) TestRunSeccompWithDefaultProfile(c *check.C) {
 	testRequires(c, testEnv.IsLocalDaemon, seccompEnabled)
 
 	out, _, err := dockerCmdWithError("run", "--security-opt", "seccomp=../profiles/seccomp/default.json", "debian:jessie", "unshare", "--map-root-user", "--user", "sh", "-c", "whoami")
-	c.Assert(err, checker.NotNil, check.Commentf("%s", out))
-	c.Assert(strings.TrimSpace(out), checker.Equals, "unshare: unshare failed: Operation not permitted")
+	assert.ErrorContains(c, err, "", out)
+	assert.Equal(c, strings.TrimSpace(out), "unshare: unshare failed: Operation not permitted")
 }
 
 // TestRunDeviceSymlink checks run with device that follows symlink (#13840 and #22271)
@@ -1362,23 +1363,23 @@ func (s *DockerSuite) TestRunDeviceSymlink(c *check.C) {
 
 	// Create a temporary directory to create symlink
 	tmpDir, err := ioutil.TempDir("", "docker_device_follow_symlink_tests")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	defer os.RemoveAll(tmpDir)
 
 	// Create a symbolic link to /dev/zero
 	symZero := filepath.Join(tmpDir, "zero")
 	err = os.Symlink("/dev/zero", symZero)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	// Create a temporary file "temp" inside tmpDir, write some data to "tmpDir/temp",
 	// then create a symlink "tmpDir/file" to the temporary file "tmpDir/temp".
 	tmpFile := filepath.Join(tmpDir, "temp")
 	err = ioutil.WriteFile(tmpFile, []byte("temp"), 0666)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	symFile := filepath.Join(tmpDir, "file")
 	err = os.Symlink(tmpFile, symFile)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	// Create a symbolic link to /dev/zero, this time with a relative path (#22271)
 	err = os.Symlink("zero", "/dev/symzero")
@@ -1394,7 +1395,7 @@ func (s *DockerSuite) TestRunDeviceSymlink(c *check.C) {
 
 	// symlink "tmpDir/file" to a file "tmpDir/temp" will result in an error as it is not a device.
 	out, _, err = dockerCmdWithError("run", "--device", symFile+":/dev/symzero", "busybox", "sh", "-c", "dd if=/dev/symzero bs=4K count=8 | md5sum")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(strings.Trim(out, "\r\n"), checker.Contains, "not a device node", check.Commentf("expected output 'not a device node'"))
 
 	// md5sum of 'dd if=/dev/zero bs=4K count=8' is bb7df04e1b0a2570657527a7e108ae23 (this time check with relative path backed, see #22271)
@@ -1408,10 +1409,10 @@ func (s *DockerSuite) TestRunPIDsLimit(c *check.C) {
 
 	file := "/sys/fs/cgroup/pids/pids.max"
 	out, _ := dockerCmd(c, "run", "--name", "skittles", "--pids-limit", "4", "busybox", "cat", file)
-	c.Assert(strings.TrimSpace(out), checker.Equals, "4")
+	assert.Equal(c, strings.TrimSpace(out), "4")
 
 	out = inspectField(c, "skittles", "HostConfig.PidsLimit")
-	c.Assert(out, checker.Equals, "4", check.Commentf("setting the pids limit failed"))
+	assert.Equal(c, out, "4", "setting the pids limit failed")
 }
 
 func (s *DockerSuite) TestRunPrivilegedAllowedDevices(c *check.C) {
@@ -1420,7 +1421,7 @@ func (s *DockerSuite) TestRunPrivilegedAllowedDevices(c *check.C) {
 	file := "/sys/fs/cgroup/devices/devices.list"
 	out, _ := dockerCmd(c, "run", "--privileged", "busybox", "cat", file)
 	c.Logf("out: %q", out)
-	c.Assert(strings.TrimSpace(out), checker.Equals, "a *:* rwm")
+	assert.Equal(c, strings.TrimSpace(out), "a *:* rwm")
 }
 
 func (s *DockerSuite) TestRunUserDeviceAllowed(c *check.C) {
@@ -1455,13 +1456,13 @@ func (s *DockerDaemonSuite) TestRunSeccompJSONNewFormat(c *check.C) {
 	]
 }`
 	tmpFile, err := ioutil.TempFile("", "profile.json")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	defer tmpFile.Close()
 	_, err = tmpFile.Write([]byte(jsonData))
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	out, err := s.d.Cmd("run", "--security-opt", "seccomp="+tmpFile.Name(), "busybox", "chmod", "777", ".")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(out, checker.Contains, "Operation not permitted")
 }
 
@@ -1481,13 +1482,13 @@ func (s *DockerDaemonSuite) TestRunSeccompJSONNoNameAndNames(c *check.C) {
 	]
 }`
 	tmpFile, err := ioutil.TempFile("", "profile.json")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	defer tmpFile.Close()
 	_, err = tmpFile.Write([]byte(jsonData))
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	out, err := s.d.Cmd("run", "--security-opt", "seccomp="+tmpFile.Name(), "busybox", "chmod", "777", ".")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(out, checker.Contains, "'name' and 'names' were specified in the seccomp profile, use either 'name' or 'names'")
 }
 
@@ -1518,13 +1519,13 @@ func (s *DockerDaemonSuite) TestRunSeccompJSONNoArchAndArchMap(c *check.C) {
 	]
 }`
 	tmpFile, err := ioutil.TempFile("", "profile.json")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	defer tmpFile.Close()
 	_, err = tmpFile.Write([]byte(jsonData))
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	out, err := s.d.Cmd("run", "--security-opt", "seccomp="+tmpFile.Name(), "busybox", "chmod", "777", ".")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(out, checker.Contains, "'architectures' and 'archMap' were specified in the seccomp profile, use either 'architectures' or 'archMap'")
 }
 
@@ -1535,7 +1536,7 @@ func (s *DockerDaemonSuite) TestRunWithDaemonDefaultSeccompProfile(c *check.C) {
 
 	// 1) verify I can run containers with the Docker default shipped profile which allows chmod
 	_, err := s.d.Cmd("run", "busybox", "chmod", "777", ".")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	jsonData := `{
 	"defaultAction": "SCMP_ACT_ALLOW",
@@ -1547,16 +1548,16 @@ func (s *DockerDaemonSuite) TestRunWithDaemonDefaultSeccompProfile(c *check.C) {
 	]
 }`
 	tmpFile, err := ioutil.TempFile("", "profile.json")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	defer tmpFile.Close()
 	_, err = tmpFile.Write([]byte(jsonData))
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	// 2) restart the daemon and add a custom seccomp profile in which we deny chmod
 	s.d.Restart(c, "--seccomp-profile="+tmpFile.Name())
 
 	out, err := s.d.Cmd("run", "busybox", "chmod", "777", ".")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(out, checker.Contains, "Operation not permitted")
 }
 
@@ -1566,20 +1567,20 @@ func (s *DockerSuite) TestRunWithNanoCPUs(c *check.C) {
 	file1 := "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"
 	file2 := "/sys/fs/cgroup/cpu/cpu.cfs_period_us"
 	out, _ := dockerCmd(c, "run", "--cpus", "0.5", "--name", "test", "busybox", "sh", "-c", fmt.Sprintf("cat %s && cat %s", file1, file2))
-	c.Assert(strings.TrimSpace(out), checker.Equals, "50000\n100000")
+	assert.Equal(c, strings.TrimSpace(out), "50000\n100000")
 
 	clt, err := client.NewClientWithOpts(client.FromEnv)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	inspect, err := clt.ContainerInspect(context.Background(), "test")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(inspect.HostConfig.NanoCPUs, checker.Equals, int64(500000000))
 
 	out = inspectField(c, "test", "HostConfig.CpuQuota")
-	c.Assert(out, checker.Equals, "0", check.Commentf("CPU CFS quota should be 0"))
+	assert.Equal(c, out, "0", "CPU CFS quota should be 0")
 	out = inspectField(c, "test", "HostConfig.CpuPeriod")
-	c.Assert(out, checker.Equals, "0", check.Commentf("CPU CFS period should be 0"))
+	assert.Equal(c, out, "0", "CPU CFS period should be 0")
 
 	out, _, err = dockerCmdWithError("run", "--cpus", "0.5", "--cpu-quota", "50000", "--cpu-period", "100000", "busybox", "sh")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(out, checker.Contains, "Conflicting options: Nano CPUs and CPU Period cannot both be set")
 }

+ 29 - 26
integration-cli/docker_cli_save_load_test.go

@@ -19,6 +19,8 @@ import (
 	"github.com/docker/docker/integration-cli/cli/build"
 	"github.com/go-check/check"
 	"github.com/opencontainers/go-digest"
+	"gotest.tools/assert"
+	is "gotest.tools/assert/cmp"
 	"gotest.tools/icmd"
 )
 
@@ -37,7 +39,7 @@ func (s *DockerSuite) TestSaveXzAndLoadRepoStdout(c *check.C) {
 		exec.Command(dockerBinary, "save", repoName),
 		exec.Command("xz", "-c"),
 		exec.Command("gzip", "-c"))
-	c.Assert(err, checker.IsNil, check.Commentf("failed to save repo: %v %v", out, err))
+	assert.NilError(c, err, "failed to save repo: %v %v", out, err)
 	deleteImages(repoName)
 
 	icmd.RunCmd(icmd.Cmd{
@@ -48,7 +50,7 @@ func (s *DockerSuite) TestSaveXzAndLoadRepoStdout(c *check.C) {
 	})
 
 	after, _, err := dockerCmdWithError("inspect", repoName)
-	c.Assert(err, checker.NotNil, check.Commentf("the repo should not exist: %v", after))
+	assert.ErrorContains(c, err, "", "the repo should not exist: %v", after)
 }
 
 // save a repo using xz+gz compression and try to load it using stdout
@@ -66,7 +68,7 @@ func (s *DockerSuite) TestSaveXzGzAndLoadRepoStdout(c *check.C) {
 		exec.Command(dockerBinary, "save", repoName),
 		exec.Command("xz", "-c"),
 		exec.Command("gzip", "-c"))
-	c.Assert(err, checker.IsNil, check.Commentf("failed to save repo: %v %v", out, err))
+	assert.NilError(c, err, "failed to save repo: %v %v", out, err)
 
 	deleteImages(repoName)
 
@@ -78,7 +80,7 @@ func (s *DockerSuite) TestSaveXzGzAndLoadRepoStdout(c *check.C) {
 	})
 
 	after, _, err := dockerCmdWithError("inspect", repoName)
-	c.Assert(err, checker.NotNil, check.Commentf("the repo should not exist: %v", after))
+	assert.ErrorContains(c, err, "", "the repo should not exist: %v", after)
 }
 
 func (s *DockerSuite) TestSaveSingleTag(c *check.C) {
@@ -93,7 +95,7 @@ func (s *DockerSuite) TestSaveSingleTag(c *check.C) {
 		exec.Command(dockerBinary, "save", fmt.Sprintf("%v:latest", repoName)),
 		exec.Command("tar", "t"),
 		exec.Command("grep", "-E", fmt.Sprintf("(^repositories$|%v)", cleanedImageID)))
-	c.Assert(err, checker.IsNil, check.Commentf("failed to save repo with image ID and 'repositories' file: %s, %v", out, err))
+	assert.NilError(c, err, "failed to save repo with image ID and 'repositories' file: %s, %v", out, err)
 }
 
 func (s *DockerSuite) TestSaveCheckTimes(c *check.C) {
@@ -105,14 +107,14 @@ func (s *DockerSuite) TestSaveCheckTimes(c *check.C) {
 		Created time.Time
 	}
 	err := json.Unmarshal([]byte(out), &data)
-	c.Assert(err, checker.IsNil, check.Commentf("failed to marshal from %q: err %v", repoName, err))
-	c.Assert(len(data), checker.Not(checker.Equals), 0, check.Commentf("failed to marshal the data from %q", repoName))
+	assert.NilError(c, err, "failed to marshal from %q: err %v", repoName, err)
+	assert.Assert(c, len(data) != 0, "failed to marshal the data from %q", repoName)
 	tarTvTimeFormat := "2006-01-02 15:04"
 	out, err = RunCommandPipelineWithOutput(
 		exec.Command(dockerBinary, "save", repoName),
 		exec.Command("tar", "tv"),
 		exec.Command("grep", "-E", fmt.Sprintf("%s %s", data[0].Created.Format(tarTvTimeFormat), digest.Digest(data[0].ID).Hex())))
-	c.Assert(err, checker.IsNil, check.Commentf("failed to save repo with image ID and 'repositories' file: %s, %v", out, err))
+	assert.NilError(c, err, "failed to save repo with image ID and 'repositories' file: %s, %v", out, err)
 }
 
 func (s *DockerSuite) TestSaveImageId(c *check.C) {
@@ -169,10 +171,10 @@ func (s *DockerSuite) TestSaveAndLoadRepoFlags(c *check.C) {
 	out, err := RunCommandPipelineWithOutput(
 		exec.Command(dockerBinary, "save", repoName),
 		exec.Command(dockerBinary, "load"))
-	c.Assert(err, checker.IsNil, check.Commentf("failed to save and load repo: %s, %v", out, err))
+	assert.NilError(c, err, "failed to save and load repo: %s, %v", out, err)
 
 	after, _ := dockerCmd(c, "inspect", repoName)
-	c.Assert(before, checker.Equals, after, check.Commentf("inspect is not the same after a save / load"))
+	assert.Equal(c, before, after, "inspect is not the same after a save / load")
 }
 
 func (s *DockerSuite) TestSaveWithNoExistImage(c *check.C) {
@@ -181,8 +183,8 @@ func (s *DockerSuite) TestSaveWithNoExistImage(c *check.C) {
 	imgName := "foobar-non-existing-image"
 
 	out, _, err := dockerCmdWithError("save", "-o", "test-img.tar", imgName)
-	c.Assert(err, checker.NotNil, check.Commentf("save image should fail for non-existing image"))
-	c.Assert(out, checker.Contains, fmt.Sprintf("No such image: %s", imgName))
+	assert.ErrorContains(c, err, "", "save image should fail for non-existing image")
+	assert.Assert(c, strings.Contains(out, fmt.Sprintf("No such image: %s", imgName)))
 }
 
 func (s *DockerSuite) TestSaveMultipleNames(c *check.C) {
@@ -200,7 +202,7 @@ func (s *DockerSuite) TestSaveMultipleNames(c *check.C) {
 		exec.Command("tar", "xO", "repositories"),
 		exec.Command("grep", "-q", "-E", "(-one|-two)"),
 	)
-	c.Assert(err, checker.IsNil, check.Commentf("failed to save multiple repos: %s, %v", out, err))
+	assert.NilError(c, err, "failed to save multiple repos: %s, %v", out, err)
 }
 
 func (s *DockerSuite) TestSaveRepoWithMultipleImages(c *check.C) {
@@ -230,7 +232,7 @@ func (s *DockerSuite) TestSaveRepoWithMultipleImages(c *check.C) {
 	out, err := RunCommandPipelineWithOutput(
 		exec.Command(dockerBinary, "save", repoName, "busybox:latest"),
 		exec.Command("tar", "t"))
-	c.Assert(err, checker.IsNil, check.Commentf("failed to save multiple images: %s, %v", out, err))
+	assert.NilError(c, err, "failed to save multiple images: %s, %v", out, err)
 
 	lines := strings.Split(strings.TrimSpace(out), "\n")
 	var actual []string
@@ -251,7 +253,7 @@ func (s *DockerSuite) TestSaveRepoWithMultipleImages(c *check.C) {
 
 	sort.Strings(actual)
 	sort.Strings(expected)
-	c.Assert(actual, checker.DeepEquals, expected, check.Commentf("archive does not contains the right layers: got %v, expected %v, output: %q", actual, expected, out))
+	assert.Assert(c, is.DeepEqual(actual, expected), "archive does not contains the right layers: got %v, expected %v, output: %q", actual, expected, out)
 }
 
 // Issue #6722 #5892 ensure directories are included in changes
@@ -275,10 +277,10 @@ func (s *DockerSuite) TestSaveDirectoryPermissions(c *check.C) {
 		exec.Command(dockerBinary, "save", name),
 		exec.Command("tar", "-xf", "-", "-C", extractionDirectory),
 	)
-	c.Assert(err, checker.IsNil, check.Commentf("failed to save and extract image: %s", out))
+	assert.NilError(c, err, "failed to save and extract image: %s", out)
 
 	dirs, err := ioutil.ReadDir(extractionDirectory)
-	c.Assert(err, checker.IsNil, check.Commentf("failed to get a listing of the layer directories: %s", err))
+	assert.NilError(c, err, "failed to get a listing of the layer directories: %s", err)
 
 	found := false
 	for _, entry := range dirs {
@@ -287,7 +289,8 @@ func (s *DockerSuite) TestSaveDirectoryPermissions(c *check.C) {
 			layerPath := filepath.Join(extractionDirectory, entry.Name(), "layer.tar")
 
 			f, err := os.Open(layerPath)
-			c.Assert(err, checker.IsNil, check.Commentf("failed to open %s: %s", layerPath, err))
+			assert.NilError(c, err, "failed to open %s: %s", layerPath, err)
+
 			defer f.Close()
 
 			entries, err := listTar(f)
@@ -296,7 +299,7 @@ func (s *DockerSuite) TestSaveDirectoryPermissions(c *check.C) {
 					entriesSansDev = append(entriesSansDev, e)
 				}
 			}
-			c.Assert(err, checker.IsNil, check.Commentf("encountered error while listing tar entries: %s", err))
+			assert.NilError(c, err, "encountered error while listing tar entries: %s", err)
 
 			if reflect.DeepEqual(entriesSansDev, layerEntries) || reflect.DeepEqual(entriesSansDev, layerEntriesAUFS) {
 				found = true
@@ -305,8 +308,7 @@ func (s *DockerSuite) TestSaveDirectoryPermissions(c *check.C) {
 		}
 	}
 
-	c.Assert(found, checker.Equals, true, check.Commentf("failed to find the layer with the right content listing"))
-
+	assert.Assert(c, found, "failed to find the layer with the right content listing")
 }
 
 func listTar(f io.Reader) ([]string, error) {
@@ -358,7 +360,7 @@ func (s *DockerSuite) TestSaveLoadParents(c *check.C) {
 	idBar := makeImage(idFoo, "bar")
 
 	tmpDir, err := ioutil.TempDir("", "save-load-parents")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer os.RemoveAll(tmpDir)
 
 	c.Log("tmpdir", tmpDir)
@@ -370,10 +372,10 @@ func (s *DockerSuite) TestSaveLoadParents(c *check.C) {
 	dockerCmd(c, "load", "-i", outfile)
 
 	inspectOut := inspectField(c, idBar, "Parent")
-	c.Assert(inspectOut, checker.Equals, idFoo)
+	assert.Equal(c, inspectOut, idFoo)
 
 	inspectOut = inspectField(c, idFoo, "Parent")
-	c.Assert(inspectOut, checker.Equals, "")
+	assert.Equal(c, inspectOut, "")
 }
 
 func (s *DockerSuite) TestSaveLoadNoTag(c *check.C) {
@@ -388,7 +390,7 @@ func (s *DockerSuite) TestSaveLoadNoTag(c *check.C) {
 	out, err := RunCommandPipelineWithOutput(
 		exec.Command(dockerBinary, "save", id),
 		exec.Command(dockerBinary, "load"))
-	c.Assert(err, checker.IsNil, check.Commentf("failed to save and load repo: %s, %v", out, err))
+	assert.NilError(c, err, "failed to save and load repo: %s, %v", out, err)
 
 	// Should not show 'name' but should show the image ID during the load
 	c.Assert(out, checker.Not(checker.Contains), "Loaded image: ")
@@ -399,7 +401,8 @@ func (s *DockerSuite) TestSaveLoadNoTag(c *check.C) {
 	out, err = RunCommandPipelineWithOutput(
 		exec.Command(dockerBinary, "save", name),
 		exec.Command(dockerBinary, "load"))
-	c.Assert(err, checker.IsNil, check.Commentf("failed to save and load repo: %s, %v", out, err))
+	assert.NilError(c, err, "failed to save and load repo: %s, %v", out, err)
+
 	c.Assert(out, checker.Contains, "Loaded image: "+name+":latest")
 	c.Assert(out, checker.Not(checker.Contains), "Loaded image ID:")
 }

+ 14 - 14
integration-cli/docker_cli_save_load_unix_test.go

@@ -11,10 +11,10 @@ import (
 	"strings"
 	"time"
 
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli/build"
 	"github.com/go-check/check"
 	"github.com/kr/pty"
+	"gotest.tools/assert"
 	"gotest.tools/icmd"
 )
 
@@ -28,7 +28,7 @@ func (s *DockerSuite) TestSaveAndLoadRepoStdout(c *check.C) {
 	before = strings.TrimRight(before, "\n")
 
 	tmpFile, err := ioutil.TempFile("", "foobar-save-load-test.tar")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	defer os.Remove(tmpFile.Name())
 
 	icmd.RunCmd(icmd.Cmd{
@@ -37,7 +37,7 @@ func (s *DockerSuite) TestSaveAndLoadRepoStdout(c *check.C) {
 	}).Assert(c, icmd.Success)
 
 	tmpFile, err = os.Open(tmpFile.Name())
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	defer tmpFile.Close()
 
 	deleteImages(repoName)
@@ -50,24 +50,24 @@ func (s *DockerSuite) TestSaveAndLoadRepoStdout(c *check.C) {
 	after := inspectField(c, repoName, "Id")
 	after = strings.TrimRight(after, "\n")
 
-	c.Assert(after, check.Equals, before) //inspect is not the same after a save / load
+	assert.Equal(c, after, before, "inspect is not the same after a save / load")
 
 	deleteImages(repoName)
 
 	pty, tty, err := pty.Open()
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	cmd := exec.Command(dockerBinary, "save", repoName)
 	cmd.Stdin = tty
 	cmd.Stdout = tty
 	cmd.Stderr = tty
-	c.Assert(cmd.Start(), check.IsNil)
-	c.Assert(cmd.Wait(), check.NotNil) //did not break writing to a TTY
+	assert.NilError(c, cmd.Start())
+	assert.ErrorContains(c, cmd.Wait(), "", "did not break writing to a TTY")
 
 	buf := make([]byte, 1024)
 
 	n, err := pty.Read(buf)
-	c.Assert(err, check.IsNil) //could not read tty output
-	c.Assert(string(buf[:n]), checker.Contains, "cowardly refusing", check.Commentf("help output is not being yielded"))
+	assert.NilError(c, err) //could not read tty output
+	assert.Assert(c, strings.Contains(string(buf[:n]), "cowardly refusing"), "help output is not being yielded")
 }
 
 func (s *DockerSuite) TestSaveAndLoadWithProgressBar(c *check.C) {
@@ -84,24 +84,24 @@ func (s *DockerSuite) TestSaveAndLoadWithProgressBar(c *check.C) {
 	dockerCmd(c, "tag", "busybox", name)
 	out, _ := dockerCmd(c, "load", "-i", tmptar)
 	expected := fmt.Sprintf("The image %s:latest already exists, renaming the old one with ID", name)
-	c.Assert(out, checker.Contains, expected)
+	assert.Assert(c, strings.Contains(out, expected))
 }
 
 // fail because load didn't receive data from stdin
 func (s *DockerSuite) TestLoadNoStdinFail(c *check.C) {
 	pty, tty, err := pty.Open()
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
 	defer cancel()
 	cmd := exec.CommandContext(ctx, dockerBinary, "load")
 	cmd.Stdin = tty
 	cmd.Stdout = tty
 	cmd.Stderr = tty
-	c.Assert(cmd.Run(), check.NotNil) // docker-load should fail
+	assert.ErrorContains(c, cmd.Run(), "", "docker-load should fail")
 
 	buf := make([]byte, 1024)
 
 	n, err := pty.Read(buf)
-	c.Assert(err, check.IsNil) //could not read tty output
-	c.Assert(string(buf[:n]), checker.Contains, "requested load from stdin, but stdin is empty")
+	assert.NilError(c, err) //could not read tty output
+	assert.Assert(c, strings.Contains(string(buf[:n]), "requested load from stdin, but stdin is empty"))
 }

+ 31 - 31
integration-cli/docker_cli_search_test.go

@@ -4,8 +4,8 @@ import (
 	"fmt"
 	"strings"
 
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 // search for repos named  "registry" on the central registry
@@ -13,67 +13,67 @@ func (s *DockerSuite) TestSearchOnCentralRegistry(c *check.C) {
 	testRequires(c, Network, DaemonIsLinux)
 
 	out, _ := dockerCmd(c, "search", "busybox")
-	c.Assert(out, checker.Contains, "Busybox base image.", check.Commentf("couldn't find any repository named (or containing) 'Busybox base image.'"))
+	assert.Assert(c, strings.Contains(out, "Busybox base image."), "couldn't find any repository named (or containing) 'Busybox base image.'")
 }
 
 func (s *DockerSuite) TestSearchStarsOptionWithWrongParameter(c *check.C) {
 	out, _, err := dockerCmdWithError("search", "--filter", "stars=a", "busybox")
-	c.Assert(err, check.NotNil, check.Commentf("%s", out))
-	c.Assert(out, checker.Contains, "Invalid filter", check.Commentf("couldn't find the invalid filter warning"))
+	assert.ErrorContains(c, err, "", out)
+	assert.Assert(c, strings.Contains(out, "Invalid filter"), "couldn't find the invalid filter warning")
 
 	out, _, err = dockerCmdWithError("search", "-f", "stars=a", "busybox")
-	c.Assert(err, check.NotNil, check.Commentf("%s", out))
-	c.Assert(out, checker.Contains, "Invalid filter", check.Commentf("couldn't find the invalid filter warning"))
+	assert.ErrorContains(c, err, "", out)
+	assert.Assert(c, strings.Contains(out, "Invalid filter"), "couldn't find the invalid filter warning")
 
 	out, _, err = dockerCmdWithError("search", "-f", "is-automated=a", "busybox")
-	c.Assert(err, check.NotNil, check.Commentf("%s", out))
-	c.Assert(out, checker.Contains, "Invalid filter", check.Commentf("couldn't find the invalid filter warning"))
+	assert.ErrorContains(c, err, "", out)
+	assert.Assert(c, strings.Contains(out, "Invalid filter"), "couldn't find the invalid filter warning")
 
 	out, _, err = dockerCmdWithError("search", "-f", "is-official=a", "busybox")
-	c.Assert(err, check.NotNil, check.Commentf("%s", out))
-	c.Assert(out, checker.Contains, "Invalid filter", check.Commentf("couldn't find the invalid filter warning"))
+	assert.ErrorContains(c, err, "", out)
+	assert.Assert(c, strings.Contains(out, "Invalid filter"), "couldn't find the invalid filter warning")
 
 	// -s --stars deprecated since Docker 1.13
 	out, _, err = dockerCmdWithError("search", "--stars=a", "busybox")
-	c.Assert(err, check.NotNil, check.Commentf("%s", out))
-	c.Assert(out, checker.Contains, "invalid syntax", check.Commentf("couldn't find the invalid value warning"))
+	assert.ErrorContains(c, err, "", out)
+	assert.Assert(c, strings.Contains(out, "invalid syntax"), "couldn't find the invalid value warning")
 
 	// -s --stars deprecated since Docker 1.13
 	out, _, err = dockerCmdWithError("search", "-s=-1", "busybox")
-	c.Assert(err, check.NotNil, check.Commentf("%s", out))
-	c.Assert(out, checker.Contains, "invalid syntax", check.Commentf("couldn't find the invalid value warning"))
+	assert.ErrorContains(c, err, "", out)
+	assert.Assert(c, strings.Contains(out, "invalid syntax"), "couldn't find the invalid value warning")
 }
 
 func (s *DockerSuite) TestSearchCmdOptions(c *check.C) {
 	testRequires(c, Network, DaemonIsLinux)
 
 	out, _ := dockerCmd(c, "search", "--help")
-	c.Assert(out, checker.Contains, "Usage:\tdocker search [OPTIONS] TERM")
+	assert.Assert(c, strings.Contains(out, "Usage:\tdocker search [OPTIONS] TERM"))
 
 	outSearchCmd, _ := dockerCmd(c, "search", "busybox")
 	outSearchCmdNotrunc, _ := dockerCmd(c, "search", "--no-trunc=true", "busybox")
 
-	c.Assert(len(outSearchCmd) > len(outSearchCmdNotrunc), check.Equals, false, check.Commentf("The no-trunc option can't take effect."))
+	assert.Assert(c, len(outSearchCmd) <= len(outSearchCmdNotrunc), "The no-trunc option can't take effect.")
 
 	outSearchCmdautomated, _ := dockerCmd(c, "search", "--filter", "is-automated=true", "busybox") //The busybox is a busybox base image, not an AUTOMATED image.
 	outSearchCmdautomatedSlice := strings.Split(outSearchCmdautomated, "\n")
 	for i := range outSearchCmdautomatedSlice {
-		c.Assert(strings.HasPrefix(outSearchCmdautomatedSlice[i], "busybox "), check.Equals, false, check.Commentf("The busybox is not an AUTOMATED image: %s", outSearchCmdautomated))
+		assert.Assert(c, !strings.HasPrefix(outSearchCmdautomatedSlice[i], "busybox "), "The busybox is not an AUTOMATED image: %s", outSearchCmdautomated)
 	}
 
 	outSearchCmdNotOfficial, _ := dockerCmd(c, "search", "--filter", "is-official=false", "busybox") //The busybox is a busybox base image, official image.
 	outSearchCmdNotOfficialSlice := strings.Split(outSearchCmdNotOfficial, "\n")
 	for i := range outSearchCmdNotOfficialSlice {
-		c.Assert(strings.HasPrefix(outSearchCmdNotOfficialSlice[i], "busybox "), check.Equals, false, check.Commentf("The busybox is not an OFFICIAL image: %s", outSearchCmdNotOfficial))
+		assert.Assert(c, !strings.HasPrefix(outSearchCmdNotOfficialSlice[i], "busybox "), "The busybox is not an OFFICIAL image: %s", outSearchCmdNotOfficial)
 	}
 
 	outSearchCmdOfficial, _ := dockerCmd(c, "search", "--filter", "is-official=true", "busybox") //The busybox is a busybox base image, official image.
 	outSearchCmdOfficialSlice := strings.Split(outSearchCmdOfficial, "\n")
-	c.Assert(outSearchCmdOfficialSlice, checker.HasLen, 3) // 1 header, 1 line, 1 carriage return
-	c.Assert(strings.HasPrefix(outSearchCmdOfficialSlice[1], "busybox "), check.Equals, true, check.Commentf("The busybox is an OFFICIAL image: %s", outSearchCmdNotOfficial))
+	assert.Equal(c, len(outSearchCmdOfficialSlice), 3) // 1 header, 1 line, 1 carriage return
+	assert.Assert(c, strings.HasPrefix(outSearchCmdOfficialSlice[1], "busybox "), "The busybox is an OFFICIAL image: %s", outSearchCmdOfficial)
 
 	outSearchCmdStars, _ := dockerCmd(c, "search", "--filter", "stars=2", "busybox")
-	c.Assert(strings.Count(outSearchCmdStars, "[OK]") > strings.Count(outSearchCmd, "[OK]"), check.Equals, false, check.Commentf("The quantity of images with stars should be less than that of all images: %s", outSearchCmdStars))
+	assert.Assert(c, strings.Count(outSearchCmdStars, "[OK]") <= strings.Count(outSearchCmd, "[OK]"), "The quantity of images with stars should be less than that of all images: %s", outSearchCmdStars)
 
 	dockerCmd(c, "search", "--filter", "is-automated=true", "--filter", "stars=2", "--no-trunc=true", "busybox")
 
@@ -81,12 +81,12 @@ func (s *DockerSuite) TestSearchCmdOptions(c *check.C) {
 	outSearchCmdautomated1, _ := dockerCmd(c, "search", "--automated=true", "busybox") //The busybox is a busybox base image, not an AUTOMATED image.
 	outSearchCmdautomatedSlice1 := strings.Split(outSearchCmdautomated1, "\n")
 	for i := range outSearchCmdautomatedSlice1 {
-		c.Assert(strings.HasPrefix(outSearchCmdautomatedSlice1[i], "busybox "), check.Equals, false, check.Commentf("The busybox is not an AUTOMATED image: %s", outSearchCmdautomated))
+		assert.Assert(c, !strings.HasPrefix(outSearchCmdautomatedSlice1[i], "busybox "), "The busybox is not an AUTOMATED image: %s", outSearchCmdautomated)
 	}
 
 	// -s --stars deprecated since Docker 1.13
 	outSearchCmdStars1, _ := dockerCmd(c, "search", "--stars=2", "busybox")
-	c.Assert(strings.Count(outSearchCmdStars1, "[OK]") > strings.Count(outSearchCmd, "[OK]"), check.Equals, false, check.Commentf("The quantity of images with stars should be less than that of all images: %s", outSearchCmdStars1))
+	assert.Assert(c, strings.Count(outSearchCmdStars1, "[OK]") <= strings.Count(outSearchCmd, "[OK]"), "The quantity of images with stars should be less than that of all images: %s", outSearchCmdStars1)
 
 	// -s --stars deprecated since Docker 1.13
 	dockerCmd(c, "search", "--stars=2", "--automated=true", "--no-trunc=true", "busybox")
@@ -105,27 +105,27 @@ func (s *DockerSuite) TestSearchWithLimit(c *check.C) {
 
 	limit := 10
 	out, _, err := dockerCmdWithError("search", fmt.Sprintf("--limit=%d", limit), "docker")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	outSlice := strings.Split(out, "\n")
-	c.Assert(outSlice, checker.HasLen, limit+2) // 1 header, 1 carriage return
+	assert.Equal(c, len(outSlice), limit+2) // 1 header, 1 carriage return
 
 	limit = 50
 	out, _, err = dockerCmdWithError("search", fmt.Sprintf("--limit=%d", limit), "docker")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	outSlice = strings.Split(out, "\n")
-	c.Assert(outSlice, checker.HasLen, limit+2) // 1 header, 1 carriage return
+	assert.Equal(c, len(outSlice), limit+2) // 1 header, 1 carriage return
 
 	limit = 100
 	out, _, err = dockerCmdWithError("search", fmt.Sprintf("--limit=%d", limit), "docker")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	outSlice = strings.Split(out, "\n")
-	c.Assert(outSlice, checker.HasLen, limit+2) // 1 header, 1 carriage return
+	assert.Equal(c, len(outSlice), limit+2) // 1 header, 1 carriage return
 
 	limit = 0
 	_, _, err = dockerCmdWithError("search", fmt.Sprintf("--limit=%d", limit), "docker")
-	c.Assert(err, checker.Not(checker.IsNil))
+	assert.ErrorContains(c, err, "")
 
 	limit = 200
 	_, _, err = dockerCmdWithError("search", fmt.Sprintf("--limit=%d", limit), "docker")
-	c.Assert(err, checker.Not(checker.IsNil))
+	assert.ErrorContains(c, err, "")
 }

+ 47 - 46
integration-cli/docker_cli_service_create_test.go

@@ -13,12 +13,13 @@ import (
 	"github.com/docker/docker/api/types/swarm"
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 func (s *DockerSwarmSuite) TestServiceCreateMountVolume(c *check.C) {
 	d := s.AddDaemon(c, true, true)
 	out, err := d.Cmd("service", "create", "--no-resolve-image", "--detach=true", "--mount", "type=volume,source=foo,target=/foo,volume-nocopy", "busybox", "top")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 	id := strings.TrimSpace(out)
 
 	var tasks []swarm.Task
@@ -37,7 +38,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountVolume(c *check.C) {
 
 	// check container mount config
 	out, err = s.nodeCmd(c, task.NodeID, "inspect", "--format", "{{json .HostConfig.Mounts}}", task.Status.ContainerStatus.ContainerID)
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	var mountConfig []mount.Mount
 	c.Assert(json.Unmarshal([]byte(out), &mountConfig), checker.IsNil)
@@ -51,7 +52,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountVolume(c *check.C) {
 
 	// check container mounts actual
 	out, err = s.nodeCmd(c, task.NodeID, "inspect", "--format", "{{json .Mounts}}", task.Status.ContainerStatus.ContainerID)
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	var mounts []types.MountPoint
 	c.Assert(json.Unmarshal([]byte(out), &mounts), checker.IsNil)
@@ -77,14 +78,14 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSimple(c *check.C) {
 	c.Assert(id, checker.Not(checker.Equals), "", check.Commentf("secrets: %s", id))
 
 	out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--secret", testName, "busybox", "top")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Secrets }}", serviceName)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	var refs []swarm.SecretReference
 	c.Assert(json.Unmarshal([]byte(out), &refs), checker.IsNil)
-	c.Assert(refs, checker.HasLen, 1)
+	assert.Equal(c, len(refs), 1)
 
 	c.Assert(refs[0].SecretName, checker.Equals, testName)
 	c.Assert(refs[0].File, checker.Not(checker.IsNil))
@@ -93,7 +94,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSimple(c *check.C) {
 	c.Assert(refs[0].File.GID, checker.Equals, "0")
 
 	out, err = d.Cmd("service", "rm", serviceName)
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 	d.DeleteSecret(c, testName)
 }
 
@@ -126,14 +127,14 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSourceTargetPaths(c *check
 	serviceCmd = append(serviceCmd, secretFlags...)
 	serviceCmd = append(serviceCmd, "busybox", "top")
 	out, err := d.Cmd(serviceCmd...)
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Secrets }}", serviceName)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	var refs []swarm.SecretReference
 	c.Assert(json.Unmarshal([]byte(out), &refs), checker.IsNil)
-	c.Assert(refs, checker.HasLen, len(testPaths))
+	assert.Equal(c, len(refs), len(testPaths))
 
 	var tasks []swarm.Task
 	waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) {
@@ -155,12 +156,12 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSourceTargetPaths(c *check
 			path = filepath.Join("/run/secrets", path)
 		}
 		out, err := d.Cmd("exec", task.Status.ContainerStatus.ContainerID, "cat", path)
-		c.Assert(err, checker.IsNil)
-		c.Assert(out, checker.Equals, "TESTINGDATA "+testName+" "+testTarget)
+		assert.NilError(c, err)
+		assert.Equal(c, out, "TESTINGDATA "+testName+" "+testTarget)
 	}
 
 	out, err = d.Cmd("service", "rm", serviceName)
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 }
 
 func (s *DockerSwarmSuite) TestServiceCreateWithSecretReferencedTwice(c *check.C) {
@@ -176,14 +177,14 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretReferencedTwice(c *check.C
 
 	serviceName := "svc"
 	out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--secret", "source=mysecret,target=target1", "--secret", "source=mysecret,target=target2", "busybox", "top")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Secrets }}", serviceName)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	var refs []swarm.SecretReference
 	c.Assert(json.Unmarshal([]byte(out), &refs), checker.IsNil)
-	c.Assert(refs, checker.HasLen, 2)
+	assert.Equal(c, len(refs), 2)
 
 	var tasks []swarm.Task
 	waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) {
@@ -200,15 +201,15 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretReferencedTwice(c *check.C
 	}, checker.Equals, true)
 
 	for _, target := range []string{"target1", "target2"} {
-		c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+		assert.NilError(c, err, out)
 		path := filepath.Join("/run/secrets", target)
 		out, err := d.Cmd("exec", task.Status.ContainerStatus.ContainerID, "cat", path)
-		c.Assert(err, checker.IsNil)
-		c.Assert(out, checker.Equals, "TESTINGDATA")
+		assert.NilError(c, err)
+		assert.Equal(c, out, "TESTINGDATA")
 	}
 
 	out, err = d.Cmd("service", "rm", serviceName)
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 }
 
 func (s *DockerSwarmSuite) TestServiceCreateWithConfigSimple(c *check.C) {
@@ -225,14 +226,14 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSimple(c *check.C) {
 	c.Assert(id, checker.Not(checker.Equals), "", check.Commentf("configs: %s", id))
 
 	out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--config", testName, "busybox", "top")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Configs }}", serviceName)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	var refs []swarm.ConfigReference
 	c.Assert(json.Unmarshal([]byte(out), &refs), checker.IsNil)
-	c.Assert(refs, checker.HasLen, 1)
+	assert.Equal(c, len(refs), 1)
 
 	c.Assert(refs[0].ConfigName, checker.Equals, testName)
 	c.Assert(refs[0].File, checker.Not(checker.IsNil))
@@ -241,7 +242,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSimple(c *check.C) {
 	c.Assert(refs[0].File.GID, checker.Equals, "0")
 
 	out, err = d.Cmd("service", "rm", serviceName)
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 	d.DeleteConfig(c, testName)
 }
 
@@ -273,14 +274,14 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSourceTargetPaths(c *check
 	serviceCmd = append(serviceCmd, configFlags...)
 	serviceCmd = append(serviceCmd, "busybox", "top")
 	out, err := d.Cmd(serviceCmd...)
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Configs }}", serviceName)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	var refs []swarm.ConfigReference
 	c.Assert(json.Unmarshal([]byte(out), &refs), checker.IsNil)
-	c.Assert(refs, checker.HasLen, len(testPaths))
+	assert.Equal(c, len(refs), len(testPaths))
 
 	var tasks []swarm.Task
 	waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) {
@@ -302,12 +303,12 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSourceTargetPaths(c *check
 			path = filepath.Join("/", path)
 		}
 		out, err := d.Cmd("exec", task.Status.ContainerStatus.ContainerID, "cat", path)
-		c.Assert(err, checker.IsNil)
-		c.Assert(out, checker.Equals, "TESTINGDATA "+testName+" "+testTarget)
+		assert.NilError(c, err)
+		assert.Equal(c, out, "TESTINGDATA "+testName+" "+testTarget)
 	}
 
 	out, err = d.Cmd("service", "rm", serviceName)
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 }
 
 func (s *DockerSwarmSuite) TestServiceCreateWithConfigReferencedTwice(c *check.C) {
@@ -323,14 +324,14 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigReferencedTwice(c *check.C
 
 	serviceName := "svc"
 	out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--config", "source=myconfig,target=target1", "--config", "source=myconfig,target=target2", "busybox", "top")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.TaskTemplate.ContainerSpec.Configs }}", serviceName)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	var refs []swarm.ConfigReference
 	c.Assert(json.Unmarshal([]byte(out), &refs), checker.IsNil)
-	c.Assert(refs, checker.HasLen, 2)
+	assert.Equal(c, len(refs), 2)
 
 	var tasks []swarm.Task
 	waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) {
@@ -347,21 +348,21 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigReferencedTwice(c *check.C
 	}, checker.Equals, true)
 
 	for _, target := range []string{"target1", "target2"} {
-		c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+		assert.NilError(c, err, out)
 		path := filepath.Join("/", target)
 		out, err := d.Cmd("exec", task.Status.ContainerStatus.ContainerID, "cat", path)
-		c.Assert(err, checker.IsNil)
-		c.Assert(out, checker.Equals, "TESTINGDATA")
+		assert.NilError(c, err)
+		assert.Equal(c, out, "TESTINGDATA")
 	}
 
 	out, err = d.Cmd("service", "rm", serviceName)
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 }
 
 func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *check.C) {
 	d := s.AddDaemon(c, true, true)
 	out, err := d.Cmd("service", "create", "--no-resolve-image", "--detach=true", "--mount", "type=tmpfs,target=/foo,tmpfs-size=1MB", "busybox", "sh", "-c", "mount | grep foo; tail -f /dev/null")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 	id := strings.TrimSpace(out)
 
 	var tasks []swarm.Task
@@ -380,7 +381,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *check.C) {
 
 	// check container mount config
 	out, err = s.nodeCmd(c, task.NodeID, "inspect", "--format", "{{json .HostConfig.Mounts}}", task.Status.ContainerStatus.ContainerID)
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	var mountConfig []mount.Mount
 	c.Assert(json.Unmarshal([]byte(out), &mountConfig), checker.IsNil)
@@ -394,7 +395,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *check.C) {
 
 	// check container mounts actual
 	out, err = s.nodeCmd(c, task.NodeID, "inspect", "--format", "{{json .Mounts}}", task.Status.ContainerStatus.ContainerID)
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	var mounts []types.MountPoint
 	c.Assert(json.Unmarshal([]byte(out), &mounts), checker.IsNil)
@@ -406,18 +407,18 @@ func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *check.C) {
 	c.Assert(mounts[0].RW, checker.Equals, true)
 
 	out, err = s.nodeCmd(c, task.NodeID, "logs", task.Status.ContainerStatus.ContainerID)
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
-	c.Assert(strings.TrimSpace(out), checker.HasPrefix, "tmpfs on /foo type tmpfs")
-	c.Assert(strings.TrimSpace(out), checker.Contains, "size=1024k")
+	assert.NilError(c, err, out)
+	assert.Assert(c, strings.HasPrefix(strings.TrimSpace(out), "tmpfs on /foo type tmpfs"))
+	assert.Assert(c, strings.Contains(strings.TrimSpace(out), "size=1024k"))
 }
 
 func (s *DockerSwarmSuite) TestServiceCreateWithNetworkAlias(c *check.C) {
 	d := s.AddDaemon(c, true, true)
 	out, err := d.Cmd("network", "create", "--scope=swarm", "test_swarm_br")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	out, err = d.Cmd("service", "create", "--no-resolve-image", "--detach=true", "--network=name=test_swarm_br,alias=srv_alias", "--name=alias_tst_container", "busybox", "top")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 	id := strings.TrimSpace(out)
 
 	var tasks []swarm.Task
@@ -436,7 +437,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithNetworkAlias(c *check.C) {
 
 	// check container alias config
 	out, err = s.nodeCmd(c, task.NodeID, "inspect", "--format", "{{json .NetworkSettings.Networks.test_swarm_br.Aliases}}", task.Status.ContainerStatus.ContainerID)
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	// Make sure the only alias seen is the container-id
 	var aliases []string

+ 3 - 2
integration-cli/docker_cli_service_health_test.go

@@ -12,6 +12,7 @@ import (
 	"github.com/docker/docker/integration-cli/cli"
 	"github.com/docker/docker/integration-cli/cli/build"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 	"gotest.tools/icmd"
 )
 
@@ -34,7 +35,7 @@ func (s *DockerSwarmSuite) TestServiceHealthRun(c *check.C) {
 
 	serviceName := "healthServiceRun"
 	out, err := d.Cmd("service", "create", "--no-resolve-image", "--detach=true", "--name", serviceName, imageName, "top")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 	id := strings.TrimSpace(out)
 
 	var tasks []swarm.Task
@@ -95,7 +96,7 @@ func (s *DockerSwarmSuite) TestServiceHealthStart(c *check.C) {
 
 	serviceName := "healthServiceStart"
 	out, err := d.Cmd("service", "create", "--no-resolve-image", "--detach=true", "--name", serviceName, imageName, "top")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 	id := strings.TrimSpace(out)
 
 	var tasks []swarm.Task

+ 34 - 33
integration-cli/docker_cli_service_logs_test.go

@@ -13,6 +13,7 @@ import (
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/daemon"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 	"gotest.tools/icmd"
 )
 
@@ -33,8 +34,8 @@ func (s *DockerSwarmSuite) TestServiceLogs(c *check.C) {
 	for name, message := range services {
 		out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", name, "busybox",
 			"sh", "-c", fmt.Sprintf("echo %s; tail -f /dev/null", message))
-		c.Assert(err, checker.IsNil)
-		c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
+		assert.NilError(c, err)
+		assert.Assert(c, strings.TrimSpace(out) != "")
 	}
 
 	// make sure task has been deployed.
@@ -44,9 +45,9 @@ func (s *DockerSwarmSuite) TestServiceLogs(c *check.C) {
 
 	for name, message := range services {
 		out, err := d.Cmd("service", "logs", name)
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 		c.Logf("log for %q: %q", name, out)
-		c.Assert(out, checker.Contains, message)
+		assert.Assert(c, strings.Contains(out, message))
 	}
 }
 
@@ -75,8 +76,8 @@ func (s *DockerSwarmSuite) TestServiceLogsCompleteness(c *check.C) {
 
 	// make a service that prints 6 lines
 	out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", name, "busybox", "sh", "-c", "for line in $(seq 0 5); do echo log test $line; done; sleep 100000")
-	c.Assert(err, checker.IsNil)
-	c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
+	assert.NilError(c, err)
+	assert.Assert(c, strings.TrimSpace(out) != "")
 
 	// make sure task has been deployed.
 	waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 1)
@@ -84,14 +85,14 @@ func (s *DockerSwarmSuite) TestServiceLogsCompleteness(c *check.C) {
 	waitAndAssert(c, defaultReconciliationTimeout, countLogLines(d, name), checker.Equals, 6)
 
 	out, err = d.Cmd("service", "logs", name)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	lines := strings.Split(strings.TrimSpace(out), "\n")
 
 	// i have heard anecdotal reports that logs may come back from the engine
 	// mis-ordered. if this tests fails, consider the possibility that that
 	// might be occurring
 	for i, line := range lines {
-		c.Assert(line, checker.Contains, fmt.Sprintf("log test %v", i))
+		assert.Assert(c, strings.Contains(line, fmt.Sprintf("log test %v", i)))
 	}
 }
 
@@ -102,20 +103,20 @@ func (s *DockerSwarmSuite) TestServiceLogsTail(c *check.C) {
 
 	// make a service that prints 6 lines
 	out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", name, "busybox", "sh", "-c", "for line in $(seq 1 6); do echo log test $line; done; sleep 100000")
-	c.Assert(err, checker.IsNil)
-	c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
+	assert.NilError(c, err)
+	assert.Assert(c, strings.TrimSpace(out) != "")
 
 	// make sure task has been deployed.
 	waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 1)
 	waitAndAssert(c, defaultReconciliationTimeout, countLogLines(d, name), checker.Equals, 6)
 
 	out, err = d.Cmd("service", "logs", "--tail=2", name)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	lines := strings.Split(strings.TrimSpace(out), "\n")
 
 	for i, line := range lines {
 		// doing i+5 is hacky but not too fragile, it's good enough. if it flakes something else is wrong
-		c.Assert(line, checker.Contains, fmt.Sprintf("log test %v", i+5))
+		assert.Assert(c, strings.Contains(line, fmt.Sprintf("log test %v", i+5)))
 	}
 }
 
@@ -126,31 +127,31 @@ func (s *DockerSwarmSuite) TestServiceLogsSince(c *check.C) {
 	name := "TestServiceLogsSince"
 
 	out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", name, "busybox", "sh", "-c", "for i in $(seq 1 3); do sleep .1; echo log$i; done; sleep 10000000")
-	c.Assert(err, checker.IsNil)
-	c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
+	assert.NilError(c, err)
+	assert.Assert(c, strings.TrimSpace(out) != "")
 	waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 1)
 	// wait a sec for the logs to come in
 	waitAndAssert(c, defaultReconciliationTimeout, countLogLines(d, name), checker.Equals, 3)
 
 	out, err = d.Cmd("service", "logs", "-t", name)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	log2Line := strings.Split(strings.Split(out, "\n")[1], " ")
 	t, err := time.Parse(time.RFC3339Nano, log2Line[0]) // timestamp log2 is written
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	u := t.Add(50 * time.Millisecond) // add .05s so log1 & log2 don't show up
 	since := u.Format(time.RFC3339Nano)
 
 	out, err = d.Cmd("service", "logs", "-t", fmt.Sprintf("--since=%v", since), name)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	unexpected := []string{"log1", "log2"}
 	expected := []string{"log3"}
 	for _, v := range unexpected {
-		c.Assert(out, checker.Not(checker.Contains), v, check.Commentf("unexpected log message returned, since=%v", u))
+		assert.Assert(c, !strings.Contains(out, v), "unexpected log message returned, since=%v", u)
 	}
 	for _, v := range expected {
-		c.Assert(out, checker.Contains, v, check.Commentf("expected log message %v, was not present, since=%v", u))
+		assert.Assert(c, strings.Contains(out, v), "expected log message %v, was not present, since=%v", u)
 	}
 }
 
@@ -160,8 +161,8 @@ func (s *DockerSwarmSuite) TestServiceLogsFollow(c *check.C) {
 	name := "TestServiceLogsFollow"
 
 	out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", name, "busybox", "sh", "-c", "while true; do echo log test; sleep 0.1; done")
-	c.Assert(err, checker.IsNil)
-	c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
+	assert.NilError(c, err)
+	assert.Assert(c, strings.TrimSpace(out) != "")
 
 	// make sure task has been deployed.
 	waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 1)
@@ -171,7 +172,7 @@ func (s *DockerSwarmSuite) TestServiceLogsFollow(c *check.C) {
 	r, w := io.Pipe()
 	cmd.Stdout = w
 	cmd.Stderr = w
-	c.Assert(cmd.Start(), checker.IsNil)
+	assert.NilError(c, cmd.Start())
 	go cmd.Wait()
 
 	// Make sure pipe is written to
@@ -192,12 +193,12 @@ func (s *DockerSwarmSuite) TestServiceLogsFollow(c *check.C) {
 
 	for i := 0; i < 3; i++ {
 		msg := <-ch
-		c.Assert(msg.err, checker.IsNil)
-		c.Assert(string(msg.data), checker.Contains, "log test")
+		assert.NilError(c, msg.err)
+		assert.Assert(c, strings.Contains(string(msg.data), "log test"))
 	}
 	close(done)
 
-	c.Assert(cmd.Process.Kill(), checker.IsNil)
+	assert.NilError(c, cmd.Process.Kill())
 }
 
 func (s *DockerSwarmSuite) TestServiceLogsTaskLogs(c *check.C) {
@@ -220,7 +221,7 @@ func (s *DockerSwarmSuite) TestServiceLogsTaskLogs(c *check.C) {
 	// ^^ verify that we get no error
 	// then verify that we have an id in stdout
 	id := strings.TrimSpace(result.Stdout())
-	c.Assert(id, checker.Not(checker.Equals), "")
+	assert.Assert(c, id != "")
 	// so, right here, we're basically inspecting by id and returning only
 	// the ID. if they don't match, the service doesn't exist.
 	result = icmd.RunCmd(d.Command("service", "inspect", "--format=\"{{.ID}}\"", id))
@@ -235,7 +236,7 @@ func (s *DockerSwarmSuite) TestServiceLogsTaskLogs(c *check.C) {
 	result.Assert(c, icmd.Expected{})
 	// make sure we have two tasks
 	taskIDs := strings.Split(strings.TrimSpace(result.Stdout()), "\n")
-	c.Assert(taskIDs, checker.HasLen, replicas)
+	assert.Equal(c, len(taskIDs), replicas)
 
 	for _, taskID := range taskIDs {
 		c.Logf("checking task %v", taskID)
@@ -246,9 +247,9 @@ func (s *DockerSwarmSuite) TestServiceLogsTaskLogs(c *check.C) {
 		c.Logf("checking messages for %v", taskID)
 		for i, line := range lines {
 			// make sure the message is in order
-			c.Assert(line, checker.Contains, fmt.Sprintf("log test %v", i))
+			assert.Assert(c, strings.Contains(line, fmt.Sprintf("log test %v", i)))
 			// make sure it contains the task id
-			c.Assert(line, checker.Contains, taskID)
+			assert.Assert(c, strings.Contains(line, taskID))
 		}
 	}
 }
@@ -273,7 +274,7 @@ func (s *DockerSwarmSuite) TestServiceLogsTTY(c *check.C) {
 
 	result.Assert(c, icmd.Expected{})
 	id := strings.TrimSpace(result.Stdout())
-	c.Assert(id, checker.Not(checker.Equals), "")
+	assert.Assert(c, id != "")
 	// so, right here, we're basically inspecting by id and returning only
 	// the ID. if they don't match, the service doesn't exist.
 	result = icmd.RunCmd(d.Command("service", "inspect", "--format=\"{{.ID}}\"", id))
@@ -311,7 +312,7 @@ func (s *DockerSwarmSuite) TestServiceLogsNoHangDeletedContainer(c *check.C) {
 	result.Assert(c, icmd.Expected{})
 	// get the service id
 	id := strings.TrimSpace(result.Stdout())
-	c.Assert(id, checker.Not(checker.Equals), "")
+	assert.Assert(c, id != "")
 
 	// make sure task has been deployed.
 	waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 1)
@@ -321,7 +322,7 @@ func (s *DockerSwarmSuite) TestServiceLogsNoHangDeletedContainer(c *check.C) {
 	// now find and nuke the container
 	result = icmd.RunCmd(d.Command("ps", "-q"))
 	containerID := strings.TrimSpace(result.Stdout())
-	c.Assert(containerID, checker.Not(checker.Equals), "")
+	assert.Assert(c, containerID != "")
 	result = icmd.RunCmd(d.Command("stop", containerID))
 	result.Assert(c, icmd.Expected{Out: containerID})
 	result = icmd.RunCmd(d.Command("rm", containerID))
@@ -364,7 +365,7 @@ func (s *DockerSwarmSuite) TestServiceLogsDetails(c *check.C) {
 
 	result.Assert(c, icmd.Expected{})
 	id := strings.TrimSpace(result.Stdout())
-	c.Assert(id, checker.Not(checker.Equals), "")
+	assert.Assert(c, id != "")
 
 	// make sure task has been deployed
 	waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 1)

+ 7 - 7
integration-cli/docker_cli_service_scale_test.go

@@ -6,8 +6,8 @@ import (
 	"fmt"
 	"strings"
 
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 func (s *DockerSwarmSuite) TestServiceScale(c *check.C) {
@@ -22,16 +22,16 @@ func (s *DockerSwarmSuite) TestServiceScale(c *check.C) {
 
 	// Create services
 	_, err := d.Cmd(service1Args...)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	_, err = d.Cmd(service2Args...)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	_, err = d.Cmd("service", "scale", "TestService1=2")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, err := d.Cmd("service", "scale", "TestService1=foobar")
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 
 	str := fmt.Sprintf("%s: invalid replicas value %s", service1Name, "foobar")
 	if !strings.Contains(out, str) {
@@ -39,7 +39,7 @@ func (s *DockerSwarmSuite) TestServiceScale(c *check.C) {
 	}
 
 	out, err = d.Cmd("service", "scale", "TestService1=-1")
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 
 	str = fmt.Sprintf("%s: invalid replicas value %s", service1Name, "-1")
 	if !strings.Contains(out, str) {
@@ -48,7 +48,7 @@ func (s *DockerSwarmSuite) TestServiceScale(c *check.C) {
 
 	// TestService2 is a global mode
 	out, err = d.Cmd("service", "scale", "TestService2=2")
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 
 	str = fmt.Sprintf("%s: scale can only be used with replicated mode\n", service2Name)
 	if out != str {

+ 4 - 3
integration-cli/docker_cli_sni_test.go

@@ -11,6 +11,7 @@ import (
 	"strings"
 
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 func (s *DockerSuite) TestClientSetsTLSServerName(c *check.C) {
@@ -27,7 +28,7 @@ func (s *DockerSuite) TestClientSetsTLSServerName(c *check.C) {
 	virtualHostServer.Config.ErrorLog = log.New(ioutil.Discard, "", 0)
 
 	u, err := url.Parse(virtualHostServer.URL)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	hostPort := u.Host
 	serverName = strings.Split(hostPort, ":")[0]
 
@@ -36,9 +37,9 @@ func (s *DockerSuite) TestClientSetsTLSServerName(c *check.C) {
 	cmd.Run()
 
 	// check that the fake server was hit at least once
-	c.Assert(len(serverNameReceived) > 0, check.Equals, true)
+	assert.Assert(c, len(serverNameReceived) > 0)
 	// check that for each hit the right server name was received
 	for _, item := range serverNameReceived {
-		c.Check(item, check.Equals, serverName)
+		assert.Check(c, item == serverName)
 	}
 }

+ 7 - 6
integration-cli/docker_cli_start_test.go

@@ -8,6 +8,7 @@ import (
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 	"gotest.tools/icmd"
 )
 
@@ -34,7 +35,7 @@ func (s *DockerSuite) TestStartAttachReturnsOnError(c *check.C) {
 
 	select {
 	case err := <-ch:
-		c.Assert(err, check.IsNil)
+		assert.NilError(c, err)
 	case <-time.After(5 * time.Second):
 		c.Fatalf("Attach did not exit properly")
 	}
@@ -121,7 +122,7 @@ func (s *DockerSuite) TestStartMultipleContainers(c *check.C) {
 
 	out := inspectField(c, "parent", "State.Running")
 	// Container should be stopped
-	c.Assert(out, checker.Equals, "false")
+	assert.Equal(c, out, "false")
 
 	// start all the three containers, container `child_first` start first which should be failed
 	// container 'parent' start second and then start container 'child_second'
@@ -138,7 +139,7 @@ func (s *DockerSuite) TestStartMultipleContainers(c *check.C) {
 	for container, expected := range map[string]string{"parent": "true", "child_first": "false", "child_second": "true"} {
 		out := inspectField(c, container, "State.Running")
 		// Container running state wrong
-		c.Assert(out, checker.Equals, expected)
+		assert.Equal(c, out, expected)
 	}
 }
 
@@ -166,7 +167,7 @@ func (s *DockerSuite) TestStartAttachMultipleContainers(c *check.C) {
 	for container, expected := range map[string]string{"test1": "false", "test2": "false", "test3": "false"} {
 		out := inspectField(c, container, "State.Running")
 		// Container running state wrong
-		c.Assert(out, checker.Equals, expected)
+		assert.Equal(c, out, expected)
 	}
 }
 
@@ -191,10 +192,10 @@ func (s *DockerSuite) TestStartReturnCorrectExitCode(c *check.C) {
 	dockerCmd(c, "create", "--rm", "--name", "withRm", "busybox", "sh", "-c", "exit 12")
 
 	out, exitCode, err := dockerCmdWithError("start", "-a", "withRestart")
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(exitCode, checker.Equals, 11, check.Commentf("out: %s", out))
 
 	out, exitCode, err = dockerCmdWithError("start", "-a", "withRm")
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(exitCode, checker.Equals, 12, check.Commentf("out: %s", out))
 }

+ 26 - 24
integration-cli/docker_cli_stats_test.go

@@ -7,9 +7,10 @@ import (
 	"strings"
 	"time"
 
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
+	is "gotest.tools/assert/cmp"
 )
 
 func (s *DockerSuite) TestStatsNoStream(c *check.C) {
@@ -17,7 +18,7 @@ func (s *DockerSuite) TestStatsNoStream(c *check.C) {
 	testRequires(c, DaemonIsLinux)
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 	id := strings.TrimSpace(out)
-	c.Assert(waitRun(id), checker.IsNil)
+	assert.NilError(c, waitRun(id))
 
 	statsCmd := exec.Command(dockerBinary, "stats", "--no-stream", id)
 	type output struct {
@@ -33,8 +34,8 @@ func (s *DockerSuite) TestStatsNoStream(c *check.C) {
 
 	select {
 	case outerr := <-ch:
-		c.Assert(outerr.err, checker.IsNil, check.Commentf("Error running stats: %v", outerr.err))
-		c.Assert(string(outerr.out), checker.Contains, id[:12]) //running container wasn't present in output
+		assert.NilError(c, outerr.err, "Error running stats: %v", outerr.err)
+		assert.Assert(c, is.Contains(string(outerr.out), id[:12]), "running container wasn't present in output")
 	case <-time.After(3 * time.Second):
 		statsCmd.Process.Kill()
 		c.Fatalf("stats did not return immediately when not streaming")
@@ -46,12 +47,12 @@ func (s *DockerSuite) TestStatsContainerNotFound(c *check.C) {
 	testRequires(c, DaemonIsLinux)
 
 	out, _, err := dockerCmdWithError("stats", "notfound")
-	c.Assert(err, checker.NotNil)
-	c.Assert(out, checker.Contains, "No such container: notfound", check.Commentf("Expected to fail on not found container stats, got %q instead", out))
+	assert.ErrorContains(c, err, "")
+	assert.Assert(c, is.Contains(out, "No such container: notfound"), "Expected to fail on not found container stats, got %q instead", out)
 
 	out, _, err = dockerCmdWithError("stats", "--no-stream", "notfound")
-	c.Assert(err, checker.NotNil)
-	c.Assert(out, checker.Contains, "No such container: notfound", check.Commentf("Expected to fail on not found container stats with --no-stream, got %q instead", out))
+	assert.ErrorContains(c, err, "")
+	assert.Assert(c, is.Contains(out, "No such container: notfound"), "Expected to fail on not found container stats with --no-stream, got %q instead", out)
 }
 
 func (s *DockerSuite) TestStatsAllRunningNoStream(c *check.C) {
@@ -60,13 +61,13 @@ func (s *DockerSuite) TestStatsAllRunningNoStream(c *check.C) {
 
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 	id1 := strings.TrimSpace(out)[:12]
-	c.Assert(waitRun(id1), check.IsNil)
+	assert.NilError(c, waitRun(id1))
 	out, _ = dockerCmd(c, "run", "-d", "busybox", "top")
 	id2 := strings.TrimSpace(out)[:12]
-	c.Assert(waitRun(id2), check.IsNil)
+	assert.NilError(c, waitRun(id2))
 	out, _ = dockerCmd(c, "run", "-d", "busybox", "top")
 	id3 := strings.TrimSpace(out)[:12]
-	c.Assert(waitRun(id3), check.IsNil)
+	assert.NilError(c, waitRun(id3))
 	dockerCmd(c, "stop", id3)
 
 	out, _ = dockerCmd(c, "stats", "--no-stream")
@@ -84,10 +85,10 @@ func (s *DockerSuite) TestStatsAllRunningNoStream(c *check.C) {
 	outLines := strings.Split(out, "\n")
 	// check stat result of id2 contains real data
 	realData := reg.Find([]byte(outLines[1][12:]))
-	c.Assert(realData, checker.NotNil, check.Commentf("stat result are empty: %s", out))
+	assert.Assert(c, realData != nil, "stat result are empty: %s", out)
 	// check stat result of id1 contains real data
 	realData = reg.Find([]byte(outLines[2][12:]))
-	c.Assert(realData, checker.NotNil, check.Commentf("stat result are empty: %s", out))
+	assert.Assert(c, realData != nil, "stat result are empty: %s", out)
 }
 
 func (s *DockerSuite) TestStatsAllNoStream(c *check.C) {
@@ -96,11 +97,11 @@ func (s *DockerSuite) TestStatsAllNoStream(c *check.C) {
 
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
 	id1 := strings.TrimSpace(out)[:12]
-	c.Assert(waitRun(id1), check.IsNil)
+	assert.NilError(c, waitRun(id1))
 	dockerCmd(c, "stop", id1)
 	out, _ = dockerCmd(c, "run", "-d", "busybox", "top")
 	id2 := strings.TrimSpace(out)[:12]
-	c.Assert(waitRun(id2), check.IsNil)
+	assert.NilError(c, waitRun(id2))
 
 	out, _ = dockerCmd(c, "stats", "--all", "--no-stream")
 	if !strings.Contains(out, id1) || !strings.Contains(out, id2) {
@@ -113,10 +114,11 @@ func (s *DockerSuite) TestStatsAllNoStream(c *check.C) {
 	outLines := strings.Split(out, "\n")
 	// check stat result of id2 contains real data
 	realData := reg.Find([]byte(outLines[1][12:]))
-	c.Assert(realData, checker.NotNil, check.Commentf("stat result of %s is empty: %s", id2, out))
+	assert.Assert(c, realData != nil, "stat result of %s is empty: %s", id2, out)
+
 	// check stat result of id1 contains all zero
 	realData = reg.Find([]byte(outLines[2][12:]))
-	c.Assert(realData, checker.IsNil, check.Commentf("stat result of %s should be empty : %s", id1, out))
+	assert.Assert(c, realData == nil, "stat result of %s should be empty : %s", id1, out)
 }
 
 func (s *DockerSuite) TestStatsAllNewContainersAdded(c *check.C) {
@@ -129,8 +131,8 @@ func (s *DockerSuite) TestStatsAllNewContainersAdded(c *check.C) {
 	runSleepingContainer(c, "-d")
 	statsCmd := exec.Command(dockerBinary, "stats")
 	stdout, err := statsCmd.StdoutPipe()
-	c.Assert(err, check.IsNil)
-	c.Assert(statsCmd.Start(), check.IsNil)
+	assert.NilError(c, err)
+	assert.NilError(c, statsCmd.Start())
 	go statsCmd.Wait()
 	defer statsCmd.Process.Kill()
 
@@ -149,7 +151,7 @@ func (s *DockerSuite) TestStatsAllNewContainersAdded(c *check.C) {
 	}()
 
 	out := runSleepingContainer(c, "-d")
-	c.Assert(waitRun(strings.TrimSpace(out)), check.IsNil)
+	assert.NilError(c, waitRun(strings.TrimSpace(out)))
 	id <- strings.TrimSpace(out)[:12]
 
 	select {
@@ -171,10 +173,10 @@ func (s *DockerSuite) TestStatsFormatAll(c *check.C) {
 	cli.WaitExited(c, "ExitedOne", 5*time.Second)
 
 	out := cli.DockerCmd(c, "stats", "--no-stream", "--format", "{{.Name}}").Combined()
-	c.Assert(out, checker.Contains, "RunningOne")
-	c.Assert(out, checker.Not(checker.Contains), "ExitedOne")
+	assert.Assert(c, is.Contains(out, "RunningOne"))
+	assert.Assert(c, !strings.Contains(out, "ExitedOne"))
 
 	out = cli.DockerCmd(c, "stats", "--all", "--no-stream", "--format", "{{.Name}}").Combined()
-	c.Assert(out, checker.Contains, "RunningOne")
-	c.Assert(out, checker.Contains, "ExitedOne")
+	assert.Assert(c, is.Contains(out, "RunningOne"))
+	assert.Assert(c, is.Contains(out, "ExitedOne"))
 }

File diff ditekan karena terlalu besar
+ 172 - 171
integration-cli/docker_cli_swarm_test.go


+ 16 - 15
integration-cli/docker_cli_swarm_unix_test.go

@@ -10,13 +10,14 @@ import (
 	"github.com/docker/docker/api/types/swarm"
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 func (s *DockerSwarmSuite) TestSwarmVolumePlugin(c *check.C) {
 	d := s.AddDaemon(c, true, true)
 
 	out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--mount", "type=volume,source=my-volume,destination=/foo,volume-driver=customvolumedriver", "--name", "top", "busybox", "top")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	// Make sure task stays pending before plugin is available
 	waitAndAssert(c, defaultReconciliationTimeout, d.CheckServiceTasksInStateWithError("top", swarm.TaskStatePending, "missing plugin on 1 node"), checker.Equals, 1)
@@ -26,7 +27,7 @@ func (s *DockerSwarmSuite) TestSwarmVolumePlugin(c *check.C) {
 
 	// create a dummy volume to trigger lazy loading of the plugin
 	out, err = d.Cmd("volume", "create", "-d", "customvolumedriver", "hello")
-	c.Assert(err, checker.IsNil, check.Commentf("%s", out))
+	assert.NilError(c, err, out)
 
 	// TODO(aaronl): It will take about 15 seconds for swarm to realize the
 	// plugin was loaded. Switching the test over to plugin v2 would avoid
@@ -36,21 +37,21 @@ func (s *DockerSwarmSuite) TestSwarmVolumePlugin(c *check.C) {
 	waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 1)
 
 	out, err = d.Cmd("ps", "-q")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	containerID := strings.TrimSpace(out)
 
 	out, err = d.Cmd("inspect", "-f", "{{json .Mounts}}", containerID)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	var mounts []struct {
 		Name   string
 		Driver string
 	}
 
-	c.Assert(json.NewDecoder(strings.NewReader(out)).Decode(&mounts), checker.IsNil)
-	c.Assert(len(mounts), checker.Equals, 1, check.Commentf("%s", out))
-	c.Assert(mounts[0].Name, checker.Equals, "my-volume")
-	c.Assert(mounts[0].Driver, checker.Equals, "customvolumedriver")
+	assert.NilError(c, json.NewDecoder(strings.NewReader(out)).Decode(&mounts))
+	assert.Equal(c, len(mounts), 1, string(out))
+	assert.Equal(c, mounts[0].Name, "my-volume")
+	assert.Equal(c, mounts[0].Driver, "customvolumedriver")
 }
 
 // Test network plugin filter in swarm
@@ -63,27 +64,27 @@ func (s *DockerSwarmSuite) TestSwarmNetworkPluginV2(c *check.C) {
 	pluginName := "aragunathan/global-net-plugin:latest"
 
 	_, err := d1.Cmd("plugin", "install", pluginName, "--grant-all-permissions")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	_, err = d2.Cmd("plugin", "install", pluginName, "--grant-all-permissions")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	// create network
 	networkName := "globalnet"
 	_, err = d1.Cmd("network", "create", "--driver", pluginName, networkName)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	// create a global service to ensure that both nodes will have an instance
 	serviceName := "my-service"
 	_, err = d1.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--mode=global", "--network", networkName, "busybox", "top")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	// wait for tasks ready
 	waitAndAssert(c, defaultReconciliationTimeout, reducedCheck(sumAsIntegers, d1.CheckActiveContainerCount, d2.CheckActiveContainerCount), checker.Equals, 2)
 
 	// remove service
 	_, err = d1.Cmd("service", "rm", serviceName)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	// wait to ensure all containers have exited before removing the plugin. Else there's a
 	// possibility of container exits erroring out due to plugins being unavailable.
@@ -91,14 +92,14 @@ func (s *DockerSwarmSuite) TestSwarmNetworkPluginV2(c *check.C) {
 
 	// disable plugin on worker
 	_, err = d2.Cmd("plugin", "disable", "-f", pluginName)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	time.Sleep(20 * time.Second)
 
 	image := "busybox:latest"
 	// create a new global service again.
 	_, err = d1.Cmd("service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "--mode=global", "--network", networkName, image, "top")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	waitAndAssert(c, defaultReconciliationTimeout, d1.CheckRunningTaskImages, checker.DeepEquals,
 		map[string]int{image: 1})

+ 6 - 6
integration-cli/docker_cli_top_test.go

@@ -3,8 +3,8 @@ package main
 import (
 	"strings"
 
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 	"gotest.tools/icmd"
 )
 
@@ -40,8 +40,8 @@ func (s *DockerSuite) TestTopNonPrivileged(c *check.C) {
 		lookingFor = "top"
 	}
 
-	c.Assert(out1, checker.Contains, lookingFor, check.Commentf("top should've listed `%s` in the process list, but failed the first time", lookingFor))
-	c.Assert(out2, checker.Contains, lookingFor, check.Commentf("top should've listed `%s` in the process list, but failed the second time", lookingFor))
+	assert.Assert(c, strings.Contains(out1, lookingFor), "top should've listed `%s` in the process list, but failed the first time", lookingFor)
+	assert.Assert(c, strings.Contains(out2, lookingFor), "top should've listed `%s` in the process list, but failed the second time", lookingFor)
 }
 
 // TestTopWindowsCoreProcesses validates that there are lines for the critical
@@ -54,7 +54,7 @@ func (s *DockerSuite) TestTopWindowsCoreProcesses(c *check.C) {
 	out1, _ := dockerCmd(c, "top", cleanedContainerID)
 	lookingFor := []string{"smss.exe", "csrss.exe", "wininit.exe", "services.exe", "lsass.exe", "CExecSvc.exe"}
 	for i, s := range lookingFor {
-		c.Assert(out1, checker.Contains, s, check.Commentf("top should've listed `%s` in the process list, but failed. Test case %d", s, i))
+		assert.Assert(c, strings.Contains(out1, s), "top should've listed `%s` in the process list, but failed. Test case %d", s, i)
 	}
 }
 
@@ -68,6 +68,6 @@ func (s *DockerSuite) TestTopPrivileged(c *check.C) {
 	out2, _ := dockerCmd(c, "top", cleanedContainerID)
 	dockerCmd(c, "kill", cleanedContainerID)
 
-	c.Assert(out1, checker.Contains, "top", check.Commentf("top should've listed `top` in the process list, but failed the first time"))
-	c.Assert(out2, checker.Contains, "top", check.Commentf("top should've listed `top` in the process list, but failed the second time"))
+	assert.Assert(c, strings.Contains(out1, "top"), "top should've listed `top` in the process list, but failed the first time")
+	assert.Assert(c, strings.Contains(out2, "top"), "top should've listed `top` in the process list, but failed the second time")
 }

+ 56 - 58
integration-cli/docker_cli_update_unix_test.go

@@ -12,11 +12,11 @@ import (
 
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/client"
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/internal/test/request"
 	"github.com/docker/docker/pkg/parsers/kernel"
 	"github.com/go-check/check"
 	"github.com/kr/pty"
+	"gotest.tools/assert"
 )
 
 func (s *DockerSuite) TestUpdateRunningContainer(c *check.C) {
@@ -27,11 +27,11 @@ func (s *DockerSuite) TestUpdateRunningContainer(c *check.C) {
 	dockerCmd(c, "run", "-d", "--name", name, "-m", "300M", "busybox", "top")
 	dockerCmd(c, "update", "-m", "500M", name)
 
-	c.Assert(inspectField(c, name, "HostConfig.Memory"), checker.Equals, "524288000")
+	assert.Equal(c, inspectField(c, name, "HostConfig.Memory"), "524288000")
 
 	file := "/sys/fs/cgroup/memory/memory.limit_in_bytes"
 	out, _ := dockerCmd(c, "exec", name, "cat", file)
-	c.Assert(strings.TrimSpace(out), checker.Equals, "524288000")
+	assert.Equal(c, strings.TrimSpace(out), "524288000")
 }
 
 func (s *DockerSuite) TestUpdateRunningContainerWithRestart(c *check.C) {
@@ -43,11 +43,11 @@ func (s *DockerSuite) TestUpdateRunningContainerWithRestart(c *check.C) {
 	dockerCmd(c, "update", "-m", "500M", name)
 	dockerCmd(c, "restart", name)
 
-	c.Assert(inspectField(c, name, "HostConfig.Memory"), checker.Equals, "524288000")
+	assert.Equal(c, inspectField(c, name, "HostConfig.Memory"), "524288000")
 
 	file := "/sys/fs/cgroup/memory/memory.limit_in_bytes"
 	out, _ := dockerCmd(c, "exec", name, "cat", file)
-	c.Assert(strings.TrimSpace(out), checker.Equals, "524288000")
+	assert.Equal(c, strings.TrimSpace(out), "524288000")
 }
 
 func (s *DockerSuite) TestUpdateStoppedContainer(c *check.C) {
@@ -59,10 +59,10 @@ func (s *DockerSuite) TestUpdateStoppedContainer(c *check.C) {
 	dockerCmd(c, "run", "--name", name, "-m", "300M", "busybox", "cat", file)
 	dockerCmd(c, "update", "-m", "500M", name)
 
-	c.Assert(inspectField(c, name, "HostConfig.Memory"), checker.Equals, "524288000")
+	assert.Equal(c, inspectField(c, name, "HostConfig.Memory"), "524288000")
 
 	out, _ := dockerCmd(c, "start", "-a", name)
-	c.Assert(strings.TrimSpace(out), checker.Equals, "524288000")
+	assert.Equal(c, strings.TrimSpace(out), "524288000")
 }
 
 func (s *DockerSuite) TestUpdatePausedContainer(c *check.C) {
@@ -74,12 +74,12 @@ func (s *DockerSuite) TestUpdatePausedContainer(c *check.C) {
 	dockerCmd(c, "pause", name)
 	dockerCmd(c, "update", "--cpu-shares", "500", name)
 
-	c.Assert(inspectField(c, name, "HostConfig.CPUShares"), checker.Equals, "500")
+	assert.Equal(c, inspectField(c, name, "HostConfig.CPUShares"), "500")
 
 	dockerCmd(c, "unpause", name)
 	file := "/sys/fs/cgroup/cpu/cpu.shares"
 	out, _ := dockerCmd(c, "exec", name, "cat", file)
-	c.Assert(strings.TrimSpace(out), checker.Equals, "500")
+	assert.Equal(c, strings.TrimSpace(out), "500")
 }
 
 func (s *DockerSuite) TestUpdateWithUntouchedFields(c *check.C) {
@@ -93,11 +93,11 @@ func (s *DockerSuite) TestUpdateWithUntouchedFields(c *check.C) {
 
 	// Update memory and not touch cpus, `cpuset.cpus` should still have the old value
 	out := inspectField(c, name, "HostConfig.CPUShares")
-	c.Assert(out, check.Equals, "800")
+	assert.Equal(c, out, "800")
 
 	file := "/sys/fs/cgroup/cpu/cpu.shares"
 	out, _ = dockerCmd(c, "exec", name, "cat", file)
-	c.Assert(strings.TrimSpace(out), checker.Equals, "800")
+	assert.Equal(c, strings.TrimSpace(out), "800")
 }
 
 func (s *DockerSuite) TestUpdateContainerInvalidValue(c *check.C) {
@@ -107,9 +107,9 @@ func (s *DockerSuite) TestUpdateContainerInvalidValue(c *check.C) {
 	name := "test-update-container"
 	dockerCmd(c, "run", "-d", "--name", name, "-m", "300M", "busybox", "true")
 	out, _, err := dockerCmdWithError("update", "-m", "2M", name)
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	expected := "Minimum memory limit allowed is 4MB"
-	c.Assert(out, checker.Contains, expected)
+	assert.Assert(c, strings.Contains(out, expected))
 }
 
 func (s *DockerSuite) TestUpdateContainerWithoutFlags(c *check.C) {
@@ -119,7 +119,7 @@ func (s *DockerSuite) TestUpdateContainerWithoutFlags(c *check.C) {
 	name := "test-update-container"
 	dockerCmd(c, "run", "-d", "--name", name, "-m", "300M", "busybox", "true")
 	_, _, err := dockerCmdWithError("update", name)
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 }
 
 func (s *DockerSuite) TestUpdateKernelMemory(c *check.C) {
@@ -129,11 +129,11 @@ func (s *DockerSuite) TestUpdateKernelMemory(c *check.C) {
 	dockerCmd(c, "run", "-d", "--name", name, "--kernel-memory", "50M", "busybox", "top")
 	dockerCmd(c, "update", "--kernel-memory", "100M", name)
 
-	c.Assert(inspectField(c, name, "HostConfig.KernelMemory"), checker.Equals, "104857600")
+	assert.Equal(c, inspectField(c, name, "HostConfig.KernelMemory"), "104857600")
 
 	file := "/sys/fs/cgroup/memory/memory.kmem.limit_in_bytes"
 	out, _ := dockerCmd(c, "exec", name, "cat", file)
-	c.Assert(strings.TrimSpace(out), checker.Equals, "104857600")
+	assert.Equal(c, strings.TrimSpace(out), "104857600")
 }
 
 func (s *DockerSuite) TestUpdateKernelMemoryUninitialized(c *check.C) {
@@ -146,17 +146,17 @@ func (s *DockerSuite) TestUpdateKernelMemoryUninitialized(c *check.C) {
 	// Update kernel memory to a running container without kernel memory initialized
 	// is not allowed before kernel version 4.6.
 	if !isNewKernel {
-		c.Assert(err, check.NotNil)
+		assert.ErrorContains(c, err, "")
 	} else {
-		c.Assert(err, check.IsNil)
+		assert.NilError(c, err)
 	}
 
 	dockerCmd(c, "pause", name)
 	_, _, err = dockerCmdWithError("update", "--kernel-memory", "200M", name)
 	if !isNewKernel {
-		c.Assert(err, check.NotNil)
+		assert.ErrorContains(c, err, "")
 	} else {
-		c.Assert(err, check.IsNil)
+		assert.NilError(c, err)
 	}
 	dockerCmd(c, "unpause", name)
 
@@ -164,11 +164,11 @@ func (s *DockerSuite) TestUpdateKernelMemoryUninitialized(c *check.C) {
 	dockerCmd(c, "update", "--kernel-memory", "300M", name)
 	dockerCmd(c, "start", name)
 
-	c.Assert(inspectField(c, name, "HostConfig.KernelMemory"), checker.Equals, "314572800")
+	assert.Equal(c, inspectField(c, name, "HostConfig.KernelMemory"), "314572800")
 
 	file := "/sys/fs/cgroup/memory/memory.kmem.limit_in_bytes"
 	out, _ := dockerCmd(c, "exec", name, "cat", file)
-	c.Assert(strings.TrimSpace(out), checker.Equals, "314572800")
+	assert.Equal(c, strings.TrimSpace(out), "314572800")
 }
 
 // GetKernelVersion gets the current kernel version.
@@ -192,11 +192,11 @@ func (s *DockerSuite) TestUpdateSwapMemoryOnly(c *check.C) {
 	dockerCmd(c, "run", "-d", "--name", name, "--memory", "300M", "--memory-swap", "500M", "busybox", "top")
 	dockerCmd(c, "update", "--memory-swap", "600M", name)
 
-	c.Assert(inspectField(c, name, "HostConfig.MemorySwap"), checker.Equals, "629145600")
+	assert.Equal(c, inspectField(c, name, "HostConfig.MemorySwap"), "629145600")
 
 	file := "/sys/fs/cgroup/memory/memory.memsw.limit_in_bytes"
 	out, _ := dockerCmd(c, "exec", name, "cat", file)
-	c.Assert(strings.TrimSpace(out), checker.Equals, "629145600")
+	assert.Equal(c, strings.TrimSpace(out), "629145600")
 }
 
 func (s *DockerSuite) TestUpdateInvalidSwapMemory(c *check.C) {
@@ -209,19 +209,19 @@ func (s *DockerSuite) TestUpdateInvalidSwapMemory(c *check.C) {
 	_, _, err := dockerCmdWithError("update", "--memory-swap", "200M", name)
 	// Update invalid swap memory should fail.
 	// This will pass docker config validation, but failed at kernel validation
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 
 	// Update invalid swap memory with failure should not change HostConfig
-	c.Assert(inspectField(c, name, "HostConfig.Memory"), checker.Equals, "314572800")
-	c.Assert(inspectField(c, name, "HostConfig.MemorySwap"), checker.Equals, "524288000")
+	assert.Equal(c, inspectField(c, name, "HostConfig.Memory"), "314572800")
+	assert.Equal(c, inspectField(c, name, "HostConfig.MemorySwap"), "524288000")
 
 	dockerCmd(c, "update", "--memory-swap", "600M", name)
 
-	c.Assert(inspectField(c, name, "HostConfig.MemorySwap"), checker.Equals, "629145600")
+	assert.Equal(c, inspectField(c, name, "HostConfig.MemorySwap"), "629145600")
 
 	file := "/sys/fs/cgroup/memory/memory.memsw.limit_in_bytes"
 	out, _ := dockerCmd(c, "exec", name, "cat", file)
-	c.Assert(strings.TrimSpace(out), checker.Equals, "629145600")
+	assert.Equal(c, strings.TrimSpace(out), "629145600")
 }
 
 func (s *DockerSuite) TestUpdateStats(c *check.C) {
@@ -231,16 +231,16 @@ func (s *DockerSuite) TestUpdateStats(c *check.C) {
 	name := "foo"
 	dockerCmd(c, "run", "-d", "-ti", "--name", name, "-m", "500m", "busybox")
 
-	c.Assert(waitRun(name), checker.IsNil)
+	assert.NilError(c, waitRun(name))
 
 	getMemLimit := func(id string) uint64 {
 		resp, body, err := request.Get(fmt.Sprintf("/containers/%s/stats?stream=false", id))
-		c.Assert(err, checker.IsNil)
-		c.Assert(resp.Header.Get("Content-Type"), checker.Equals, "application/json")
+		assert.NilError(c, err)
+		assert.Equal(c, resp.Header.Get("Content-Type"), "application/json")
 
 		var v *types.Stats
 		err = json.NewDecoder(body).Decode(&v)
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 		body.Close()
 
 		return v.MemoryStats.Limit
@@ -250,9 +250,7 @@ func (s *DockerSuite) TestUpdateStats(c *check.C) {
 	dockerCmd(c, "update", "--cpu-quota", "2000", name)
 
 	curMemLimit := getMemLimit(name)
-
-	c.Assert(preMemLimit, checker.Equals, curMemLimit)
-
+	assert.Equal(c, preMemLimit, curMemLimit)
 }
 
 func (s *DockerSuite) TestUpdateMemoryWithSwapMemory(c *check.C) {
@@ -263,8 +261,8 @@ func (s *DockerSuite) TestUpdateMemoryWithSwapMemory(c *check.C) {
 	name := "test-update-container"
 	dockerCmd(c, "run", "-d", "--name", name, "--memory", "300M", "busybox", "top")
 	out, _, err := dockerCmdWithError("update", "--memory", "800M", name)
-	c.Assert(err, checker.NotNil)
-	c.Assert(out, checker.Contains, "Memory limit should be smaller than already set memoryswap limit")
+	assert.ErrorContains(c, err, "")
+	assert.Assert(c, strings.Contains(out, "Memory limit should be smaller than already set memoryswap limit"))
 
 	dockerCmd(c, "update", "--memory", "800M", "--memory-swap", "1000M", name)
 }
@@ -277,24 +275,24 @@ func (s *DockerSuite) TestUpdateNotAffectMonitorRestartPolicy(c *check.C) {
 	dockerCmd(c, "update", "--cpu-shares", "512", id)
 
 	cpty, tty, err := pty.Open()
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer cpty.Close()
 
 	cmd := exec.Command(dockerBinary, "attach", id)
 	cmd.Stdin = tty
 
-	c.Assert(cmd.Start(), checker.IsNil)
+	assert.NilError(c, cmd.Start())
 	defer cmd.Process.Kill()
 
 	_, err = cpty.Write([]byte("exit\n"))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
-	c.Assert(cmd.Wait(), checker.IsNil)
+	assert.NilError(c, cmd.Wait())
 
 	// container should restart again and keep running
 	err = waitInspect(id, "{{.RestartCount}}", "1", 30*time.Second)
-	c.Assert(err, checker.IsNil)
-	c.Assert(waitRun(id), checker.IsNil)
+	assert.NilError(c, err)
+	assert.NilError(c, waitRun(id))
 }
 
 func (s *DockerSuite) TestUpdateWithNanoCPUs(c *check.C) {
@@ -304,36 +302,36 @@ func (s *DockerSuite) TestUpdateWithNanoCPUs(c *check.C) {
 	file2 := "/sys/fs/cgroup/cpu/cpu.cfs_period_us"
 
 	out, _ := dockerCmd(c, "run", "-d", "--cpus", "0.5", "--name", "top", "busybox", "top")
-	c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
+	assert.Assert(c, strings.TrimSpace(out) != "")
 
 	out, _ = dockerCmd(c, "exec", "top", "sh", "-c", fmt.Sprintf("cat %s && cat %s", file1, file2))
-	c.Assert(strings.TrimSpace(out), checker.Equals, "50000\n100000")
+	assert.Equal(c, strings.TrimSpace(out), "50000\n100000")
 
 	clt, err := client.NewClientWithOpts(client.FromEnv)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	inspect, err := clt.ContainerInspect(context.Background(), "top")
-	c.Assert(err, checker.IsNil)
-	c.Assert(inspect.HostConfig.NanoCPUs, checker.Equals, int64(500000000))
+	assert.NilError(c, err)
+	assert.Equal(c, inspect.HostConfig.NanoCPUs, int64(500000000))
 
 	out = inspectField(c, "top", "HostConfig.CpuQuota")
-	c.Assert(out, checker.Equals, "0", check.Commentf("CPU CFS quota should be 0"))
+	assert.Equal(c, out, "0", "CPU CFS quota should be 0")
 	out = inspectField(c, "top", "HostConfig.CpuPeriod")
-	c.Assert(out, checker.Equals, "0", check.Commentf("CPU CFS period should be 0"))
+	assert.Equal(c, out, "0", "CPU CFS period should be 0")
 
 	out, _, err = dockerCmdWithError("update", "--cpu-quota", "80000", "top")
-	c.Assert(err, checker.NotNil)
-	c.Assert(out, checker.Contains, "Conflicting options: CPU Quota cannot be updated as NanoCPUs has already been set")
+	assert.ErrorContains(c, err, "")
+	assert.Assert(c, strings.Contains(out, "Conflicting options: CPU Quota cannot be updated as NanoCPUs has already been set"))
 
 	dockerCmd(c, "update", "--cpus", "0.8", "top")
 	inspect, err = clt.ContainerInspect(context.Background(), "top")
-	c.Assert(err, checker.IsNil)
-	c.Assert(inspect.HostConfig.NanoCPUs, checker.Equals, int64(800000000))
+	assert.NilError(c, err)
+	assert.Equal(c, inspect.HostConfig.NanoCPUs, int64(800000000))
 
 	out = inspectField(c, "top", "HostConfig.CpuQuota")
-	c.Assert(out, checker.Equals, "0", check.Commentf("CPU CFS quota should be 0"))
+	assert.Equal(c, out, "0", "CPU CFS quota should be 0")
 	out = inspectField(c, "top", "HostConfig.CpuPeriod")
-	c.Assert(out, checker.Equals, "0", check.Commentf("CPU CFS period should be 0"))
+	assert.Equal(c, out, "0", "CPU CFS period should be 0")
 
 	out, _ = dockerCmd(c, "exec", "top", "sh", "-c", fmt.Sprintf("cat %s && cat %s", file1, file2))
-	c.Assert(strings.TrimSpace(out), checker.Equals, "80000\n100000")
+	assert.Equal(c, strings.TrimSpace(out), "80000\n100000")
 }

+ 11 - 9
integration-cli/docker_cli_userns_test.go

@@ -16,6 +16,7 @@ import (
 	"github.com/docker/docker/pkg/stringid"
 	"github.com/docker/docker/pkg/system"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 // user namespaces test: run daemon with remapped root setting
@@ -27,7 +28,7 @@ func (s *DockerDaemonSuite) TestDaemonUserNamespaceRootSetting(c *check.C) {
 	s.d.StartWithBusybox(c, "--userns-remap", "default")
 
 	tmpDir, err := ioutil.TempDir("", "userns")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	defer os.RemoveAll(tmpDir)
 
@@ -39,21 +40,22 @@ func (s *DockerDaemonSuite) TestDaemonUserNamespaceRootSetting(c *check.C) {
 	uidgid := strings.Split(filepath.Base(s.d.Root), ".")
 	c.Assert(uidgid, checker.HasLen, 2, check.Commentf("Should have gotten uid/gid strings from root dirname: %s", filepath.Base(s.d.Root)))
 	uid, err := strconv.Atoi(uidgid[0])
-	c.Assert(err, checker.IsNil, check.Commentf("Can't parse uid"))
+	assert.NilError(c, err, "Can't parse uid")
 	gid, err := strconv.Atoi(uidgid[1])
-	c.Assert(err, checker.IsNil, check.Commentf("Can't parse gid"))
+	assert.NilError(c, err, "Can't parse gid")
 
 	// writable by the remapped root UID/GID pair
-	c.Assert(os.Chown(tmpDir, uid, gid), checker.IsNil)
+	assert.NilError(c, os.Chown(tmpDir, uid, gid))
 
 	out, err := s.d.Cmd("run", "-d", "--name", "userns", "-v", tmpDir+":/goofy", "-v", tmpDirNotExists+":/donald", "busybox", "sh", "-c", "touch /goofy/testfile; top")
-	c.Assert(err, checker.IsNil, check.Commentf("Output: %s", out))
+	assert.NilError(c, err, "Output: %s", out)
+
 	user := s.findUser(c, "userns")
 	c.Assert(uidgid[0], checker.Equals, user)
 
 	// check that the created directory is owned by remapped uid:gid
 	statNotExists, err := system.Stat(tmpDirNotExists)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(statNotExists.UID(), checker.Equals, uint32(uid), check.Commentf("Created directory not owned by remapped root UID"))
 	c.Assert(statNotExists.GID(), checker.Equals, uint32(gid), check.Commentf("Created directory not owned by remapped root GID"))
 
@@ -64,16 +66,16 @@ func (s *DockerDaemonSuite) TestDaemonUserNamespaceRootSetting(c *check.C) {
 	_, err = RunCommandPipelineWithOutput(
 		exec.Command("cat", "/proc/"+strings.TrimSpace(pid)+"/uid_map"),
 		exec.Command("grep", "-E", fmt.Sprintf("0[[:space:]]+%d[[:space:]]+", uid)))
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	_, err = RunCommandPipelineWithOutput(
 		exec.Command("cat", "/proc/"+strings.TrimSpace(pid)+"/gid_map"),
 		exec.Command("grep", "-E", fmt.Sprintf("0[[:space:]]+%d[[:space:]]+", gid)))
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	// check that the touched file is owned by remapped uid:gid
 	stat, err := system.Stat(filepath.Join(tmpDir, "testfile"))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	c.Assert(stat.UID(), checker.Equals, uint32(uid), check.Commentf("Touched file not owned by remapped root UID"))
 	c.Assert(stat.GID(), checker.Equals, uint32(gid), check.Commentf("Touched file not owned by remapped root GID"))
 

+ 4 - 3
integration-cli/docker_cli_v2_only_test.go

@@ -8,6 +8,7 @@ import (
 
 	"github.com/docker/docker/internal/test/registry"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 func makefile(path string, contents string) (string, error) {
@@ -27,7 +28,7 @@ func makefile(path string, contents string) (string, error) {
 func (s *DockerRegistrySuite) TestV2Only(c *check.C) {
 	reg, err := registry.NewMock(c)
 	defer reg.Close()
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	reg.RegisterHandler("/v2/", func(w http.ResponseWriter, r *http.Request) {
 		w.WriteHeader(404)
@@ -42,11 +43,11 @@ func (s *DockerRegistrySuite) TestV2Only(c *check.C) {
 	s.d.Start(c, "--insecure-registry", reg.URL())
 
 	tmp, err := ioutil.TempDir("", "integration-cli-")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	defer os.RemoveAll(tmp)
 
 	dockerfileName, err := makefile(tmp, fmt.Sprintf("FROM %s/busybox", reg.URL()))
-	c.Assert(err, check.IsNil, check.Commentf("Unable to create test dockerfile"))
+	assert.NilError(c, err, "Unable to create test dockerfile")
 
 	s.d.Cmd("build", "--file", dockerfileName, tmp)
 

+ 22 - 37
integration-cli/docker_cli_volume_test.go

@@ -16,6 +16,7 @@ import (
 	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli/build"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 	"gotest.tools/icmd"
 )
 
@@ -23,7 +24,7 @@ func (s *DockerSuite) TestVolumeCLICreate(c *check.C) {
 	dockerCmd(c, "volume", "create")
 
 	_, _, err := dockerCmdWithError("volume", "create", "-d", "nosuchdriver")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 
 	// test using hidden --name option
 	out, _ := dockerCmd(c, "volume", "create", "--name=test")
@@ -100,32 +101,16 @@ func (s *DockerSuite) TestVolumeLsFormatDefaultFormat(c *check.C) {
 		"volumesFormat": "{{ .Name }} default"
 }`
 	d, err := ioutil.TempDir("", "integration-cli-")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer os.RemoveAll(d)
 
 	err = ioutil.WriteFile(filepath.Join(d, "config.json"), []byte(config), 0644)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	out, _ := dockerCmd(c, "--config", d, "volume", "ls")
 	assertVolumesInList(c, out, []string{"aaa default", "soo default", "test default"})
 }
 
-// assertVolList checks volume retrieved with ls command
-// equals to expected volume list
-// note: out should be `volume ls [option]` result
-func assertVolList(c *check.C, out string, expectVols []string) {
-	lines := strings.Split(out, "\n")
-	var volList []string
-	for _, line := range lines[1 : len(lines)-1] {
-		volFields := strings.Fields(line)
-		// wrap all volume name in volList
-		volList = append(volList, volFields[1])
-	}
-
-	// volume ls should contains all expected volumes
-	c.Assert(volList, checker.DeepEquals, expectVols)
-}
-
 func assertVolumesInList(c *check.C, out string, expected []string) {
 	lines := strings.Split(strings.TrimSpace(string(out)), "\n")
 	for _, expect := range expected {
@@ -136,7 +121,7 @@ func assertVolumesInList(c *check.C, out string, expected []string) {
 				break
 			}
 		}
-		c.Assert(found, checker.Equals, true, check.Commentf("Expected volume not found: %v, got: %v", expect, lines))
+		assert.Assert(c, found, "Expected volume not found: %v, got: %v", expect, lines)
 	}
 }
 
@@ -192,13 +177,13 @@ func (s *DockerSuite) TestVolumeCLILsFilterDangling(c *check.C) {
 
 func (s *DockerSuite) TestVolumeCLILsErrorWithInvalidFilterName(c *check.C) {
 	out, _, err := dockerCmdWithError("volume", "ls", "-f", "FOO=123")
-	c.Assert(err, checker.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(out, checker.Contains, "Invalid filter")
 }
 
 func (s *DockerSuite) TestVolumeCLILsWithIncorrectFilterValue(c *check.C) {
 	out, _, err := dockerCmdWithError("volume", "ls", "-f", "dangling=invalid")
-	c.Assert(err, check.NotNil)
+	assert.ErrorContains(c, err, "")
 	c.Assert(out, checker.Contains, "Invalid filter")
 }
 
@@ -301,7 +286,7 @@ func (s *DockerSuite) TestVolumeCLICreateLabel(c *check.C) {
 	testValue := "bar"
 
 	_, _, err := dockerCmdWithError("volume", "create", "--label", testLabel+"="+testValue, testVol)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	out, _ := dockerCmd(c, "volume", "inspect", "--format={{ .Labels."+testLabel+" }}", testVol)
 	c.Assert(strings.TrimSpace(out), check.Equals, testValue)
@@ -326,7 +311,7 @@ func (s *DockerSuite) TestVolumeCLICreateLabelMultiple(c *check.C) {
 	}
 
 	_, _, err := dockerCmdWithError(args...)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	for k, v := range testLabels {
 		out, _ := dockerCmd(c, "volume", "inspect", "--format={{ .Labels."+k+" }}", testVol)
@@ -337,11 +322,11 @@ func (s *DockerSuite) TestVolumeCLICreateLabelMultiple(c *check.C) {
 func (s *DockerSuite) TestVolumeCLILsFilterLabels(c *check.C) {
 	testVol1 := "testvolcreatelabel-1"
 	_, _, err := dockerCmdWithError("volume", "create", "--label", "foo=bar1", testVol1)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	testVol2 := "testvolcreatelabel-2"
 	_, _, err = dockerCmdWithError("volume", "create", "--label", "foo=bar2", testVol2)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	out, _ := dockerCmd(c, "volume", "ls", "--filter", "label=foo")
 
@@ -368,11 +353,11 @@ func (s *DockerSuite) TestVolumeCLILsFilterDrivers(c *check.C) {
 	// using default volume driver local to create volumes
 	testVol1 := "testvol-1"
 	_, _, err := dockerCmdWithError("volume", "create", testVol1)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	testVol2 := "testvol-2"
 	_, _, err = dockerCmdWithError("volume", "create", testVol2)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	// filter with driver=local
 	out, _ := dockerCmd(c, "volume", "ls", "--filter", "driver=local")
@@ -412,7 +397,7 @@ func (s *DockerSuite) TestVolumeCLIRmForce(c *check.C) {
 	c.Assert(id, checker.Equals, name)
 
 	out, _ = dockerCmd(c, "volume", "inspect", "--format", "{{.Mountpoint}}", name)
-	c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "")
+	assert.Assert(c, strings.TrimSpace(out) != "")
 	// Mountpoint is in the form of "/var/lib/docker/volumes/.../_data", removing `/_data`
 	path := strings.TrimSuffix(strings.TrimSpace(out), "/_data")
 	icmd.RunCommand("rm", "-rf", path).Assert(c, icmd.Success)
@@ -438,8 +423,8 @@ func (s *DockerSuite) TestVolumeCLIRmForceInUse(c *check.C) {
 	cid := strings.TrimSpace(out)
 
 	_, _, err := dockerCmdWithError("volume", "rm", "-f", name)
-	c.Assert(err, check.NotNil)
-	c.Assert(err.Error(), checker.Contains, "volume is in use")
+	assert.ErrorContains(c, err, "")
+	assert.ErrorContains(c, err, "volume is in use")
 	out, _ = dockerCmd(c, "volume", "ls")
 	c.Assert(out, checker.Contains, name)
 
@@ -448,8 +433,8 @@ func (s *DockerSuite) TestVolumeCLIRmForceInUse(c *check.C) {
 	// Calling `volume rm` a second time to confirm it's not removed
 	// when calling twice.
 	_, _, err = dockerCmdWithError("volume", "rm", "-f", name)
-	c.Assert(err, check.NotNil)
-	c.Assert(err.Error(), checker.Contains, "volume is in use")
+	assert.ErrorContains(c, err, "")
+	assert.ErrorContains(c, err, "volume is in use")
 	out, _ = dockerCmd(c, "volume", "ls")
 	c.Assert(out, checker.Contains, name)
 
@@ -516,7 +501,7 @@ func (s *DockerSuite) TestDuplicateMountpointsForVolumesFrom(c *check.C) {
 
 	// Only the second volume will be referenced, this is backward compatible
 	out, _ = dockerCmd(c, "inspect", "--format", "{{(index .Mounts 0).Name}}", "app")
-	c.Assert(strings.TrimSpace(out), checker.Equals, data2)
+	assert.Equal(c, strings.TrimSpace(out), data2)
 
 	dockerCmd(c, "rm", "-f", "-v", "app")
 	dockerCmd(c, "rm", "-f", "-v", "data1")
@@ -598,10 +583,10 @@ func (s *DockerSuite) TestDuplicateMountpointsForVolumesFromAndMounts(c *check.C
 	c.Assert(strings.TrimSpace(out), checker.Contains, data2)
 
 	err := os.MkdirAll("/tmp/data", 0755)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	// Mounts is available in API
 	cli, err := client.NewClientWithOpts(client.FromEnv)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer cli.Close()
 
 	config := container.Config{
@@ -621,7 +606,7 @@ func (s *DockerSuite) TestDuplicateMountpointsForVolumesFromAndMounts(c *check.C
 	}
 	_, err = cli.ContainerCreate(context.Background(), &config, &hostConfig, &network.NetworkingConfig{}, "app")
 
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	// No volume will be referenced (mount is /tmp/data), this is backward compatible
 	out, _ = dockerCmd(c, "inspect", "--format", "{{(index .Mounts 0).Name}}", "app")

+ 47 - 46
integration-cli/docker_deprecated_api_v124_test.go

@@ -8,9 +8,10 @@ import (
 	"strings"
 
 	"github.com/docker/docker/api/types/versions"
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/internal/test/request"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
+	is "gotest.tools/assert/cmp"
 )
 
 func formatV123StartAPIURL(url string) string {
@@ -24,15 +25,15 @@ func (s *DockerSuite) TestDeprecatedContainerAPIStartHostConfig(c *check.C) {
 		"Binds": []string{"/aa:/bb"},
 	}
 	res, body, err := request.Post("/containers/"+name+"/start", request.JSONBody(config))
-	c.Assert(err, checker.IsNil)
-	c.Assert(res.StatusCode, checker.Equals, http.StatusBadRequest)
+	assert.NilError(c, err)
+	assert.Equal(c, res.StatusCode, http.StatusBadRequest)
 	if versions.GreaterThanOrEqualTo(testEnv.DaemonAPIVersion(), "1.32") {
 		// assertions below won't work before 1.32
 		buf, err := request.ReadBody(body)
-		c.Assert(err, checker.IsNil)
+		assert.NilError(c, err)
 
-		c.Assert(res.StatusCode, checker.Equals, http.StatusBadRequest)
-		c.Assert(string(buf), checker.Contains, "was deprecated since API v1.22")
+		assert.Equal(c, res.StatusCode, http.StatusBadRequest)
+		assert.Assert(c, strings.Contains(string(buf), "was deprecated since API v1.22"))
 	}
 }
 
@@ -50,20 +51,20 @@ func (s *DockerSuite) TestDeprecatedContainerAPIStartVolumeBinds(c *check.C) {
 	}
 
 	res, _, err := request.Post(formatV123StartAPIURL("/containers/create?name="+name), request.JSONBody(config))
-	c.Assert(err, checker.IsNil)
-	c.Assert(res.StatusCode, checker.Equals, http.StatusCreated)
+	assert.NilError(c, err)
+	assert.Equal(c, res.StatusCode, http.StatusCreated)
 
 	bindPath := RandomTmpDirPath("test", testEnv.OSType)
 	config = map[string]interface{}{
 		"Binds": []string{bindPath + ":" + path},
 	}
 	res, _, err = request.Post(formatV123StartAPIURL("/containers/"+name+"/start"), request.JSONBody(config))
-	c.Assert(err, checker.IsNil)
-	c.Assert(res.StatusCode, checker.Equals, http.StatusNoContent)
+	assert.NilError(c, err)
+	assert.Equal(c, res.StatusCode, http.StatusNoContent)
 
 	pth, err := inspectMountSourceField(name, path)
-	c.Assert(err, checker.IsNil)
-	c.Assert(pth, checker.Equals, bindPath, check.Commentf("expected volume host path to be %s, got %s", bindPath, pth))
+	assert.NilError(c, err)
+	assert.Equal(c, pth, bindPath, "expected volume host path to be %s, got %s", bindPath, pth)
 }
 
 // Test for GH#10618
@@ -77,8 +78,8 @@ func (s *DockerSuite) TestDeprecatedContainerAPIStartDupVolumeBinds(c *check.C)
 	}
 
 	res, _, err := request.Post(formatV123StartAPIURL("/containers/create?name="+name), request.JSONBody(config))
-	c.Assert(err, checker.IsNil)
-	c.Assert(res.StatusCode, checker.Equals, http.StatusCreated)
+	assert.NilError(c, err)
+	assert.Equal(c, res.StatusCode, http.StatusCreated)
 
 	bindPath1 := RandomTmpDirPath("test1", testEnv.OSType)
 	bindPath2 := RandomTmpDirPath("test2", testEnv.OSType)
@@ -87,17 +88,17 @@ func (s *DockerSuite) TestDeprecatedContainerAPIStartDupVolumeBinds(c *check.C)
 		"Binds": []string{bindPath1 + ":/tmp", bindPath2 + ":/tmp"},
 	}
 	res, body, err := request.Post(formatV123StartAPIURL("/containers/"+name+"/start"), request.JSONBody(config))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	buf, err := request.ReadBody(body)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	if versions.LessThan(testEnv.DaemonAPIVersion(), "1.32") {
-		c.Assert(res.StatusCode, checker.Equals, http.StatusInternalServerError)
+		assert.Equal(c, res.StatusCode, http.StatusInternalServerError)
 	} else {
-		c.Assert(res.StatusCode, checker.Equals, http.StatusBadRequest)
+		assert.Equal(c, res.StatusCode, http.StatusBadRequest)
 	}
-	c.Assert(string(buf), checker.Contains, "Duplicate mount point", check.Commentf("Expected failure due to duplicate bind mounts to same path, instead got: %q with error: %v", string(buf), err))
+	assert.Assert(c, strings.Contains(string(buf), "Duplicate mount point"), "Expected failure due to duplicate bind mounts to same path, instead got: %q with error: %v", string(buf), err)
 }
 
 func (s *DockerSuite) TestDeprecatedContainerAPIStartVolumesFrom(c *check.C) {
@@ -115,21 +116,21 @@ func (s *DockerSuite) TestDeprecatedContainerAPIStartVolumesFrom(c *check.C) {
 	}
 
 	res, _, err := request.Post(formatV123StartAPIURL("/containers/create?name="+name), request.JSONBody(config))
-	c.Assert(err, checker.IsNil)
-	c.Assert(res.StatusCode, checker.Equals, http.StatusCreated)
+	assert.NilError(c, err)
+	assert.Equal(c, res.StatusCode, http.StatusCreated)
 
 	config = map[string]interface{}{
 		"VolumesFrom": []string{volName},
 	}
 	res, _, err = request.Post(formatV123StartAPIURL("/containers/"+name+"/start"), request.JSONBody(config))
-	c.Assert(err, checker.IsNil)
-	c.Assert(res.StatusCode, checker.Equals, http.StatusNoContent)
+	assert.NilError(c, err)
+	assert.Equal(c, res.StatusCode, http.StatusNoContent)
 
 	pth, err := inspectMountSourceField(name, volPath)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	pth2, err := inspectMountSourceField(volName, volPath)
-	c.Assert(err, checker.IsNil)
-	c.Assert(pth, checker.Equals, pth2, check.Commentf("expected volume host path to be %s, got %s", pth, pth2))
+	assert.NilError(c, err)
+	assert.Equal(c, pth, pth2, "expected volume host path to be %s, got %s", pth, pth2)
 }
 
 // #9981 - Allow a docker created volume (ie, one in /var/lib/docker/volumes) to be used to overwrite (via passing in Binds on api start) an existing volume
@@ -139,18 +140,18 @@ func (s *DockerSuite) TestDeprecatedPostContainerBindNormalVolume(c *check.C) {
 	dockerCmd(c, "create", "-v", "/foo", "--name=one", "busybox")
 
 	fooDir, err := inspectMountSourceField("one", "/foo")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	dockerCmd(c, "create", "-v", "/foo", "--name=two", "busybox")
 
 	bindSpec := map[string][]string{"Binds": {fooDir + ":/foo"}}
 	res, _, err := request.Post(formatV123StartAPIURL("/containers/two/start"), request.JSONBody(bindSpec))
-	c.Assert(err, checker.IsNil)
-	c.Assert(res.StatusCode, checker.Equals, http.StatusNoContent)
+	assert.NilError(c, err)
+	assert.Equal(c, res.StatusCode, http.StatusNoContent)
 
 	fooDir2, err := inspectMountSourceField("two", "/foo")
-	c.Assert(err, checker.IsNil)
-	c.Assert(fooDir2, checker.Equals, fooDir, check.Commentf("expected volume path to be %s, got: %s", fooDir, fooDir2))
+	assert.NilError(c, err)
+	assert.Equal(c, fooDir2, fooDir, "expected volume path to be %s, got: %s", fooDir, fooDir2)
 }
 
 func (s *DockerSuite) TestDeprecatedStartWithTooLowMemoryLimit(c *check.C) {
@@ -166,15 +167,15 @@ func (s *DockerSuite) TestDeprecatedStartWithTooLowMemoryLimit(c *check.C) {
         }`
 
 	res, body, err := request.Post(formatV123StartAPIURL("/containers/"+containerID+"/start"), request.RawString(config), request.JSON)
-	c.Assert(err, checker.IsNil)
-	b, err2 := request.ReadBody(body)
-	c.Assert(err2, checker.IsNil)
+	assert.NilError(c, err)
+	b, err := request.ReadBody(body)
+	assert.NilError(c, err)
 	if versions.LessThan(testEnv.DaemonAPIVersion(), "1.32") {
-		c.Assert(res.StatusCode, checker.Equals, http.StatusInternalServerError)
+		assert.Equal(c, res.StatusCode, http.StatusInternalServerError)
 	} else {
-		c.Assert(res.StatusCode, checker.Equals, http.StatusBadRequest)
+		assert.Equal(c, res.StatusCode, http.StatusBadRequest)
 	}
-	c.Assert(string(b), checker.Contains, "Minimum memory limit allowed is 4MB")
+	assert.Assert(c, is.Contains(string(b), "Minimum memory limit allowed is 4MB"))
 }
 
 // #14640
@@ -189,8 +190,8 @@ func (s *DockerSuite) TestDeprecatedPostContainersStartWithoutLinksInHostConfig(
 	config := `{"HostConfig":` + hc + `}`
 
 	res, b, err := request.Post(formatV123StartAPIURL("/containers/"+name+"/start"), request.RawString(config), request.JSON)
-	c.Assert(err, checker.IsNil)
-	c.Assert(res.StatusCode, checker.Equals, http.StatusNoContent)
+	assert.NilError(c, err)
+	assert.Equal(c, res.StatusCode, http.StatusNoContent)
 	b.Close()
 }
 
@@ -207,8 +208,8 @@ func (s *DockerSuite) TestDeprecatedPostContainersStartWithLinksInHostConfig(c *
 	config := `{"HostConfig":` + hc + `}`
 
 	res, b, err := request.Post(formatV123StartAPIURL("/containers/"+name+"/start"), request.RawString(config), request.JSON)
-	c.Assert(err, checker.IsNil)
-	c.Assert(res.StatusCode, checker.Equals, http.StatusNoContent)
+	assert.NilError(c, err)
+	assert.Equal(c, res.StatusCode, http.StatusNoContent)
 	b.Close()
 }
 
@@ -227,8 +228,8 @@ func (s *DockerSuite) TestDeprecatedPostContainersStartWithLinksInHostConfigIdLi
 	config := `{"HostConfig":` + hc + `}`
 
 	res, b, err := request.Post(formatV123StartAPIURL("/containers/"+name+"/start"), request.RawString(config), request.JSON)
-	c.Assert(err, checker.IsNil)
-	c.Assert(res.StatusCode, checker.Equals, http.StatusNoContent)
+	assert.NilError(c, err)
+	assert.Equal(c, res.StatusCode, http.StatusNoContent)
 	b.Close()
 }
 
@@ -241,10 +242,10 @@ func (s *DockerSuite) TestDeprecatedStartWithNilDNS(c *check.C) {
 	config := `{"HostConfig": {"Dns": null}}`
 
 	res, b, err := request.Post(formatV123StartAPIURL("/containers/"+containerID+"/start"), request.RawString(config), request.JSON)
-	c.Assert(err, checker.IsNil)
-	c.Assert(res.StatusCode, checker.Equals, http.StatusNoContent)
+	assert.NilError(c, err)
+	assert.Equal(c, res.StatusCode, http.StatusNoContent)
 	b.Close()
 
 	dns := inspectFieldJSON(c, containerID, "HostConfig.Dns")
-	c.Assert(dns, checker.Equals, "[]")
+	assert.Equal(c, dns, "[]")
 }

+ 6 - 6
integration-cli/docker_deprecated_api_v124_unix_test.go

@@ -3,11 +3,11 @@
 package main
 
 import (
-	"fmt"
+	"strings"
 
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/internal/test/request"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 // #19100 This is a deprecated feature test, it should be removed in Docker 1.12
@@ -23,9 +23,9 @@ func (s *DockerNetworkSuite) TestDeprecatedDockerNetworkStartAPIWithHostconfig(c
 		},
 	}
 	_, _, err := request.Post(formatV123StartAPIURL("/containers/"+conName+"/start"), request.JSONBody(config))
-	c.Assert(err, checker.IsNil)
-	c.Assert(waitRun(conName), checker.IsNil)
+	assert.NilError(c, err)
+	assert.NilError(c, waitRun(conName))
 	networks := inspectField(c, conName, "NetworkSettings.Networks")
-	c.Assert(networks, checker.Contains, netName, check.Commentf(fmt.Sprintf("Should contain '%s' network", netName)))
-	c.Assert(networks, checker.Not(checker.Contains), "bridge", check.Commentf("Should not contain 'bridge' network"))
+	assert.Assert(c, strings.Contains(networks, netName), "Should contain '%s' network", netName)
+	assert.Assert(c, !strings.Contains(networks, "bridge"), "Should not contain 'bridge' network")
 }

+ 17 - 17
integration-cli/docker_utils_test.go

@@ -16,10 +16,10 @@ import (
 
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/client"
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/integration-cli/cli"
 	"github.com/docker/docker/integration-cli/daemon"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 	"gotest.tools/icmd"
 )
 
@@ -66,7 +66,7 @@ func getContainerCount(c *check.C) int {
 			output = strings.TrimLeft(output, containers)
 			output = strings.Trim(output, " ")
 			containerCount, err := strconv.Atoi(output)
-			c.Assert(err, checker.IsNil)
+			assert.NilError(c, err)
 			return containerCount
 		}
 	}
@@ -100,7 +100,7 @@ func inspectFieldWithError(name, field string) (string, error) {
 func inspectField(c *check.C, name, field string) string {
 	out, err := inspectFilter(name, fmt.Sprintf(".%s", field))
 	if c != nil {
-		c.Assert(err, check.IsNil)
+		assert.NilError(c, err)
 	}
 	return out
 }
@@ -109,7 +109,7 @@ func inspectField(c *check.C, name, field string) string {
 func inspectFieldJSON(c *check.C, name, field string) string {
 	out, err := inspectFilter(name, fmt.Sprintf("json .%s", field))
 	if c != nil {
-		c.Assert(err, check.IsNil)
+		assert.NilError(c, err)
 	}
 	return out
 }
@@ -118,7 +118,7 @@ func inspectFieldJSON(c *check.C, name, field string) string {
 func inspectFieldMap(c *check.C, name, path, field string) string {
 	out, err := inspectFilter(name, fmt.Sprintf("index .%s %q", path, field))
 	if c != nil {
-		c.Assert(err, check.IsNil)
+		assert.NilError(c, err)
 	}
 	return out
 }
@@ -181,7 +181,7 @@ func inspectImage(c *check.C, name, filter string) string {
 
 func getIDByName(c *check.C, name string) string {
 	id, err := inspectFieldWithError(name, "Id")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	return id
 }
 
@@ -203,18 +203,18 @@ func writeFile(dst, content string, c *check.C) {
 	// Create subdirectories if necessary
 	c.Assert(os.MkdirAll(path.Dir(dst), 0700), check.IsNil)
 	f, err := os.OpenFile(dst, os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0700)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	defer f.Close()
 	// Write content (truncate if it exists)
 	_, err = io.Copy(f, strings.NewReader(content))
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 }
 
 // Return the contents of file at path `src`.
 // Fail the test when error occurs.
 func readFile(src string, c *check.C) (content string) {
 	data, err := ioutil.ReadFile(src)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	return string(data)
 }
@@ -236,11 +236,11 @@ func runCommandAndReadContainerFile(c *check.C, filename string, command string,
 
 func readContainerFile(c *check.C, containerID, filename string) []byte {
 	f, err := os.Open(containerStorageFile(containerID, filename))
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	defer f.Close()
 
 	content, err := ioutil.ReadAll(f)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 	return content
 }
 
@@ -256,11 +256,11 @@ func daemonTime(c *check.C) time.Time {
 		return time.Now()
 	}
 	cli, err := client.NewClientWithOpts(client.FromEnv)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	defer cli.Close()
 
 	info, err := cli.Info(context.Background())
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	dt, err := time.Parse(time.RFC3339Nano, info.SystemTime)
 	c.Assert(err, check.IsNil, check.Commentf("invalid time format in GET /info response"))
@@ -306,12 +306,12 @@ func appendBaseEnv(isTLS bool, env ...string) []string {
 
 func createTmpFile(c *check.C, content string) string {
 	f, err := ioutil.TempFile("", "testfile")
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	filename := f.Name()
 
 	err = ioutil.WriteFile(filename, []byte(content), 0644)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 
 	return filename
 }
@@ -337,10 +337,10 @@ func waitInspectWithArgs(name, expr, expected string, timeout time.Duration, arg
 
 func getInspectBody(c *check.C, version, id string) []byte {
 	cli, err := client.NewClientWithOpts(client.FromEnv, client.WithVersion(version))
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	defer cli.Close()
 	_, body, err := cli.ContainerInspectWithRaw(context.Background(), id, false)
-	c.Assert(err, check.IsNil)
+	assert.NilError(c, err)
 	return body
 }
 

+ 7 - 7
integration-cli/events_utils_test.go

@@ -10,9 +10,9 @@ import (
 	"strings"
 
 	eventstestutils "github.com/docker/docker/daemon/events/testutils"
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/go-check/check"
 	"github.com/sirupsen/logrus"
+	"gotest.tools/assert"
 )
 
 // eventMatcher is a function that tries to match an event input.
@@ -155,7 +155,7 @@ func eventActionsByIDAndType(c *check.C, events []string, id, eventType string)
 	var filtered []string
 	for _, event := range events {
 		matches := eventstestutils.ScanMap(event)
-		c.Assert(matches, checker.Not(checker.IsNil))
+		assert.Assert(c, matches != nil)
 		if matchIDAndEventType(matches, id, eventType) {
 			filtered = append(filtered, matches["action"])
 		}
@@ -188,8 +188,8 @@ func parseEvents(c *check.C, out, match string) {
 	for _, event := range events {
 		matches := eventstestutils.ScanMap(event)
 		matched, err := regexp.MatchString(match, matches["action"])
-		c.Assert(err, checker.IsNil)
-		c.Assert(matched, checker.True, check.Commentf("Matcher: %s did not match %s", match, matches["action"]))
+		assert.NilError(c, err)
+		assert.Assert(c, matched, "Matcher: %s did not match %s", match, matches["action"])
 	}
 }
 
@@ -197,10 +197,10 @@ func parseEventsWithID(c *check.C, out, match, id string) {
 	events := strings.Split(strings.TrimSpace(out), "\n")
 	for _, event := range events {
 		matches := eventstestutils.ScanMap(event)
-		c.Assert(matchEventID(matches, id), checker.True)
+		assert.Assert(c, matchEventID(matches, id))
 
 		matched, err := regexp.MatchString(match, matches["action"])
-		c.Assert(err, checker.IsNil)
-		c.Assert(matched, checker.True, check.Commentf("Matcher: %s did not match %s", match, matches["action"]))
+		assert.NilError(c, err)
+		assert.Assert(c, matched, "Matcher: %s did not match %s", match, matches["action"])
 	}
 }

+ 12 - 12
integration-cli/fixtures_linux_daemon_test.go

@@ -9,9 +9,9 @@ import (
 	"runtime"
 	"strings"
 
-	"github.com/docker/docker/integration-cli/checker"
 	"github.com/docker/docker/internal/test/fixtures/load"
 	"github.com/go-check/check"
+	"gotest.tools/assert"
 )
 
 type testingT interface {
@@ -39,21 +39,21 @@ func ensureSyscallTest(c *check.C) {
 	}
 
 	tmp, err := ioutil.TempDir("", "syscall-test-build")
-	c.Assert(err, checker.IsNil, check.Commentf("couldn't create temp dir"))
+	assert.NilError(c, err, "couldn't create temp dir")
 	defer os.RemoveAll(tmp)
 
 	gcc, err := exec.LookPath("gcc")
-	c.Assert(err, checker.IsNil, check.Commentf("could not find gcc"))
+	assert.NilError(c, err, "could not find gcc")
 
 	tests := []string{"userns", "ns", "acct", "setuid", "setgid", "socket", "raw"}
 	for _, test := range tests {
 		out, err := exec.Command(gcc, "-g", "-Wall", "-static", fmt.Sprintf("../contrib/syscall-test/%s.c", test), "-o", fmt.Sprintf("%s/%s-test", tmp, test)).CombinedOutput()
-		c.Assert(err, checker.IsNil, check.Commentf(string(out)))
+		assert.NilError(c, err, string(out))
 	}
 
 	if runtime.GOOS == "linux" && runtime.GOARCH == "amd64" {
 		out, err := exec.Command(gcc, "-s", "-m32", "-nostdlib", "-static", "../contrib/syscall-test/exit32.s", "-o", tmp+"/"+"exit32-test").CombinedOutput()
-		c.Assert(err, checker.IsNil, check.Commentf(string(out)))
+		assert.NilError(c, err, string(out))
 	}
 
 	dockerFile := filepath.Join(tmp, "Dockerfile")
@@ -62,7 +62,7 @@ func ensureSyscallTest(c *check.C) {
 	COPY . /usr/bin/
 	`)
 	err = ioutil.WriteFile(dockerFile, content, 600)
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	var buildArgs []string
 	if arg := os.Getenv("DOCKER_BUILD_ARGS"); strings.TrimSpace(arg) != "" {
@@ -75,7 +75,7 @@ func ensureSyscallTest(c *check.C) {
 
 func ensureSyscallTestBuild(c *check.C) {
 	err := load.FrozenImagesLinux(testEnv.APIClient(), "buildpack-deps:jessie")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	var buildArgs []string
 	if arg := os.Getenv("DOCKER_BUILD_ARGS"); strings.TrimSpace(arg) != "" {
@@ -102,13 +102,13 @@ func ensureNNPTest(c *check.C) {
 	}
 
 	tmp, err := ioutil.TempDir("", "docker-nnp-test")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	gcc, err := exec.LookPath("gcc")
-	c.Assert(err, checker.IsNil, check.Commentf("could not find gcc"))
+	assert.NilError(c, err, "could not find gcc")
 
 	out, err := exec.Command(gcc, "-g", "-Wall", "-static", "../contrib/nnp-test/nnp-test.c", "-o", filepath.Join(tmp, "nnp-test")).CombinedOutput()
-	c.Assert(err, checker.IsNil, check.Commentf(string(out)))
+	assert.NilError(c, err, string(out))
 
 	dockerfile := filepath.Join(tmp, "Dockerfile")
 	content := `
@@ -117,7 +117,7 @@ func ensureNNPTest(c *check.C) {
 	RUN chmod +s /usr/bin/nnp-test
 	`
 	err = ioutil.WriteFile(dockerfile, []byte(content), 600)
-	c.Assert(err, checker.IsNil, check.Commentf("could not write Dockerfile for nnp-test image"))
+	assert.NilError(c, err, "could not write Dockerfile for nnp-test image")
 
 	var buildArgs []string
 	if arg := os.Getenv("DOCKER_BUILD_ARGS"); strings.TrimSpace(arg) != "" {
@@ -130,7 +130,7 @@ func ensureNNPTest(c *check.C) {
 
 func ensureNNPTestBuild(c *check.C) {
 	err := load.FrozenImagesLinux(testEnv.APIClient(), "buildpack-deps:jessie")
-	c.Assert(err, checker.IsNil)
+	assert.NilError(c, err)
 
 	var buildArgs []string
 	if arg := os.Getenv("DOCKER_BUILD_ARGS"); strings.TrimSpace(arg) != "" {

+ 1 - 1
vendor.conf

@@ -13,7 +13,7 @@ github.com/kr/pty 5cf931ef8f
 github.com/mattn/go-shellwords v1.0.3
 github.com/sirupsen/logrus 8bdbc7bcc01dcbb8ec23dc8a28e332258d25251f # v1.4.1
 github.com/tchap/go-patricia v2.2.6
-github.com/vdemeester/shakers 24d7f1d6a71aa5d9cbe7390e4afb66b7eef9e1b3
+github.com/vdemeester/shakers 24d7f1d6a71aa5d9cbe7390e4afb66b7eef9e1b3 # v0.1.0
 golang.org/x/net a680a1efc54dd51c040b3b5ce4939ea3cf2ea0d1
 golang.org/x/sys d455e41777fca6e8a5a79e34a14b8368bc11d9ba
 github.com/docker/go-units 47565b4f722fb6ceae66b95f853feed578a4a51c # v0.3.3

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini