Skip to content

Commit

Permalink
test(cron): should return error if running out of IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
janrnc committed Nov 11, 2023
1 parent 4079229 commit be8677e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cron_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,20 @@ func TestMultiThreadedStartAndStop(t *testing.T) {
cron.Stop()
}

func TestRunningOutOfIDs(t *testing.T) {
cron := New()
cron.next = ID(^uint(0))

_, err := cron.Add("* * * * *", func() {})
if err != nil {
t.Error("non-nil error")
}
_, err = cron.Add("* * * * *", func() {})
if err == nil {
t.Error("expected error, got nil")
}
}

func wait(wg *sync.WaitGroup) chan bool {
ch := make(chan bool)
go func() {
Expand Down

0 comments on commit be8677e

Please sign in to comment.