Skip to content

Commit 3a24472

Browse files
author
Tibor Vass
committed
rm-gocheck: check.CommentInterface -> string
sed -E -i 's#(\*testing\.T\b.*)check\.CommentInterface\b#\1string#g' \ -- "integration-cli/daemon/daemon.go" "integration-cli/daemon/daemon_swarm.go" "integration-cli/docker_api_exec_test.go" "integration-cli/docker_api_swarm_service_test.go" "integration-cli/docker_api_swarm_test.go" "integration-cli/docker_cli_daemon_test.go" "integration-cli/docker_cli_prune_unix_test.go" "integration-cli/docker_cli_restart_test.go" "integration-cli/docker_cli_service_create_test.go" "integration-cli/docker_cli_service_health_test.go" "integration-cli/docker_cli_service_logs_test.go" "integration-cli/docker_cli_swarm_test.go" "integration-cli/docker_utils_test.go" Signed-off-by: Tibor Vass <tibor@docker.com>
1 parent 6e5cf53 commit 3a24472

13 files changed

+64
-64
lines changed

integration-cli/daemon/daemon.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func (d *Daemon) inspectFieldWithError(name, field string) (string, error) {
8989

9090
// CheckActiveContainerCount returns the number of active containers
9191
// FIXME(vdemeester) should re-use ActivateContainers in some way
92-
func (d *Daemon) CheckActiveContainerCount(c *testing.T) (interface{}, check.CommentInterface) {
92+
func (d *Daemon) CheckActiveContainerCount(c *testing.T) (interface{}, string) {
9393
out, err := d.Cmd("ps", "-q")
9494
assert.NilError(c, err)
9595
if len(strings.TrimSpace(out)) == 0 {

integration-cli/daemon/daemon_swarm.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import (
1616

1717
// CheckServiceTasksInState returns the number of tasks with a matching state,
1818
// and optional message substring.
19-
func (d *Daemon) CheckServiceTasksInState(service string, state swarm.TaskState, message string) func(*testing.T) (interface{}, check.CommentInterface) {
20-
return func(c *testing.T) (interface{}, check.CommentInterface) {
19+
func (d *Daemon) CheckServiceTasksInState(service string, state swarm.TaskState, message string) func(*testing.T) (interface{}, string) {
20+
return func(c *testing.T) (interface{}, string) {
2121
tasks := d.GetServiceTasks(c, service)
2222
var count int
2323
for _, task := range tasks {
@@ -33,8 +33,8 @@ func (d *Daemon) CheckServiceTasksInState(service string, state swarm.TaskState,
3333

3434
// CheckServiceTasksInStateWithError returns the number of tasks with a matching state,
3535
// and optional message substring.
36-
func (d *Daemon) CheckServiceTasksInStateWithError(service string, state swarm.TaskState, errorMessage string) func(*testing.T) (interface{}, check.CommentInterface) {
37-
return func(c *testing.T) (interface{}, check.CommentInterface) {
36+
func (d *Daemon) CheckServiceTasksInStateWithError(service string, state swarm.TaskState, errorMessage string) func(*testing.T) (interface{}, string) {
37+
return func(c *testing.T) (interface{}, string) {
3838
tasks := d.GetServiceTasks(c, service)
3939
var count int
4040
for _, task := range tasks {
@@ -49,13 +49,13 @@ func (d *Daemon) CheckServiceTasksInStateWithError(service string, state swarm.T
4949
}
5050

5151
// CheckServiceRunningTasks returns the number of running tasks for the specified service
52-
func (d *Daemon) CheckServiceRunningTasks(service string) func(*testing.T) (interface{}, check.CommentInterface) {
52+
func (d *Daemon) CheckServiceRunningTasks(service string) func(*testing.T) (interface{}, string) {
5353
return d.CheckServiceTasksInState(service, swarm.TaskStateRunning, "")
5454
}
5555

5656
// CheckServiceUpdateState returns the current update state for the specified service
57-
func (d *Daemon) CheckServiceUpdateState(service string) func(*testing.T) (interface{}, check.CommentInterface) {
58-
return func(c *testing.T) (interface{}, check.CommentInterface) {
57+
func (d *Daemon) CheckServiceUpdateState(service string) func(*testing.T) (interface{}, string) {
58+
return func(c *testing.T) (interface{}, string) {
5959
service := d.GetService(c, service)
6060
if service.UpdateStatus == nil {
6161
return "", nil
@@ -65,8 +65,8 @@ func (d *Daemon) CheckServiceUpdateState(service string) func(*testing.T) (inter
6565
}
6666

6767
// CheckPluginRunning returns the runtime state of the plugin
68-
func (d *Daemon) CheckPluginRunning(plugin string) func(c *testing.T) (interface{}, check.CommentInterface) {
69-
return func(c *testing.T) (interface{}, check.CommentInterface) {
68+
func (d *Daemon) CheckPluginRunning(plugin string) func(c *testing.T) (interface{}, string) {
69+
return func(c *testing.T) (interface{}, string) {
7070
apiclient := d.NewClientT(c)
7171
resp, _, err := apiclient.PluginInspectWithRaw(context.Background(), plugin)
7272
if client.IsErrNotFound(err) {
@@ -78,8 +78,8 @@ func (d *Daemon) CheckPluginRunning(plugin string) func(c *testing.T) (interface
7878
}
7979

8080
// CheckPluginImage returns the runtime state of the plugin
81-
func (d *Daemon) CheckPluginImage(plugin string) func(c *testing.T) (interface{}, check.CommentInterface) {
82-
return func(c *testing.T) (interface{}, check.CommentInterface) {
81+
func (d *Daemon) CheckPluginImage(plugin string) func(c *testing.T) (interface{}, string) {
82+
return func(c *testing.T) (interface{}, string) {
8383
apiclient := d.NewClientT(c)
8484
resp, _, err := apiclient.PluginInspectWithRaw(context.Background(), plugin)
8585
if client.IsErrNotFound(err) {
@@ -91,15 +91,15 @@ func (d *Daemon) CheckPluginImage(plugin string) func(c *testing.T) (interface{}
9191
}
9292

9393
// CheckServiceTasks returns the number of tasks for the specified service
94-
func (d *Daemon) CheckServiceTasks(service string) func(*testing.T) (interface{}, check.CommentInterface) {
95-
return func(c *testing.T) (interface{}, check.CommentInterface) {
94+
func (d *Daemon) CheckServiceTasks(service string) func(*testing.T) (interface{}, string) {
95+
return func(c *testing.T) (interface{}, string) {
9696
tasks := d.GetServiceTasks(c, service)
9797
return len(tasks), nil
9898
}
9999
}
100100

101101
// CheckRunningTaskNetworks returns the number of times each network is referenced from a task.
102-
func (d *Daemon) CheckRunningTaskNetworks(c *testing.T) (interface{}, check.CommentInterface) {
102+
func (d *Daemon) CheckRunningTaskNetworks(c *testing.T) (interface{}, string) {
103103
cli := d.NewClientT(c)
104104
defer cli.Close()
105105

@@ -123,7 +123,7 @@ func (d *Daemon) CheckRunningTaskNetworks(c *testing.T) (interface{}, check.Comm
123123
}
124124

125125
// CheckRunningTaskImages returns the times each image is running as a task.
126-
func (d *Daemon) CheckRunningTaskImages(c *testing.T) (interface{}, check.CommentInterface) {
126+
func (d *Daemon) CheckRunningTaskImages(c *testing.T) (interface{}, string) {
127127
cli := d.NewClientT(c)
128128
defer cli.Close()
129129

@@ -147,7 +147,7 @@ func (d *Daemon) CheckRunningTaskImages(c *testing.T) (interface{}, check.Commen
147147
}
148148

149149
// CheckNodeReadyCount returns the number of ready node on the swarm
150-
func (d *Daemon) CheckNodeReadyCount(c *testing.T) (interface{}, check.CommentInterface) {
150+
func (d *Daemon) CheckNodeReadyCount(c *testing.T) (interface{}, string) {
151151
nodes := d.ListNodes(c)
152152
var readyCount int
153153
for _, node := range nodes {
@@ -159,20 +159,20 @@ func (d *Daemon) CheckNodeReadyCount(c *testing.T) (interface{}, check.CommentIn
159159
}
160160

161161
// CheckLocalNodeState returns the current swarm node state
162-
func (d *Daemon) CheckLocalNodeState(c *testing.T) (interface{}, check.CommentInterface) {
162+
func (d *Daemon) CheckLocalNodeState(c *testing.T) (interface{}, string) {
163163
info := d.SwarmInfo(c)
164164
return info.LocalNodeState, nil
165165
}
166166

167167
// CheckControlAvailable returns the current swarm control available
168-
func (d *Daemon) CheckControlAvailable(c *testing.T) (interface{}, check.CommentInterface) {
168+
func (d *Daemon) CheckControlAvailable(c *testing.T) (interface{}, string) {
169169
info := d.SwarmInfo(c)
170170
assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive)
171171
return info.ControlAvailable, nil
172172
}
173173

174174
// CheckLeader returns whether there is a leader on the swarm or not
175-
func (d *Daemon) CheckLeader(c *testing.T) (interface{}, check.CommentInterface) {
175+
func (d *Daemon) CheckLeader(c *testing.T) (interface{}, string) {
176176
cli := d.NewClientT(c)
177177
defer cli.Close()
178178

integration-cli/docker_api_exec_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ func (s *DockerSuite) TestExecStateCleanup(c *testing.T) {
216216

217217
stateDir := "/var/run/docker/containerd/" + cid
218218

219-
checkReadDir := func(c *testing.T) (interface{}, check.CommentInterface) {
219+
checkReadDir := func(c *testing.T) (interface{}, string) {
220220
fi, err := ioutil.ReadDir(stateDir)
221221
assert.NilError(c, err)
222222
return len(fi), nil

integration-cli/docker_api_swarm_service_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesUpdateStartFirst(c *testing.T) {
224224

225225
checkStartingTasks := func(expected int) []swarm.Task {
226226
var startingTasks []swarm.Task
227-
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
227+
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
228228
tasks := d.GetServiceTasks(c, id)
229229
startingTasks = nil
230230
for _, t := range tasks {

integration-cli/docker_api_swarm_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ func (s *DockerSwarmSuite) TestAPISwarmPromoteDemote(c *testing.T) {
223223
// back to manager quickly might cause the node to pause for awhile
224224
// while waiting for the role to change to worker, and the test can
225225
// time out during this interval.
226-
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
226+
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
227227
certBytes, err := ioutil.ReadFile(filepath.Join(d2.Folder, "root", "swarm", "certificates", "swarm-node.crt"))
228228
if err != nil {
229229
return "", fmt.Sprintf("error: %v", err)
@@ -317,7 +317,7 @@ func (s *DockerSwarmSuite) TestAPISwarmLeaderElection(c *testing.T) {
317317
)
318318
var lastErr error
319319
checkLeader := func(nodes ...*daemon.Daemon) checkF {
320-
return func(c *testing.T) (interface{}, check.CommentInterface) {
320+
return func(c *testing.T) (interface{}, string) {
321321
// clear these out before each run
322322
leader = nil
323323
followers = nil
@@ -404,7 +404,7 @@ func (s *DockerSwarmSuite) TestAPISwarmRaftQuorum(c *testing.T) {
404404
defer cli.Close()
405405

406406
// d1 will eventually step down from leader because there is no longer an active quorum, wait for that to happen
407-
waitAndAssert(c, defaultReconciliationTimeout*2, func(c *testing.T) (interface{}, check.CommentInterface) {
407+
waitAndAssert(c, defaultReconciliationTimeout*2, func(c *testing.T) (interface{}, string) {
408408
_, err := cli.ServiceCreate(context.Background(), service.Spec, types.ServiceCreateOptions{})
409409
return err.Error(), nil
410410
}, checker.Contains, "Make sure more than half of the managers are online.")
@@ -738,7 +738,7 @@ func checkClusterHealth(c *testing.T, cl []*daemon.Daemon, managerCount, workerC
738738
)
739739

740740
// check info in a waitAndAssert, because if the cluster doesn't have a leader, `info` will return an error
741-
checkInfo := func(c *testing.T) (interface{}, check.CommentInterface) {
741+
checkInfo := func(c *testing.T) (interface{}, string) {
742742
client := d.NewClientT(c)
743743
daemonInfo, err := client.Info(context.Background())
744744
info = daemonInfo.Swarm
@@ -755,7 +755,7 @@ func checkClusterHealth(c *testing.T, cl []*daemon.Daemon, managerCount, workerC
755755
var mCount, wCount int
756756

757757
for _, n := range d.ListNodes(c) {
758-
waitReady := func(c *testing.T) (interface{}, check.CommentInterface) {
758+
waitReady := func(c *testing.T) (interface{}, string) {
759759
if n.Status.State == swarm.NodeStateReady {
760760
return true, nil
761761
}
@@ -765,7 +765,7 @@ func checkClusterHealth(c *testing.T, cl []*daemon.Daemon, managerCount, workerC
765765
}
766766
waitAndAssert(c, defaultReconciliationTimeout, waitReady, checker.True)
767767

768-
waitActive := func(c *testing.T) (interface{}, check.CommentInterface) {
768+
waitActive := func(c *testing.T) (interface{}, string) {
769769
if n.Spec.Availability == swarm.NodeAvailabilityActive {
770770
return true, nil
771771
}

integration-cli/docker_cli_daemon_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2072,7 +2072,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithUnpausedRunningContainer(t *tes
20722072

20732073
// Give time to containerd to process the command if we don't
20742074
// the resume event might be received after we do the inspect
2075-
waitAndAssert(t, defaultReconciliationTimeout, func(*testing.T) (interface{}, check.CommentInterface) {
2075+
waitAndAssert(t, defaultReconciliationTimeout, func(*testing.T) (interface{}, string) {
20762076
result := icmd.RunCommand("kill", "-0", strings.TrimSpace(pid))
20772077
return result.ExitCode, nil
20782078
}, checker.Equals, 0)

integration-cli/docker_cli_prune_unix_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ func pruneNetworkAndVerify(c *testing.T, d *daemon.Daemon, kept, pruned []string
2525
assert.NilError(c, err)
2626

2727
for _, s := range kept {
28-
waitAndAssert(c, defaultReconciliationTimeout, func(*testing.T) (interface{}, check.CommentInterface) {
28+
waitAndAssert(c, defaultReconciliationTimeout, func(*testing.T) (interface{}, string) {
2929
out, err := d.Cmd("network", "ls", "--format", "{{.Name}}")
3030
assert.NilError(c, err)
3131
return out, nil
3232
}, checker.Contains, s)
3333
}
3434

3535
for _, s := range pruned {
36-
waitAndAssert(c, defaultReconciliationTimeout, func(*testing.T) (interface{}, check.CommentInterface) {
36+
waitAndAssert(c, defaultReconciliationTimeout, func(*testing.T) (interface{}, string) {
3737
out, err := d.Cmd("network", "ls", "--format", "{{.Name}}")
3838
assert.NilError(c, err)
3939
return out, nil

integration-cli/docker_cli_restart_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func (s *DockerSuite) TestRestartRunningContainer(c *testing.T) {
3737

3838
assert.NilError(c, waitRun(cleanedContainerID))
3939

40-
getLogs := func(c *testing.T) (interface{}, check.CommentInterface) {
40+
getLogs := func(c *testing.T) (interface{}, string) {
4141
out, _ := dockerCmd(c, "logs", cleanedContainerID)
4242
return out, nil
4343
}

integration-cli/docker_cli_service_create_test.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ func (s *DockerSwarmSuite) TestServiceCreateMountVolume(c *testing.T) {
2424
id := strings.TrimSpace(out)
2525

2626
var tasks []swarm.Task
27-
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
27+
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
2828
tasks = d.GetServiceTasks(c, id)
2929
return len(tasks) > 0, nil
3030
}, checker.Equals, true)
3131

3232
task := tasks[0]
33-
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
33+
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
3434
if task.NodeID == "" || task.Status.ContainerStatus == nil {
3535
task = d.GetTask(c, task.ID)
3636
}
@@ -138,13 +138,13 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSourceTargetPaths(c *testi
138138
assert.Equal(c, len(refs), len(testPaths))
139139

140140
var tasks []swarm.Task
141-
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
141+
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
142142
tasks = d.GetServiceTasks(c, serviceName)
143143
return len(tasks) > 0, nil
144144
}, checker.Equals, true)
145145

146146
task := tasks[0]
147-
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
147+
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
148148
if task.NodeID == "" || task.Status.ContainerStatus == nil {
149149
task = d.GetTask(c, task.ID)
150150
}
@@ -188,13 +188,13 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretReferencedTwice(c *testing
188188
assert.Equal(c, len(refs), 2)
189189

190190
var tasks []swarm.Task
191-
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
191+
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
192192
tasks = d.GetServiceTasks(c, serviceName)
193193
return len(tasks) > 0, nil
194194
}, checker.Equals, true)
195195

196196
task := tasks[0]
197-
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
197+
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
198198
if task.NodeID == "" || task.Status.ContainerStatus == nil {
199199
task = d.GetTask(c, task.ID)
200200
}
@@ -285,13 +285,13 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSourceTargetPaths(c *testi
285285
assert.Equal(c, len(refs), len(testPaths))
286286

287287
var tasks []swarm.Task
288-
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
288+
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
289289
tasks = d.GetServiceTasks(c, serviceName)
290290
return len(tasks) > 0, nil
291291
}, checker.Equals, true)
292292

293293
task := tasks[0]
294-
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
294+
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
295295
if task.NodeID == "" || task.Status.ContainerStatus == nil {
296296
task = d.GetTask(c, task.ID)
297297
}
@@ -335,13 +335,13 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigReferencedTwice(c *testing
335335
assert.Equal(c, len(refs), 2)
336336

337337
var tasks []swarm.Task
338-
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
338+
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
339339
tasks = d.GetServiceTasks(c, serviceName)
340340
return len(tasks) > 0, nil
341341
}, checker.Equals, true)
342342

343343
task := tasks[0]
344-
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
344+
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
345345
if task.NodeID == "" || task.Status.ContainerStatus == nil {
346346
task = d.GetTask(c, task.ID)
347347
}
@@ -367,13 +367,13 @@ func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *testing.T) {
367367
id := strings.TrimSpace(out)
368368

369369
var tasks []swarm.Task
370-
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
370+
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
371371
tasks = d.GetServiceTasks(c, id)
372372
return len(tasks) > 0, nil
373373
}, checker.Equals, true)
374374

375375
task := tasks[0]
376-
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
376+
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
377377
if task.NodeID == "" || task.Status.ContainerStatus == nil {
378378
task = d.GetTask(c, task.ID)
379379
}
@@ -423,13 +423,13 @@ func (s *DockerSwarmSuite) TestServiceCreateWithNetworkAlias(c *testing.T) {
423423
id := strings.TrimSpace(out)
424424

425425
var tasks []swarm.Task
426-
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
426+
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
427427
tasks = d.GetServiceTasks(c, id)
428428
return len(tasks) > 0, nil
429429
}, checker.Equals, true)
430430

431431
task := tasks[0]
432-
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
432+
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
433433
if task.NodeID == "" || task.Status.ContainerStatus == nil {
434434
task = d.GetTask(c, task.ID)
435435
}

0 commit comments

Comments
 (0)