From f6ec3f3f138ce759e77201d8e233a983fe34634d Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Tue, 10 Sep 2024 17:02:03 +0800 Subject: [PATCH] *: make `TestAccelerateRegionsScheduleInRanges` stable (#8604) close tikv/pd#8430 Signed-off-by: Ryan Leung Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com> --- pkg/schedule/checker/checker_controller.go | 3 +++ tests/server/api/region_test.go | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/pkg/schedule/checker/checker_controller.go b/pkg/schedule/checker/checker_controller.go index 17bf36cc92f..f9b75e942c9 100644 --- a/pkg/schedule/checker/checker_controller.go +++ b/pkg/schedule/checker/checker_controller.go @@ -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 diff --git a/tests/server/api/region_test.go b/tests/server/api/region_test.go index 20af44f4614..0bec0f43e8b 100644 --- a/tests/server/api/region_test.go +++ b/tests/server/api/region_test.go @@ -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) { @@ -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) {