-
Notifications
You must be signed in to change notification settings - Fork 712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pdctl: support top query in pdctl #7843
Changes from 4 commits
bc4e71d
598d9f0
b710df3
a8e13f6
bac873b
9293b72
97d170b
2377e05
8d5c2d5
8208d89
a244a4e
a9a1dd8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1144,6 +1144,34 @@ func (suite *configTestSuite) checkMicroServiceConfig(cluster *pdTests.TestClust | |
re.False(svr.GetMicroServiceConfig().EnableSchedulingFallback) | ||
} | ||
|
||
func (suite *configTestSuite) TestRegionRules() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why add it in this PR? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From other unmerged pr There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then, we should remove it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or opening a new pr for adding test to cover it? They are both acceptable for me. |
||
suite.env.RunTestInTwoModes(suite.checkRegionRules) | ||
} | ||
|
||
func (suite *configTestSuite) checkRegionRules(cluster *pdTests.TestCluster) { | ||
re := suite.Require() | ||
leaderServer := cluster.GetLeaderServer() | ||
pdAddr := leaderServer.GetAddr() | ||
cmd := ctl.GetRootCmd() | ||
|
||
storeID, regionID := uint64(1), uint64(2) | ||
store := &metapb.Store{ | ||
Id: storeID, | ||
State: metapb.StoreState_Up, | ||
} | ||
pdTests.MustPutStore(re, cluster, store) | ||
pdTests.MustPutRegion(re, cluster, regionID, storeID, []byte{}, []byte{}) | ||
|
||
args := []string{"-u", pdAddr, "config", "placement-rules", "show", "--region=" + strconv.Itoa(int(regionID)), "--detail"} | ||
output, err := tests.ExecuteCommand(cmd, args...) | ||
re.NoError(err) | ||
fit := &placement.RegionFit{} | ||
re.NoError(json.Unmarshal(output, fit)) | ||
re.Len(fit.RuleFits, 1) | ||
re.Equal(placement.DefaultGroupID, fit.RuleFits[0].Rule.GroupID) | ||
re.Equal(placement.DefaultRuleID, fit.RuleFits[0].Rule.ID) | ||
} | ||
|
||
func assertBundles(re *require.Assertions, a, b []placement.GroupBundle) { | ||
re.Len(b, len(a)) | ||
for i := 0; i < len(a); i++ { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will it break the compatibility?