Skip to content

Commit

Permalink
Merge branch 'master' into fix-test-2024-6
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot[bot] committed Apr 8, 2024
2 parents 97c2de2 + affbae1 commit 815d8bd
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions tests/server/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ func (suite *configTestSuite) SetupSuite() {
func (suite *configTestSuite) TearDownSuite() {
suite.env.Cleanup()
}

func (suite *configTestSuite) TestConfigAll() {
suite.env.RunTestInTwoModes(suite.checkConfigAll)
}
Expand Down Expand Up @@ -140,16 +141,17 @@ func (suite *configTestSuite) checkConfigAll(cluster *tests.TestCluster) {
re.NoError(err)
err = tu.CheckPostJSON(testDialClient, addr, postData, tu.StatusOK(re))
re.NoError(err)

newCfg := &config.Config{}
err = tu.ReadGetJSON(re, testDialClient, addr, newCfg)
re.NoError(err)
cfg.Replication.MaxReplicas = 5
cfg.Replication.LocationLabels = []string{"zone", "rack"}
cfg.Schedule.RegionScheduleLimit = 10
cfg.PDServerCfg.MetricStorage = "http://127.0.0.1:9090"
re.Equal(newCfg, cfg)

tu.Eventually(re, func() bool {
newCfg := &config.Config{}
err = tu.ReadGetJSON(re, testDialClient, addr, newCfg)
re.NoError(err)
return suite.Equal(newCfg, cfg)
})
// the new way
l = map[string]any{
"schedule.tolerant-size-ratio": 2.5,
Expand All @@ -165,9 +167,6 @@ func (suite *configTestSuite) checkConfigAll(cluster *tests.TestCluster) {
re.NoError(err)
err = tu.CheckPostJSON(testDialClient, addr, postData, tu.StatusOK(re))
re.NoError(err)
newCfg1 := &config.Config{}
err = tu.ReadGetJSON(re, testDialClient, addr, newCfg1)
re.NoError(err)
cfg.Schedule.EnableTiKVSplitRegion = false
cfg.Schedule.TolerantSizeRatio = 2.5
cfg.Replication.LocationLabels = []string{"idc", "host"}
Expand All @@ -178,7 +177,12 @@ func (suite *configTestSuite) checkConfigAll(cluster *tests.TestCluster) {
v, err := versioninfo.ParseVersion("v4.0.0-beta")
re.NoError(err)
cfg.ClusterVersion = *v
re.Equal(cfg, newCfg1)
tu.Eventually(re, func() bool {
newCfg1 := &config.Config{}
err = tu.ReadGetJSON(re, testDialClient, addr, newCfg1)
re.NoError(err)
return suite.Equal(cfg, newCfg1)
})

// revert this to avoid it affects TestConfigTTL
l["schedule.enable-tikv-split-region"] = "true"
Expand Down

0 comments on commit 815d8bd

Please sign in to comment.