Skip to content

Commit

Permalink
add more test
Browse files Browse the repository at this point in the history
Signed-off-by: lhy1024 <[email protected]>
  • Loading branch information
lhy1024 committed Nov 6, 2023
1 parent 9856a96 commit c78d06e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions server/schedule/checker/rule_checker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,24 @@ func (suite *ruleCheckerTestSuite) TestFixToManyOrphanPeers() {
suite.Equal(i, op.Step(0).(operator.RemovePeer).FromStore)
suite.cluster.SetStoreUp(i)
}
// Case4:
// store 4, 5, 6 are orphan peers, and peer on two of stores is disconnect peer
// we should remove disconnect peer first.
for i := uint64(4); i <= 6; i++ {
region = suite.cluster.GetRegion(1)
suite.cluster.SetStoreDisconnect(4)
suite.cluster.SetStoreDisconnect(5)
suite.cluster.SetStoreDisconnect(6)
suite.cluster.SetStoreUp(i)
region = region.Clone(
core.WithDownPeers([]*pdpb.PeerStats{{Peer: region.GetStorePeer(3), DownSeconds: 60000}}),
core.WithPendingPeers([]*metapb.Peer{region.GetStorePeer(3)}))
suite.cluster.PutRegion(region)
op = suite.rc.Check(suite.cluster.GetRegion(1))
suite.NotNil(op)
suite.Equal("remove-orphan-peer", op.Desc())
suite.NotEqual(i, op.Step(0).(operator.RemovePeer).FromStore)
}
}

func (suite *ruleCheckerTestSuite) TestFixToManyOrphanPeers2() {
Expand Down

0 comments on commit c78d06e

Please sign in to comment.