Skip to content

Commit

Permalink
server: make testClusterWorkerSuite stable. (tikv#577)
Browse files Browse the repository at this point in the history
  • Loading branch information
disksing authored Mar 21, 2017
1 parent 3566f27 commit 0d76dac
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions server/cluster_worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (s *testClusterWorkerSuite) SetUpTest(c *C) {

s.svr, s.cleanup = newTestServer(c)
s.svr.cfg.nextRetryDelay = 50 * time.Millisecond
s.svr.scheduleOpt.SetMaxReplicas(5)
s.svr.scheduleOpt.SetMaxReplicas(1)

s.client = s.svr.client
s.clusterID = s.svr.clusterID
Expand Down Expand Up @@ -353,8 +353,6 @@ func (s *testClusterWorkerSuite) TestHeartbeatSplit(c *C) {
cluster := s.svr.GetRaftCluster()
c.Assert(cluster, NotNil)

s.svr.scheduleOpt.SetMaxReplicas(1)

leaderPD := mustGetLeader(c, s.client, s.svr.getLeaderPath())
conn, err := rpcConnect(leaderPD.GetAddr())
c.Assert(err, IsNil)
Expand Down Expand Up @@ -408,6 +406,8 @@ func (s *testClusterWorkerSuite) TestHeartbeatSplit(c *C) {
}

func (s *testClusterWorkerSuite) TestHeartbeatSplit2(c *C) {
s.svr.scheduleOpt.SetMaxReplicas(5)

cluster := s.svr.GetRaftCluster()
c.Assert(cluster, NotNil)

Expand Down Expand Up @@ -444,6 +444,8 @@ func (s *testClusterWorkerSuite) TestHeartbeatSplit2(c *C) {
}

func (s *testClusterWorkerSuite) TestHeartbeatChangePeer(c *C) {
s.svr.scheduleOpt.SetMaxReplicas(5)

opt := s.svr.scheduleOpt

cluster := s.svr.GetRaftCluster()
Expand Down Expand Up @@ -503,11 +505,11 @@ func (s *testClusterWorkerSuite) TestHeartbeatChangePeer(c *C) {
}

func (s *testClusterWorkerSuite) TestHeartbeatSplitAddPeer(c *C) {
s.svr.scheduleOpt.SetMaxReplicas(2)

cluster := s.svr.GetRaftCluster()
c.Assert(cluster, NotNil)

s.svr.scheduleOpt.SetMaxReplicas(2)

leaderPD := mustGetLeader(c, s.client, s.svr.getLeaderPath())
conn, err := rpcConnect(leaderPD.GetAddr())
c.Assert(err, IsNil)
Expand Down

0 comments on commit 0d76dac

Please sign in to comment.