-
Notifications
You must be signed in to change notification settings - Fork 214
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
Allow setting activity timeouts in testsuite #1187
base: master
Are you sure you want to change the base?
Allow setting activity timeouts in testsuite #1187
Conversation
8d1302f
to
c27397f
Compare
Add 2 method to TestActivityEnvironment: - SetActivityStartToCloseTimeout - SetActivityScheduleToCloseTimeout This will allow changing the default 10 minute timeouts in the current test environments.
c27397f
to
0d10acf
Compare
// SetActivityStartToCloseTimeout sets the start to close timeouts of activities in the test environment. | ||
func (e *TestActivityEnvironment) SetActivityStartToCloseTimeout(timeout time.Duration) { | ||
e.impl.testWorkflowEnvironmentShared.activityStartToCloseTimeout = timeout | ||
} | ||
|
||
// SetActivityStartToCloseTimeout sets the schedule to close timeouts of activities in the test environment | ||
func (e *TestActivityEnvironment) SetActivityScheduleToCloseTimeout(timeout time.Duration) { | ||
e.impl.testWorkflowEnvironmentShared.activityScheduleToCloseTimeout = timeout | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hrmm, longer than 10-minutes using this framework is a bit rough. You might consider a proper integration test with a real server instead.
Regardless, I wonder if we should document on these what the default is and document any relation to SetTestTimeout
here and on that method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we should include a comment here on what the default values are
return nil | ||
} | ||
|
||
noTimeoutActivity := func(ctx context.Context) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The low timing resolution/granularity of this test will lead to flakiness on an overloaded CI worker. I think you can just remove the no-timeout assertion part.
What was changed
Added 2 method to TestActivityEnvironment:
This will allow changing the default 10 minute timeouts in the current test environments.
Why?
There are cases where we would like to test long running activities, or test activity timeouts.
The current test suite did not support that, as it had a hardcoded 10 minute timeout.
Checklist
Closes Allow setting activity timeouts in TestActivityEnvironment #1167
How was this tested:
Set the StartToClose timeout to a specific duration, and test that:
Same test for ScheduleToClose, I did not see a difference between them in case of the testsuite.
Comment added to the new method, I don't believe further updates are needed.