......
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
| ... | ... |
@@ -332,6 +332,7 @@ func (s *DockerSwarmSuite) TestAPISwarmLeaderElection(c *check.C) {
|
| 332 | 332 |
} |
| 333 | 333 |
|
| 334 | 334 |
// wait for an election to occur |
| 335 |
+ c.Logf("Waiting for election to occur...")
|
|
| 335 | 336 |
waitAndAssert(c, defaultReconciliationTimeout, checkLeader(d2, d3), checker.True) |
| 336 | 337 |
|
| 337 | 338 |
// assert that we have a new leader |
| ... | ... |
@@ -343,9 +344,8 @@ func (s *DockerSwarmSuite) TestAPISwarmLeaderElection(c *check.C) {
|
| 343 | 343 |
// add the d1, the initial leader, back |
| 344 | 344 |
d1.Start(c) |
| 345 | 345 |
|
| 346 |
- // TODO(stevvooe): may need to wait for rejoin here |
|
| 347 |
- |
|
| 348 | 346 |
// wait for possible election |
| 347 |
+ c.Logf("Waiting for possible election...")
|
|
| 349 | 348 |
waitAndAssert(c, defaultReconciliationTimeout, checkLeader(d1, d2, d3), checker.True) |
| 350 | 349 |
// pick out the leader and the followers again |
| 351 | 350 |
|
| ... | ... |
@@ -419,6 +419,12 @@ func getErrorMessage(c *check.C, body []byte) string {
|
| 419 | 419 |
} |
| 420 | 420 |
|
| 421 | 421 |
func waitAndAssert(c *check.C, timeout time.Duration, f checkF, checker check.Checker, args ...interface{}) {
|
| 422 |
+ t1 := time.Now() |
|
| 423 |
+ defer func() {
|
|
| 424 |
+ t2 := time.Now() |
|
| 425 |
+ c.Logf("waited for %v (out of %v)", t2.Sub(t1), timeout)
|
|
| 426 |
+ }() |
|
| 427 |
+ |
|
| 422 | 428 |
after := time.After(timeout) |
| 423 | 429 |
for {
|
| 424 | 430 |
v, comment := f(c) |
| ... | ... |
@@ -23,7 +23,7 @@ func (d *Daemon) GetNode(t assert.TestingT, id string) *swarm.Node {
|
| 23 | 23 |
defer cli.Close() |
| 24 | 24 |
|
| 25 | 25 |
node, _, err := cli.NodeInspectWithRaw(context.Background(), id) |
| 26 |
- assert.NilError(t, err) |
|
| 26 |
+ assert.NilError(t, err, "[%s] (*Daemon).GetNode: NodeInspectWithRaw(%q) failed", d.id, id) |
|
| 27 | 27 |
assert.Check(t, node.ID == id) |
| 28 | 28 |
return &node |
| 29 | 29 |
} |