Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: nolouch <nolouch@gmail.com>
  • Loading branch information
nolouch committed Jul 4, 2024
1 parent c13a0c7 commit 4a4c69f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pkg/mcs/resource_manager/server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,11 @@ func (c *Config) Parse(flagSet *pflag.FlagSet) error {
configutil.AdjustCommandlineString(flagSet, &c.ListenAddr, "listen-addr")
configutil.AdjustCommandlineString(flagSet, &c.AdvertiseListenAddr, "advertise-listen-addr")

return c.Adjust(meta, false)
return c.Adjust(meta)
}

// Adjust is used to adjust the resource manager configurations.
func (c *Config) Adjust(meta *toml.MetaData, reloading bool) error {
func (c *Config) Adjust(meta *toml.MetaData) error {
configMetaData := configutil.NewConfigMetadata(meta)
warningMsgs := make([]string, 0)
if err := configMetaData.CheckUndecoded(); err != nil {
Expand Down
10 changes: 5 additions & 5 deletions tests/pdctl/resourcemanager/resource_manager_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (s *testResourceManagerSuite) TearDownSuite() {
}

func (s *testResourceManagerSuite) TestConfigController() {
expectCfg := server.ControllerConfig{}
expectCfg := server.Config{}
expectCfg.Adjust(nil)
// Show controller config
checkShow := func() {
Expand All @@ -67,7 +67,7 @@ func (s *testResourceManagerSuite) TestConfigController() {
actualCfg := server.ControllerConfig{}
err = json.Unmarshal(output, &actualCfg)
s.Nil(err)
s.Equal(expectCfg, actualCfg)
s.Equal(expectCfg.Controller, actualCfg)
}

// Check default config
Expand All @@ -78,20 +78,20 @@ func (s *testResourceManagerSuite) TestConfigController() {
output, err := pdctl.ExecuteCommand(pdctlCmd.GetRootCmd(), args...)
s.Nil(err)
s.Contains(string(output), "Success!")
expectCfg.LTBMaxWaitDuration = typeutil.Duration{Duration: 1 * time.Hour}
expectCfg.Controller.LTBMaxWaitDuration = typeutil.Duration{Duration: 1 * time.Hour}
checkShow()

args = []string{"-u", s.pdAddr, "resource-manager", "config", "controller", "set", "enable-controller-trace-log", "true"}
output, err = pdctl.ExecuteCommand(pdctlCmd.GetRootCmd(), args...)
s.Nil(err)
s.Contains(string(output), "Success!")
expectCfg.EnableControllerTraceLog = true
expectCfg.Controller.EnableControllerTraceLog = true
checkShow()

args = []string{"-u", s.pdAddr, "resource-manager", "config", "controller", "set", "write-base-cost", "2"}
output, err = pdctl.ExecuteCommand(pdctlCmd.GetRootCmd(), args...)
s.Nil(err)
s.Contains(string(output), "Success!")
expectCfg.RequestUnit.WriteBaseCost = 2
expectCfg.Controller.RequestUnit.WriteBaseCost = 2
checkShow()
}

0 comments on commit 4a4c69f

Please sign in to comment.