Skip to content

Commit

Permalink
broken test to catch transient cron origin parse errors
Browse files Browse the repository at this point in the history
  • Loading branch information
safeer committed Aug 23, 2024
1 parent e028694 commit 851171e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions backend/controller/dal/async_calls_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,20 @@ func TestNoCallToAcquire(t *testing.T) {
assert.IsError(t, err, dalerrs.ErrNotFound)
assert.EqualError(t, err, "no pending async calls: not found")
}

func TestParseAsyncOrigin(t *testing.T) {
cronKeys := []string{
"crn-cron-cron-10pvs393nkv3new4", // 1:23: exponent has no digits
"crn-initial-verb0-3poj0hr6wmtvmz99", // 1:26: exponent has no digits
"crn-initial-verb0Cron-5eq2ivpmuv0lvnoc", // 1:30: exponent has no digits
}
for _, cronKey := range cronKeys {
origin, err := ParseAsyncOrigin("cron:" + cronKey)
assert.NoError(t, err)

Check failure on line 34 in backend/controller/dal/async_calls_test.go

View workflow job for this annotation

GitHub Actions / Test Go

=== RUN TestParseAsyncOrigin backend/controller/dal/async_calls_test.go:34: Did not expect an error but got: 1:23: exponent has no digits --- FAIL: TestParseAsyncOrigin (0.00s)
assert.Equal(t, "cron", origin.Origin())

asyncOrigin, ok := origin.(*AsyncOriginCron)
assert.True(t, ok, "origin is not a cron origin")
assert.Equal(t, cronKey, asyncOrigin.CronJobKey)
}
}

0 comments on commit 851171e

Please sign in to comment.