1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

integration-cli: allow temporary no-leader error

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi 2019-07-16 14:07:26 -07:00
parent 3df1095bbd
commit 52e0dfef90

View file

@ -1303,9 +1303,21 @@ func (s *DockerSwarmSuite) TestSwarmRotateUnlockKey(c *check.C) {
c.Assert(getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateActive) c.Assert(getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateActive)
outs, err = d.Cmd("node", "ls") retry := 0
assert.NilError(c, err) for {
c.Assert(outs, checker.Not(checker.Contains), "Swarm is encrypted and needs to be unlocked") // 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") {
retry++
time.Sleep(3 * time.Second)
continue
}
}
assert.NilError(c, err)
c.Assert(outs, checker.Not(checker.Contains), "Swarm is encrypted and needs to be unlocked")
break
}
unlockKey = newUnlockKey unlockKey = newUnlockKey
} }
@ -1383,9 +1395,21 @@ func (s *DockerSwarmSuite) TestSwarmClusterRotateUnlockKey(c *check.C) {
c.Assert(getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateActive) c.Assert(getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateActive)
outs, err = d.Cmd("node", "ls") retry := 0
c.Assert(err, checker.IsNil, check.Commentf("%s", outs)) for {
c.Assert(outs, checker.Not(checker.Contains), "Swarm is encrypted and needs to be unlocked") // 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") {
retry++
time.Sleep(3 * time.Second)
continue
}
}
c.Assert(err, checker.IsNil, check.Commentf("%s", outs))
c.Assert(outs, checker.Not(checker.Contains), "Swarm is encrypted and needs to be unlocked")
break
}
} }
unlockKey = newUnlockKey unlockKey = newUnlockKey