Browse code

integration-cli: normalize comment formatting

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2019/11/27 23:36:45
Showing 15 changed files
... ...
@@ -210,26 +210,21 @@ func (s *DockerSuite) TestBuildAPIUnnormalizedTarPaths(c *testing.T) {
210 210
 			Name: "Dockerfile",
211 211
 			Size: int64(len(dockerfile)),
212 212
 		})
213
-		//failed to write tar file header
214
-		assert.NilError(c, err)
213
+		assert.NilError(c, err, "failed to write tar file header")
215 214
 
216 215
 		_, err = tw.Write(dockerfile)
217
-		// failed to write Dockerfile in tar file content
218
-		assert.NilError(c, err)
216
+		assert.NilError(c, err, "failed to write Dockerfile in tar file content")
219 217
 
220 218
 		err = tw.WriteHeader(&tar.Header{
221 219
 			Name: "dir/./file",
222 220
 			Size: int64(len(fileContents)),
223 221
 		})
224
-		//failed to write tar file header
225
-		assert.NilError(c, err)
222
+		assert.NilError(c, err, "failed to write tar file header")
226 223
 
227 224
 		_, err = tw.Write(fileContents)
228
-		// failed to write file contents in tar file content
229
-		assert.NilError(c, err)
225
+		assert.NilError(c, err, "failed to write file contents in tar file content")
230 226
 
231
-		// failed to close tar archive
232
-		assert.NilError(c, tw.Close())
227
+		assert.NilError(c, tw.Close(), "failed to close tar archive")
233 228
 
234 229
 		res, body, err := request.Post("/build", request.RawContent(ioutil.NopCloser(buffer)), request.ContentType("application/x-tar"))
235 230
 		assert.NilError(c, err)
... ...
@@ -689,7 +689,7 @@ func (s *DockerSuite) TestContainerAPIVerifyHeader(c *testing.T) {
689 689
 	body.Close()
690 690
 }
691 691
 
692
-//Issue 14230. daemon should return 500 for invalid port syntax
692
+// Issue 14230. daemon should return 500 for invalid port syntax
693 693
 func (s *DockerSuite) TestContainerAPIInvalidPortSyntax(c *testing.T) {
694 694
 	config := `{
695 695
 				  "Image": "busybox",
... ...
@@ -44,7 +44,7 @@ func (s *DockerSuite) TestAPIImagesFilter(c *testing.T) {
44 44
 		return images
45 45
 	}
46 46
 
47
-	//incorrect number of matches returned
47
+	// incorrect number of matches returned
48 48
 	images := getImages("utest*/*")
49 49
 	assert.Equal(c, len(images[0].RepoTags), 2)
50 50
 
... ...
@@ -356,7 +356,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServiceConstraintRole(c *testing.T) {
356 356
 		node := daemons[0].GetNode(c, task.NodeID)
357 357
 		assert.Equal(c, node.Spec.Role, swarm.NodeRoleWorker)
358 358
 	}
359
-	//remove service
359
+	// remove service
360 360
 	daemons[0].RemoveService(c, id)
361 361
 
362 362
 	// create service
... ...
@@ -370,7 +370,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServiceConstraintRole(c *testing.T) {
370 370
 		node := daemons[0].GetNode(c, task.NodeID)
371 371
 		assert.Equal(c, node.Spec.Role, swarm.NodeRoleManager)
372 372
 	}
373
-	//remove service
373
+	// remove service
374 374
 	daemons[0].RemoveService(c, id)
375 375
 
376 376
 	// create service
... ...
@@ -423,7 +423,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServiceConstraintLabel(c *testing.T) {
423 423
 	for _, task := range tasks {
424 424
 		assert.Assert(c, task.NodeID == nodes[0].ID)
425 425
 	}
426
-	//remove service
426
+	// remove service
427 427
 	daemons[0].RemoveService(c, id)
428 428
 
429 429
 	// create service
... ...
@@ -436,7 +436,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServiceConstraintLabel(c *testing.T) {
436 436
 	for _, task := range tasks {
437 437
 		assert.Assert(c, task.NodeID != nodes[0].ID)
438 438
 	}
439
-	//remove service
439
+	// remove service
440 440
 	daemons[0].RemoveService(c, id)
441 441
 
442 442
 	constraints = []string{"node.labels.security==medium"}
... ...
@@ -450,7 +450,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServiceConstraintLabel(c *testing.T) {
450 450
 	for _, task := range tasks {
451 451
 		assert.Assert(c, task.NodeID == "")
452 452
 	}
453
-	//remove service
453
+	// remove service
454 454
 	daemons[0].RemoveService(c, id)
455 455
 
456 456
 	// multiple constraints
... ...
@@ -175,7 +175,7 @@ func (s *DockerRegistrySuite) TestRemoveImageByDigest(c *testing.T) {
175 175
 
176 176
 	// try to inspect again - it should error this time
177 177
 	_, err = inspectFieldWithError(imageReference, "Id")
178
-	//unexpected nil err trying to inspect what should be a non-existent image
178
+	// unexpected nil err trying to inspect what should be a non-existent image
179 179
 	assert.ErrorContains(c, err, "No such object")
180 180
 }
181 181
 
... ...
@@ -255,8 +255,7 @@ func (s *DockerRegistrySuite) TestListImagesWithDigests(c *testing.T) {
255 255
 	assert.Assert(c, re1.MatchString(out), "expected %q: %s", re1.String(), out)
256 256
 	// setup image2
257 257
 	digest2, err := setupImageWithTag(c, "tag2")
258
-	//error setting up image
259
-	assert.NilError(c, err)
258
+	assert.NilError(c, err, "error setting up image")
260 259
 	imageReference2 := fmt.Sprintf("%s@%s", repoName, digest2)
261 260
 	c.Logf("imageReference2 = %s", imageReference2)
262 261
 
... ...
@@ -38,7 +38,7 @@ func (s *DockerSuite) TestCommitWithoutPause(c *testing.T) {
38 38
 	dockerCmd(c, "inspect", cleanedImageID)
39 39
 }
40 40
 
41
-//test commit a paused container should not unpause it after commit
41
+// TestCommitPausedContainer tests that a paused container is not unpaused after being committed
42 42
 func (s *DockerSuite) TestCommitPausedContainer(c *testing.T) {
43 43
 	testRequires(c, DaemonIsLinux)
44 44
 	out, _ := dockerCmd(c, "run", "-i", "-d", "busybox")
... ...
@@ -213,7 +213,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithInvalidBasesize(c *testing.T) {
213 213
 	s.d.Start(c)
214 214
 
215 215
 	oldBasesizeBytes := getBaseDeviceSize(c, s.d)
216
-	var newBasesizeBytes int64 = 1073741824 //1GB in bytes
216
+	var newBasesizeBytes int64 = 1073741824 // 1GB in bytes
217 217
 
218 218
 	if newBasesizeBytes < oldBasesizeBytes {
219 219
 		err := s.d.RestartWithError("--storage-opt", fmt.Sprintf("dm.basesize=%d", newBasesizeBytes))
... ...
@@ -234,7 +234,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithIncreasedBasesize(c *testing.T)
234 234
 
235 235
 	oldBasesizeBytes := getBaseDeviceSize(c, s.d)
236 236
 
237
-	var newBasesizeBytes int64 = 53687091200 //50GB in bytes
237
+	var newBasesizeBytes int64 = 53687091200 // 50GB in bytes
238 238
 
239 239
 	if newBasesizeBytes < oldBasesizeBytes {
240 240
 		c.Skip(fmt.Sprintf("New base device size (%v) must be greater than (%s)", units.HumanSize(float64(newBasesizeBytes)), units.HumanSize(float64(oldBasesizeBytes))))
... ...
@@ -572,16 +572,16 @@ func (s *DockerDaemonSuite) TestDaemonKeyGeneration(c *testing.T) {
572 572
 // Note that this explicitly tests the conflict of {-b,--bridge} and {--bip} options as the means
573 573
 // to get a daemon init failure; no other tests for -b/--bip conflict are therefore required
574 574
 func (s *DockerDaemonSuite) TestDaemonExitOnFailure(c *testing.T) {
575
-	//attempt to start daemon with incorrect flags (we know -b and --bip conflict)
575
+	// attempt to start daemon with incorrect flags (we know -b and --bip conflict)
576 576
 	if err := s.d.StartWithError("--bridge", "nosuchbridge", "--bip", "1.1.1.1"); err != nil {
577
-		//verify we got the right error
577
+		// verify we got the right error
578 578
 		if !strings.Contains(err.Error(), "daemon exited") {
579 579
 			c.Fatalf("Expected daemon not to start, got %v", err)
580 580
 		}
581 581
 		// look in the log and make sure we got the message that daemon is shutting down
582 582
 		icmd.RunCommand("grep", "failed to start daemon", s.d.LogFileName()).Assert(c, icmd.Success)
583 583
 	} else {
584
-		//if we didn't get an error and the daemon is running, this is a failure
584
+		// if we didn't get an error and the daemon is running, this is a failure
585 585
 		c.Fatal("Conflicting options should cause the daemon to error out with a failure")
586 586
 	}
587 587
 }
... ...
@@ -697,7 +697,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithBridgeIPChange(c *testing.T) {
697 697
 
698 698
 	s.d.Start(c, "--bip", bridgeIP)
699 699
 
700
-	//check if the iptables contains new bridgeIP MASQUERADE rule
700
+	// check if the iptables contains new bridgeIP MASQUERADE rule
701 701
 	ipTablesSearchString := bridgeIPNet.String()
702 702
 	icmd.RunCommand("iptables", "-t", "nat", "-nvL").Assert(c, icmd.Expected{
703 703
 		Out: ipTablesSearchString,
... ...
@@ -1203,7 +1203,7 @@ func (s *DockerDaemonSuite) TestDaemonWithWrongkey(c *testing.T) {
1203 1203
 		c.Fatalf("Error Unmarshal: %s", err)
1204 1204
 	}
1205 1205
 
1206
-	//replace config.Kid with the fake value
1206
+	// replace config.Kid with the fake value
1207 1207
 	config.Kid = "VSAJ:FUYR:X3H2:B2VZ:KZ6U:CJD5:K7BX:ZXHY:UZXT:P4FT:MJWG:HRJ4"
1208 1208
 
1209 1209
 	// NEW Data-Struct to byte[]
... ...
@@ -48,7 +48,7 @@ func (s *DockerSuite) TestEventsTimestampFormats(c *testing.T) {
48 48
 		events = events[:len(events)-1]
49 49
 
50 50
 		nEvents := len(events)
51
-		assert.Assert(c, nEvents >= 5) //Missing expected event
51
+		assert.Assert(c, nEvents >= 5)
52 52
 		containerEvents := eventActionsByIDAndType(c, events, name, "container")
53 53
 		assert.Assert(c, is.DeepEqual(containerEvents, []string{"create", "attach", "start", "die", "destroy"}), out)
54 54
 	}
... ...
@@ -99,7 +99,7 @@ func (s *DockerSuite) TestEventsContainerEventsAttrSort(c *testing.T) {
99 99
 	events := strings.Split(out, "\n")
100 100
 
101 101
 	nEvents := len(events)
102
-	assert.Assert(c, nEvents >= 3) //Missing expected event
102
+	assert.Assert(c, nEvents >= 3)
103 103
 	matchedEvents := 0
104 104
 	for _, event := range events {
105 105
 		matches := eventstestutils.ScanMap(event)
... ...
@@ -124,7 +124,7 @@ func (s *DockerSuite) TestEventsContainerEventsSinceUnixEpoch(c *testing.T) {
124 124
 	events = events[:len(events)-1]
125 125
 
126 126
 	nEvents := len(events)
127
-	assert.Assert(c, nEvents >= 5) //Missing expected event
127
+	assert.Assert(c, nEvents >= 5)
128 128
 	containerEvents := eventActionsByIDAndType(c, events, "since-epoch-test", "container")
129 129
 	assert.Assert(c, is.DeepEqual(containerEvents, []string{"create", "attach", "start", "die", "destroy"}), out)
130 130
 }
... ...
@@ -664,7 +664,7 @@ func (s *DockerSuite) TestEventsContainerRestart(c *testing.T) {
664 664
 	events := strings.Split(strings.TrimSpace(out), "\n")
665 665
 
666 666
 	nEvents := len(events)
667
-	assert.Assert(c, nEvents >= 1) //Missing expected event
667
+	assert.Assert(c, nEvents >= 1)
668 668
 	actions := eventActionsByIDAndType(c, events, "testEvent", "container")
669 669
 
670 670
 	for _, a := range actions {
... ...
@@ -243,7 +243,7 @@ func (s *DockerSuite) TestEventsContainerWithMultiNetwork(c *testing.T) {
243 243
 	assert.Assert(c, strings.Contains(netEvents[0], "disconnect"))
244 244
 	assert.Assert(c, strings.Contains(netEvents[1], "disconnect"))
245 245
 
246
-	//both networks appeared in the network event output
246
+	// both networks appeared in the network event output
247 247
 	assert.Assert(c, strings.Contains(out, "test-event-network-local-1"))
248 248
 	assert.Assert(c, strings.Contains(out, "test-event-network-local-2"))
249 249
 }
... ...
@@ -242,10 +242,10 @@ func (s *DockerSuite) TestImagesEnsureDanglingImageOnlyListedOnce(c *testing.T)
242 242
 	assert.Equal(c, strings.Count(out, imageID), 1)
243 243
 
244 244
 	out, _ = dockerCmd(c, "images", "-q", "-f", "dangling=false")
245
-	//dangling=false would not include dangling images
245
+	// dangling=false would not include dangling images
246 246
 	assert.Assert(c, !strings.Contains(out, imageID))
247 247
 	out, _ = dockerCmd(c, "images")
248
-	//docker images still include dangling images
248
+	// docker images still include dangling images
249 249
 	assert.Assert(c, strings.Contains(out, imageID))
250 250
 }
251 251
 
... ...
@@ -42,8 +42,8 @@ func (s *DockerSuite) TestInspectInt64(c *testing.T) {
42 42
 }
43 43
 
44 44
 func (s *DockerSuite) TestInspectDefault(c *testing.T) {
45
-	//Both the container and image are named busybox. docker inspect will fetch the container JSON.
46
-	//If the container JSON is not available, it will go for the image JSON.
45
+	// Both the container and image are named busybox. docker inspect will fetch the container JSON.
46
+	// If the container JSON is not available, it will go for the image JSON.
47 47
 
48 48
 	out, _ := dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "true")
49 49
 	containerID := strings.TrimSpace(out)
... ...
@@ -78,8 +78,8 @@ func (s *DockerSuite) TestInspectStatus(c *testing.T) {
78 78
 }
79 79
 
80 80
 func (s *DockerSuite) TestInspectTypeFlagContainer(c *testing.T) {
81
-	//Both the container and image are named busybox. docker inspect will fetch container
82
-	//JSON State.Running field. If the field is true, it's a container.
81
+	// Both the container and image are named busybox. docker inspect will fetch container
82
+	// JSON State.Running field. If the field is true, it's a container.
83 83
 	runSleepingContainer(c, "--name=busybox", "-d")
84 84
 
85 85
 	formatStr := "--format={{.State.Running}}"
... ...
@@ -88,9 +88,9 @@ func (s *DockerSuite) TestInspectTypeFlagContainer(c *testing.T) {
88 88
 }
89 89
 
90 90
 func (s *DockerSuite) TestInspectTypeFlagWithNoContainer(c *testing.T) {
91
-	//Run this test on an image named busybox. docker inspect will try to fetch container
92
-	//JSON. Since there is no container named busybox and --type=container, docker inspect will
93
-	//not try to get the image JSON. It will throw an error.
91
+	// Run this test on an image named busybox. docker inspect will try to fetch container
92
+	// JSON. Since there is no container named busybox and --type=container, docker inspect will
93
+	// not try to get the image JSON. It will throw an error.
94 94
 
95 95
 	dockerCmd(c, "run", "-d", "busybox", "true")
96 96
 
... ...
@@ -100,9 +100,9 @@ func (s *DockerSuite) TestInspectTypeFlagWithNoContainer(c *testing.T) {
100 100
 }
101 101
 
102 102
 func (s *DockerSuite) TestInspectTypeFlagWithImage(c *testing.T) {
103
-	//Both the container and image are named busybox. docker inspect will fetch image
104
-	//JSON as --type=image. if there is no image with name busybox, docker inspect
105
-	//will throw an error.
103
+	// Both the container and image are named busybox. docker inspect will fetch image
104
+	// JSON as --type=image. if there is no image with name busybox, docker inspect
105
+	// will throw an error.
106 106
 
107 107
 	dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "true")
108 108
 
... ...
@@ -112,8 +112,8 @@ func (s *DockerSuite) TestInspectTypeFlagWithImage(c *testing.T) {
112 112
 }
113 113
 
114 114
 func (s *DockerSuite) TestInspectTypeFlagWithInvalidValue(c *testing.T) {
115
-	//Both the container and image are named busybox. docker inspect will fail
116
-	//as --type=foobar is not a valid value for the flag.
115
+	// Both the container and image are named busybox. docker inspect will fail
116
+	// as --type=foobar is not a valid value for the flag.
117 117
 
118 118
 	dockerCmd(c, "run", "--name=busybox", "-d", "busybox", "true")
119 119
 
... ...
@@ -295,9 +295,8 @@ func (s *DockerSuite) TestInspectLogConfigNoType(c *testing.T) {
295 295
 }
296 296
 
297 297
 func (s *DockerSuite) TestInspectNoSizeFlagContainer(c *testing.T) {
298
-
299
-	//Both the container and image are named busybox. docker inspect will fetch container
300
-	//JSON SizeRw and SizeRootFs field. If there is no flag --size/-s, there are no size fields.
298
+	// Both the container and image are named busybox. docker inspect will fetch container
299
+	// JSON SizeRw and SizeRootFs field. If there is no flag --size/-s, there are no size fields.
301 300
 
302 301
 	runSleepingContainer(c, "--name=busybox", "-d")
303 302
 
... ...
@@ -755,7 +755,7 @@ func (s *DockerSuite) TestPsListContainersFilterNetwork(c *testing.T) {
755 755
 	// skip header
756 756
 	lines = lines[1:]
757 757
 
758
-	//ps output should have both the containers
758
+	// ps output should have both the containers
759 759
 	assert.Equal(c, len(RemoveLinesForExistingElements(lines, existing)), 2)
760 760
 
761 761
 	// Making sure onbridgenetwork and onnonenetwork is on the output
... ...
@@ -175,7 +175,7 @@ func (s *DockerSuite) TestRunWithoutNetworking(c *testing.T) {
175 175
 	}
176 176
 }
177 177
 
178
-//test --link use container name to link target
178
+// test --link use container name to link target
179 179
 func (s *DockerSuite) TestRunLinksContainerWithContainerName(c *testing.T) {
180 180
 	// TODO Windows: This test cannot run on a Windows daemon as the networking
181 181
 	// settings are not populated back yet on inspect.
... ...
@@ -190,7 +190,7 @@ func (s *DockerSuite) TestRunLinksContainerWithContainerName(c *testing.T) {
190 190
 	}
191 191
 }
192 192
 
193
-//test --link use container id to link target
193
+// test --link use container id to link target
194 194
 func (s *DockerSuite) TestRunLinksContainerWithContainerID(c *testing.T) {
195 195
 	// TODO Windows: This test cannot run on a Windows daemon as the networking
196 196
 	// settings are not populated back yet on inspect.
... ...
@@ -1430,7 +1430,7 @@ func (s *DockerSuite) TestRunResolvconfUpdate(c *testing.T) {
1430 1430
 	tmpResolvConf := []byte("search pommesfrites.fr\nnameserver 12.34.56.78\n")
1431 1431
 	tmpLocalhostResolvConf := []byte("nameserver 127.0.0.1")
1432 1432
 
1433
-	//take a copy of resolv.conf for restoring after test completes
1433
+	// take a copy of resolv.conf for restoring after test completes
1434 1434
 	resolvConfSystem, err := ioutil.ReadFile("/etc/resolv.conf")
1435 1435
 	if err != nil {
1436 1436
 		c.Fatal(err)
... ...
@@ -1447,14 +1447,14 @@ func (s *DockerSuite) TestRunResolvconfUpdate(c *testing.T) {
1447 1447
 		icmd.RunCommand("umount", "/etc/resolv.conf").Assert(c, icmd.Success)
1448 1448
 	}
1449 1449
 
1450
-	//cleanup
1450
+	// cleanup
1451 1451
 	defer func() {
1452 1452
 		if err := ioutil.WriteFile("/etc/resolv.conf", resolvConfSystem, 0644); err != nil {
1453 1453
 			c.Fatal(err)
1454 1454
 		}
1455 1455
 	}()
1456 1456
 
1457
-	//1. test that a restarting container gets an updated resolv.conf
1457
+	// 1. test that a restarting container gets an updated resolv.conf
1458 1458
 	dockerCmd(c, "run", "--name=first", "busybox", "true")
1459 1459
 	containerID1 := getIDByName(c, "first")
1460 1460
 
... ...
@@ -1472,16 +1472,16 @@ func (s *DockerSuite) TestRunResolvconfUpdate(c *testing.T) {
1472 1472
 		c.Fatalf("Restarted container does not have updated resolv.conf; expected %q, got %q", tmpResolvConf, string(containerResolv))
1473 1473
 	}
1474 1474
 
1475
-	/*	//make a change to resolv.conf (in this case replacing our tmp copy with orig copy)
1475
+	/*	// make a change to resolv.conf (in this case replacing our tmp copy with orig copy)
1476 1476
 		if err := ioutil.WriteFile("/etc/resolv.conf", resolvConfSystem, 0644); err != nil {
1477 1477
 						c.Fatal(err)
1478 1478
 								} */
1479
-	//2. test that a restarting container does not receive resolv.conf updates
1479
+	// 2. test that a restarting container does not receive resolv.conf updates
1480 1480
 	//   if it modified the container copy of the starting point resolv.conf
1481 1481
 	dockerCmd(c, "run", "--name=second", "busybox", "sh", "-c", "echo 'search mylittlepony.com' >>/etc/resolv.conf")
1482 1482
 	containerID2 := getIDByName(c, "second")
1483 1483
 
1484
-	//make a change to resolv.conf (in this case replacing our tmp copy with orig copy)
1484
+	// make a change to resolv.conf (in this case replacing our tmp copy with orig copy)
1485 1485
 	if err := ioutil.WriteFile("/etc/resolv.conf", resolvConfSystem, 0644); err != nil {
1486 1486
 		c.Fatal(err)
1487 1487
 	}
... ...
@@ -1495,7 +1495,7 @@ func (s *DockerSuite) TestRunResolvconfUpdate(c *testing.T) {
1495 1495
 		c.Fatalf("Container's resolv.conf should not have been updated with host resolv.conf: %q", string(containerResolv))
1496 1496
 	}
1497 1497
 
1498
-	//3. test that a running container's resolv.conf is not modified while running
1498
+	// 3. test that a running container's resolv.conf is not modified while running
1499 1499
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
1500 1500
 	runningContainerID := strings.TrimSpace(out)
1501 1501
 
... ...
@@ -1510,7 +1510,7 @@ func (s *DockerSuite) TestRunResolvconfUpdate(c *testing.T) {
1510 1510
 		c.Fatalf("Running container should not have updated resolv.conf; expected %q, got %q", string(resolvConfSystem), string(containerResolv))
1511 1511
 	}
1512 1512
 
1513
-	//4. test that a running container's resolv.conf is updated upon restart
1513
+	// 4. test that a running container's resolv.conf is updated upon restart
1514 1514
 	//   (the above container is still running..)
1515 1515
 	dockerCmd(c, "restart", runningContainerID)
1516 1516
 
... ...
@@ -1520,7 +1520,7 @@ func (s *DockerSuite) TestRunResolvconfUpdate(c *testing.T) {
1520 1520
 		c.Fatalf("Restarted container should have updated resolv.conf; expected %q, got %q", string(tmpResolvConf), string(containerResolv))
1521 1521
 	}
1522 1522
 
1523
-	//5. test that additions of a localhost resolver are cleaned from
1523
+	// 5. test that additions of a localhost resolver are cleaned from
1524 1524
 	//   host resolv.conf before updating container's resolv.conf copies
1525 1525
 
1526 1526
 	// replace resolv.conf with a localhost-only nameserver copy
... ...
@@ -1539,7 +1539,7 @@ func (s *DockerSuite) TestRunResolvconfUpdate(c *testing.T) {
1539 1539
 		c.Fatalf("Container does not have cleaned/replaced DNS in resolv.conf; expected %q, got %q", expected, string(containerResolv))
1540 1540
 	}
1541 1541
 
1542
-	//6. Test that replacing (as opposed to modifying) resolv.conf triggers an update
1542
+	// 6. Test that replacing (as opposed to modifying) resolv.conf triggers an update
1543 1543
 	//   of containers' resolv.conf.
1544 1544
 
1545 1545
 	// Restore the original resolv.conf
... ...
@@ -1570,7 +1570,7 @@ func (s *DockerSuite) TestRunResolvconfUpdate(c *testing.T) {
1570 1570
 		c.Fatalf("Stopped container does not have updated resolv.conf; expected\n%q\n got\n%q", tmpResolvConf, string(containerResolv))
1571 1571
 	}
1572 1572
 
1573
-	//cleanup, restore original resolv.conf happens in defer func()
1573
+	// cleanup, restore original resolv.conf happens in defer func()
1574 1574
 }
1575 1575
 
1576 1576
 func (s *DockerSuite) TestRunAddHost(c *testing.T) {
... ...
@@ -1958,7 +1958,7 @@ func (s *DockerSuite) TestRunCidFileCleanupIfEmpty(c *testing.T) {
1958 1958
 }
1959 1959
 
1960 1960
 // #2098 - Docker cidFiles only contain short version of the containerId
1961
-//sudo docker run --cidfile /tmp/docker_tesc.cid ubuntu echo "test"
1961
+// sudo docker run --cidfile /tmp/docker_tesc.cid ubuntu echo "test"
1962 1962
 // TestRunCidFile tests that run --cidfile returns the longid
1963 1963
 func (s *DockerSuite) TestRunCidFileCheckIDLength(c *testing.T) {
1964 1964
 	tmpDir, err := ioutil.TempDir("", "TestRunCidFile")
... ...
@@ -2016,7 +2016,7 @@ func (s *DockerSuite) TestRunInspectMacAddress(c *testing.T) {
2016 2016
 // test docker run use an invalid mac address
2017 2017
 func (s *DockerSuite) TestRunWithInvalidMacAddress(c *testing.T) {
2018 2018
 	out, _, err := dockerCmdWithError("run", "--mac-address", "92:d0:c6:0a:29", "busybox")
2019
-	//use an invalid mac address should with an error out
2019
+	// use an invalid mac address should with an error out
2020 2020
 	if err == nil || !strings.Contains(out, "is not a valid mac address") {
2021 2021
 		c.Fatalf("run with an invalid --mac-address should with error out")
2022 2022
 	}
... ...
@@ -2148,7 +2148,7 @@ func (s *DockerSuite) TestRunReuseBindVolumeThatIsSymlink(c *testing.T) {
2148 2148
 	dockerCmd(c, "run", "-v", fmt.Sprintf("%s:"+prefix+"/tmp/test", linkPath), "busybox", "ls", prefix+"/tmp/test")
2149 2149
 }
2150 2150
 
2151
-//GH#10604: Test an "/etc" volume doesn't overlay special bind mounts in container
2151
+// GH#10604: Test an "/etc" volume doesn't overlay special bind mounts in container
2152 2152
 func (s *DockerSuite) TestRunCreateVolumeEtc(c *testing.T) {
2153 2153
 	// While Windows supports volumes, it does not support --add-host hence
2154 2154
 	// this test is not applicable on Windows.
... ...
@@ -66,7 +66,7 @@ func (s *DockerSuite) TestSaveAndLoadRepoStdout(c *testing.T) {
66 66
 	buf := make([]byte, 1024)
67 67
 
68 68
 	n, err := pty.Read(buf)
69
-	assert.NilError(c, err) //could not read tty output
69
+	assert.NilError(c, err, "could not read tty output")
70 70
 	assert.Assert(c, strings.Contains(string(buf[:n]), "cowardly refusing"), "help output is not being yielded")
71 71
 }
72 72
 
... ...
@@ -36,19 +36,19 @@ func (s *DockerSuite) TestSearchCmdOptions(c *testing.T) {
36 36
 	outSearchCmd, _ := dockerCmd(c, "search", "busybox")
37 37
 	assert.Assert(c, strings.Count(outSearchCmd, "\n") > 3, outSearchCmd)
38 38
 
39
-	outSearchCmdautomated, _ := dockerCmd(c, "search", "--filter", "is-automated=true", "busybox") //The busybox is a busybox base image, not an AUTOMATED image.
39
+	outSearchCmdautomated, _ := dockerCmd(c, "search", "--filter", "is-automated=true", "busybox") // The busybox is a busybox base image, not an AUTOMATED image.
40 40
 	outSearchCmdautomatedSlice := strings.Split(outSearchCmdautomated, "\n")
41 41
 	for i := range outSearchCmdautomatedSlice {
42 42
 		assert.Assert(c, !strings.HasPrefix(outSearchCmdautomatedSlice[i], "busybox "), "The busybox is not an AUTOMATED image: %s", outSearchCmdautomated)
43 43
 	}
44 44
 
45
-	outSearchCmdNotOfficial, _ := dockerCmd(c, "search", "--filter", "is-official=false", "busybox") //The busybox is a busybox base image, official image.
45
+	outSearchCmdNotOfficial, _ := dockerCmd(c, "search", "--filter", "is-official=false", "busybox") // The busybox is a busybox base image, official image.
46 46
 	outSearchCmdNotOfficialSlice := strings.Split(outSearchCmdNotOfficial, "\n")
47 47
 	for i := range outSearchCmdNotOfficialSlice {
48 48
 		assert.Assert(c, !strings.HasPrefix(outSearchCmdNotOfficialSlice[i], "busybox "), "The busybox is not an OFFICIAL image: %s", outSearchCmdNotOfficial)
49 49
 	}
50 50
 
51
-	outSearchCmdOfficial, _ := dockerCmd(c, "search", "--filter", "is-official=true", "busybox") //The busybox is a busybox base image, official image.
51
+	outSearchCmdOfficial, _ := dockerCmd(c, "search", "--filter", "is-official=true", "busybox") // The busybox is a busybox base image, official image.
52 52
 	outSearchCmdOfficialSlice := strings.Split(outSearchCmdOfficial, "\n")
53 53
 	assert.Equal(c, len(outSearchCmdOfficialSlice), 3) // 1 header, 1 line, 1 carriage return
54 54
 	assert.Assert(c, strings.HasPrefix(outSearchCmdOfficialSlice[1], "busybox "), "The busybox is an OFFICIAL image: %s", outSearchCmdOfficial)