Browse code

rm-gocheck: NotNil

sed -E -i 's#\bassert\.Assert\(c, (.*), checker\.NotNil\b#assert.Assert(c, \1 != nil#g' \
-- "integration-cli/docker_cli_build_test.go" "integration-cli/docker_cli_by_digest_test.go" "integration-cli/docker_cli_create_test.go" "integration-cli/docker_cli_daemon_test.go" "integration-cli/docker_cli_external_volume_driver_unix_test.go" "integration-cli/docker_cli_history_test.go" "integration-cli/docker_cli_import_test.go" "integration-cli/docker_cli_inspect_test.go" "integration-cli/docker_cli_links_test.go" "integration-cli/docker_cli_netmode_test.go" "integration-cli/docker_cli_network_unix_test.go" "integration-cli/docker_cli_port_test.go" "integration-cli/docker_cli_ps_test.go" "integration-cli/docker_cli_run_test.go" "integration-cli/docker_cli_service_create_test.go" "integration-cli/docker_cli_start_test.go" "integration-cli/docker_cli_swarm_test.go" "integration-cli/docker_cli_volume_test.go" "pkg/discovery/discovery_test.go" "pkg/discovery/file/file_test.go" "pkg/discovery/kv/kv_test.go" "pkg/discovery/nodes/nodes_test.go"

Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 64a161aa3e84c51e64600f9b665bcaf131d9fdd6)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Tibor Vass authored on 2019/09/10 06:05:57
Showing 22 changed files
... ...
@@ -5395,14 +5395,14 @@ func (s *DockerSuite) TestBuildWithFailure(c *testing.T) {
5395 5395
 	// First test case can only detect `nobody` in runtime so all steps will show up
5396 5396
 	dockerfile := "FROM busybox\nRUN nobody"
5397 5397
 	result := buildImage(name, build.WithDockerfile(dockerfile))
5398
-	assert.Assert(c, result.Error, checker.NotNil)
5398
+	assert.Assert(c, result.Error != nil)
5399 5399
 	assert.Assert(c, result.Stdout(), checker.Contains, "Step 1/2 : FROM busybox")
5400 5400
 	assert.Assert(c, result.Stdout(), checker.Contains, "Step 2/2 : RUN nobody")
5401 5401
 
5402 5402
 	// Second test case `FFOM` should have been detected before build runs so no steps
5403 5403
 	dockerfile = "FFOM nobody\nRUN nobody"
5404 5404
 	result = buildImage(name, build.WithDockerfile(dockerfile))
5405
-	assert.Assert(c, result.Error, checker.NotNil)
5405
+	assert.Assert(c, result.Error != nil)
5406 5406
 	assert.Assert(c, result.Stdout(), checker.Not(checker.Contains), "Step 1/2 : FROM busybox")
5407 5407
 	assert.Assert(c, result.Stdout(), checker.Not(checker.Contains), "Step 2/2 : RUN nobody")
5408 5408
 }
... ...
@@ -115,7 +115,7 @@ func testPullByDigestNoFallback(c *testing.T) {
115 115
 	// pull from the registry using the <name>@<digest> reference
116 116
 	imageReference := fmt.Sprintf("%s@sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", repoName)
117 117
 	out, _, err := dockerCmdWithError("pull", imageReference)
118
-	assert.Assert(c, err, checker.NotNil, check.Commentf("expected non-zero exit status and correct error message when pulling non-existing image"))
118
+	assert.Assert(c, err != nil, check.Commentf("expected non-zero exit status and correct error message when pulling non-existing image"))
119 119
 	assert.Assert(c, out, checker.Contains, fmt.Sprintf("manifest for %s not found", imageReference), check.Commentf("expected non-zero exit status and correct error message when pulling non-existing image"))
120 120
 }
121 121
 
... ...
@@ -100,7 +100,7 @@ func (s *DockerSuite) TestCreateHostConfig(c *testing.T) {
100 100
 	assert.Equal(c, len(containers), 1)
101 101
 
102 102
 	cont := containers[0]
103
-	assert.Assert(c, cont.HostConfig, checker.NotNil, check.Commentf("Expected HostConfig, got none"))
103
+	assert.Assert(c, cont.HostConfig != nil, check.Commentf("Expected HostConfig, got none"))
104 104
 	assert.Assert(c, cont.HostConfig.PublishAllPorts, checker.True, check.Commentf("Expected PublishAllPorts, got false"))
105 105
 }
106 106
 
... ...
@@ -122,7 +122,7 @@ func (s *DockerSuite) TestCreateWithPortRange(c *testing.T) {
122 122
 
123 123
 	cont := containers[0]
124 124
 
125
-	assert.Assert(c, cont.HostConfig, checker.NotNil, check.Commentf("Expected HostConfig, got none"))
125
+	assert.Assert(c, cont.HostConfig != nil, check.Commentf("Expected HostConfig, got none"))
126 126
 	assert.Equal(c, len(cont.HostConfig.PortBindings), 4, check.Commentf("Expected 4 ports bindings, got %d", len(cont.HostConfig.PortBindings)))
127 127
 
128 128
 	for k, v := range cont.HostConfig.PortBindings {
... ...
@@ -151,7 +151,7 @@ func (s *DockerSuite) TestCreateWithLargePortRange(c *testing.T) {
151 151
 	assert.Equal(c, len(containers), 1)
152 152
 
153 153
 	cont := containers[0]
154
-	assert.Assert(c, cont.HostConfig, checker.NotNil, check.Commentf("Expected HostConfig, got none"))
154
+	assert.Assert(c, cont.HostConfig != nil, check.Commentf("Expected HostConfig, got none"))
155 155
 	assert.Equal(c, len(cont.HostConfig.PortBindings), 65535)
156 156
 
157 157
 	for k, v := range cont.HostConfig.PortBindings {
... ...
@@ -216,7 +216,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithInvalidBasesize(c *testing.T) {
216 216
 
217 217
 	if newBasesizeBytes < oldBasesizeBytes {
218 218
 		err := s.d.RestartWithError("--storage-opt", fmt.Sprintf("dm.basesize=%d", newBasesizeBytes))
219
-		assert.Assert(c, err, checker.NotNil, check.Commentf("daemon should not have started as new base device size is less than existing base device size: %v", err))
219
+		assert.Assert(c, err != nil, check.Commentf("daemon should not have started as new base device size is less than existing base device size: %v", err))
220 220
 		// 'err != nil' is expected behaviour, no new daemon started,
221 221
 		// so no need to stop daemon.
222 222
 		if err != nil {
... ...
@@ -434,7 +434,7 @@ func (s *DockerDaemonSuite) TestDaemonIPv6FixedCIDR(c *testing.T) {
434 434
 	out = strings.Trim(out, " \r\n'")
435 435
 
436 436
 	ip := net.ParseIP(out)
437
-	assert.Assert(c, ip, checker.NotNil, check.Commentf("Container should have a global IPv6 address"))
437
+	assert.Assert(c, ip != nil, check.Commentf("Container should have a global IPv6 address"))
438 438
 
439 439
 	out, err = s.d.Cmd("inspect", "--format", "{{.NetworkSettings.Networks.bridge.IPv6Gateway}}", "ipv6test")
440 440
 	assert.NilError(c, err, out)
... ...
@@ -477,7 +477,7 @@ func (s *DockerDaemonSuite) TestDaemonIPv6HostMode(c *testing.T) {
477 477
 }
478 478
 
479 479
 func (s *DockerDaemonSuite) TestDaemonLogLevelWrong(c *testing.T) {
480
-	assert.Assert(c, s.d.StartWithError("--log-level=bogus"), checker.NotNil, check.Commentf("Daemon shouldn't start with wrong log level"))
480
+	assert.Assert(c, s.d.StartWithError("--log-level=bogus") != nil, check.Commentf("Daemon shouldn't start with wrong log level"))
481 481
 }
482 482
 
483 483
 func (s *DockerDaemonSuite) TestDaemonLogLevelDebug(c *testing.T) {
... ...
@@ -844,7 +844,7 @@ func (s *DockerDaemonSuite) TestDaemonIP(c *testing.T) {
844 844
 	defer d.Restart(c)
845 845
 
846 846
 	out, err := d.Cmd("run", "-d", "-p", "8000:8000", "busybox", "top")
847
-	assert.Assert(c, err, checker.NotNil, check.Commentf("Running a container must fail with an invalid --ip option"))
847
+	assert.Assert(c, err != nil, check.Commentf("Running a container must fail with an invalid --ip option"))
848 848
 	assert.Equal(c, strings.Contains(out, "Error starting userland proxy"), true)
849 849
 
850 850
 	ifName := "dummy"
... ...
@@ -1136,7 +1136,7 @@ func (s *DockerDaemonSuite) TestDaemonLoggingDriverNoneLogsError(c *testing.T) {
1136 1136
 	assert.NilError(c, err, out)
1137 1137
 
1138 1138
 	out, err = s.d.Cmd("logs", "test")
1139
-	assert.Assert(c, err, checker.NotNil, check.Commentf("Logs should fail with 'none' driver"))
1139
+	assert.Assert(c, err != nil, check.Commentf("Logs should fail with 'none' driver"))
1140 1140
 	expected := `configured logging driver does not support reading`
1141 1141
 	assert.Assert(c, strings.Contains(out, expected))
1142 1142
 }
... ...
@@ -1630,7 +1630,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartRmVolumeInUse(c *testing.T) {
1630 1630
 	s.d.Restart(c)
1631 1631
 
1632 1632
 	out, err = s.d.Cmd("volume", "rm", "test")
1633
-	assert.Assert(c, err, checker.NotNil, check.Commentf("should not be able to remove in use volume after daemon restart"))
1633
+	assert.Assert(c, err != nil, check.Commentf("should not be able to remove in use volume after daemon restart"))
1634 1634
 	assert.Assert(c, out, checker.Contains, "in use")
1635 1635
 }
1636 1636
 
... ...
@@ -1648,7 +1648,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartLocalVolumes(c *testing.T) {
1648 1648
 // FIXME(vdemeester) should be a unit test
1649 1649
 func (s *DockerDaemonSuite) TestDaemonCorruptedLogDriverAddress(c *testing.T) {
1650 1650
 	d := daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution))
1651
-	assert.Assert(c, d.StartWithError("--log-driver=syslog", "--log-opt", "syslog-address=corrupted:42"), checker.NotNil)
1651
+	assert.Assert(c, d.StartWithError("--log-driver=syslog", "--log-opt", "syslog-address=corrupted:42") != nil)
1652 1652
 	expected := "syslog-address should be in form proto://address"
1653 1653
 	icmd.RunCommand("grep", expected, d.LogFileName()).Assert(c, icmd.Success)
1654 1654
 }
... ...
@@ -1656,7 +1656,7 @@ func (s *DockerDaemonSuite) TestDaemonCorruptedLogDriverAddress(c *testing.T) {
1656 1656
 // FIXME(vdemeester) should be a unit test
1657 1657
 func (s *DockerDaemonSuite) TestDaemonCorruptedFluentdAddress(c *testing.T) {
1658 1658
 	d := daemon.New(c, dockerBinary, dockerdBinary, testdaemon.WithEnvironment(testEnv.Execution))
1659
-	assert.Assert(c, d.StartWithError("--log-driver=fluentd", "--log-opt", "fluentd-address=corrupted:c"), checker.NotNil)
1659
+	assert.Assert(c, d.StartWithError("--log-driver=fluentd", "--log-opt", "fluentd-address=corrupted:c") != nil)
1660 1660
 	expected := "invalid fluentd-address corrupted:c: "
1661 1661
 	icmd.RunCommand("grep", expected, d.LogFileName()).Assert(c, icmd.Success)
1662 1662
 }
... ...
@@ -1725,7 +1725,7 @@ func (s *DockerDaemonSuite) TestDaemonStartWithDefaultTLSHost(c *testing.T) {
1725 1725
 	assert.NilError(c, err)
1726 1726
 	conn.Close()
1727 1727
 
1728
-	assert.Assert(c, certRequestInfo, checker.NotNil)
1728
+	assert.Assert(c, certRequestInfo != nil)
1729 1729
 	assert.Equal(c, len(certRequestInfo.AcceptableCAs), 1)
1730 1730
 	assert.DeepEqual(c, certRequestInfo.AcceptableCAs[0], rootCert.RawSubject)
1731 1731
 }
... ...
@@ -1779,7 +1779,7 @@ func (s *DockerDaemonSuite) TestDaemonNoSpaceLeftOnDeviceError(c *testing.T) {
1779 1779
 
1780 1780
 	// pull a repository large enough to overfill the mounted filesystem
1781 1781
 	pullOut, err := s.d.Cmd("pull", "debian:stretch")
1782
-	assert.Assert(c, err, checker.NotNil, check.Commentf("%s", pullOut))
1782
+	assert.Assert(c, err != nil, check.Commentf("%s", pullOut))
1783 1783
 	assert.Assert(c, pullOut, checker.Contains, "no space left on device")
1784 1784
 }
1785 1785
 
... ...
@@ -2546,7 +2546,7 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromCommandLine(c *testing.T) {
2546 2546
 
2547 2547
 	// Check that we can't override the default runtime
2548 2548
 	s.d.Stop(c)
2549
-	assert.Assert(c, s.d.StartWithError("--add-runtime", "runc=my-runc"), checker.NotNil)
2549
+	assert.Assert(c, s.d.StartWithError("--add-runtime", "runc=my-runc") != nil)
2550 2550
 
2551 2551
 	content, err := s.d.ReadLogFile()
2552 2552
 	assert.NilError(c, err)
... ...
@@ -287,7 +287,7 @@ func (s *DockerExternalVolumeSuite) TestVolumeCLICreateOptionConflict(c *testing
287 287
 	dockerCmd(c, "volume", "create", "test")
288 288
 
289 289
 	out, _, err := dockerCmdWithError("volume", "create", "test", "--driver", volumePluginName)
290
-	assert.Assert(c, err, checker.NotNil, check.Commentf("volume create exception name already in use with another driver"))
290
+	assert.Assert(c, err != nil, check.Commentf("volume create exception name already in use with another driver"))
291 291
 	assert.Assert(c, out, checker.Contains, "must be unique")
292 292
 
293 293
 	out, _ = dockerCmd(c, "volume", "inspect", "--format={{ .Driver }}", "test")
... ...
@@ -585,7 +585,7 @@ func (s *DockerExternalVolumeSuite) TestExternalVolumeDriverOutOfBandDelete(c *t
585 585
 	assert.NilError(c, err)
586 586
 	assert.Equal(c, len(vs), 1)
587 587
 	assert.Equal(c, vs[0].Driver, driverName)
588
-	assert.Assert(c, vs[0].Options, checker.NotNil)
588
+	assert.Assert(c, vs[0].Options != nil)
589 589
 	assert.Equal(c, vs[0].Options["foo"], "bar")
590 590
 	assert.Equal(c, vs[0].Driver, driverName)
591 591
 
... ...
@@ -61,7 +61,7 @@ func (s *DockerSuite) TestHistoryExistentImage(c *testing.T) {
61 61
 
62 62
 func (s *DockerSuite) TestHistoryNonExistentImage(c *testing.T) {
63 63
 	_, _, err := dockerCmdWithError("history", "testHistoryNonExistentImage")
64
-	assert.Assert(c, err, checker.NotNil, check.Commentf("history on a non-existent image should fail."))
64
+	assert.Assert(c, err != nil, check.Commentf("history on a non-existent image should fail."))
65 65
 }
66 66
 
67 67
 func (s *DockerSuite) TestHistoryImageWithComment(c *testing.T) {
... ...
@@ -36,7 +36,7 @@ func (s *DockerSuite) TestImportDisplay(c *testing.T) {
36 36
 
37 37
 func (s *DockerSuite) TestImportBadURL(c *testing.T) {
38 38
 	out, _, err := dockerCmdWithError("import", "http://nourl/bad")
39
-	assert.Assert(c, err, checker.NotNil, check.Commentf("import was supposed to fail but didn't"))
39
+	assert.Assert(c, err != nil, check.Commentf("import was supposed to fail but didn't"))
40 40
 	// Depending on your system you can get either of these errors
41 41
 	if !strings.Contains(out, "dial tcp") &&
42 42
 		!strings.Contains(out, "ApplyLayer exit status 1 stdout:  stderr: archive/tar: invalid tar header") &&
... ...
@@ -122,7 +122,7 @@ func (s *DockerSuite) TestImportFileWithMessage(c *testing.T) {
122 122
 
123 123
 func (s *DockerSuite) TestImportFileNonExistentFile(c *testing.T) {
124 124
 	_, _, err := dockerCmdWithError("import", "example.com/myImage.tar")
125
-	assert.Assert(c, err, checker.NotNil, check.Commentf("import non-existing file must failed"))
125
+	assert.Assert(c, err != nil, check.Commentf("import non-existing file must failed"))
126 126
 }
127 127
 
128 128
 func (s *DockerSuite) TestImportWithQuotedChanges(c *testing.T) {
... ...
@@ -119,7 +119,7 @@ func (s *DockerSuite) TestInspectTypeFlagWithInvalidValue(c *testing.T) {
119 119
 	dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "true")
120 120
 
121 121
 	out, exitCode, err := dockerCmdWithError("inspect", "--type=foobar", "busybox")
122
-	assert.Assert(c, err, checker.NotNil, check.Commentf("%d", exitCode))
122
+	assert.Assert(c, err != nil, check.Commentf("%d", exitCode))
123 123
 	assert.Equal(c, exitCode, 1, check.Commentf("%s", err))
124 124
 	assert.Assert(c, out, checker.Contains, "not a valid value for --type")
125 125
 }
... ...
@@ -27,7 +27,7 @@ func (s *DockerSuite) TestLinksInvalidContainerTarget(c *testing.T) {
27 27
 	out, _, err := dockerCmdWithError("run", "--link", "bogus:alias", "busybox", "true")
28 28
 
29 29
 	// an invalid container target should produce an error
30
-	assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
30
+	assert.Assert(c, err != nil, check.Commentf("out: %s", out))
31 31
 	// an invalid container target should produce an error
32 32
 	// note: convert the output to lowercase first as the error string
33 33
 	// capitalization was changed after API version 1.32
... ...
@@ -169,7 +169,7 @@ func (s *DockerSuite) TestLinksUpdateOnRestart(c *testing.T) {
169 169
 	getIP := func(hosts []byte, hostname string) string {
170 170
 		re := regexp.MustCompile(fmt.Sprintf(`(\S*)\t%s`, regexp.QuoteMeta(hostname)))
171 171
 		matches := re.FindSubmatch(hosts)
172
-		assert.Assert(c, matches, checker.NotNil, check.Commentf("Hostname %s have no matches in hosts", hostname))
172
+		assert.Assert(c, matches != nil, check.Commentf("Hostname %s have no matches in hosts", hostname))
173 173
 		return string(matches[1])
174 174
 	}
175 175
 	ip := getIP(content, "one")
... ...
@@ -220,7 +220,7 @@ func (s *DockerSuite) TestLinksNetworkHostContainer(c *testing.T) {
220 220
 	out, _, err := dockerCmdWithError("run", "--name", "should_fail", "--link", "host_container:tester", "busybox", "true")
221 221
 
222 222
 	// Running container linking to a container with --net host should have failed
223
-	assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
223
+	assert.Assert(c, err != nil, check.Commentf("out: %s", out))
224 224
 	// Running container linking to a container with --net host should have failed
225 225
 	assert.Assert(c, out, checker.Contains, runconfig.ErrConflictHostNetworkAndLinks.Error())
226 226
 }
... ...
@@ -19,7 +19,7 @@ const stringCheckPS = "PID   USER"
19 19
 // stop the tests.
20 20
 func dockerCmdWithFail(c *testing.T, args ...string) (string, int) {
21 21
 	out, status, err := dockerCmdWithError(args...)
22
-	assert.Assert(c, err, checker.NotNil, check.Commentf("%v", out))
22
+	assert.Assert(c, err != nil, check.Commentf("%v", out))
23 23
 	return out, status
24 24
 }
25 25
 
... ...
@@ -64,7 +64,7 @@ func (s *DockerNetworkSuite) TearDownTest(c *testing.T) {
64 64
 func (s *DockerNetworkSuite) SetUpSuite(c *testing.T) {
65 65
 	mux := http.NewServeMux()
66 66
 	s.server = httptest.NewServer(mux)
67
-	assert.Assert(c, s.server, checker.NotNil, check.Commentf("Failed to start an HTTP Server"))
67
+	assert.Assert(c, s.server != nil, check.Commentf("Failed to start an HTTP Server"))
68 68
 	setupRemoteNetworkDrivers(c, mux, s.server.URL, dummyNetworkDriver, dummyIPAMDriver)
69 69
 }
70 70
 
... ...
@@ -416,7 +416,7 @@ func (s *DockerSuite) TestDockerNetworkDeleteMultiple(c *testing.T) {
416 416
 	// contains active container, its deletion should fail.
417 417
 	out, _, err := dockerCmdWithError("network", "rm", "testDelMulti0", "testDelMulti1", "testDelMulti2")
418 418
 	// err should not be nil due to deleting testDelMulti2 failed.
419
-	assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
419
+	assert.Assert(c, err != nil, check.Commentf("out: %s", out))
420 420
 	// testDelMulti2 should fail due to network has active endpoints
421 421
 	assert.Assert(c, out, checker.Contains, "has active endpoints")
422 422
 	assertNwNotAvailable(c, "testDelMulti0")
... ...
@@ -765,7 +765,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkDriverOptions(c *testing.T) {
765 765
 	dockerCmd(c, "network", "create", "-d", dummyNetworkDriver, "-o", "opt1=drv1", "-o", "opt2=drv2", "testopt")
766 766
 	assertNwIsAvailable(c, "testopt")
767 767
 	gopts := remoteDriverNetworkRequest.Options[netlabel.GenericData]
768
-	assert.Assert(c, gopts, checker.NotNil)
768
+	assert.Assert(c, gopts != nil)
769 769
 	opts, ok := gopts.(map[string]interface{})
770 770
 	assert.Equal(c, ok, true)
771 771
 	assert.Equal(c, opts["opt1"], "drv1")
... ...
@@ -1149,7 +1149,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkDisconnectFromHost(c *testing.T) {
1149 1149
 	dockerCmd(c, "run", "-d", "--name", "container1", "--net=host", "busybox", "top")
1150 1150
 	assert.Assert(c, waitRun("container1") == nil)
1151 1151
 	out, _, err := dockerCmdWithError("network", "disconnect", "host", "container1")
1152
-	assert.Assert(c, err, checker.NotNil, check.Commentf("Should err out disconnect from host"))
1152
+	assert.Assert(c, err != nil, check.Commentf("Should err out disconnect from host"))
1153 1153
 	assert.Assert(c, out, checker.Contains, runconfig.ErrConflictHostNetwork.Error())
1154 1154
 }
1155 1155
 
... ...
@@ -1317,7 +1317,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectPreferredIP(c *testing.T) {
1317 1317
 
1318 1318
 	// Still it should fail to connect to the default network with a specified IP (whatever ip)
1319 1319
 	out, _, err := dockerCmdWithError("network", "connect", "--ip", "172.21.55.44", "bridge", "c0")
1320
-	assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
1320
+	assert.Assert(c, err != nil, check.Commentf("out: %s", out))
1321 1321
 	assert.Assert(c, out, checker.Contains, runconfig.ErrUnsupportedNetworkAndIP.Error())
1322 1322
 
1323 1323
 }
... ...
@@ -1356,11 +1356,11 @@ func (s *DockerNetworkSuite) TestDockerNetworkUnsupportedRequiredIP(c *testing.T
1356 1356
 	assertNwIsAvailable(c, "n0")
1357 1357
 
1358 1358
 	out, _, err := dockerCmdWithError("run", "-d", "--ip", "172.28.99.88", "--net", "n0", "busybox", "top")
1359
-	assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
1359
+	assert.Assert(c, err != nil, check.Commentf("out: %s", out))
1360 1360
 	assert.Assert(c, out, checker.Contains, runconfig.ErrUnsupportedNetworkNoSubnetAndIP.Error())
1361 1361
 
1362 1362
 	out, _, err = dockerCmdWithError("run", "-d", "--ip6", "2001:db8:1234::9988", "--net", "n0", "busybox", "top")
1363
-	assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
1363
+	assert.Assert(c, err != nil, check.Commentf("out: %s", out))
1364 1364
 	assert.Assert(c, out, checker.Contains, runconfig.ErrUnsupportedNetworkNoSubnetAndIP.Error())
1365 1365
 
1366 1366
 	dockerCmd(c, "network", "rm", "n0")
... ...
@@ -1369,7 +1369,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkUnsupportedRequiredIP(c *testing.T
1369 1369
 
1370 1370
 func checkUnsupportedNetworkAndIP(c *testing.T, nwMode string) {
1371 1371
 	out, _, err := dockerCmdWithError("run", "-d", "--net", nwMode, "--ip", "172.28.99.88", "--ip6", "2001:db8:1234::9988", "busybox", "top")
1372
-	assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
1372
+	assert.Assert(c, err != nil, check.Commentf("out: %s", out))
1373 1373
 	assert.Assert(c, out, checker.Contains, runconfig.ErrUnsupportedNetworkAndIP.Error())
1374 1374
 }
1375 1375
 
... ...
@@ -1560,12 +1560,12 @@ func (s *DockerSuite) TestUserDefinedNetworkConnectDisconnectAlias(c *testing.T)
1560 1560
 
1561 1561
 	// verify the alias option is rejected when running on predefined network
1562 1562
 	out, _, err := dockerCmdWithError("run", "--rm", "--name=any", "--net-alias=any", "busybox:glibc", "top")
1563
-	assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
1563
+	assert.Assert(c, err != nil, check.Commentf("out: %s", out))
1564 1564
 	assert.Assert(c, out, checker.Contains, runconfig.ErrUnsupportedNetworkAndAlias.Error())
1565 1565
 
1566 1566
 	// verify the alias option is rejected when connecting to predefined network
1567 1567
 	out, _, err = dockerCmdWithError("network", "connect", "--alias=any", "bridge", "first")
1568
-	assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
1568
+	assert.Assert(c, err != nil, check.Commentf("out: %s", out))
1569 1569
 	assert.Assert(c, out, checker.Contains, runconfig.ErrUnsupportedNetworkAndAlias.Error())
1570 1570
 }
1571 1571
 
... ...
@@ -105,7 +105,7 @@ func (s *DockerSuite) TestPortList(c *testing.T) {
105 105
 			"-p", "9090-9092:80",
106 106
 			"busybox", "top")
107 107
 		// Exhausted port range did not return an error
108
-		assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
108
+		assert.Assert(c, err != nil, check.Commentf("out: %s", out))
109 109
 
110 110
 		for i := 0; i < 3; i++ {
111 111
 			dockerCmd(c, "rm", "-f", IDs[i])
... ...
@@ -121,7 +121,7 @@ func (s *DockerSuite) TestPortList(c *testing.T) {
121 121
 			"-p", invalidRange,
122 122
 			"busybox", "top")
123 123
 		// Port range should have returned an error
124
-		assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
124
+		assert.Assert(c, err != nil, check.Commentf("out: %s", out))
125 125
 	}
126 126
 
127 127
 	// test host range:container range spec.
... ...
@@ -302,7 +302,7 @@ func (s *DockerSuite) TestPortHostBinding(c *testing.T) {
302 302
 
303 303
 	out, _, err = dockerCmdWithError("run", "--net=host", "busybox", "nc", "localhost", "9876")
304 304
 	// Port is still bound after the Container is removed
305
-	assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
305
+	assert.Assert(c, err != nil, check.Commentf("out: %s", out))
306 306
 }
307 307
 
308 308
 func (s *DockerSuite) TestPortExposeHostBinding(c *testing.T) {
... ...
@@ -324,7 +324,7 @@ func (s *DockerSuite) TestPortExposeHostBinding(c *testing.T) {
324 324
 	out, _, err = dockerCmdWithError("run", "--net=host", "busybox",
325 325
 		"nc", "localhost", strings.TrimSpace(exposedPort))
326 326
 	// Port is still bound after the Container is removed
327
-	assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
327
+	assert.Assert(c, err != nil, check.Commentf("out: %s", out))
328 328
 }
329 329
 
330 330
 func (s *DockerSuite) TestPortBindingOnSandbox(c *testing.T) {
... ...
@@ -338,7 +338,7 @@ func (s *DockerSuite) TestPortBindingOnSandbox(c *testing.T) {
338 338
 	assert.Assert(c, waitRun("c1") == nil)
339 339
 
340 340
 	_, _, err := dockerCmdWithError("run", "--net=host", "busybox", "nc", "localhost", "8080")
341
-	assert.Assert(c, err, checker.NotNil, check.Commentf("Port mapping on internal network is expected to fail"))
341
+	assert.Assert(c, err != nil, check.Commentf("Port mapping on internal network is expected to fail"))
342 342
 	// Connect container to another normal bridge network
343 343
 	dockerCmd(c, "network", "create", "-d", "bridge", "foo-net")
344 344
 	dockerCmd(c, "network", "connect", "foo-net", "c1")
... ...
@@ -443,11 +443,11 @@ func (s *DockerSuite) TestPsListContainersFilterExited(c *testing.T) {
443 443
 	secondZero, _ := dockerCmd(c, "run", "-d", "busybox", "true")
444 444
 
445 445
 	out, _, err := dockerCmdWithError("run", "--name", "nonzero1", "busybox", "false")
446
-	assert.Assert(c, err, checker.NotNil, check.Commentf("Should fail. out: %s", out))
446
+	assert.Assert(c, err != nil, check.Commentf("Should fail. out: %s", out))
447 447
 	firstNonZero := getIDByName(c, "nonzero1")
448 448
 
449 449
 	out, _, err = dockerCmdWithError("run", "--name", "nonzero2", "busybox", "false")
450
-	assert.Assert(c, err, checker.NotNil, check.Commentf("Should fail. out: %s", out))
450
+	assert.Assert(c, err != nil, check.Commentf("Should fail. out: %s", out))
451 451
 	secondNonZero := getIDByName(c, "nonzero2")
452 452
 
453 453
 	// filter containers by exited=0
... ...
@@ -2292,7 +2292,7 @@ func (s *DockerSuite) TestRunAllowPortRangeThroughExpose(c *testing.T) {
2292 2292
 
2293 2293
 func (s *DockerSuite) TestRunExposePort(c *testing.T) {
2294 2294
 	out, _, err := dockerCmdWithError("run", "--expose", "80000", "busybox")
2295
-	assert.Assert(c, err, checker.NotNil, check.Commentf("--expose with an invalid port should error out"))
2295
+	assert.Assert(c, err != nil, check.Commentf("--expose with an invalid port should error out"))
2296 2296
 	assert.Assert(c, out, checker.Contains, "invalid range format for --expose")
2297 2297
 }
2298 2298
 
... ...
@@ -3208,10 +3208,10 @@ func (s *DockerSuite) TestRunCreateContainerFailedCleanUp(c *testing.T) {
3208 3208
 	testRequires(c, DaemonIsLinux)
3209 3209
 	name := "unique_name"
3210 3210
 	_, _, err := dockerCmdWithError("run", "--name", name, "--link", "nothing:nothing", "busybox")
3211
-	assert.Assert(c, err, checker.NotNil, check.Commentf("Expected docker run to fail!"))
3211
+	assert.Assert(c, err != nil, check.Commentf("Expected docker run to fail!"))
3212 3212
 
3213 3213
 	containerID, err := inspectFieldWithError(name, "Id")
3214
-	assert.Assert(c, err, checker.NotNil, check.Commentf("Expected not to have this container: %s!", containerID))
3214
+	assert.Assert(c, err != nil, check.Commentf("Expected not to have this container: %s!", containerID))
3215 3215
 	assert.Equal(c, containerID, "", check.Commentf("Expected not to have this container: %s!", containerID))
3216 3216
 }
3217 3217
 
... ...
@@ -3948,7 +3948,7 @@ func (s *DockerSuite) TestRunAttachFailedNoLeak(c *testing.T) {
3948 3948
 	// We will need the following `inspect` to diagnose the issue if test fails (#21247)
3949 3949
 	out1, err1 := dockerCmd(c, "inspect", "--format", "{{json .State}}", "test")
3950 3950
 	out2, err2 := dockerCmd(c, "inspect", "--format", "{{json .State}}", "fail")
3951
-	assert.Assert(c, err, checker.NotNil, check.Commentf("Command should have failed but succeeded with: %s\nContainer 'test' [%+v]: %s\nContainer 'fail' [%+v]: %s", out, err1, out1, err2, out2))
3951
+	assert.Assert(c, err != nil, check.Commentf("Command should have failed but succeeded with: %s\nContainer 'test' [%+v]: %s\nContainer 'fail' [%+v]: %s", out, err1, out1, err2, out2))
3952 3952
 	// check for windows error as well
3953 3953
 	// TODO Windows Post TP5. Fix the error message string
3954 3954
 	assert.Assert(c, strings.Contains(string(out), "port is already allocated") ||
... ...
@@ -4160,7 +4160,7 @@ func (s *DockerSuite) TestRunCredentialSpecFailures(c *testing.T) {
4160 4160
 	}
4161 4161
 	for _, attempt := range attempts {
4162 4162
 		_, _, err := dockerCmdWithError("run", "--security-opt=credentialspec="+attempt.value, "busybox", "true")
4163
-		assert.Assert(c, err, checker.NotNil, check.Commentf("%s expected non-nil err", attempt.value))
4163
+		assert.Assert(c, err != nil, check.Commentf("%s expected non-nil err", attempt.value))
4164 4164
 		assert.Assert(c, err.Error(), checker.Contains, attempt.expectedError, check.Commentf("%s expected %s got %s", attempt.value, attempt.expectedError, err))
4165 4165
 	}
4166 4166
 }
... ...
@@ -4499,7 +4499,7 @@ func (s *DockerSuite) TestRunMount(c *testing.T) {
4499 4499
 				assert.Assert(c, testCase.fn(cName) == nil, check.Commentf("got error while executing test for %v (%s)", opts, cName))
4500 4500
 				dockerCmd(c, "rm", "-f", cName)
4501 4501
 			} else {
4502
-				assert.Assert(c, err, checker.NotNil, check.Commentf("got nil while creating a container with %v (%s)", opts, cName))
4502
+				assert.Assert(c, err != nil, check.Commentf("got nil while creating a container with %v (%s)", opts, cName))
4503 4503
 			}
4504 4504
 		}
4505 4505
 	}
... ...
@@ -47,7 +47,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountVolume(c *testing.T) {
47 47
 	assert.Equal(c, mountConfig[0].Source, "foo")
48 48
 	assert.Equal(c, mountConfig[0].Target, "/foo")
49 49
 	assert.Equal(c, mountConfig[0].Type, mount.TypeVolume)
50
-	assert.Assert(c, mountConfig[0].VolumeOptions, checker.NotNil)
50
+	assert.Assert(c, mountConfig[0].VolumeOptions != nil)
51 51
 	assert.Assert(c, mountConfig[0].VolumeOptions.NoCopy, checker.True)
52 52
 
53 53
 	// check container mounts actual
... ...
@@ -390,7 +390,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *testing.T) {
390 390
 	assert.Equal(c, mountConfig[0].Source, "")
391 391
 	assert.Equal(c, mountConfig[0].Target, "/foo")
392 392
 	assert.Equal(c, mountConfig[0].Type, mount.TypeTmpfs)
393
-	assert.Assert(c, mountConfig[0].TmpfsOptions, checker.NotNil)
393
+	assert.Assert(c, mountConfig[0].TmpfsOptions != nil)
394 394
 	assert.Equal(c, mountConfig[0].TmpfsOptions.SizeBytes, int64(1048576))
395 395
 
396 396
 	// check container mounts actual
... ...
@@ -21,7 +21,7 @@ func (s *DockerSuite) TestStartAttachReturnsOnError(c *testing.T) {
21 21
 	// Expect this to fail because the above container is stopped, this is what we want
22 22
 	out, _, err := dockerCmdWithError("run", "--name", "test2", "--link", "test:test", "busybox")
23 23
 	// err shouldn't be nil because container test2 try to link to stopped container
24
-	assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
24
+	assert.Assert(c, err != nil, check.Commentf("out: %s", out))
25 25
 
26 26
 	ch := make(chan error)
27 27
 	go func() {
... ...
@@ -79,7 +79,7 @@ func (s *DockerSuite) TestStartRecordError(c *testing.T) {
79 79
 	// Expect this to fail and records error because of ports conflict
80 80
 	out, _, err := dockerCmdWithError("run", "-d", "--name", "test2", "-p", "9999:9999", "busybox", "top")
81 81
 	// err shouldn't be nil because docker run will fail
82
-	assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
82
+	assert.Assert(c, err != nil, check.Commentf("out: %s", out))
83 83
 
84 84
 	stateErr = inspectField(c, "test2", "State.Error")
85 85
 	assert.Assert(c, stateErr, checker.Contains, "port is already allocated")
... ...
@@ -102,7 +102,7 @@ func (s *DockerSuite) TestStartPausedContainer(c *testing.T) {
102 102
 
103 103
 	out, _, err := dockerCmdWithError("start", "testing")
104 104
 	// an error should have been shown that you cannot start paused container
105
-	assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
105
+	assert.Assert(c, err != nil, check.Commentf("out: %s", out))
106 106
 	// an error should have been shown that you cannot start paused container
107 107
 	assert.Assert(c, strings.ToLower(out), checker.Contains, "cannot start a paused container, try unpause instead")
108 108
 }
... ...
@@ -130,7 +130,7 @@ func (s *DockerSuite) TestStartMultipleContainers(c *testing.T) {
130 130
 	expErr := "failed to start containers: [child_first]"
131 131
 	out, _, err := dockerCmdWithError("start", "child_first", "parent", "child_second")
132 132
 	// err shouldn't be nil because start will fail
133
-	assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
133
+	assert.Assert(c, err != nil, check.Commentf("out: %s", out))
134 134
 	// output does not correspond to what was expected
135 135
 	if !(strings.Contains(out, expOut) || strings.Contains(err.Error(), expErr)) {
136 136
 		c.Fatalf("Expected out: %v with err: %v  but got out: %v with err: %v", expOut, expErr, out, err)
... ...
@@ -158,7 +158,7 @@ func (s *DockerSuite) TestStartAttachMultipleContainers(c *testing.T) {
158 158
 	for _, option := range []string{"-a", "-i", "-ai"} {
159 159
 		out, _, err := dockerCmdWithError("start", option, "test1", "test2", "test3")
160 160
 		// err shouldn't be nil because start will fail
161
-		assert.Assert(c, err, checker.NotNil, check.Commentf("out: %s", out))
161
+		assert.Assert(c, err != nil, check.Commentf("out: %s", out))
162 162
 		// output does not correspond to what was expected
163 163
 		assert.Assert(c, out, checker.Contains, "you cannot start and attach multiple containers at once")
164 164
 	}
... ...
@@ -803,7 +803,7 @@ func setupRemoteGlobalNetworkPlugin(c *testing.T, mux *http.ServeMux, url, netDr
803 803
 func (s *DockerSwarmSuite) TestSwarmNetworkPlugin(c *testing.T) {
804 804
 	mux := http.NewServeMux()
805 805
 	s.server = httptest.NewServer(mux)
806
-	assert.Assert(c, s.server, checker.NotNil) // check that HTTP server has started
806
+	assert.Assert(c, s.server != nil) // check that HTTP server has started
807 807
 	setupRemoteGlobalNetworkPlugin(c, mux, s.server.URL, globalNetworkPlugin, globalIPAMPlugin)
808 808
 	defer func() {
809 809
 		s.server.Close()
... ...
@@ -242,7 +242,7 @@ func (s *DockerSuite) TestVolumeCLIInspectTmplError(c *testing.T) {
242 242
 	name := strings.TrimSpace(out)
243 243
 
244 244
 	out, exitCode, err := dockerCmdWithError("volume", "inspect", "--format='{{ .FooBar }}'", name)
245
-	assert.Assert(c, err, checker.NotNil, check.Commentf("Output: %s", out))
245
+	assert.Assert(c, err != nil, check.Commentf("Output: %s", out))
246 246
 	assert.Equal(c, exitCode, 1, check.Commentf("Output: %s", out))
247 247
 	assert.Assert(c, out, checker.Contains, "Template parsing error")
248 248
 }
... ...
@@ -25,7 +25,7 @@ func (s *DiscoverySuite) TestNewEntry(c *testing.T) {
25 25
 	assert.Equal(c, entry.String(), "[2001:db8:0:f101::2]:2375")
26 26
 
27 27
 	_, err = NewEntry("127.0.0.1")
28
-	assert.Assert(c, err, checker.NotNil)
28
+	assert.Assert(c, err != nil)
29 29
 }
30 30
 
31 31
 func (s *DiscoverySuite) TestParse(c *testing.T) {
... ...
@@ -65,7 +65,7 @@ func (s *DiscoverySuite) TestCreateEntries(c *testing.T) {
65 65
 	assert.Equal(c, entries.Equals(expected), true)
66 66
 
67 67
 	_, err = CreateEntries([]string{"127.0.0.1", "127.0.0.2"})
68
-	assert.Assert(c, err, checker.NotNil)
68
+	assert.Assert(c, err != nil)
69 69
 }
70 70
 
71 71
 func (s *DiscoverySuite) TestContainsEntry(c *testing.T) {
... ...
@@ -45,7 +45,7 @@ func (s *DiscoverySuite) TestContent(c *testing.T) {
45 45
 
46 46
 func (s *DiscoverySuite) TestRegister(c *testing.T) {
47 47
 	discovery := &Discovery{path: "/path/to/file"}
48
-	assert.Assert(c, discovery.Register("0.0.0.0"), checker.NotNil)
48
+	assert.Assert(c, discovery.Register("0.0.0.0") != nil)
49 49
 }
50 50
 
51 51
 func (s *DiscoverySuite) TestParsingContentsWithComments(c *testing.T) {
... ...
@@ -86,7 +86,7 @@ func (s *DiscoverySuite) TestWatch(c *testing.T) {
86 86
 	ch, errCh := d.Watch(stopCh)
87 87
 
88 88
 	// Make sure it fires errors since the file doesn't exist.
89
-	assert.Assert(c, <-errCh, checker.NotNil)
89
+	assert.Assert(c, <-errCh != nil)
90 90
 	// We have to drain the error channel otherwise Watch will get stuck.
91 91
 	go func() {
92 92
 		for range errCh {
... ...
@@ -101,7 +101,7 @@ func (s *DiscoverySuite) TestWatch(c *testing.T) {
101 101
 	expected = append(expected, &discovery.Entry{Host: "3.3.3.3", Port: "3333"})
102 102
 	f, err := os.OpenFile(tmp.Name(), os.O_APPEND|os.O_WRONLY, 0600)
103 103
 	assert.Assert(c, err == nil)
104
-	assert.Assert(c, f, checker.NotNil)
104
+	assert.Assert(c, f != nil)
105 105
 	_, err = f.WriteString("\n3.3.3.3:3333\n")
106 106
 	assert.Assert(c, err == nil)
107 107
 	f.Close()
... ...
@@ -200,8 +200,8 @@ BFrwkQE4HQtQBV60hYQUzzlSk44VFDz+jxIEtacRHaomDRh2FtOTz+I=
200 200
 	})
201 201
 	assert.Assert(c, err == nil)
202 202
 	s := d.store.(*Mock)
203
-	assert.Assert(c, s.Options.TLS, checker.NotNil)
204
-	assert.Assert(c, s.Options.TLS.RootCAs, checker.NotNil)
203
+	assert.Assert(c, s.Options.TLS != nil)
204
+	assert.Assert(c, s.Options.TLS.RootCAs != nil)
205 205
 	assert.Equal(c, len(s.Options.TLS.Certificates), 1)
206 206
 }
207 207
 
... ...
@@ -47,5 +47,5 @@ func (s *DiscoverySuite) TestWatch(c *testing.T) {
47 47
 
48 48
 func (s *DiscoverySuite) TestRegister(c *testing.T) {
49 49
 	d := &Discovery{}
50
-	assert.Assert(c, d.Register("0.0.0.0"), checker.NotNil)
50
+	assert.Assert(c, d.Register("0.0.0.0") != nil)
51 51
 }