Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit c93da8d

Browse files
dpernythaJeztah
authored andcommitted
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 <drew.erny@docker.com> (cherry picked from commit b79adac) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent cf05755 commit c93da8d

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
@@ -1308,7 +1308,7 @@ func (s *DockerSwarmSuite) TestSwarmRotateUnlockKey(c *check.C) {
13081308
// an issue sometimes prevents leader to be available right away
13091309
outs, err = d.Cmd("node", "ls")
13101310
if err != nil && retry < 5 {
1311-
if strings.Contains(err.Error(), "swarm does not have a leader") {
1311+
if strings.Contains(outs, "swarm does not have a leader") {
13121312
retry++
13131313
time.Sleep(3 * time.Second)
13141314
continue
@@ -1400,7 +1400,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterRotateUnlockKey(c *check.C) {
14001400
// an issue sometimes prevents leader to be available right away
14011401
outs, err = d.Cmd("node", "ls")
14021402
if err != nil && retry < 5 {
1403-
if strings.Contains(err.Error(), "swarm does not have a leader") {
1403+
if strings.Contains(outs, "swarm does not have a leader") {
14041404
retry++
14051405
time.Sleep(3 * time.Second)
14061406
continue

0 commit comments

Comments
 (0)