diff --git a/common/util_test.go b/common/util_test.go index ab3a0e8eaed..bc8f5dc8cbd 100644 --- a/common/util_test.go +++ b/common/util_test.go @@ -693,3 +693,17 @@ func TestValidateRetryPolicy_Error(t *testing.T) { }) } } + +func TestConvertGetTaskFailedCauseToErr(t *testing.T) { + for cause, wantErr := range map[types.GetTaskFailedCause]error{ + types.GetTaskFailedCauseServiceBusy: &types.ServiceBusyError{}, + types.GetTaskFailedCauseTimeout: context.DeadlineExceeded, + types.GetTaskFailedCauseShardOwnershipLost: &types.ShardOwnershipLostError{}, + types.GetTaskFailedCauseUncategorized: &types.InternalServiceError{Message: "uncategorized error"}, + } { + t.Run(cause.String(), func(t *testing.T) { + gotErr := ConvertGetTaskFailedCauseToErr(cause) + require.Equal(t, wantErr, gotErr) + }) + } +}