mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
[integration-cli] fix flaky raft test
Fixes previously flaky TestAPISwarmRaftQuorum. In the test we are shutting down 2 of 3 nodes, all of which are managers. When this happens the remaining node prepares to step down from being a leader because there is no longer an active quorum. This test was written before that change was implemented, and assumes that the remaining node can still handle requests to create a service (it can't) There was further flakiness depending on whether or not the node has stepped down or was in the process of doing so. Fix this by waiting for the node to completely step down and checking to see if it errors out like it should. Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
This commit is contained in:
parent
a437b078d3
commit
fd32d49c49
1 changed files with 6 additions and 2 deletions
|
@ -370,8 +370,12 @@ func (s *DockerSwarmSuite) TestAPISwarmRaftQuorum(c *check.C) {
|
|||
cli, err := d1.NewClient()
|
||||
c.Assert(err, checker.IsNil)
|
||||
defer cli.Close()
|
||||
|
||||
// d1 will eventually step down from leader because there is no longer an active quorum, wait for that to happen
|
||||
waitAndAssert(c, defaultReconciliationTimeout, func(c *check.C) (interface{}, check.CommentInterface) {
|
||||
_, err = cli.ServiceCreate(context.Background(), service.Spec, types.ServiceCreateOptions{})
|
||||
c.Assert(err.Error(), checker.Contains, "deadline exceeded")
|
||||
return err.Error(), nil
|
||||
}, checker.Contains, "Make sure more than half of the managers are online.")
|
||||
|
||||
d2.Start(c)
|
||||
|
||||
|
|
Loading…
Reference in a new issue