From 92ea0321281327146326530852ab33567b955a61 Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Mon, 9 Sep 2024 15:55:53 +0800 Subject: [PATCH] make TestAccelerateRegionsScheduleInRanges stable Signed-off-by: Ryan Leung --- 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) {