Skip to content

Commit

Permalink
client/http: fix the URI of GetRegionLabelRulesByIDs (#8490) (#8493)
Browse files Browse the repository at this point in the history
close #8491, ref pingcap/tidb#55188

Fix the URI of `GetRegionLabelRulesByIDs` to correct the call.

Signed-off-by: ti-chi-bot <[email protected]>
Signed-off-by: JmPotato <[email protected]>

Co-authored-by: JmPotato <[email protected]>
  • Loading branch information
ti-chi-bot and JmPotato authored Aug 5, 2024
1 parent 85258b3 commit 3d11c4d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion client/http/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ func (c *client) GetRegionLabelRulesByIDs(ctx context.Context, ruleIDs []string)
var labelRules []*LabelRule
err = c.request(ctx, newRequestInfo().
WithName(getRegionLabelRulesByIDsName).
WithURI(RegionLabelRules).
WithURI(RegionLabelRulesByIDs).
WithMethod(http.MethodGet).
WithBody(idsJSON).
WithResp(&labelRules))
Expand Down
4 changes: 4 additions & 0 deletions tests/integrations/client/http_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,10 @@ func (suite *httpClientTestSuite) checkRegionLabel(mode mode, client pd.Client)
re.Equal(labelRule.ID, allLabelRules[1].ID)
re.Equal(labelRule.Labels, allLabelRules[1].Labels)
re.Equal(labelRule.RuleType, allLabelRules[1].RuleType)
labelRules, err = client.GetRegionLabelRulesByIDs(env.ctx, []string{"rule2"})
re.NoError(err)
re.Len(labelRules, 1)
re.Equal(labelRule, labelRules[0])
labelRules, err = client.GetRegionLabelRulesByIDs(env.ctx, []string{"keyspaces/0", "rule2"})
re.NoError(err)
sort.Slice(labelRules, func(i, j int) bool {
Expand Down

0 comments on commit 3d11c4d

Please sign in to comment.