From 851171e5147ece88669539dd324272d6f5ea10b0 Mon Sep 17 00:00:00 2001 From: Safeer Jiwan Date: Fri, 23 Aug 2024 15:32:48 -0700 Subject: [PATCH] broken test to catch transient cron origin parse errors --- backend/controller/dal/async_calls_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/backend/controller/dal/async_calls_test.go b/backend/controller/dal/async_calls_test.go index c1ea520cc8..9417d3e3d1 100644 --- a/backend/controller/dal/async_calls_test.go +++ b/backend/controller/dal/async_calls_test.go @@ -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) + 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) + } +}