Why is this test failing? Why does IsWorkflowComplete return true when the activity has returned activity.ErrResultPending. I’ve verified the activity is executed.
Error: Received unexpected error:
workflow execution error (type: Workflow, workflowID: default-test-workflow-id, runID: default-test-run-id): A valid StartToClose or ScheduleToCloseTimeout is not set on command. (type: InvalidArgument, retryable: true)
Thank you for the response, maxim. After modifying the code as directed I received the error: workflow execution error (type: Workflow, workflowID: default-test-workflow-id, runID: default-test-run-id): deadline exceeded (type: ScheduleToClose)
Adding the following didn’t change the result: ScheduleToCloseTimeout: 10 * time.Second,
Here is my new code that results in a ScheduleToClose timeout error:
In creating the simple example from my actual code under test I had inadvertently ignored the error in the workflow. I also have the timeouts in my actual code, and I was failing to check GetWorkflowError(). After adding it to my test, my actual code under test is failing on the same error as the above code.
Thank you again for your help with testing this negative case.
So it works as expected in this case. The activity is never completed, so it times out. As StartToClose timeout and the ScheduleToStart timeout are the same it times out with ScheduleToStart. The workflow propagates the activity error up, so you see it as the cause of the workflow failure.
I’m attempting to test the result of a query of a workflow that is not yet complete. Is there an example that tests that use case? My test completes in less than 300 milliseconds. How is timeout elapsing? Is there a mock clock I need to control?
Apologies if this comes across as an XY problem. Even though my ultimate goal is testing the query, the problem presented is something I wish to understand.
I see. The test framework automatically forwards the workflow clock forward to support testing long-running workflows. To test query perform it from a delayed callback.