Skip to content

Commit

Permalink
*: make TestDisable stable (#7487)
Browse files Browse the repository at this point in the history
close #7468

Signed-off-by: Ryan Leung <rleungx@gmail.com>

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 Nov 30, 2023
1 parent d91886f commit 3191594
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/schedule/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ func (c *Coordinator) InitSchedulers(needRun bool) {
if err := c.cluster.GetSchedulerConfig().Persist(c.cluster.GetStorage()); err != nil {
log.Error("cannot persist schedule config", errs.ZapError(err))
}
log.Info("scheduler config is updated", zap.Reflect("scheduler-config", scheduleCfg.Schedulers))

c.markSchedulersInitialized()
}
Expand Down
5 changes: 5 additions & 0 deletions server/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,10 @@ func (c *RaftCluster) startGCTuner() {
func (c *RaftCluster) runStoreConfigSync() {
defer logutil.LogPanic()
defer c.wg.Done()
// TODO: After we fix the atomic problem of config, we can remove this failpoint.
failpoint.Inject("skipStoreConfigSync", func() {
failpoint.Return()
})

var (
synced, switchRaftV2Config, needPersist bool
Expand All @@ -491,6 +495,7 @@ func (c *RaftCluster) runStoreConfigSync() {
if err := c.opt.Persist(c.storage); err != nil {
log.Warn("store config persisted failed", zap.Error(err))
}
log.Info("store config is updated")
}
select {
case <-c.ctx.Done():
Expand Down
2 changes: 2 additions & 0 deletions tests/server/api/scheduler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,10 @@ func (suite *scheduleTestSuite) checkAPI(cluster *tests.TestCluster) {
}

func (suite *scheduleTestSuite) TestDisable() {
suite.NoError(failpoint.Enable("github.com/tikv/pd/server/cluster/skipStoreConfigSync", `return(true)`))
env := tests.NewSchedulingTestEnvironment(suite.T())
env.RunTestInTwoModes(suite.checkDisable)
suite.NoError(failpoint.Disable("github.com/tikv/pd/server/cluster/skipStoreConfigSync"))
}

func (suite *scheduleTestSuite) checkDisable(cluster *tests.TestCluster) {
Expand Down

0 comments on commit 3191594

Please sign in to comment.