while :; do \
out=$(go test -c ./integration-cli 2>&1 | grep 'cannot use nil as type string in return argument') || break
echo "$out" | while read line; do
file=$(echo "$line" | cut -d: -f1)
n=$(echo "$line" | cut -d: -f2)
sed -E -i "${n}"'s#\b(return .*, )nil#\1""#g' "$file"
done
done \
&& \
while :; do \
out=$(go test -c ./integration-cli/daemon 2>&1 | grep 'cannot use nil as type string in return argument') || break
echo "$out" | while read line; do
file=$(echo "$line" | cut -d: -f1)
n=$(echo "$line" | cut -d: -f2)
sed -E -i "${n}"'s#\b(return .*, )nil#\1""#g' "$file"
done
done \
&& \
while :; do \
out=$(go test -c ./pkg/discovery 2>&1 | grep 'cannot use nil as type string in return argument') || break
echo "$out" | while read line; do
file=$(echo "$line" | cut -d: -f1)
n=$(echo "$line" | cut -d: -f2)
sed -E -i "${n}"'s#\b(return .*, )nil#\1""#g' "$file"
done
done \
&& \
while :; do \
out=$(go test -c ./pkg/discovery/file 2>&1 | grep 'cannot use nil as type string in return argument') || break
echo "$out" | while read line; do
file=$(echo "$line" | cut -d: -f1)
n=$(echo "$line" | cut -d: -f2)
sed -E -i "${n}"'s#\b(return .*, )nil#\1""#g' "$file"
done
done \
&& \
while :; do \
out=$(go test -c ./pkg/discovery/kv 2>&1 | grep 'cannot use nil as type string in return argument') || break
echo "$out" | while read line; do
file=$(echo "$line" | cut -d: -f1)
n=$(echo "$line" | cut -d: -f2)
sed -E -i "${n}"'s#\b(return .*, )nil#\1""#g' "$file"
done
done \
&& \
while :; do \
out=$(go test -c ./pkg/discovery/memory 2>&1 | grep 'cannot use nil as type string in return argument') || break
echo "$out" | while read line; do
file=$(echo "$line" | cut -d: -f1)
n=$(echo "$line" | cut -d: -f2)
sed -E -i "${n}"'s#\b(return .*, )nil#\1""#g' "$file"
done
done \
&& \
while :; do \
out=$(go test -c ./pkg/discovery/nodes 2>&1 | grep 'cannot use nil as type string in return argument') || break
echo "$out" | while read line; do
file=$(echo "$line" | cut -d: -f1)
n=$(echo "$line" | cut -d: -f2)
sed -E -i "${n}"'s#\b(return .*, )nil#\1""#g' "$file"
done
done
Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 64de5e82289b1a97b3a9757959210a0400a602f7)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -92,7 +92,7 @@ func (d *Daemon) CheckActiveContainerCount(c *testing.T) (interface{}, string) {
|
| 92 | 92 |
out, err := d.Cmd("ps", "-q")
|
| 93 | 93 |
assert.NilError(c, err) |
| 94 | 94 |
if len(strings.TrimSpace(out)) == 0 {
|
| 95 |
- return 0, nil |
|
| 95 |
+ return 0, "" |
|
| 96 | 96 |
} |
| 97 | 97 |
return len(strings.Split(strings.TrimSpace(out), "\n")), fmt.Sprintf("output: %q", string(out))
|
| 98 | 98 |
} |
| ... | ... |
@@ -26,7 +26,7 @@ func (d *Daemon) CheckServiceTasksInState(service string, state swarm.TaskState, |
| 26 | 26 |
} |
| 27 | 27 |
} |
| 28 | 28 |
} |
| 29 |
- return count, nil |
|
| 29 |
+ return count, "" |
|
| 30 | 30 |
} |
| 31 | 31 |
} |
| 32 | 32 |
|
| ... | ... |
@@ -43,7 +43,7 @@ func (d *Daemon) CheckServiceTasksInStateWithError(service string, state swarm.T |
| 43 | 43 |
} |
| 44 | 44 |
} |
| 45 | 45 |
} |
| 46 |
- return count, nil |
|
| 46 |
+ return count, "" |
|
| 47 | 47 |
} |
| 48 | 48 |
} |
| 49 | 49 |
|
| ... | ... |
@@ -57,9 +57,9 @@ func (d *Daemon) CheckServiceUpdateState(service string) func(*testing.T) (inter |
| 57 | 57 |
return func(c *testing.T) (interface{}, string) {
|
| 58 | 58 |
service := d.GetService(c, service) |
| 59 | 59 |
if service.UpdateStatus == nil {
|
| 60 |
- return "", nil |
|
| 60 |
+ return "", "" |
|
| 61 | 61 |
} |
| 62 |
- return service.UpdateStatus.State, nil |
|
| 62 |
+ return service.UpdateStatus.State, "" |
|
| 63 | 63 |
} |
| 64 | 64 |
} |
| 65 | 65 |
|
| ... | ... |
@@ -93,7 +93,7 @@ func (d *Daemon) CheckPluginImage(plugin string) func(c *testing.T) (interface{}
|
| 93 | 93 |
func (d *Daemon) CheckServiceTasks(service string) func(*testing.T) (interface{}, string) {
|
| 94 | 94 |
return func(c *testing.T) (interface{}, string) {
|
| 95 | 95 |
tasks := d.GetServiceTasks(c, service) |
| 96 |
- return len(tasks), nil |
|
| 96 |
+ return len(tasks), "" |
|
| 97 | 97 |
} |
| 98 | 98 |
} |
| 99 | 99 |
|
| ... | ... |
@@ -118,7 +118,7 @@ func (d *Daemon) CheckRunningTaskNetworks(c *testing.T) (interface{}, string) {
|
| 118 | 118 |
result[network.Target]++ |
| 119 | 119 |
} |
| 120 | 120 |
} |
| 121 |
- return result, nil |
|
| 121 |
+ return result, "" |
|
| 122 | 122 |
} |
| 123 | 123 |
|
| 124 | 124 |
// CheckRunningTaskImages returns the times each image is running as a task. |
| ... | ... |
@@ -142,7 +142,7 @@ func (d *Daemon) CheckRunningTaskImages(c *testing.T) (interface{}, string) {
|
| 142 | 142 |
result[task.Spec.ContainerSpec.Image]++ |
| 143 | 143 |
} |
| 144 | 144 |
} |
| 145 |
- return result, nil |
|
| 145 |
+ return result, "" |
|
| 146 | 146 |
} |
| 147 | 147 |
|
| 148 | 148 |
// CheckNodeReadyCount returns the number of ready node on the swarm |
| ... | ... |
@@ -154,20 +154,20 @@ func (d *Daemon) CheckNodeReadyCount(c *testing.T) (interface{}, string) {
|
| 154 | 154 |
readyCount++ |
| 155 | 155 |
} |
| 156 | 156 |
} |
| 157 |
- return readyCount, nil |
|
| 157 |
+ return readyCount, "" |
|
| 158 | 158 |
} |
| 159 | 159 |
|
| 160 | 160 |
// CheckLocalNodeState returns the current swarm node state |
| 161 | 161 |
func (d *Daemon) CheckLocalNodeState(c *testing.T) (interface{}, string) {
|
| 162 | 162 |
info := d.SwarmInfo(c) |
| 163 |
- return info.LocalNodeState, nil |
|
| 163 |
+ return info.LocalNodeState, "" |
|
| 164 | 164 |
} |
| 165 | 165 |
|
| 166 | 166 |
// CheckControlAvailable returns the current swarm control available |
| 167 | 167 |
func (d *Daemon) CheckControlAvailable(c *testing.T) (interface{}, string) {
|
| 168 | 168 |
info := d.SwarmInfo(c) |
| 169 | 169 |
assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive) |
| 170 |
- return info.ControlAvailable, nil |
|
| 170 |
+ return info.ControlAvailable, "" |
|
| 171 | 171 |
} |
| 172 | 172 |
|
| 173 | 173 |
// CheckLeader returns whether there is a leader on the swarm or not |
| ... | ... |
@@ -184,7 +184,7 @@ func (d *Daemon) CheckLeader(c *testing.T) (interface{}, string) {
|
| 184 | 184 |
|
| 185 | 185 |
for _, node := range ls {
|
| 186 | 186 |
if node.ManagerStatus != nil && node.ManagerStatus.Leader {
|
| 187 |
- return nil, nil |
|
| 187 |
+ return nil, "" |
|
| 188 | 188 |
} |
| 189 | 189 |
} |
| 190 | 190 |
return fmt.Errorf("no leader"), "could not find leader"
|
| ... | ... |
@@ -218,7 +218,7 @@ func (s *DockerSuite) TestExecStateCleanup(c *testing.T) {
|
| 218 | 218 |
checkReadDir := func(c *testing.T) (interface{}, string) {
|
| 219 | 219 |
fi, err := ioutil.ReadDir(stateDir) |
| 220 | 220 |
assert.NilError(c, err) |
| 221 |
- return len(fi), nil |
|
| 221 |
+ return len(fi), "" |
|
| 222 | 222 |
} |
| 223 | 223 |
|
| 224 | 224 |
fi, err := ioutil.ReadDir(stateDir) |
| ... | ... |
@@ -231,7 +231,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesUpdateStartFirst(c *testing.T) {
|
| 231 | 231 |
startingTasks = append(startingTasks, t) |
| 232 | 232 |
} |
| 233 | 233 |
} |
| 234 |
- return startingTasks, nil |
|
| 234 |
+ return startingTasks, "" |
|
| 235 | 235 |
}, checker.HasLen, expected) |
| 236 | 236 |
|
| 237 | 237 |
return startingTasks |
| ... | ... |
@@ -229,7 +229,7 @@ func (s *DockerSwarmSuite) TestAPISwarmPromoteDemote(c *testing.T) {
|
| 229 | 229 |
} |
| 230 | 230 |
certs, err := helpers.ParseCertificatesPEM(certBytes) |
| 231 | 231 |
if err == nil && len(certs) > 0 && len(certs[0].Subject.OrganizationalUnit) > 0 {
|
| 232 |
- return certs[0].Subject.OrganizationalUnit[0], nil |
|
| 232 |
+ return certs[0].Subject.OrganizationalUnit[0], "" |
|
| 233 | 233 |
} |
| 234 | 234 |
return "", "could not get organizational unit from certificate" |
| 235 | 235 |
}, checker.Equals, "swarm-worker") |
| ... | ... |
@@ -405,7 +405,7 @@ func (s *DockerSwarmSuite) TestAPISwarmRaftQuorum(c *testing.T) {
|
| 405 | 405 |
// d1 will eventually step down from leader because there is no longer an active quorum, wait for that to happen |
| 406 | 406 |
waitAndAssert(c, defaultReconciliationTimeout*2, func(c *testing.T) (interface{}, string) {
|
| 407 | 407 |
_, err := cli.ServiceCreate(context.Background(), service.Spec, types.ServiceCreateOptions{})
|
| 408 |
- return err.Error(), nil |
|
| 408 |
+ return err.Error(), "" |
|
| 409 | 409 |
}, checker.Contains, "Make sure more than half of the managers are online.") |
| 410 | 410 |
|
| 411 | 411 |
d2.StartNode(c) |
| ... | ... |
@@ -756,7 +756,7 @@ func checkClusterHealth(c *testing.T, cl []*daemon.Daemon, managerCount, workerC |
| 756 | 756 |
for _, n := range d.ListNodes(c) {
|
| 757 | 757 |
waitReady := func(c *testing.T) (interface{}, string) {
|
| 758 | 758 |
if n.Status.State == swarm.NodeStateReady {
|
| 759 |
- return true, nil |
|
| 759 |
+ return true, "" |
|
| 760 | 760 |
} |
| 761 | 761 |
nn := d.GetNode(c, n.ID) |
| 762 | 762 |
n = *nn |
| ... | ... |
@@ -766,7 +766,7 @@ func checkClusterHealth(c *testing.T, cl []*daemon.Daemon, managerCount, workerC |
| 766 | 766 |
|
| 767 | 767 |
waitActive := func(c *testing.T) (interface{}, string) {
|
| 768 | 768 |
if n.Spec.Availability == swarm.NodeAvailabilityActive {
|
| 769 |
- return true, nil |
|
| 769 |
+ return true, "" |
|
| 770 | 770 |
} |
| 771 | 771 |
nn := d.GetNode(c, n.ID) |
| 772 | 772 |
n = *nn |
| ... | ... |
@@ -2073,7 +2073,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithUnpausedRunningContainer(t *tes |
| 2073 | 2073 |
// the resume event might be received after we do the inspect |
| 2074 | 2074 |
waitAndAssert(t, defaultReconciliationTimeout, func(*testing.T) (interface{}, string) {
|
| 2075 | 2075 |
result := icmd.RunCommand("kill", "-0", strings.TrimSpace(pid))
|
| 2076 |
- return result.ExitCode, nil |
|
| 2076 |
+ return result.ExitCode, "" |
|
| 2077 | 2077 |
}, checker.Equals, 0) |
| 2078 | 2078 |
|
| 2079 | 2079 |
// restart the daemon |
| ... | ... |
@@ -27,7 +27,7 @@ func pruneNetworkAndVerify(c *testing.T, d *daemon.Daemon, kept, pruned []string |
| 27 | 27 |
waitAndAssert(c, defaultReconciliationTimeout, func(*testing.T) (interface{}, string) {
|
| 28 | 28 |
out, err := d.Cmd("network", "ls", "--format", "{{.Name}}")
|
| 29 | 29 |
assert.NilError(c, err) |
| 30 |
- return out, nil |
|
| 30 |
+ return out, "" |
|
| 31 | 31 |
}, checker.Contains, s) |
| 32 | 32 |
} |
| 33 | 33 |
|
| ... | ... |
@@ -35,7 +35,7 @@ func pruneNetworkAndVerify(c *testing.T, d *daemon.Daemon, kept, pruned []string |
| 35 | 35 |
waitAndAssert(c, defaultReconciliationTimeout, func(*testing.T) (interface{}, string) {
|
| 36 | 36 |
out, err := d.Cmd("network", "ls", "--format", "{{.Name}}")
|
| 37 | 37 |
assert.NilError(c, err) |
| 38 |
- return out, nil |
|
| 38 |
+ return out, "" |
|
| 39 | 39 |
}, checker.Not(checker.Contains), s) |
| 40 | 40 |
} |
| 41 | 41 |
} |
| ... | ... |
@@ -38,7 +38,7 @@ func (s *DockerSuite) TestRestartRunningContainer(c *testing.T) {
|
| 38 | 38 |
|
| 39 | 39 |
getLogs := func(c *testing.T) (interface{}, string) {
|
| 40 | 40 |
out, _ := dockerCmd(c, "logs", cleanedContainerID) |
| 41 |
- return out, nil |
|
| 41 |
+ return out, "" |
|
| 42 | 42 |
} |
| 43 | 43 |
|
| 44 | 44 |
// Wait 10 seconds for the 'echo' to appear in the logs |
| ... | ... |
@@ -25,7 +25,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountVolume(c *testing.T) {
|
| 25 | 25 |
var tasks []swarm.Task |
| 26 | 26 |
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
| 27 | 27 |
tasks = d.GetServiceTasks(c, id) |
| 28 |
- return len(tasks) > 0, nil |
|
| 28 |
+ return len(tasks) > 0, "" |
|
| 29 | 29 |
}, checker.Equals, true) |
| 30 | 30 |
|
| 31 | 31 |
task := tasks[0] |
| ... | ... |
@@ -33,7 +33,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountVolume(c *testing.T) {
|
| 33 | 33 |
if task.NodeID == "" || task.Status.ContainerStatus == nil {
|
| 34 | 34 |
task = d.GetTask(c, task.ID) |
| 35 | 35 |
} |
| 36 |
- return task.NodeID != "" && task.Status.ContainerStatus != nil, nil |
|
| 36 |
+ return task.NodeID != "" && task.Status.ContainerStatus != nil, "" |
|
| 37 | 37 |
}, checker.Equals, true) |
| 38 | 38 |
|
| 39 | 39 |
// check container mount config |
| ... | ... |
@@ -139,7 +139,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSourceTargetPaths(c *testi |
| 139 | 139 |
var tasks []swarm.Task |
| 140 | 140 |
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
| 141 | 141 |
tasks = d.GetServiceTasks(c, serviceName) |
| 142 |
- return len(tasks) > 0, nil |
|
| 142 |
+ return len(tasks) > 0, "" |
|
| 143 | 143 |
}, checker.Equals, true) |
| 144 | 144 |
|
| 145 | 145 |
task := tasks[0] |
| ... | ... |
@@ -147,7 +147,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSourceTargetPaths(c *testi |
| 147 | 147 |
if task.NodeID == "" || task.Status.ContainerStatus == nil {
|
| 148 | 148 |
task = d.GetTask(c, task.ID) |
| 149 | 149 |
} |
| 150 |
- return task.NodeID != "" && task.Status.ContainerStatus != nil, nil |
|
| 150 |
+ return task.NodeID != "" && task.Status.ContainerStatus != nil, "" |
|
| 151 | 151 |
}, checker.Equals, true) |
| 152 | 152 |
|
| 153 | 153 |
for testName, testTarget := range testPaths {
|
| ... | ... |
@@ -189,7 +189,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretReferencedTwice(c *testing |
| 189 | 189 |
var tasks []swarm.Task |
| 190 | 190 |
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
| 191 | 191 |
tasks = d.GetServiceTasks(c, serviceName) |
| 192 |
- return len(tasks) > 0, nil |
|
| 192 |
+ return len(tasks) > 0, "" |
|
| 193 | 193 |
}, checker.Equals, true) |
| 194 | 194 |
|
| 195 | 195 |
task := tasks[0] |
| ... | ... |
@@ -197,7 +197,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretReferencedTwice(c *testing |
| 197 | 197 |
if task.NodeID == "" || task.Status.ContainerStatus == nil {
|
| 198 | 198 |
task = d.GetTask(c, task.ID) |
| 199 | 199 |
} |
| 200 |
- return task.NodeID != "" && task.Status.ContainerStatus != nil, nil |
|
| 200 |
+ return task.NodeID != "" && task.Status.ContainerStatus != nil, "" |
|
| 201 | 201 |
}, checker.Equals, true) |
| 202 | 202 |
|
| 203 | 203 |
for _, target := range []string{"target1", "target2"} {
|
| ... | ... |
@@ -286,7 +286,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSourceTargetPaths(c *testi |
| 286 | 286 |
var tasks []swarm.Task |
| 287 | 287 |
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
| 288 | 288 |
tasks = d.GetServiceTasks(c, serviceName) |
| 289 |
- return len(tasks) > 0, nil |
|
| 289 |
+ return len(tasks) > 0, "" |
|
| 290 | 290 |
}, checker.Equals, true) |
| 291 | 291 |
|
| 292 | 292 |
task := tasks[0] |
| ... | ... |
@@ -294,7 +294,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSourceTargetPaths(c *testi |
| 294 | 294 |
if task.NodeID == "" || task.Status.ContainerStatus == nil {
|
| 295 | 295 |
task = d.GetTask(c, task.ID) |
| 296 | 296 |
} |
| 297 |
- return task.NodeID != "" && task.Status.ContainerStatus != nil, nil |
|
| 297 |
+ return task.NodeID != "" && task.Status.ContainerStatus != nil, "" |
|
| 298 | 298 |
}, checker.Equals, true) |
| 299 | 299 |
|
| 300 | 300 |
for testName, testTarget := range testPaths {
|
| ... | ... |
@@ -336,7 +336,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigReferencedTwice(c *testing |
| 336 | 336 |
var tasks []swarm.Task |
| 337 | 337 |
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
| 338 | 338 |
tasks = d.GetServiceTasks(c, serviceName) |
| 339 |
- return len(tasks) > 0, nil |
|
| 339 |
+ return len(tasks) > 0, "" |
|
| 340 | 340 |
}, checker.Equals, true) |
| 341 | 341 |
|
| 342 | 342 |
task := tasks[0] |
| ... | ... |
@@ -344,7 +344,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigReferencedTwice(c *testing |
| 344 | 344 |
if task.NodeID == "" || task.Status.ContainerStatus == nil {
|
| 345 | 345 |
task = d.GetTask(c, task.ID) |
| 346 | 346 |
} |
| 347 |
- return task.NodeID != "" && task.Status.ContainerStatus != nil, nil |
|
| 347 |
+ return task.NodeID != "" && task.Status.ContainerStatus != nil, "" |
|
| 348 | 348 |
}, checker.Equals, true) |
| 349 | 349 |
|
| 350 | 350 |
for _, target := range []string{"target1", "target2"} {
|
| ... | ... |
@@ -368,7 +368,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *testing.T) {
|
| 368 | 368 |
var tasks []swarm.Task |
| 369 | 369 |
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
| 370 | 370 |
tasks = d.GetServiceTasks(c, id) |
| 371 |
- return len(tasks) > 0, nil |
|
| 371 |
+ return len(tasks) > 0, "" |
|
| 372 | 372 |
}, checker.Equals, true) |
| 373 | 373 |
|
| 374 | 374 |
task := tasks[0] |
| ... | ... |
@@ -376,7 +376,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *testing.T) {
|
| 376 | 376 |
if task.NodeID == "" || task.Status.ContainerStatus == nil {
|
| 377 | 377 |
task = d.GetTask(c, task.ID) |
| 378 | 378 |
} |
| 379 |
- return task.NodeID != "" && task.Status.ContainerStatus != nil, nil |
|
| 379 |
+ return task.NodeID != "" && task.Status.ContainerStatus != nil, "" |
|
| 380 | 380 |
}, checker.Equals, true) |
| 381 | 381 |
|
| 382 | 382 |
// check container mount config |
| ... | ... |
@@ -424,7 +424,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithNetworkAlias(c *testing.T) {
|
| 424 | 424 |
var tasks []swarm.Task |
| 425 | 425 |
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
| 426 | 426 |
tasks = d.GetServiceTasks(c, id) |
| 427 |
- return len(tasks) > 0, nil |
|
| 427 |
+ return len(tasks) > 0, "" |
|
| 428 | 428 |
}, checker.Equals, true) |
| 429 | 429 |
|
| 430 | 430 |
task := tasks[0] |
| ... | ... |
@@ -432,7 +432,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithNetworkAlias(c *testing.T) {
|
| 432 | 432 |
if task.NodeID == "" || task.Status.ContainerStatus == nil {
|
| 433 | 433 |
task = d.GetTask(c, task.ID) |
| 434 | 434 |
} |
| 435 |
- return task.NodeID != "" && task.Status.ContainerStatus != nil, nil |
|
| 435 |
+ return task.NodeID != "" && task.Status.ContainerStatus != nil, "" |
|
| 436 | 436 |
}, checker.Equals, true) |
| 437 | 437 |
|
| 438 | 438 |
// check container alias config |
| ... | ... |
@@ -41,7 +41,7 @@ func (s *DockerSwarmSuite) TestServiceHealthRun(c *testing.T) {
|
| 41 | 41 |
var tasks []swarm.Task |
| 42 | 42 |
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
| 43 | 43 |
tasks = d.GetServiceTasks(c, id) |
| 44 |
- return tasks, nil |
|
| 44 |
+ return tasks, "" |
|
| 45 | 45 |
}, checker.HasLen, 1) |
| 46 | 46 |
|
| 47 | 47 |
task := tasks[0] |
| ... | ... |
@@ -49,14 +49,14 @@ func (s *DockerSwarmSuite) TestServiceHealthRun(c *testing.T) {
|
| 49 | 49 |
// wait for task to start |
| 50 | 50 |
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
| 51 | 51 |
task = d.GetTask(c, task.ID) |
| 52 |
- return task.Status.State, nil |
|
| 52 |
+ return task.Status.State, "" |
|
| 53 | 53 |
}, checker.Equals, swarm.TaskStateRunning) |
| 54 | 54 |
containerID := task.Status.ContainerStatus.ContainerID |
| 55 | 55 |
|
| 56 | 56 |
// wait for container to be healthy |
| 57 | 57 |
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
| 58 | 58 |
out, _ := d.Cmd("inspect", "--format={{.State.Health.Status}}", containerID)
|
| 59 |
- return strings.TrimSpace(out), nil |
|
| 59 |
+ return strings.TrimSpace(out), "" |
|
| 60 | 60 |
}, checker.Equals, "healthy") |
| 61 | 61 |
|
| 62 | 62 |
// make it fail |
| ... | ... |
@@ -64,13 +64,13 @@ func (s *DockerSwarmSuite) TestServiceHealthRun(c *testing.T) {
|
| 64 | 64 |
// wait for container to be unhealthy |
| 65 | 65 |
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
| 66 | 66 |
out, _ := d.Cmd("inspect", "--format={{.State.Health.Status}}", containerID)
|
| 67 |
- return strings.TrimSpace(out), nil |
|
| 67 |
+ return strings.TrimSpace(out), "" |
|
| 68 | 68 |
}, checker.Equals, "unhealthy") |
| 69 | 69 |
|
| 70 | 70 |
// Task should be terminated |
| 71 | 71 |
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
| 72 | 72 |
task = d.GetTask(c, task.ID) |
| 73 |
- return task.Status.State, nil |
|
| 73 |
+ return task.Status.State, "" |
|
| 74 | 74 |
}, checker.Equals, swarm.TaskStateFailed) |
| 75 | 75 |
|
| 76 | 76 |
if !strings.Contains(task.Status.Err, container.ErrContainerUnhealthy.Error()) {
|
| ... | ... |
@@ -102,7 +102,7 @@ func (s *DockerSwarmSuite) TestServiceHealthStart(c *testing.T) {
|
| 102 | 102 |
var tasks []swarm.Task |
| 103 | 103 |
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
| 104 | 104 |
tasks = d.GetServiceTasks(c, id) |
| 105 |
- return tasks, nil |
|
| 105 |
+ return tasks, "" |
|
| 106 | 106 |
}, checker.HasLen, 1) |
| 107 | 107 |
|
| 108 | 108 |
task := tasks[0] |
| ... | ... |
@@ -110,7 +110,7 @@ func (s *DockerSwarmSuite) TestServiceHealthStart(c *testing.T) {
|
| 110 | 110 |
// wait for task to start |
| 111 | 111 |
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
| 112 | 112 |
task = d.GetTask(c, task.ID) |
| 113 |
- return task.Status.State, nil |
|
| 113 |
+ return task.Status.State, "" |
|
| 114 | 114 |
}, checker.Equals, swarm.TaskStateStarting) |
| 115 | 115 |
|
| 116 | 116 |
containerID := task.Status.ContainerStatus.ContainerID |
| ... | ... |
@@ -119,7 +119,7 @@ func (s *DockerSwarmSuite) TestServiceHealthStart(c *testing.T) {
|
| 119 | 119 |
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
| 120 | 120 |
out, _ := d.Cmd("inspect", "--format={{.State.Health.FailingStreak}}", containerID)
|
| 121 | 121 |
failingStreak, _ := strconv.Atoi(strings.TrimSpace(out)) |
| 122 |
- return failingStreak, nil |
|
| 122 |
+ return failingStreak, "" |
|
| 123 | 123 |
}, checker.GreaterThan, 0) |
| 124 | 124 |
|
| 125 | 125 |
// task should be blocked at starting status |
| ... | ... |
@@ -132,6 +132,6 @@ func (s *DockerSwarmSuite) TestServiceHealthStart(c *testing.T) {
|
| 132 | 132 |
// Task should be at running status |
| 133 | 133 |
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
| 134 | 134 |
task = d.GetTask(c, task.ID) |
| 135 |
- return task.Status.State, nil |
|
| 135 |
+ return task.Status.State, "" |
|
| 136 | 136 |
}, checker.Equals, swarm.TaskStateRunning) |
| 137 | 137 |
} |
| ... | ... |
@@ -385,7 +385,7 @@ func (s *DockerSwarmSuite) TestSwarmContainerAttachByNetworkId(c *testing.T) {
|
| 385 | 385 |
checkNetwork := func(*testing.T) (interface{}, string) {
|
| 386 | 386 |
out, err := d.Cmd("network", "ls")
|
| 387 | 387 |
assert.NilError(c, err) |
| 388 |
- return out, nil |
|
| 388 |
+ return out, "" |
|
| 389 | 389 |
} |
| 390 | 390 |
|
| 391 | 391 |
waitAndAssert(c, 3*time.Second, checkNetwork, checker.Not(checker.Contains), "testnet") |
| ... | ... |
@@ -546,7 +546,7 @@ func (s *DockerSwarmSuite) TestSwarmTaskListFilter(c *testing.T) {
|
| 546 | 546 |
checkNumTasks := func(*testing.T) (interface{}, string) {
|
| 547 | 547 |
out, err := d.Cmd("service", "ps", "--filter", filter, name)
|
| 548 | 548 |
assert.NilError(c, err, out) |
| 549 |
- return len(strings.Split(out, "\n")) - 2, nil // includes header and nl in last line |
|
| 549 |
+ return len(strings.Split(out, "\n")) - 2, "" // includes header and nl in last line |
|
| 550 | 550 |
} |
| 551 | 551 |
|
| 552 | 552 |
// wait until all tasks have been created |
| ... | ... |
@@ -988,15 +988,15 @@ func checkKeyIsEncrypted(d *daemon.Daemon) func(*testing.T) (interface{}, string
|
| 988 | 988 |
return func(c *testing.T) (interface{}, string) {
|
| 989 | 989 |
keyBytes, err := ioutil.ReadFile(filepath.Join(d.Folder, "root", "swarm", "certificates", "swarm-node.key")) |
| 990 | 990 |
if err != nil {
|
| 991 |
- return fmt.Errorf("error reading key: %v", err), nil
|
|
| 991 |
+ return fmt.Errorf("error reading key: %v", err), ""
|
|
| 992 | 992 |
} |
| 993 | 993 |
|
| 994 | 994 |
keyBlock, _ := pem.Decode(keyBytes) |
| 995 | 995 |
if keyBlock == nil {
|
| 996 |
- return fmt.Errorf("invalid PEM-encoded private key"), nil
|
|
| 996 |
+ return fmt.Errorf("invalid PEM-encoded private key"), ""
|
|
| 997 | 997 |
} |
| 998 | 998 |
|
| 999 |
- return keyutils.IsEncryptedPEMBlock(keyBlock), nil |
|
| 999 |
+ return keyutils.IsEncryptedPEMBlock(keyBlock), "" |
|
| 1000 | 1000 |
} |
| 1001 | 1001 |
} |
| 1002 | 1002 |
|
| ... | ... |
@@ -1220,7 +1220,7 @@ func (s *DockerSwarmSuite) TestSwarmJoinPromoteLocked(c *testing.T) {
|
| 1220 | 1220 |
} |
| 1221 | 1221 |
certs, err := helpers.ParseCertificatesPEM(certBytes) |
| 1222 | 1222 |
if err == nil && len(certs) > 0 && len(certs[0].Subject.OrganizationalUnit) > 0 {
|
| 1223 |
- return certs[0].Subject.OrganizationalUnit[0], nil |
|
| 1223 |
+ return certs[0].Subject.OrganizationalUnit[0], "" |
|
| 1224 | 1224 |
} |
| 1225 | 1225 |
return "", "could not get organizational unit from certificate" |
| 1226 | 1226 |
}, checker.Equals, "swarm-worker") |