Skip to content

Commit b79adac

Browse files
committed
Fix TestSwarmClusterRotateUnlockKey
TestSwarmClusterRotateUnlockKey had been identified as a flaky test. It turns out that the test code was wrong: where we should have been checking the string output of a command, we were instead checking the value of the error. This means that the error case we were expecting was not being matched, and the test was failing when it should have just retried. Signed-off-by: Drew Erny <[email protected]>
1 parent 9f122f0 commit b79adac

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

integration-cli/docker_cli_swarm_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,7 +1312,7 @@ func (s *DockerSwarmSuite) TestSwarmRotateUnlockKey(c *check.C) {
13121312
// an issue sometimes prevents leader to be available right away
13131313
outs, err = d.Cmd("node", "ls")
13141314
if err != nil && retry < 5 {
1315-
if strings.Contains(err.Error(), "swarm does not have a leader") {
1315+
if strings.Contains(outs, "swarm does not have a leader") {
13161316
retry++
13171317
time.Sleep(3 * time.Second)
13181318
continue
@@ -1404,7 +1404,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterRotateUnlockKey(c *check.C) {
14041404
// an issue sometimes prevents leader to be available right away
14051405
outs, err = d.Cmd("node", "ls")
14061406
if err != nil && retry < 5 {
1407-
if strings.Contains(err.Error(), "swarm does not have a leader") {
1407+
if strings.Contains(outs, "swarm does not have a leader") {
14081408
retry++
14091409
time.Sleep(3 * time.Second)
14101410
continue

0 commit comments

Comments
 (0)