Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <[email protected]>
  • Loading branch information
rleungx committed Dec 11, 2024
1 parent cf80a06 commit 00aaf77
Showing 1 changed file with 42 additions and 53 deletions.
95 changes: 42 additions & 53 deletions tests/pdctl/scheduler/scheduler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,20 @@ func (suite *schedulerTestSuite) checkScheduler(cluster *tests.TestCluster) {

// scheduler show command
expected := map[string]bool{
"balance-region-scheduler": true,
"balance-leader-scheduler": true,
"balance-hot-region-scheduler": true,
"transfer-witness-leader-scheduler": true,
"balance-witness-scheduler": true,
"balance-region-scheduler": true,
"balance-leader-scheduler": true,
"balance-hot-region-scheduler": true,
"evict-slow-store-scheduler": true,
}
checkSchedulerCommand(nil, expected)

// scheduler delete command
args := []string{"-u", pdAddr, "scheduler", "remove", "balance-region-scheduler"}
time.Sleep(10 * time.Second)
expected = map[string]bool{
"balance-leader-scheduler": true,
"balance-hot-region-scheduler": true,
"transfer-witness-leader-scheduler": true,
"balance-witness-scheduler": true,
"balance-leader-scheduler": true,
"balance-hot-region-scheduler": true,
"evict-slow-store-scheduler": true,
}
checkSchedulerCommand(args, expected)

Expand All @@ -136,11 +134,10 @@ func (suite *schedulerTestSuite) checkScheduler(cluster *tests.TestCluster) {
// scheduler add command
args = []string{"-u", pdAddr, "scheduler", "add", schedulers[idx], "2"}
expected = map[string]bool{
"balance-leader-scheduler": true,
"balance-hot-region-scheduler": true,
schedulers[idx]: true,
"transfer-witness-leader-scheduler": true,
"balance-witness-scheduler": true,
"balance-leader-scheduler": true,
"balance-hot-region-scheduler": true,
"evict-slow-store-scheduler": true,
schedulers[idx]: true,
}
checkSchedulerCommand(args, expected)

Expand All @@ -152,11 +149,10 @@ func (suite *schedulerTestSuite) checkScheduler(cluster *tests.TestCluster) {
// scheduler config update command
args = []string{"-u", pdAddr, "scheduler", "config", schedulers[idx], "add-store", "3"}
expected = map[string]bool{
"balance-leader-scheduler": true,
"balance-hot-region-scheduler": true,
schedulers[idx]: true,
"transfer-witness-leader-scheduler": true,
"balance-witness-scheduler": true,
"balance-leader-scheduler": true,
"balance-hot-region-scheduler": true,
"evict-slow-store-scheduler": true,
schedulers[idx]: true,
}
checkSchedulerCommand(args, expected)

Expand All @@ -167,32 +163,29 @@ func (suite *schedulerTestSuite) checkScheduler(cluster *tests.TestCluster) {
// scheduler delete command
args = []string{"-u", pdAddr, "scheduler", "remove", schedulers[idx]}
expected = map[string]bool{
"balance-leader-scheduler": true,
"balance-hot-region-scheduler": true,
"transfer-witness-leader-scheduler": true,
"balance-witness-scheduler": true,
"balance-leader-scheduler": true,
"balance-hot-region-scheduler": true,
"evict-slow-store-scheduler": true,
}
checkSchedulerCommand(args, expected)

// scheduler add command
args = []string{"-u", pdAddr, "scheduler", "add", schedulers[idx], "2"}
expected = map[string]bool{
"balance-leader-scheduler": true,
"balance-hot-region-scheduler": true,
schedulers[idx]: true,
"transfer-witness-leader-scheduler": true,
"balance-witness-scheduler": true,
"balance-leader-scheduler": true,
"balance-hot-region-scheduler": true,
"evict-slow-store-scheduler": true,
schedulers[idx]: true,
}
checkSchedulerCommand(args, expected)

// scheduler add command twice
args = []string{"-u", pdAddr, "scheduler", "add", schedulers[idx], "4"}
expected = map[string]bool{
"balance-leader-scheduler": true,
"balance-hot-region-scheduler": true,
schedulers[idx]: true,
"transfer-witness-leader-scheduler": true,
"balance-witness-scheduler": true,
"balance-leader-scheduler": true,
"balance-hot-region-scheduler": true,
"evict-slow-store-scheduler": true,
schedulers[idx]: true,
}
checkSchedulerCommand(args, expected)

Expand All @@ -203,11 +196,10 @@ func (suite *schedulerTestSuite) checkScheduler(cluster *tests.TestCluster) {
// scheduler remove command [old]
args = []string{"-u", pdAddr, "scheduler", "remove", schedulers[idx] + "-4"}
expected = map[string]bool{
"balance-leader-scheduler": true,
"balance-hot-region-scheduler": true,
schedulers[idx]: true,
"transfer-witness-leader-scheduler": true,
"balance-witness-scheduler": true,
"balance-leader-scheduler": true,
"balance-hot-region-scheduler": true,
"evict-slow-store-scheduler": true,
schedulers[idx]: true,
}
checkSchedulerCommand(args, expected)

Expand All @@ -218,21 +210,19 @@ func (suite *schedulerTestSuite) checkScheduler(cluster *tests.TestCluster) {
// scheduler remove command, when remove the last store, it should remove whole scheduler
args = []string{"-u", pdAddr, "scheduler", "remove", schedulers[idx] + "-2"}
expected = map[string]bool{
"balance-leader-scheduler": true,
"balance-hot-region-scheduler": true,
"transfer-witness-leader-scheduler": true,
"balance-witness-scheduler": true,
"balance-leader-scheduler": true,
"balance-hot-region-scheduler": true,
"evict-slow-store-scheduler": true,
}
checkSchedulerCommand(args, expected)
}

// test shuffle region config
checkSchedulerCommand([]string{"-u", pdAddr, "scheduler", "add", "shuffle-region-scheduler"}, map[string]bool{
"balance-leader-scheduler": true,
"balance-hot-region-scheduler": true,
"shuffle-region-scheduler": true,
"transfer-witness-leader-scheduler": true,
"balance-witness-scheduler": true,
"balance-leader-scheduler": true,
"balance-hot-region-scheduler": true,
"evict-slow-store-scheduler": true,
"shuffle-region-scheduler": true,
})
var roles []string
mustExec(re, cmd, []string{"-u", pdAddr, "scheduler", "config", "shuffle-region-scheduler", "show-roles"}, &roles)
Expand All @@ -245,12 +235,11 @@ func (suite *schedulerTestSuite) checkScheduler(cluster *tests.TestCluster) {

// test grant hot region scheduler config
checkSchedulerCommand([]string{"-u", pdAddr, "scheduler", "add", "grant-hot-region-scheduler", "1", "1,2,3"}, map[string]bool{
"balance-leader-scheduler": true,
"balance-hot-region-scheduler": true,
"shuffle-region-scheduler": true,
"grant-hot-region-scheduler": true,
"transfer-witness-leader-scheduler": true,
"balance-witness-scheduler": true,
"balance-leader-scheduler": true,
"balance-hot-region-scheduler": true,
"evict-slow-store-scheduler": true,
"shuffle-region-scheduler": true,
"grant-hot-region-scheduler": true,
})
var conf3 map[string]interface{}
expected3 := map[string]interface{}{
Expand Down

0 comments on commit 00aaf77

Please sign in to comment.