Typically, workflows that have a finite time-span can be tested with the following asserts:
require.True(t, env.IsWorkflowCompleted())
require.NoError(t, env.GetWorkflowError())
If the workflow is instead an infinitely long workflow (never-ending), we see the following error when testing:
2020/10/06 16:40:02 DEBUG Auto fire timer TimerID 0 TimerDuration 87600h0m0s TimeSkipped 87600h0m0s
Test_ForeverWorkflow: forever_test.go:35:
Error Trace: forever_test.go:35
Error: Received unexpected error:
workflow execution error (workflowID: default-test-workflow-id, runID: default-test-run-id, workflowType: ForeverWorkflow): TimeoutType: ScheduleToClose, Cause: <nil>
Test: Test_ForeverWorkflow
--- FAIL: Test_ForeverWorkflow (0.00s)
The test should essentially verify the signal has been processed. I see two options:
- Only test that the signal was processed successfully.
- Test that the signal was processed successfully, and also test to make sure the workflow never completed by checking if the ScheduleToClose error fired after 87600h0m0s time skipped.
Any options I’m not considering?
Upon further consideration: I think it’s a valid test case to make sure the workflow never completes.