Skip to content

Commit

Permalink
*: make TestAccelerateRegionsScheduleInRanges stable (#8604)
Browse files Browse the repository at this point in the history
close #8430

Signed-off-by: Ryan Leung <[email protected]>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
  • Loading branch information
rleungx and ti-chi-bot[bot] authored Sep 10, 2024
1 parent 3bd5e3c commit f6ec3f3
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 f6ec3f3

Please sign in to comment.