Skip to content

Commit

Permalink
make TestScheduler stable
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <rleungx@gmail.com>
  • Loading branch information
rleungx committed Apr 25, 2023
1 parent 4f87e9d commit e3f8525
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/pdctl/scheduler/scheduler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,15 @@ func TestScheduler(t *testing.T) {
checkSchedulerWithStatusCommand(nil, "paused", []string{
"balance-leader-scheduler",
})
checkSchedulerDescribeCommand("balance-leader-scheduler", "paused", "")
result := make(map[string]interface{})
testutil.Eventually(re, func() bool {
mightExec([]string{"-u", pdAddr, "scheduler", "describe", "balance-leader-scheduler"}, &result)
return len(result) != 0
}, testutil.WithTickInterval(50*time.Millisecond))

testutil.Eventually(re, func() bool {
return result["status"] == "paused" && result["summary"] == ""
}, testutil.WithTickInterval(50*time.Millisecond))

mustUsage([]string{"-u", pdAddr, "scheduler", "resume", "balance-leader-scheduler", "60"})
mustExec([]string{"-u", pdAddr, "scheduler", "resume", "balance-leader-scheduler"}, nil)
Expand Down

0 comments on commit e3f8525

Please sign in to comment.