You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix flaky test Test_runDispatcher/gateway_actions_passed (#5405)
* refctor: make context timeout adjustable per test case
A short context timeout makes some tests flaky, but making it longer across the board would unnecessarily make test runs longer. Let's make it customizable per test case.
* Fix flaky test `Test_runDispatcher/gateway_actions_passed`
The flakiness is a result of a 100 miliseconds not always being enough time to dispatch the action in the test environment.
The correct way to fix this issue is to run the assertions in an `assert.Eventually` with a longer timeout. Unfortunately, a deficiency in the `testify` testing framework makes it impossible to put the `AssertExpectations` methods in an `assert.Eventually` or `assert.EventuallyWithT` function: stretchr/testify#1414.
The workaround is to increase the context timeout for the `gateway actions passed` test case. I'm increasing it from 100ms to 200ms.
dispatcher.On("Dispatch", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Maybe() // allow a second call in case there are timing issues in the CI pipeline
0 commit comments