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>
| ... | ... |
@@ -89,7 +89,7 @@ func (d *Daemon) inspectFieldWithError(name, field string) (string, error) {
|
| 89 | 89 |
|
| 90 | 90 |
// CheckActiveContainerCount returns the number of active containers |
| 91 | 91 |
// 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) {
|
|
| 93 | 93 |
out, err := d.Cmd("ps", "-q")
|
| 94 | 94 |
assert.NilError(c, err) |
| 95 | 95 |
if len(strings.TrimSpace(out)) == 0 {
|
| ... | ... |
@@ -16,8 +16,8 @@ import ( |
| 16 | 16 |
|
| 17 | 17 |
// CheckServiceTasksInState returns the number of tasks with a matching state, |
| 18 | 18 |
// 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) {
|
|
| 21 | 21 |
tasks := d.GetServiceTasks(c, service) |
| 22 | 22 |
var count int |
| 23 | 23 |
for _, task := range tasks {
|
| ... | ... |
@@ -33,8 +33,8 @@ func (d *Daemon) CheckServiceTasksInState(service string, state swarm.TaskState, |
| 33 | 33 |
|
| 34 | 34 |
// CheckServiceTasksInStateWithError returns the number of tasks with a matching state, |
| 35 | 35 |
// 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) {
|
|
| 38 | 38 |
tasks := d.GetServiceTasks(c, service) |
| 39 | 39 |
var count int |
| 40 | 40 |
for _, task := range tasks {
|
| ... | ... |
@@ -49,13 +49,13 @@ func (d *Daemon) CheckServiceTasksInStateWithError(service string, state swarm.T |
| 49 | 49 |
} |
| 50 | 50 |
|
| 51 | 51 |
// 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) {
|
|
| 53 | 53 |
return d.CheckServiceTasksInState(service, swarm.TaskStateRunning, "") |
| 54 | 54 |
} |
| 55 | 55 |
|
| 56 | 56 |
// 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) {
|
|
| 59 | 59 |
service := d.GetService(c, service) |
| 60 | 60 |
if service.UpdateStatus == nil {
|
| 61 | 61 |
return "", nil |
| ... | ... |
@@ -65,8 +65,8 @@ func (d *Daemon) CheckServiceUpdateState(service string) func(*testing.T) (inter |
| 65 | 65 |
} |
| 66 | 66 |
|
| 67 | 67 |
// 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) {
|
|
| 70 | 70 |
apiclient := d.NewClientT(c) |
| 71 | 71 |
resp, _, err := apiclient.PluginInspectWithRaw(context.Background(), plugin) |
| 72 | 72 |
if client.IsErrNotFound(err) {
|
| ... | ... |
@@ -78,8 +78,8 @@ func (d *Daemon) CheckPluginRunning(plugin string) func(c *testing.T) (interface |
| 78 | 78 |
} |
| 79 | 79 |
|
| 80 | 80 |
// 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) {
|
|
| 83 | 83 |
apiclient := d.NewClientT(c) |
| 84 | 84 |
resp, _, err := apiclient.PluginInspectWithRaw(context.Background(), plugin) |
| 85 | 85 |
if client.IsErrNotFound(err) {
|
| ... | ... |
@@ -91,15 +91,15 @@ func (d *Daemon) CheckPluginImage(plugin string) func(c *testing.T) (interface{}
|
| 91 | 91 |
} |
| 92 | 92 |
|
| 93 | 93 |
// 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) {
|
|
| 96 | 96 |
tasks := d.GetServiceTasks(c, service) |
| 97 | 97 |
return len(tasks), nil |
| 98 | 98 |
} |
| 99 | 99 |
} |
| 100 | 100 |
|
| 101 | 101 |
// 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) {
|
|
| 103 | 103 |
cli := d.NewClientT(c) |
| 104 | 104 |
defer cli.Close() |
| 105 | 105 |
|
| ... | ... |
@@ -123,7 +123,7 @@ func (d *Daemon) CheckRunningTaskNetworks(c *testing.T) (interface{}, check.Comm
|
| 123 | 123 |
} |
| 124 | 124 |
|
| 125 | 125 |
// 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) {
|
|
| 127 | 127 |
cli := d.NewClientT(c) |
| 128 | 128 |
defer cli.Close() |
| 129 | 129 |
|
| ... | ... |
@@ -147,7 +147,7 @@ func (d *Daemon) CheckRunningTaskImages(c *testing.T) (interface{}, check.Commen
|
| 147 | 147 |
} |
| 148 | 148 |
|
| 149 | 149 |
// 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) {
|
|
| 151 | 151 |
nodes := d.ListNodes(c) |
| 152 | 152 |
var readyCount int |
| 153 | 153 |
for _, node := range nodes {
|
| ... | ... |
@@ -159,20 +159,20 @@ func (d *Daemon) CheckNodeReadyCount(c *testing.T) (interface{}, check.CommentIn
|
| 159 | 159 |
} |
| 160 | 160 |
|
| 161 | 161 |
// 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) {
|
|
| 163 | 163 |
info := d.SwarmInfo(c) |
| 164 | 164 |
return info.LocalNodeState, nil |
| 165 | 165 |
} |
| 166 | 166 |
|
| 167 | 167 |
// 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) {
|
|
| 169 | 169 |
info := d.SwarmInfo(c) |
| 170 | 170 |
assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive) |
| 171 | 171 |
return info.ControlAvailable, nil |
| 172 | 172 |
} |
| 173 | 173 |
|
| 174 | 174 |
// 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) {
|
|
| 176 | 176 |
cli := d.NewClientT(c) |
| 177 | 177 |
defer cli.Close() |
| 178 | 178 |
|
| ... | ... |
@@ -216,7 +216,7 @@ func (s *DockerSuite) TestExecStateCleanup(c *testing.T) {
|
| 216 | 216 |
|
| 217 | 217 |
stateDir := "/var/run/docker/containerd/" + cid |
| 218 | 218 |
|
| 219 |
- checkReadDir := func(c *testing.T) (interface{}, check.CommentInterface) {
|
|
| 219 |
+ checkReadDir := func(c *testing.T) (interface{}, string) {
|
|
| 220 | 220 |
fi, err := ioutil.ReadDir(stateDir) |
| 221 | 221 |
assert.NilError(c, err) |
| 222 | 222 |
return len(fi), nil |
| ... | ... |
@@ -224,7 +224,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesUpdateStartFirst(c *testing.T) {
|
| 224 | 224 |
|
| 225 | 225 |
checkStartingTasks := func(expected int) []swarm.Task {
|
| 226 | 226 |
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) {
|
|
| 228 | 228 |
tasks := d.GetServiceTasks(c, id) |
| 229 | 229 |
startingTasks = nil |
| 230 | 230 |
for _, t := range tasks {
|
| ... | ... |
@@ -223,7 +223,7 @@ func (s *DockerSwarmSuite) TestAPISwarmPromoteDemote(c *testing.T) {
|
| 223 | 223 |
// back to manager quickly might cause the node to pause for awhile |
| 224 | 224 |
// while waiting for the role to change to worker, and the test can |
| 225 | 225 |
// 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) {
|
|
| 227 | 227 |
certBytes, err := ioutil.ReadFile(filepath.Join(d2.Folder, "root", "swarm", "certificates", "swarm-node.crt")) |
| 228 | 228 |
if err != nil {
|
| 229 | 229 |
return "", fmt.Sprintf("error: %v", err)
|
| ... | ... |
@@ -317,7 +317,7 @@ func (s *DockerSwarmSuite) TestAPISwarmLeaderElection(c *testing.T) {
|
| 317 | 317 |
) |
| 318 | 318 |
var lastErr error |
| 319 | 319 |
checkLeader := func(nodes ...*daemon.Daemon) checkF {
|
| 320 |
- return func(c *testing.T) (interface{}, check.CommentInterface) {
|
|
| 320 |
+ return func(c *testing.T) (interface{}, string) {
|
|
| 321 | 321 |
// clear these out before each run |
| 322 | 322 |
leader = nil |
| 323 | 323 |
followers = nil |
| ... | ... |
@@ -404,7 +404,7 @@ func (s *DockerSwarmSuite) TestAPISwarmRaftQuorum(c *testing.T) {
|
| 404 | 404 |
defer cli.Close() |
| 405 | 405 |
|
| 406 | 406 |
// 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) {
|
|
| 408 | 408 |
_, err := cli.ServiceCreate(context.Background(), service.Spec, types.ServiceCreateOptions{})
|
| 409 | 409 |
return err.Error(), nil |
| 410 | 410 |
}, 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 |
| 738 | 738 |
) |
| 739 | 739 |
|
| 740 | 740 |
// 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) {
|
|
| 742 | 742 |
client := d.NewClientT(c) |
| 743 | 743 |
daemonInfo, err := client.Info(context.Background()) |
| 744 | 744 |
info = daemonInfo.Swarm |
| ... | ... |
@@ -755,7 +755,7 @@ func checkClusterHealth(c *testing.T, cl []*daemon.Daemon, managerCount, workerC |
| 755 | 755 |
var mCount, wCount int |
| 756 | 756 |
|
| 757 | 757 |
for _, n := range d.ListNodes(c) {
|
| 758 |
- waitReady := func(c *testing.T) (interface{}, check.CommentInterface) {
|
|
| 758 |
+ waitReady := func(c *testing.T) (interface{}, string) {
|
|
| 759 | 759 |
if n.Status.State == swarm.NodeStateReady {
|
| 760 | 760 |
return true, nil |
| 761 | 761 |
} |
| ... | ... |
@@ -765,7 +765,7 @@ func checkClusterHealth(c *testing.T, cl []*daemon.Daemon, managerCount, workerC |
| 765 | 765 |
} |
| 766 | 766 |
waitAndAssert(c, defaultReconciliationTimeout, waitReady, checker.True) |
| 767 | 767 |
|
| 768 |
- waitActive := func(c *testing.T) (interface{}, check.CommentInterface) {
|
|
| 768 |
+ waitActive := func(c *testing.T) (interface{}, string) {
|
|
| 769 | 769 |
if n.Spec.Availability == swarm.NodeAvailabilityActive {
|
| 770 | 770 |
return true, nil |
| 771 | 771 |
} |
| ... | ... |
@@ -2072,7 +2072,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithUnpausedRunningContainer(t *tes |
| 2072 | 2072 |
|
| 2073 | 2073 |
// Give time to containerd to process the command if we don't |
| 2074 | 2074 |
// 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) {
|
|
| 2076 | 2076 |
result := icmd.RunCommand("kill", "-0", strings.TrimSpace(pid))
|
| 2077 | 2077 |
return result.ExitCode, nil |
| 2078 | 2078 |
}, checker.Equals, 0) |
| ... | ... |
@@ -25,7 +25,7 @@ func pruneNetworkAndVerify(c *testing.T, d *daemon.Daemon, kept, pruned []string |
| 25 | 25 |
assert.NilError(c, err) |
| 26 | 26 |
|
| 27 | 27 |
for _, s := range kept {
|
| 28 |
- waitAndAssert(c, defaultReconciliationTimeout, func(*testing.T) (interface{}, check.CommentInterface) {
|
|
| 28 |
+ waitAndAssert(c, defaultReconciliationTimeout, func(*testing.T) (interface{}, string) {
|
|
| 29 | 29 |
out, err := d.Cmd("network", "ls", "--format", "{{.Name}}")
|
| 30 | 30 |
assert.NilError(c, err) |
| 31 | 31 |
return out, nil |
| ... | ... |
@@ -33,7 +33,7 @@ func pruneNetworkAndVerify(c *testing.T, d *daemon.Daemon, kept, pruned []string |
| 33 | 33 |
} |
| 34 | 34 |
|
| 35 | 35 |
for _, s := range pruned {
|
| 36 |
- waitAndAssert(c, defaultReconciliationTimeout, func(*testing.T) (interface{}, check.CommentInterface) {
|
|
| 36 |
+ waitAndAssert(c, defaultReconciliationTimeout, func(*testing.T) (interface{}, string) {
|
|
| 37 | 37 |
out, err := d.Cmd("network", "ls", "--format", "{{.Name}}")
|
| 38 | 38 |
assert.NilError(c, err) |
| 39 | 39 |
return out, nil |
| ... | ... |
@@ -37,7 +37,7 @@ func (s *DockerSuite) TestRestartRunningContainer(c *testing.T) {
|
| 37 | 37 |
|
| 38 | 38 |
assert.NilError(c, waitRun(cleanedContainerID)) |
| 39 | 39 |
|
| 40 |
- getLogs := func(c *testing.T) (interface{}, check.CommentInterface) {
|
|
| 40 |
+ getLogs := func(c *testing.T) (interface{}, string) {
|
|
| 41 | 41 |
out, _ := dockerCmd(c, "logs", cleanedContainerID) |
| 42 | 42 |
return out, nil |
| 43 | 43 |
} |
| ... | ... |
@@ -24,13 +24,13 @@ func (s *DockerSwarmSuite) TestServiceCreateMountVolume(c *testing.T) {
|
| 24 | 24 |
id := strings.TrimSpace(out) |
| 25 | 25 |
|
| 26 | 26 |
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) {
|
|
| 28 | 28 |
tasks = d.GetServiceTasks(c, id) |
| 29 | 29 |
return len(tasks) > 0, nil |
| 30 | 30 |
}, checker.Equals, true) |
| 31 | 31 |
|
| 32 | 32 |
task := tasks[0] |
| 33 |
- waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
|
|
| 33 |
+ waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
|
| 34 | 34 |
if task.NodeID == "" || task.Status.ContainerStatus == nil {
|
| 35 | 35 |
task = d.GetTask(c, task.ID) |
| 36 | 36 |
} |
| ... | ... |
@@ -138,13 +138,13 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSourceTargetPaths(c *testi |
| 138 | 138 |
assert.Equal(c, len(refs), len(testPaths)) |
| 139 | 139 |
|
| 140 | 140 |
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) {
|
|
| 142 | 142 |
tasks = d.GetServiceTasks(c, serviceName) |
| 143 | 143 |
return len(tasks) > 0, nil |
| 144 | 144 |
}, checker.Equals, true) |
| 145 | 145 |
|
| 146 | 146 |
task := tasks[0] |
| 147 |
- waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
|
|
| 147 |
+ waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
|
| 148 | 148 |
if task.NodeID == "" || task.Status.ContainerStatus == nil {
|
| 149 | 149 |
task = d.GetTask(c, task.ID) |
| 150 | 150 |
} |
| ... | ... |
@@ -188,13 +188,13 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretReferencedTwice(c *testing |
| 188 | 188 |
assert.Equal(c, len(refs), 2) |
| 189 | 189 |
|
| 190 | 190 |
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) {
|
|
| 192 | 192 |
tasks = d.GetServiceTasks(c, serviceName) |
| 193 | 193 |
return len(tasks) > 0, nil |
| 194 | 194 |
}, checker.Equals, true) |
| 195 | 195 |
|
| 196 | 196 |
task := tasks[0] |
| 197 |
- waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
|
|
| 197 |
+ waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
|
| 198 | 198 |
if task.NodeID == "" || task.Status.ContainerStatus == nil {
|
| 199 | 199 |
task = d.GetTask(c, task.ID) |
| 200 | 200 |
} |
| ... | ... |
@@ -285,13 +285,13 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSourceTargetPaths(c *testi |
| 285 | 285 |
assert.Equal(c, len(refs), len(testPaths)) |
| 286 | 286 |
|
| 287 | 287 |
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) {
|
|
| 289 | 289 |
tasks = d.GetServiceTasks(c, serviceName) |
| 290 | 290 |
return len(tasks) > 0, nil |
| 291 | 291 |
}, checker.Equals, true) |
| 292 | 292 |
|
| 293 | 293 |
task := tasks[0] |
| 294 |
- waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
|
|
| 294 |
+ waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
|
| 295 | 295 |
if task.NodeID == "" || task.Status.ContainerStatus == nil {
|
| 296 | 296 |
task = d.GetTask(c, task.ID) |
| 297 | 297 |
} |
| ... | ... |
@@ -335,13 +335,13 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigReferencedTwice(c *testing |
| 335 | 335 |
assert.Equal(c, len(refs), 2) |
| 336 | 336 |
|
| 337 | 337 |
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) {
|
|
| 339 | 339 |
tasks = d.GetServiceTasks(c, serviceName) |
| 340 | 340 |
return len(tasks) > 0, nil |
| 341 | 341 |
}, checker.Equals, true) |
| 342 | 342 |
|
| 343 | 343 |
task := tasks[0] |
| 344 |
- waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
|
|
| 344 |
+ waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
|
| 345 | 345 |
if task.NodeID == "" || task.Status.ContainerStatus == nil {
|
| 346 | 346 |
task = d.GetTask(c, task.ID) |
| 347 | 347 |
} |
| ... | ... |
@@ -367,13 +367,13 @@ func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *testing.T) {
|
| 367 | 367 |
id := strings.TrimSpace(out) |
| 368 | 368 |
|
| 369 | 369 |
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) {
|
|
| 371 | 371 |
tasks = d.GetServiceTasks(c, id) |
| 372 | 372 |
return len(tasks) > 0, nil |
| 373 | 373 |
}, checker.Equals, true) |
| 374 | 374 |
|
| 375 | 375 |
task := tasks[0] |
| 376 |
- waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
|
|
| 376 |
+ waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
|
| 377 | 377 |
if task.NodeID == "" || task.Status.ContainerStatus == nil {
|
| 378 | 378 |
task = d.GetTask(c, task.ID) |
| 379 | 379 |
} |
| ... | ... |
@@ -423,13 +423,13 @@ func (s *DockerSwarmSuite) TestServiceCreateWithNetworkAlias(c *testing.T) {
|
| 423 | 423 |
id := strings.TrimSpace(out) |
| 424 | 424 |
|
| 425 | 425 |
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) {
|
|
| 427 | 427 |
tasks = d.GetServiceTasks(c, id) |
| 428 | 428 |
return len(tasks) > 0, nil |
| 429 | 429 |
}, checker.Equals, true) |
| 430 | 430 |
|
| 431 | 431 |
task := tasks[0] |
| 432 |
- waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
|
|
| 432 |
+ waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
|
| 433 | 433 |
if task.NodeID == "" || task.Status.ContainerStatus == nil {
|
| 434 | 434 |
task = d.GetTask(c, task.ID) |
| 435 | 435 |
} |
| ... | ... |
@@ -40,7 +40,7 @@ func (s *DockerSwarmSuite) TestServiceHealthRun(c *testing.T) {
|
| 40 | 40 |
id := strings.TrimSpace(out) |
| 41 | 41 |
|
| 42 | 42 |
var tasks []swarm.Task |
| 43 |
- waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
|
|
| 43 |
+ waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
|
| 44 | 44 |
tasks = d.GetServiceTasks(c, id) |
| 45 | 45 |
return tasks, nil |
| 46 | 46 |
}, checker.HasLen, 1) |
| ... | ... |
@@ -48,14 +48,14 @@ func (s *DockerSwarmSuite) TestServiceHealthRun(c *testing.T) {
|
| 48 | 48 |
task := tasks[0] |
| 49 | 49 |
|
| 50 | 50 |
// wait for task to start |
| 51 |
- waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
|
|
| 51 |
+ waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
|
| 52 | 52 |
task = d.GetTask(c, task.ID) |
| 53 | 53 |
return task.Status.State, nil |
| 54 | 54 |
}, checker.Equals, swarm.TaskStateRunning) |
| 55 | 55 |
containerID := task.Status.ContainerStatus.ContainerID |
| 56 | 56 |
|
| 57 | 57 |
// wait for container to be healthy |
| 58 |
- waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
|
|
| 58 |
+ waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
|
| 59 | 59 |
out, _ := d.Cmd("inspect", "--format={{.State.Health.Status}}", containerID)
|
| 60 | 60 |
return strings.TrimSpace(out), nil |
| 61 | 61 |
}, checker.Equals, "healthy") |
| ... | ... |
@@ -63,13 +63,13 @@ func (s *DockerSwarmSuite) TestServiceHealthRun(c *testing.T) {
|
| 63 | 63 |
// make it fail |
| 64 | 64 |
d.Cmd("exec", containerID, "rm", "/status")
|
| 65 | 65 |
// wait for container to be unhealthy |
| 66 |
- waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
|
|
| 66 |
+ waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
|
| 67 | 67 |
out, _ := d.Cmd("inspect", "--format={{.State.Health.Status}}", containerID)
|
| 68 | 68 |
return strings.TrimSpace(out), nil |
| 69 | 69 |
}, checker.Equals, "unhealthy") |
| 70 | 70 |
|
| 71 | 71 |
// Task should be terminated |
| 72 |
- waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
|
|
| 72 |
+ waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
|
| 73 | 73 |
task = d.GetTask(c, task.ID) |
| 74 | 74 |
return task.Status.State, nil |
| 75 | 75 |
}, checker.Equals, swarm.TaskStateFailed) |
| ... | ... |
@@ -101,7 +101,7 @@ func (s *DockerSwarmSuite) TestServiceHealthStart(c *testing.T) {
|
| 101 | 101 |
id := strings.TrimSpace(out) |
| 102 | 102 |
|
| 103 | 103 |
var tasks []swarm.Task |
| 104 |
- waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
|
|
| 104 |
+ waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
|
| 105 | 105 |
tasks = d.GetServiceTasks(c, id) |
| 106 | 106 |
return tasks, nil |
| 107 | 107 |
}, checker.HasLen, 1) |
| ... | ... |
@@ -109,7 +109,7 @@ func (s *DockerSwarmSuite) TestServiceHealthStart(c *testing.T) {
|
| 109 | 109 |
task := tasks[0] |
| 110 | 110 |
|
| 111 | 111 |
// wait for task to start |
| 112 |
- waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
|
|
| 112 |
+ waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
|
| 113 | 113 |
task = d.GetTask(c, task.ID) |
| 114 | 114 |
return task.Status.State, nil |
| 115 | 115 |
}, checker.Equals, swarm.TaskStateStarting) |
| ... | ... |
@@ -117,7 +117,7 @@ func (s *DockerSwarmSuite) TestServiceHealthStart(c *testing.T) {
|
| 117 | 117 |
containerID := task.Status.ContainerStatus.ContainerID |
| 118 | 118 |
|
| 119 | 119 |
// wait for health check to work |
| 120 |
- waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
|
|
| 120 |
+ waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
|
| 121 | 121 |
out, _ := d.Cmd("inspect", "--format={{.State.Health.FailingStreak}}", containerID)
|
| 122 | 122 |
failingStreak, _ := strconv.Atoi(strings.TrimSpace(out)) |
| 123 | 123 |
return failingStreak, nil |
| ... | ... |
@@ -131,7 +131,7 @@ func (s *DockerSwarmSuite) TestServiceHealthStart(c *testing.T) {
|
| 131 | 131 |
d.Cmd("exec", containerID, "touch", "/status")
|
| 132 | 132 |
|
| 133 | 133 |
// Task should be at running status |
| 134 |
- waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
|
|
| 134 |
+ waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
|
| 135 | 135 |
task = d.GetTask(c, task.ID) |
| 136 | 136 |
return task.Status.State, nil |
| 137 | 137 |
}, checker.Equals, swarm.TaskStateRunning) |
| ... | ... |
@@ -55,8 +55,8 @@ func (s *DockerSwarmSuite) TestServiceLogs(c *testing.T) {
|
| 55 | 55 |
// countLogLines returns a closure that can be used with waitAndAssert to |
| 56 | 56 |
// verify that a minimum number of expected container log messages have been |
| 57 | 57 |
// output. |
| 58 |
-func countLogLines(d *daemon.Daemon, name string) func(*testing.T) (interface{}, check.CommentInterface) {
|
|
| 59 |
- return func(c *testing.T) (interface{}, check.CommentInterface) {
|
|
| 58 |
+func countLogLines(d *daemon.Daemon, name string) func(*testing.T) (interface{}, string) {
|
|
| 59 |
+ return func(c *testing.T) (interface{}, string) {
|
|
| 60 | 60 |
result := icmd.RunCmd(d.Command("service", "logs", "-t", "--raw", name))
|
| 61 | 61 |
result.Assert(c, icmd.Expected{})
|
| 62 | 62 |
// if this returns an emptystring, trying to split it later will return |
| ... | ... |
@@ -383,7 +383,7 @@ func (s *DockerSwarmSuite) TestSwarmContainerAttachByNetworkId(c *testing.T) {
|
| 383 | 383 |
out, err = d.Cmd("network", "rm", "testnet")
|
| 384 | 384 |
assert.NilError(c, err, out) |
| 385 | 385 |
|
| 386 |
- checkNetwork := func(*testing.T) (interface{}, check.CommentInterface) {
|
|
| 386 |
+ checkNetwork := func(*testing.T) (interface{}, string) {
|
|
| 387 | 387 |
out, err := d.Cmd("network", "ls")
|
| 388 | 388 |
assert.NilError(c, err) |
| 389 | 389 |
return out, nil |
| ... | ... |
@@ -544,7 +544,7 @@ func (s *DockerSwarmSuite) TestSwarmTaskListFilter(c *testing.T) {
|
| 544 | 544 |
|
| 545 | 545 |
filter := "name=redis-cluster" |
| 546 | 546 |
|
| 547 |
- checkNumTasks := func(*testing.T) (interface{}, check.CommentInterface) {
|
|
| 547 |
+ checkNumTasks := func(*testing.T) (interface{}, string) {
|
|
| 548 | 548 |
out, err := d.Cmd("service", "ps", "--filter", filter, name)
|
| 549 | 549 |
assert.NilError(c, err, out) |
| 550 | 550 |
return len(strings.Split(out, "\n")) - 2, nil // includes header and nl in last line |
| ... | ... |
@@ -985,8 +985,8 @@ func getNodeStatus(c *testing.T, d *daemon.Daemon) swarm.LocalNodeState {
|
| 985 | 985 |
return info.LocalNodeState |
| 986 | 986 |
} |
| 987 | 987 |
|
| 988 |
-func checkKeyIsEncrypted(d *daemon.Daemon) func(*testing.T) (interface{}, check.CommentInterface) {
|
|
| 989 |
- return func(c *testing.T) (interface{}, check.CommentInterface) {
|
|
| 988 |
+func checkKeyIsEncrypted(d *daemon.Daemon) func(*testing.T) (interface{}, string) {
|
|
| 989 |
+ return func(c *testing.T) (interface{}, string) {
|
|
| 990 | 990 |
keyBytes, err := ioutil.ReadFile(filepath.Join(d.Folder, "root", "swarm", "certificates", "swarm-node.key")) |
| 991 | 991 |
if err != nil {
|
| 992 | 992 |
return fmt.Errorf("error reading key: %v", err), nil
|
| ... | ... |
@@ -1214,7 +1214,7 @@ func (s *DockerSwarmSuite) TestSwarmJoinPromoteLocked(c *testing.T) {
|
| 1214 | 1214 |
// (because we never want a manager TLS key to be on disk unencrypted if the cluster |
| 1215 | 1215 |
// is set to autolock) |
| 1216 | 1216 |
waitAndAssert(c, defaultReconciliationTimeout, d3.CheckControlAvailable, checker.False) |
| 1217 |
- waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, check.CommentInterface) {
|
|
| 1217 |
+ waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
|
| 1218 | 1218 |
certBytes, err := ioutil.ReadFile(filepath.Join(d3.Folder, "root", "swarm", "certificates", "swarm-node.crt")) |
| 1219 | 1219 |
if err != nil {
|
| 1220 | 1220 |
return "", fmt.Sprintf("error: %v", err)
|
| ... | ... |
@@ -441,11 +441,11 @@ func waitAndAssert(t assert.TestingT, timeout time.Duration, f checkF, compariso |
| 441 | 441 |
} |
| 442 | 442 |
} |
| 443 | 443 |
|
| 444 |
-type checkF func(*testing.T) (interface{}, check.CommentInterface)
|
|
| 444 |
+type checkF func(*testing.T) (interface{}, string)
|
|
| 445 | 445 |
type reducer func(...interface{}) interface{}
|
| 446 | 446 |
|
| 447 | 447 |
func reducedCheck(r reducer, funcs ...checkF) checkF {
|
| 448 |
- return func(c *testing.T) (interface{}, check.CommentInterface) {
|
|
| 448 |
+ return func(c *testing.T) (interface{}, string) {
|
|
| 449 | 449 |
var values []interface{}
|
| 450 | 450 |
var comments []string |
| 451 | 451 |
for _, f := range funcs {
|