integration-cli: allow temporary no-leader error
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit 52e0dfef90
)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
c502db4955
commit
cf05755e9d
1 changed files with 30 additions and 6 deletions
|
@ -1303,9 +1303,21 @@ func (s *DockerSwarmSuite) TestSwarmRotateUnlockKey(c *check.C) {
|
|||
|
||||
c.Assert(getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateActive)
|
||||
|
||||
outs, err = d.Cmd("node", "ls")
|
||||
assert.NilError(c, err)
|
||||
c.Assert(outs, checker.Not(checker.Contains), "Swarm is encrypted and needs to be unlocked")
|
||||
retry := 0
|
||||
for {
|
||||
// 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
|
||||
}
|
||||
|
@ -1383,9 +1395,21 @@ func (s *DockerSwarmSuite) TestSwarmClusterRotateUnlockKey(c *check.C) {
|
|||
|
||||
c.Assert(getNodeStatus(c, d), checker.Equals, swarm.LocalNodeStateActive)
|
||||
|
||||
outs, err = d.Cmd("node", "ls")
|
||||
c.Assert(err, checker.IsNil, check.Commentf("%s", outs))
|
||||
c.Assert(outs, checker.Not(checker.Contains), "Swarm is encrypted and needs to be unlocked")
|
||||
retry := 0
|
||||
for {
|
||||
// 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
|
||||
|
|
Loading…
Reference in a new issue