Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
Signed-off-by: lance6716 <[email protected]>
  • Loading branch information
lance6716 committed Dec 13, 2023
1 parent 271f966 commit c89be3a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions client/http/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const (
// Client is a PD (Placement Driver) HTTP client.
type Client interface {
/* Meta-related interfaces */
GetClusterVersion(context.Context) (string, error)
GetRegionByID(context.Context, uint64) (*RegionInfo, error)
GetRegionByKey(context.Context, []byte) (*RegionInfo, error)
GetRegions(context.Context) (*RegionsInfo, error)
Expand All @@ -64,10 +63,11 @@ type Client interface {
/* Config-related interfaces */
GetScheduleConfig(context.Context) (map[string]interface{}, error)
SetScheduleConfig(context.Context, map[string]interface{}) error
GetClusterVersion(context.Context) (string, error)
/* Scheduler-related interfaces */
GetSchedulers(context.Context) ([]string, error)
CreateScheduler(ctx context.Context, name string, storeID uint64) error
PostSchedulerDelay(context.Context, string, int64) error
SetSchedulerDelay(context.Context, string, int64) error
/* Rule-related interfaces */
GetAllPlacementRuleBundles(context.Context) ([]*GroupBundle, error)
GetPlacementRuleBundleByGroup(context.Context, string) (*GroupBundle, error)
Expand Down Expand Up @@ -796,8 +796,8 @@ func (c *client) AccelerateScheduleInBatch(ctx context.Context, keyRanges []*Key
http.MethodPost, inputJSON, nil)
}

// PostSchedulerDelay changes the delay of given scheduler.
func (c *client) PostSchedulerDelay(ctx context.Context, scheduler string, delaySec int64) error {
// SetSchedulerDelay sets the delay of given scheduler.
func (c *client) SetSchedulerDelay(ctx context.Context, scheduler string, delaySec int64) error {
m := map[string]int64{
"delay": delaySec,
}
Expand All @@ -806,7 +806,7 @@ func (c *client) PostSchedulerDelay(ctx context.Context, scheduler string, delay
return errors.Trace(err)

Check warning on line 806 in client/http/client.go

View check run for this annotation

Codecov / codecov/patch

client/http/client.go#L806

Added line #L806 was not covered by tests
}
return c.requestWithRetry(ctx,
"PostSchedulerDelay", SchedulerByName(scheduler),
"SetSchedulerDelay", SchedulerByName(scheduler),
http.MethodPost, inputJSON, nil)
}

Expand Down
4 changes: 2 additions & 2 deletions tests/integrations/client/http_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,9 +403,9 @@ func (suite *httpClientTestSuite) TestSchedulers() {
schedulers, err = suite.client.GetSchedulers(suite.ctx)
re.NoError(err)
re.Len(schedulers, 1)
err = suite.client.PostSchedulerDelay(suite.ctx, "evict-leader-scheduler", 100)
err = suite.client.SetSchedulerDelay(suite.ctx, "evict-leader-scheduler", 100)
re.NoError(err)
err = suite.client.PostSchedulerDelay(suite.ctx, "not-exist", 100)
err = suite.client.SetSchedulerDelay(suite.ctx, "not-exist", 100)
re.ErrorContains(err, "500 Internal Server Error") // TODO: should return friendly error message
}

Expand Down

0 comments on commit c89be3a

Please sign in to comment.