From c93da8ded9ac4efac6ac23af2ac32ab1ac50bb9b Mon Sep 17 00:00:00 2001 From: Drew Erny Date: Fri, 26 Jul 2019 13:05:00 -0500 Subject: [PATCH] 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 (cherry picked from commit b79adac339173bf8bb6de6d0a061a97973c4b62b) Signed-off-by: Sebastiaan van Stijn --- integration-cli/docker_cli_swarm_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integration-cli/docker_cli_swarm_test.go b/integration-cli/docker_cli_swarm_test.go index 5d1514930a..64d4fade55 100644 --- a/integration-cli/docker_cli_swarm_test.go +++ b/integration-cli/docker_cli_swarm_test.go @@ -1308,7 +1308,7 @@ func (s *DockerSwarmSuite) TestSwarmRotateUnlockKey(c *check.C) { // an issue sometimes prevents leader to be available right away outs, err = d.Cmd("node", "ls") if err != nil && retry < 5 { - if strings.Contains(err.Error(), "swarm does not have a leader") { + if strings.Contains(outs, "swarm does not have a leader") { retry++ time.Sleep(3 * time.Second) continue @@ -1400,7 +1400,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterRotateUnlockKey(c *check.C) { // an issue sometimes prevents leader to be available right away outs, err = d.Cmd("node", "ls") if err != nil && retry < 5 { - if strings.Contains(err.Error(), "swarm does not have a leader") { + if strings.Contains(outs, "swarm does not have a leader") { retry++ time.Sleep(3 * time.Second) continue