diff --git a/server/cluster/cluster_test.go b/server/cluster/cluster_test.go index 9a9420988a1..fa1b14d107e 100644 --- a/server/cluster/cluster_test.go +++ b/server/cluster/cluster_test.go @@ -153,7 +153,9 @@ func TestStoreHeartbeat(t *testing.T) { }, PeerStats: []*pdpb.PeerStat{}, } - cluster.opt.GetScheduleConfig().StoreLimitVersion = "v1" + scheCfg := cluster.opt.GetScheduleConfig().Clone() + scheCfg.StoreLimitVersion = "v1" + cluster.opt.SetScheduleConfig(scheCfg) re.NoError(cluster.HandleStoreHeartbeat(hotReq, hotResp)) re.NoError(cluster.HandleStoreHeartbeat(hotReq, hotResp)) re.NoError(cluster.HandleStoreHeartbeat(hotReq, hotResp)) diff --git a/tests/integrations/mcs/scheduling/api_test.go b/tests/integrations/mcs/scheduling/api_test.go index 6335d104e3e..326068c29b5 100644 --- a/tests/integrations/mcs/scheduling/api_test.go +++ b/tests/integrations/mcs/scheduling/api_test.go @@ -434,11 +434,15 @@ func (suite *apiTestSuite) checkConfigForward(cluster *tests.TestCluster) { // Test to change config only in scheduling server // Expect to get new config in scheduling server but not old config in api server - opts.GetScheduleConfig().LeaderScheduleLimit = 100 + scheCfg := opts.GetScheduleConfig().Clone() + scheCfg.LeaderScheduleLimit = 100 + opts.SetScheduleConfig(scheCfg) re.Equal(100, int(opts.GetLeaderScheduleLimit())) testutil.ReadGetJSON(re, tests.TestDialClient, urlPrefix, &cfg) re.Equal(100., cfg["schedule"].(map[string]any)["leader-schedule-limit"]) - opts.GetReplicationConfig().MaxReplicas = 5 + repCfg := opts.GetReplicationConfig().Clone() + repCfg.MaxReplicas = 5 + opts.SetReplicationConfig(repCfg) re.Equal(5, int(opts.GetReplicationConfig().MaxReplicas)) testutil.ReadGetJSON(re, tests.TestDialClient, urlPrefix, &cfg) re.Equal(5., cfg["replication"].(map[string]any)["max-replicas"]) diff --git a/tools/pd-ctl/tests/config/config_test.go b/tools/pd-ctl/tests/config/config_test.go index d4b1e90ec1b..a430d1075ff 100644 --- a/tools/pd-ctl/tests/config/config_test.go +++ b/tools/pd-ctl/tests/config/config_test.go @@ -493,8 +493,12 @@ func (suite *configTestSuite) checkConfigForwardControl(cluster *pdTests.TestClu // Test Config // inject different config to scheduling server if sche := cluster.GetSchedulingPrimaryServer(); sche != nil { - sche.GetPersistConfig().GetScheduleConfig().LeaderScheduleLimit = 233 - sche.GetPersistConfig().GetReplicationConfig().MaxReplicas = 7 + scheCfg := sche.GetPersistConfig().GetScheduleConfig().Clone() + scheCfg.LeaderScheduleLimit = 233 + sche.GetPersistConfig().SetScheduleConfig(scheCfg) + repCfg := sche.GetPersistConfig().GetReplicationConfig().Clone() + repCfg.MaxReplicas = 7 + sche.GetPersistConfig().SetReplicationConfig(repCfg) re.Equal(uint64(233), sche.GetPersistConfig().GetLeaderScheduleLimit()) re.Equal(7, sche.GetPersistConfig().GetMaxReplicas()) }