Skip to content

Commit

Permalink
client/http: fix the URI of GetRegionLabelRulesByIDs (#8490)
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: JmPotato <ghzpotato@gmail.com>
  • Loading branch information
JmPotato authored Aug 5, 2024
1 parent bf501d8 commit 838ee79
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 @@ -715,7 +715,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 @@ -440,6 +440,10 @@ func (suite *httpClientTestSuite) TestRegionLabel() {
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(ctx, []string{"rule2"})
re.NoError(err)
re.Len(labelRules, 1)
re.Equal(labelRule, labelRules[0])
labelRules, err = client.GetRegionLabelRulesByIDs(ctx, []string{"keyspaces/0", "rule2"})
re.NoError(err)
sort.Slice(labelRules, func(i, j int) bool {
Expand Down

0 comments on commit 838ee79

Please sign in to comment.