-
Notifications
You must be signed in to change notification settings - Fork 134
enforce WorkflowExecutionTimeout in test framework #562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The SetTestTimeout(idleTimeout) is to set the idle timeout for the test. What it means is that if there is nothing happen to the workflow (means workflow is idle) beyond the idleTimeout, the test framework will exit. For the example that you have with busy-looping case, the workflow is not idle and events (timer fired) are happening because auto forward clock. I think there 2 things we might want. 1) a control nob that set the timeout based on workflow time (based on the mock clock). This is like the WorkflowExecutionTimeout. Currently, the test framework does not require this setting and does not enforce a limit on the tested workflow. |
It should probably be documented differently then, currently it just says:
which doesn't really imply "when test is idle for [duration]" to me, just "the wall clock timeout for this workflow test run". If it's intended to be an idle timeout though, I'll go crank our default one down to like 10ms, they should effectively never block except in integration tests. So ignoring idle test timeout: yeah, workflow-time timeout / WorkflowExecutionTimeout covers most of our needs. Hopefully not too hard to build? |
Change the idle timeout to 10ms might not be what you want. If you have activity that takes 20ms to finish and your tested workflow is idle while waiting on that activity, it could fail the test. |
Will keep this issue to track the request to enforce WorkflowExecutionTimeout. |
NewTestWorkflowEnvironment().SetTestTimeout(...)
does not appear to work in all cases.Given a diff like this plus
go test -timeout 10s ./internal 2>&1 > out.txt
:the test suite eventually times out after 10 seconds (normal run-time is about 5 seconds), and produces 50MB of output like:
Which is well over the 100ms timeout. Even logs show it:
Note that this does work if the workflow does not "busy"-loop. E.g. this workflow panics the whole suite in 100ms:
IMO this is a three-part issue / feature request.
SetTestTimeout
should work in more scenariosSetTestTimeout
should lead toenv.IsWorkflowCompleted() == false
instead of panicking.t.Log(...)
, which is the default behavior when you setenv.Test(t)
(which I'd very much recommend in general).The text was updated successfully, but these errors were encountered: