@@ -6,7 +6,7 @@ Test workflow and steps features
66[x] workflow idempotency
77[x] workflow DLQ
88[x] workflow conflicting name
9- [] workflow timeouts & deadlines (including child workflows)
9+ [x ] workflow timeouts & deadlines (including child workflows)
1010*/
1111
1212import (
@@ -1072,60 +1072,51 @@ func TestWorkflowDeadLetterQueue(t *testing.T) {
10721072 require .Error (t , err , "expected dead letter queue error when restarting workflow with same ID but got none" )
10731073
10741074 dbosErr , ok = err .(* DBOSError )
1075- if ! ok {
1076- t .Fatalf ("expected DBOSError, got %T" , err )
1077- }
1078- if dbosErr .Code != DeadLetterQueueError {
1079- t .Fatalf ("expected DeadLetterQueueError, got %v" , dbosErr .Code )
1080- }
1075+ require .True (t , ok , "expected error to be of type *DBOSError, got %T" , err )
1076+ require .Equal (t , dbosErr .Code , DeadLetterQueueError , "expected error code to be DeadLetterQueueError" )
10811077
1082- // Unlock the workflow to allow it to complete
1083- deadLetterQueueEvent .Set ()
1084- /*
1085- // TODO: test resume when implemented
1086- resumedHandle, err := ...
1078+ // Now resume the workflow -- this clears the DLQ status
1079+ resumedHandle , err := ResumeWorkflow [int ](dbosCtx , wfID )
1080+ require .NoError (t , err , "failed to resume workflow" )
10871081
1088- // Recover pending workflows again - should work without error
1089- _, err = recoverPendingWorkflows(executor.(*dbosContext), []string{"local"})
1090- if err != nil {
1091- t.Fatalf("failed to recover pending workflows after resume: %v", err)
1092- }
1082+ // Recover pending workflows again - should work without error
1083+ _ , err = recoverPendingWorkflows (dbosCtx .(* dbosContext ), []string {"local" })
1084+ require .NoError (t , err , "failed to recover pending workflows after resume" )
10931085
1094- // Complete the blocked workflow
1095- deadLetterQueueEvent.Set()
1086+ // Complete the blocked workflow
1087+ deadLetterQueueEvent .Set ()
10961088
1097- // Wait for both handles to complete
1098- result1, err = handle.GetResult(context.Background() )
1099- if err != nil {
1100- t.Fatalf("failed to get result from original handle: %v", err)
1101- }
1089+ // Wait for both handles to complete
1090+ result1 , err : = handle .GetResult ()
1091+ if err != nil {
1092+ t .Fatalf ("failed to get result from original handle: %v" , err )
1093+ }
11021094
1103- result2, err := resumedHandle.GetResult(context.Background() )
1104- if err != nil {
1105- t.Fatalf("failed to get result from resumed handle: %v", err)
1106- }
1095+ result2 , err := resumedHandle .GetResult ()
1096+ if err != nil {
1097+ t .Fatalf ("failed to get result from resumed handle: %v" , err )
1098+ }
11071099
1108- if result1 != result2 {
1109- t.Fatalf("expected both handles to return same result, got %v and %v", result1, result2)
1110- }
1100+ if result1 != result2 {
1101+ t .Fatalf ("expected both handles to return same result, got %v and %v" , result1 , result2 )
1102+ }
11111103
1112- // Verify workflow status is SUCCESS
1113- status, err = handle.GetStatus()
1114- if err != nil {
1115- t.Fatalf("failed to get final workflow status: %v", err)
1116- }
1117- if status.Status != WorkflowStatusSuccess {
1118- t.Fatalf("expected workflow status to be SUCCESS, got %v", status.Status)
1119- }
1104+ // Verify workflow status is SUCCESS
1105+ status , err = handle .GetStatus ()
1106+ if err != nil {
1107+ t .Fatalf ("failed to get final workflow status: %v" , err )
1108+ }
1109+ if status .Status != WorkflowStatusSuccess {
1110+ t .Fatalf ("expected workflow status to be SUCCESS, got %v" , status .Status )
1111+ }
11201112
1121- // Verify that retries of a completed workflow do not raise the DLQ exception
1122- for i := 0; i < maxRecoveryAttempts*2; i++ {
1123- _, err = RunAsWorkflow(executor, deadLetterQueueWorkflow, "test", WithWorkflowID(wfID))
1124- if err != nil {
1125- t.Fatalf("unexpected error when retrying completed workflow: %v", err)
1126- }
1113+ // Verify that retries of a completed workflow do not raise the DLQ exception
1114+ for i := 0 ; i < maxRecoveryAttempts * 2 ; i ++ {
1115+ _ , err = RunAsWorkflow (dbosCtx , deadLetterQueueWorkflow , "test" , WithWorkflowID (wfID ))
1116+ if err != nil {
1117+ t .Fatalf ("unexpected error when retrying completed workflow: %v" , err )
11271118 }
1128- */
1119+ }
11291120 })
11301121
11311122 t .Run ("InfiniteRetriesWorkflow" , func (t * testing.T ) {
0 commit comments