瀏覽代碼

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 b79adac339173bf8bb6de6d0a061a97973c4b62b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Drew Erny 6 年之前
父節點
當前提交
c93da8ded9
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      integration-cli/docker_cli_swarm_test.go

+ 2 - 2
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
 			// an issue sometimes prevents leader to be available right away
 			outs, err = d.Cmd("node", "ls")
 			outs, err = d.Cmd("node", "ls")
 			if err != nil && retry < 5 {
 			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++
 					retry++
 					time.Sleep(3 * time.Second)
 					time.Sleep(3 * time.Second)
 					continue
 					continue
@@ -1400,7 +1400,7 @@ func (s *DockerSwarmSuite) TestSwarmClusterRotateUnlockKey(c *check.C) {
 				// an issue sometimes prevents leader to be available right away
 				// an issue sometimes prevents leader to be available right away
 				outs, err = d.Cmd("node", "ls")
 				outs, err = d.Cmd("node", "ls")
 				if err != nil && retry < 5 {
 				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++
 						retry++
 						time.Sleep(3 * time.Second)
 						time.Sleep(3 * time.Second)
 						continue
 						continue