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

Enforce nexus request timeout in workflow test suite #1653

Merged
merged 4 commits into from
Oct 3, 2024

Conversation

bergundy
Copy link
Member

@bergundy bergundy commented Oct 1, 2024

Also fixes issue where headers injected by workflow outbound interceptors in the test env were not normalized to lower case as done by the real server.

Comment on lines +2357 to +2366
// Use lower case header values to simulate how the Nexus SDK (used internally by the "real" server) would transmit
// these headers over the wire.
nexusHeader := make(map[string]string, len(params.nexusHeader))
for k, v := range params.nexusHeader {
nexusHeader[strings.ToLower(k)] = v
}
params.nexusHeader = nexusHeader
// The real server allows requests to take up to 10 seconds, mimic that behavior here.
// Note that if a user sets the Request-Timeout header, it gets overridden.
params.nexusHeader[strings.ToLower(nexus.HeaderRequestTimeout)] = "10s"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also set the request timeout for the cancel operation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this will set that timeout for all "requests".

@Quinn-With-Two-Ns
Copy link
Contributor

Seems like there is an issue with this PR only on Windows

@bergundy
Copy link
Member Author

bergundy commented Oct 3, 2024

Seems like there is an issue with this PR only on Windows

Changed the test slightly, CI should pass now AFAICT.

@bergundy
Copy link
Member Author

bergundy commented Oct 3, 2024

Looks like this is good to go @Quinn-With-Two-Ns.

params.nexusHeader = nexusHeader
// The real server allows requests to take up to 10 seconds, mimic that behavior here.
// Note that if a user sets the Request-Timeout header, it gets overridden.
params.nexusHeader[strings.ToLower(nexus.HeaderRequestTimeout)] = "10s"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the real server behaviour the minimum of 10s or the remaining schedule to close?

Copy link
Member Author

@bergundy bergundy Oct 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Not at the moment, but we should enforce that eventually.

@bergundy bergundy merged commit d7a2128 into temporalio:master Oct 3, 2024
13 checks passed
@bergundy bergundy deleted the nexus-request-timeout branch October 4, 2024 16:51
ReyOrtiz pushed a commit to ReyOrtiz/temporal-sdk-go that referenced this pull request Dec 5, 2024
* Enforce nexus request timeout in workflow test suite

* Use GreaterOrEqual to compare timeout
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.

3 participants