Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ohad83
Copy link

@ohad83 ohad83 commented Aug 5, 2023

What was changed

Added 2 method to TestActivityEnvironment:

  • SetActivityStartToCloseTimeout
  • SetActivityScheduleToCloseTimeout

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

  1. Closes Allow setting activity timeouts in TestActivityEnvironment #1167

  2. How was this tested:

Set the StartToClose timeout to a specific duration, and test that:

  • An activity which takes longer than that duration returns an error.
  • An activity which takes less than that duration finishes successfully.

Same test for ScheduleToClose, I did not see a difference between them in case of the testsuite.

  1. Any docs updates needed?
    Comment added to the new method, I don't believe further updates are needed.

@ohad83 ohad83 requested a review from a team as a code owner August 5, 2023 19:43
@CLAassistant
Copy link

CLAassistant commented Aug 5, 2023

CLA assistant check
All committers have signed the CLA.

@ohad83 ohad83 force-pushed the feature/testsuite-activity-timeout branch from 8d1302f to c27397f Compare August 5, 2023 20:58
Add 2 method to TestActivityEnvironment:
- SetActivityStartToCloseTimeout
- SetActivityScheduleToCloseTimeout

This will allow changing the default 10 minute timeouts in the current test environments.
@ohad83 ohad83 force-pushed the feature/testsuite-activity-timeout branch from c27397f to 0d10acf Compare August 7, 2023 07:10
Comment on lines +265 to +273
// 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
}
Copy link
Member

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.

Copy link
Contributor

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 {
Copy link
Member

@cretz cretz Aug 7, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow setting activity timeouts in TestActivityEnvironment
4 participants