mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
rm-gocheck: fix compile errors from converting check.CommentInterface to string
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>
This commit is contained in:
parent
7813dfe9d7
commit
64de5e8228
11 changed files with 51 additions and 51 deletions
|
@ -92,7 +92,7 @@ func (d *Daemon) CheckActiveContainerCount(c *testing.T) (interface{}, string) {
|
|||
out, err := d.Cmd("ps", "-q")
|
||||
assert.NilError(c, err)
|
||||
if len(strings.TrimSpace(out)) == 0 {
|
||||
return 0, nil
|
||||
return 0, ""
|
||||
}
|
||||
return len(strings.Split(strings.TrimSpace(out), "\n")), fmt.Sprintf("output: %q", string(out))
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ func (d *Daemon) CheckServiceTasksInState(service string, state swarm.TaskState,
|
|||
}
|
||||
}
|
||||
}
|
||||
return count, nil
|
||||
return count, ""
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ func (d *Daemon) CheckServiceTasksInStateWithError(service string, state swarm.T
|
|||
}
|
||||
}
|
||||
}
|
||||
return count, nil
|
||||
return count, ""
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,9 +57,9 @@ func (d *Daemon) CheckServiceUpdateState(service string) func(*testing.T) (inter
|
|||
return func(c *testing.T) (interface{}, string) {
|
||||
service := d.GetService(c, service)
|
||||
if service.UpdateStatus == nil {
|
||||
return "", nil
|
||||
return "", ""
|
||||
}
|
||||
return service.UpdateStatus.State, nil
|
||||
return service.UpdateStatus.State, ""
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ func (d *Daemon) CheckPluginImage(plugin string) func(c *testing.T) (interface{}
|
|||
func (d *Daemon) CheckServiceTasks(service string) func(*testing.T) (interface{}, string) {
|
||||
return func(c *testing.T) (interface{}, string) {
|
||||
tasks := d.GetServiceTasks(c, service)
|
||||
return len(tasks), nil
|
||||
return len(tasks), ""
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ func (d *Daemon) CheckRunningTaskNetworks(c *testing.T) (interface{}, string) {
|
|||
result[network.Target]++
|
||||
}
|
||||
}
|
||||
return result, nil
|
||||
return result, ""
|
||||
}
|
||||
|
||||
// CheckRunningTaskImages returns the times each image is running as a task.
|
||||
|
@ -142,7 +142,7 @@ func (d *Daemon) CheckRunningTaskImages(c *testing.T) (interface{}, string) {
|
|||
result[task.Spec.ContainerSpec.Image]++
|
||||
}
|
||||
}
|
||||
return result, nil
|
||||
return result, ""
|
||||
}
|
||||
|
||||
// CheckNodeReadyCount returns the number of ready node on the swarm
|
||||
|
@ -154,20 +154,20 @@ func (d *Daemon) CheckNodeReadyCount(c *testing.T) (interface{}, string) {
|
|||
readyCount++
|
||||
}
|
||||
}
|
||||
return readyCount, nil
|
||||
return readyCount, ""
|
||||
}
|
||||
|
||||
// CheckLocalNodeState returns the current swarm node state
|
||||
func (d *Daemon) CheckLocalNodeState(c *testing.T) (interface{}, string) {
|
||||
info := d.SwarmInfo(c)
|
||||
return info.LocalNodeState, nil
|
||||
return info.LocalNodeState, ""
|
||||
}
|
||||
|
||||
// CheckControlAvailable returns the current swarm control available
|
||||
func (d *Daemon) CheckControlAvailable(c *testing.T) (interface{}, string) {
|
||||
info := d.SwarmInfo(c)
|
||||
assert.Equal(c, info.LocalNodeState, swarm.LocalNodeStateActive)
|
||||
return info.ControlAvailable, nil
|
||||
return info.ControlAvailable, ""
|
||||
}
|
||||
|
||||
// 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) {
|
|||
|
||||
for _, node := range ls {
|
||||
if node.ManagerStatus != nil && node.ManagerStatus.Leader {
|
||||
return nil, nil
|
||||
return nil, ""
|
||||
}
|
||||
}
|
||||
return fmt.Errorf("no leader"), "could not find leader"
|
||||
|
|
|
@ -218,7 +218,7 @@ func (s *DockerSuite) TestExecStateCleanup(c *testing.T) {
|
|||
checkReadDir := func(c *testing.T) (interface{}, string) {
|
||||
fi, err := ioutil.ReadDir(stateDir)
|
||||
assert.NilError(c, err)
|
||||
return len(fi), nil
|
||||
return len(fi), ""
|
||||
}
|
||||
|
||||
fi, err := ioutil.ReadDir(stateDir)
|
||||
|
|
|
@ -231,7 +231,7 @@ func (s *DockerSwarmSuite) TestAPISwarmServicesUpdateStartFirst(c *testing.T) {
|
|||
startingTasks = append(startingTasks, t)
|
||||
}
|
||||
}
|
||||
return startingTasks, nil
|
||||
return startingTasks, ""
|
||||
}, checker.HasLen, expected)
|
||||
|
||||
return startingTasks
|
||||
|
|
|
@ -229,7 +229,7 @@ func (s *DockerSwarmSuite) TestAPISwarmPromoteDemote(c *testing.T) {
|
|||
}
|
||||
certs, err := helpers.ParseCertificatesPEM(certBytes)
|
||||
if err == nil && len(certs) > 0 && len(certs[0].Subject.OrganizationalUnit) > 0 {
|
||||
return certs[0].Subject.OrganizationalUnit[0], nil
|
||||
return certs[0].Subject.OrganizationalUnit[0], ""
|
||||
}
|
||||
return "", "could not get organizational unit from certificate"
|
||||
}, checker.Equals, "swarm-worker")
|
||||
|
@ -405,7 +405,7 @@ func (s *DockerSwarmSuite) TestAPISwarmRaftQuorum(c *testing.T) {
|
|||
// d1 will eventually step down from leader because there is no longer an active quorum, wait for that to happen
|
||||
waitAndAssert(c, defaultReconciliationTimeout*2, func(c *testing.T) (interface{}, string) {
|
||||
_, err := cli.ServiceCreate(context.Background(), service.Spec, types.ServiceCreateOptions{})
|
||||
return err.Error(), nil
|
||||
return err.Error(), ""
|
||||
}, checker.Contains, "Make sure more than half of the managers are online.")
|
||||
|
||||
d2.StartNode(c)
|
||||
|
@ -756,7 +756,7 @@ func checkClusterHealth(c *testing.T, cl []*daemon.Daemon, managerCount, workerC
|
|||
for _, n := range d.ListNodes(c) {
|
||||
waitReady := func(c *testing.T) (interface{}, string) {
|
||||
if n.Status.State == swarm.NodeStateReady {
|
||||
return true, nil
|
||||
return true, ""
|
||||
}
|
||||
nn := d.GetNode(c, n.ID)
|
||||
n = *nn
|
||||
|
@ -766,7 +766,7 @@ func checkClusterHealth(c *testing.T, cl []*daemon.Daemon, managerCount, workerC
|
|||
|
||||
waitActive := func(c *testing.T) (interface{}, string) {
|
||||
if n.Spec.Availability == swarm.NodeAvailabilityActive {
|
||||
return true, nil
|
||||
return true, ""
|
||||
}
|
||||
nn := d.GetNode(c, n.ID)
|
||||
n = *nn
|
||||
|
|
|
@ -2073,7 +2073,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartWithUnpausedRunningContainer(t *tes
|
|||
// the resume event might be received after we do the inspect
|
||||
waitAndAssert(t, defaultReconciliationTimeout, func(*testing.T) (interface{}, string) {
|
||||
result := icmd.RunCommand("kill", "-0", strings.TrimSpace(pid))
|
||||
return result.ExitCode, nil
|
||||
return result.ExitCode, ""
|
||||
}, checker.Equals, 0)
|
||||
|
||||
// restart the daemon
|
||||
|
|
|
@ -27,7 +27,7 @@ func pruneNetworkAndVerify(c *testing.T, d *daemon.Daemon, kept, pruned []string
|
|||
waitAndAssert(c, defaultReconciliationTimeout, func(*testing.T) (interface{}, string) {
|
||||
out, err := d.Cmd("network", "ls", "--format", "{{.Name}}")
|
||||
assert.NilError(c, err)
|
||||
return out, nil
|
||||
return out, ""
|
||||
}, checker.Contains, s)
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ func pruneNetworkAndVerify(c *testing.T, d *daemon.Daemon, kept, pruned []string
|
|||
waitAndAssert(c, defaultReconciliationTimeout, func(*testing.T) (interface{}, string) {
|
||||
out, err := d.Cmd("network", "ls", "--format", "{{.Name}}")
|
||||
assert.NilError(c, err)
|
||||
return out, nil
|
||||
return out, ""
|
||||
}, checker.Not(checker.Contains), s)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ func (s *DockerSuite) TestRestartRunningContainer(c *testing.T) {
|
|||
|
||||
getLogs := func(c *testing.T) (interface{}, string) {
|
||||
out, _ := dockerCmd(c, "logs", cleanedContainerID)
|
||||
return out, nil
|
||||
return out, ""
|
||||
}
|
||||
|
||||
// Wait 10 seconds for the 'echo' to appear in the logs
|
||||
|
|
|
@ -25,7 +25,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountVolume(c *testing.T) {
|
|||
var tasks []swarm.Task
|
||||
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
||||
tasks = d.GetServiceTasks(c, id)
|
||||
return len(tasks) > 0, nil
|
||||
return len(tasks) > 0, ""
|
||||
}, checker.Equals, true)
|
||||
|
||||
task := tasks[0]
|
||||
|
@ -33,7 +33,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountVolume(c *testing.T) {
|
|||
if task.NodeID == "" || task.Status.ContainerStatus == nil {
|
||||
task = d.GetTask(c, task.ID)
|
||||
}
|
||||
return task.NodeID != "" && task.Status.ContainerStatus != nil, nil
|
||||
return task.NodeID != "" && task.Status.ContainerStatus != nil, ""
|
||||
}, checker.Equals, true)
|
||||
|
||||
// check container mount config
|
||||
|
@ -139,7 +139,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSourceTargetPaths(c *testi
|
|||
var tasks []swarm.Task
|
||||
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
||||
tasks = d.GetServiceTasks(c, serviceName)
|
||||
return len(tasks) > 0, nil
|
||||
return len(tasks) > 0, ""
|
||||
}, checker.Equals, true)
|
||||
|
||||
task := tasks[0]
|
||||
|
@ -147,7 +147,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretSourceTargetPaths(c *testi
|
|||
if task.NodeID == "" || task.Status.ContainerStatus == nil {
|
||||
task = d.GetTask(c, task.ID)
|
||||
}
|
||||
return task.NodeID != "" && task.Status.ContainerStatus != nil, nil
|
||||
return task.NodeID != "" && task.Status.ContainerStatus != nil, ""
|
||||
}, checker.Equals, true)
|
||||
|
||||
for testName, testTarget := range testPaths {
|
||||
|
@ -189,7 +189,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretReferencedTwice(c *testing
|
|||
var tasks []swarm.Task
|
||||
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
||||
tasks = d.GetServiceTasks(c, serviceName)
|
||||
return len(tasks) > 0, nil
|
||||
return len(tasks) > 0, ""
|
||||
}, checker.Equals, true)
|
||||
|
||||
task := tasks[0]
|
||||
|
@ -197,7 +197,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithSecretReferencedTwice(c *testing
|
|||
if task.NodeID == "" || task.Status.ContainerStatus == nil {
|
||||
task = d.GetTask(c, task.ID)
|
||||
}
|
||||
return task.NodeID != "" && task.Status.ContainerStatus != nil, nil
|
||||
return task.NodeID != "" && task.Status.ContainerStatus != nil, ""
|
||||
}, checker.Equals, true)
|
||||
|
||||
for _, target := range []string{"target1", "target2"} {
|
||||
|
@ -286,7 +286,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSourceTargetPaths(c *testi
|
|||
var tasks []swarm.Task
|
||||
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
||||
tasks = d.GetServiceTasks(c, serviceName)
|
||||
return len(tasks) > 0, nil
|
||||
return len(tasks) > 0, ""
|
||||
}, checker.Equals, true)
|
||||
|
||||
task := tasks[0]
|
||||
|
@ -294,7 +294,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigSourceTargetPaths(c *testi
|
|||
if task.NodeID == "" || task.Status.ContainerStatus == nil {
|
||||
task = d.GetTask(c, task.ID)
|
||||
}
|
||||
return task.NodeID != "" && task.Status.ContainerStatus != nil, nil
|
||||
return task.NodeID != "" && task.Status.ContainerStatus != nil, ""
|
||||
}, checker.Equals, true)
|
||||
|
||||
for testName, testTarget := range testPaths {
|
||||
|
@ -336,7 +336,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigReferencedTwice(c *testing
|
|||
var tasks []swarm.Task
|
||||
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
||||
tasks = d.GetServiceTasks(c, serviceName)
|
||||
return len(tasks) > 0, nil
|
||||
return len(tasks) > 0, ""
|
||||
}, checker.Equals, true)
|
||||
|
||||
task := tasks[0]
|
||||
|
@ -344,7 +344,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithConfigReferencedTwice(c *testing
|
|||
if task.NodeID == "" || task.Status.ContainerStatus == nil {
|
||||
task = d.GetTask(c, task.ID)
|
||||
}
|
||||
return task.NodeID != "" && task.Status.ContainerStatus != nil, nil
|
||||
return task.NodeID != "" && task.Status.ContainerStatus != nil, ""
|
||||
}, checker.Equals, true)
|
||||
|
||||
for _, target := range []string{"target1", "target2"} {
|
||||
|
@ -368,7 +368,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *testing.T) {
|
|||
var tasks []swarm.Task
|
||||
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
||||
tasks = d.GetServiceTasks(c, id)
|
||||
return len(tasks) > 0, nil
|
||||
return len(tasks) > 0, ""
|
||||
}, checker.Equals, true)
|
||||
|
||||
task := tasks[0]
|
||||
|
@ -376,7 +376,7 @@ func (s *DockerSwarmSuite) TestServiceCreateMountTmpfs(c *testing.T) {
|
|||
if task.NodeID == "" || task.Status.ContainerStatus == nil {
|
||||
task = d.GetTask(c, task.ID)
|
||||
}
|
||||
return task.NodeID != "" && task.Status.ContainerStatus != nil, nil
|
||||
return task.NodeID != "" && task.Status.ContainerStatus != nil, ""
|
||||
}, checker.Equals, true)
|
||||
|
||||
// check container mount config
|
||||
|
@ -424,7 +424,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithNetworkAlias(c *testing.T) {
|
|||
var tasks []swarm.Task
|
||||
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
||||
tasks = d.GetServiceTasks(c, id)
|
||||
return len(tasks) > 0, nil
|
||||
return len(tasks) > 0, ""
|
||||
}, checker.Equals, true)
|
||||
|
||||
task := tasks[0]
|
||||
|
@ -432,7 +432,7 @@ func (s *DockerSwarmSuite) TestServiceCreateWithNetworkAlias(c *testing.T) {
|
|||
if task.NodeID == "" || task.Status.ContainerStatus == nil {
|
||||
task = d.GetTask(c, task.ID)
|
||||
}
|
||||
return task.NodeID != "" && task.Status.ContainerStatus != nil, nil
|
||||
return task.NodeID != "" && task.Status.ContainerStatus != nil, ""
|
||||
}, checker.Equals, true)
|
||||
|
||||
// check container alias config
|
||||
|
|
|
@ -41,7 +41,7 @@ func (s *DockerSwarmSuite) TestServiceHealthRun(c *testing.T) {
|
|||
var tasks []swarm.Task
|
||||
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
||||
tasks = d.GetServiceTasks(c, id)
|
||||
return tasks, nil
|
||||
return tasks, ""
|
||||
}, checker.HasLen, 1)
|
||||
|
||||
task := tasks[0]
|
||||
|
@ -49,14 +49,14 @@ func (s *DockerSwarmSuite) TestServiceHealthRun(c *testing.T) {
|
|||
// wait for task to start
|
||||
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
||||
task = d.GetTask(c, task.ID)
|
||||
return task.Status.State, nil
|
||||
return task.Status.State, ""
|
||||
}, checker.Equals, swarm.TaskStateRunning)
|
||||
containerID := task.Status.ContainerStatus.ContainerID
|
||||
|
||||
// wait for container to be healthy
|
||||
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
||||
out, _ := d.Cmd("inspect", "--format={{.State.Health.Status}}", containerID)
|
||||
return strings.TrimSpace(out), nil
|
||||
return strings.TrimSpace(out), ""
|
||||
}, checker.Equals, "healthy")
|
||||
|
||||
// make it fail
|
||||
|
@ -64,13 +64,13 @@ func (s *DockerSwarmSuite) TestServiceHealthRun(c *testing.T) {
|
|||
// wait for container to be unhealthy
|
||||
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
||||
out, _ := d.Cmd("inspect", "--format={{.State.Health.Status}}", containerID)
|
||||
return strings.TrimSpace(out), nil
|
||||
return strings.TrimSpace(out), ""
|
||||
}, checker.Equals, "unhealthy")
|
||||
|
||||
// Task should be terminated
|
||||
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
||||
task = d.GetTask(c, task.ID)
|
||||
return task.Status.State, nil
|
||||
return task.Status.State, ""
|
||||
}, checker.Equals, swarm.TaskStateFailed)
|
||||
|
||||
if !strings.Contains(task.Status.Err, container.ErrContainerUnhealthy.Error()) {
|
||||
|
@ -102,7 +102,7 @@ func (s *DockerSwarmSuite) TestServiceHealthStart(c *testing.T) {
|
|||
var tasks []swarm.Task
|
||||
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
||||
tasks = d.GetServiceTasks(c, id)
|
||||
return tasks, nil
|
||||
return tasks, ""
|
||||
}, checker.HasLen, 1)
|
||||
|
||||
task := tasks[0]
|
||||
|
@ -110,7 +110,7 @@ func (s *DockerSwarmSuite) TestServiceHealthStart(c *testing.T) {
|
|||
// wait for task to start
|
||||
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
||||
task = d.GetTask(c, task.ID)
|
||||
return task.Status.State, nil
|
||||
return task.Status.State, ""
|
||||
}, checker.Equals, swarm.TaskStateStarting)
|
||||
|
||||
containerID := task.Status.ContainerStatus.ContainerID
|
||||
|
@ -119,7 +119,7 @@ func (s *DockerSwarmSuite) TestServiceHealthStart(c *testing.T) {
|
|||
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
||||
out, _ := d.Cmd("inspect", "--format={{.State.Health.FailingStreak}}", containerID)
|
||||
failingStreak, _ := strconv.Atoi(strings.TrimSpace(out))
|
||||
return failingStreak, nil
|
||||
return failingStreak, ""
|
||||
}, checker.GreaterThan, 0)
|
||||
|
||||
// task should be blocked at starting status
|
||||
|
@ -132,6 +132,6 @@ func (s *DockerSwarmSuite) TestServiceHealthStart(c *testing.T) {
|
|||
// Task should be at running status
|
||||
waitAndAssert(c, defaultReconciliationTimeout, func(c *testing.T) (interface{}, string) {
|
||||
task = d.GetTask(c, task.ID)
|
||||
return task.Status.State, nil
|
||||
return task.Status.State, ""
|
||||
}, checker.Equals, swarm.TaskStateRunning)
|
||||
}
|
||||
|
|
|
@ -385,7 +385,7 @@ func (s *DockerSwarmSuite) TestSwarmContainerAttachByNetworkId(c *testing.T) {
|
|||
checkNetwork := func(*testing.T) (interface{}, string) {
|
||||
out, err := d.Cmd("network", "ls")
|
||||
assert.NilError(c, err)
|
||||
return out, nil
|
||||
return out, ""
|
||||
}
|
||||
|
||||
waitAndAssert(c, 3*time.Second, checkNetwork, checker.Not(checker.Contains), "testnet")
|
||||
|
@ -546,7 +546,7 @@ func (s *DockerSwarmSuite) TestSwarmTaskListFilter(c *testing.T) {
|
|||
checkNumTasks := func(*testing.T) (interface{}, string) {
|
||||
out, err := d.Cmd("service", "ps", "--filter", filter, name)
|
||||
assert.NilError(c, err, out)
|
||||
return len(strings.Split(out, "\n")) - 2, nil // includes header and nl in last line
|
||||
return len(strings.Split(out, "\n")) - 2, "" // includes header and nl in last line
|
||||
}
|
||||
|
||||
// wait until all tasks have been created
|
||||
|
@ -988,15 +988,15 @@ func checkKeyIsEncrypted(d *daemon.Daemon) func(*testing.T) (interface{}, string
|
|||
return func(c *testing.T) (interface{}, string) {
|
||||
keyBytes, err := ioutil.ReadFile(filepath.Join(d.Folder, "root", "swarm", "certificates", "swarm-node.key"))
|
||||
if err != nil {
|
||||
return fmt.Errorf("error reading key: %v", err), nil
|
||||
return fmt.Errorf("error reading key: %v", err), ""
|
||||
}
|
||||
|
||||
keyBlock, _ := pem.Decode(keyBytes)
|
||||
if keyBlock == nil {
|
||||
return fmt.Errorf("invalid PEM-encoded private key"), nil
|
||||
return fmt.Errorf("invalid PEM-encoded private key"), ""
|
||||
}
|
||||
|
||||
return keyutils.IsEncryptedPEMBlock(keyBlock), nil
|
||||
return keyutils.IsEncryptedPEMBlock(keyBlock), ""
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1220,7 +1220,7 @@ func (s *DockerSwarmSuite) TestSwarmJoinPromoteLocked(c *testing.T) {
|
|||
}
|
||||
certs, err := helpers.ParseCertificatesPEM(certBytes)
|
||||
if err == nil && len(certs) > 0 && len(certs[0].Subject.OrganizationalUnit) > 0 {
|
||||
return certs[0].Subject.OrganizationalUnit[0], nil
|
||||
return certs[0].Subject.OrganizationalUnit[0], ""
|
||||
}
|
||||
return "", "could not get organizational unit from certificate"
|
||||
}, checker.Equals, "swarm-worker")
|
||||
|
|
Loading…
Reference in a new issue