Skip to content

Commit

Permalink
push
Browse files Browse the repository at this point in the history
Signed-off-by: Calvin Neo <[email protected]>
  • Loading branch information
CalvinNeo committed Dec 25, 2024
1 parent 22da213 commit c04479b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions server/cluster/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4024,24 +4024,24 @@ func TestAddKeyrangeScheduler(t *testing.T) {
}

/// Test if a scheduler can timeout.
s, err := schedulers.CreateScheduler(types.BalanceKeyrangeScheduler, oc, storage.NewStorageWithMemoryBackend(), schedulers.ConfigSliceDecoder(types.BalanceKeyrangeScheduler, makeConfigJSON(1, "", 1, "", VeryBigEndKey)), cb)
s, err := schedulers.CreateScheduler(types.BalanceKeyrangeScheduler, oc, storage.NewStorageWithMemoryBackend(), schedulers.ConfigSliceDecoder(types.BalanceKeyrangeScheduler, makeConfigJSON(1, "", 0.5, "", VeryBigEndKey)), cb)
re.NoError(err)
re.NoError(controller.AddScheduler(s))
// The scheduler timeout.
time.Sleep(time.Second * 3)

/// Test if a scheduler can be deleted.
s2, err := schedulers.CreateScheduler(types.BalanceKeyrangeScheduler, oc, storage.NewStorageWithMemoryBackend(), schedulers.ConfigSliceDecoder(types.BalanceKeyrangeScheduler, makeConfigJSON(1, "", 1, "", VeryBigEndKey)), cb)
s2, err := schedulers.CreateScheduler(types.BalanceKeyrangeScheduler, oc, storage.NewStorageWithMemoryBackend(), schedulers.ConfigSliceDecoder(types.BalanceKeyrangeScheduler, makeConfigJSON(1, "", 0.5, "", VeryBigEndKey)), cb)
re.NoError(err)
re.NoError(controller.AddScheduler(s2))
re.NoError(controller.RemoveScheduler(types.BalanceKeyrangeScheduler.String()))
n := controller.GetScheduler(types.BalanceKeyrangeScheduler.String())
re.Equal((*schedulers.ScheduleController)(nil), n)

/// Test if this scheduler is singular.
s3, err := schedulers.CreateScheduler(types.BalanceKeyrangeScheduler, oc, storage.NewStorageWithMemoryBackend(), schedulers.ConfigSliceDecoder(types.BalanceKeyrangeScheduler, makeConfigJSON(1, "", 1, "", VeryBigEndKey)), cb)
s3, err := schedulers.CreateScheduler(types.BalanceKeyrangeScheduler, oc, storage.NewStorageWithMemoryBackend(), schedulers.ConfigSliceDecoder(types.BalanceKeyrangeScheduler, makeConfigJSON(1, "", 0.5, "", VeryBigEndKey)), cb)
re.NoError(err)
s4, err := schedulers.CreateScheduler(types.BalanceKeyrangeScheduler, oc, storage.NewStorageWithMemoryBackend(), schedulers.ConfigSliceDecoder(types.BalanceKeyrangeScheduler, makeConfigJSON(1, "", 1, "", VeryBigEndKey)), cb)
s4, err := schedulers.CreateScheduler(types.BalanceKeyrangeScheduler, oc, storage.NewStorageWithMemoryBackend(), schedulers.ConfigSliceDecoder(types.BalanceKeyrangeScheduler, makeConfigJSON(1, "", 0.5, "", VeryBigEndKey)), cb)
re.NoError(err)
re.NoError(controller.AddScheduler(s3))
re.Error(controller.AddScheduler(s4), "[PD:scheduler:ErrSchedulerExisted]scheduler existed")
Expand Down

0 comments on commit c04479b

Please sign in to comment.