Skip to content

Commit

Permalink
make TestAccelerateRegionsScheduleInRanges stable
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <[email protected]>
  • Loading branch information
rleungx committed Sep 9, 2024
1 parent 98e0407 commit 92ea032
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/schedule/checker/checker_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,9 @@ func (c *Controller) CheckSuspectRanges() {
case <-c.ctx.Done():
return
case <-ticker.C:
failpoint.Inject("skipCheckSuspectRanges", func() {
failpoint.Continue()
})
keyRange, success := c.PopOneSuspectKeyRange()
if !success {
continue
Expand Down
6 changes: 6 additions & 0 deletions tests/server/api/region_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ func (suite *regionTestSuite) checkSplitRegions(cluster *tests.TestCluster) {
}

func (suite *regionTestSuite) TestAccelerateRegionsScheduleInRange() {
re := suite.Require()
re.NoError(failpoint.Enable("github.com/tikv/pd/pkg/schedule/checker/skipCheckSuspectRanges", "return(true)"))
suite.env.RunTestBasedOnMode(suite.checkAccelerateRegionsScheduleInRange)
re.NoError(failpoint.Disable("github.com/tikv/pd/pkg/schedule/checker/skipCheckSuspectRanges"))
}

func (suite *regionTestSuite) checkAccelerateRegionsScheduleInRange(cluster *tests.TestCluster) {
Expand Down Expand Up @@ -173,7 +176,10 @@ func (suite *regionTestSuite) checkAccelerateRegionsScheduleInRange(cluster *tes
}

func (suite *regionTestSuite) TestAccelerateRegionsScheduleInRanges() {
re := suite.Require()
re.NoError(failpoint.Enable("github.com/tikv/pd/pkg/schedule/checker/skipCheckSuspectRanges", "return(true)"))
suite.env.RunTestBasedOnMode(suite.checkAccelerateRegionsScheduleInRanges)
re.NoError(failpoint.Disable("github.com/tikv/pd/pkg/schedule/checker/skipCheckSuspectRanges"))
}

func (suite *regionTestSuite) checkAccelerateRegionsScheduleInRanges(cluster *tests.TestCluster) {
Expand Down

0 comments on commit 92ea032

Please sign in to comment.