Skip to content

Commit

Permalink
Harden the scheduler test case (#488)
Browse files Browse the repository at this point in the history
  • Loading branch information
git-hulk authored May 12, 2023
1 parent 08fc015 commit 48fade6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scheduler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1808,14 +1808,16 @@ func TestScheduler_Update(t *testing.T) {
s.StartAsync()

time.Sleep(300 * time.Millisecond)
_, err = s.Job(j).Every("500ms").Update()
j1, err := s.Job(j).Every("500ms").Update()
require.Equal(t, 500*time.Millisecond, j1.getDuration())
require.NoError(t, err)

time.Sleep(550 * time.Millisecond)
_, err = s.Job(j).Every("750ms").Update()
j2, err := s.Job(j).Every("750ms").Update()
require.Equal(t, 750*time.Millisecond, j2.getDuration())
require.NoError(t, err)

time.Sleep(800 * time.Millisecond)
time.Sleep(time.Second)
s.Stop()

counterMutex.RLock()
Expand Down

0 comments on commit 48fade6

Please sign in to comment.