Skip to content

Commit

Permalink
integration: Speed up TestRestartLeader
Browse files Browse the repository at this point in the history
I should have noticed before merging it, but unfortunately
TestRestartLeader roughly doubles the time it takes to run integration
tests.

These changes take it from about 50s to 15s for me:

- Don't wait for the leader's agent to get marked as DOWN, as this takes
  a long time.

- Lower the number of workers and managers. In principle, the test
  doesn't need a high number of workers, since the workers are
  completely independent.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
  • Loading branch information
aaronlehmann committed Jan 5, 2017
1 parent 337eb93 commit 98a5ee3
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ func TestDemoteDownedManager(t *testing.T) {
}

func TestRestartLeader(t *testing.T) {
numWorker, numManager := 10, 5
numWorker, numManager := 5, 3
cl := newCluster(t, numWorker, numManager)
defer func() {
require.NoError(t, cl.Stop())
Expand All @@ -386,19 +386,6 @@ func TestRestartLeader(t *testing.T) {

require.NoError(t, leader.Pause())

require.NoError(t, raftutils.PollFuncWithTimeout(nil, func() error {
resp, err := cl.api.GetNode(context.Background(), &api.GetNodeRequest{
NodeID: origLeaderID,
})
if err != nil {
return err
}
if resp.Node.Status.State != api.NodeStatus_DOWN {
return errors.Errorf("node %s is still not down", origLeaderID)
}
return nil
}, opsTimeout))

require.NoError(t, raftutils.PollFuncWithTimeout(nil, func() error {
resp, err := cl.api.ListNodes(context.Background(), &api.ListNodesRequest{})
if err != nil {
Expand Down

0 comments on commit 98a5ee3

Please # to comment.