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

Support terminate-if-running workflow ID reuse policy in test server #1683

Conversation

jeffschoner-stripe
Copy link
Contributor

What was changed

Terminates any existing execution in the test service when the terminate-if-running workflow ID reuse policy is specified. A new test has been added for this case, but also some basic workflow ID reuse policy test cases.

Why?

Starting a workflow with this policy when another is already running throws WorkflowExecutionAlreadyStarted rather than the existing execution being terminated and a new run being started.

Checklist

  1. Closes Add support for TerminateIfRunning WorkflowIdReusePolicy in Test Server #1682

  2. How was this tested:

New unit tests in temporal-test-server/src/test/java/io/temporal/testserver/functional/WorkflowIdReusePolicyTest.java

  1. Any docs updates needed?

@jeffschoner-stripe jeffschoner-stripe requested a review from a team as a code owner March 1, 2023 02:00
@jeffschoner-stripe jeffschoner-stripe force-pushed the test-service-terminate-if-running branch from e1aa098 to 632f37b Compare March 1, 2023 02:21
Copy link
Contributor

@Spikhalskiy Spikhalskiy left a comment

Choose a reason for hiding this comment

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

This is great! Thank you for your contribution.

try {
workflowStub.execute();
} catch (WorkflowFailedException e) {
// Expected
Copy link
Contributor

Choose a reason for hiding this comment

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

If it's expected, you may consider asserting it with assertThrows.

import org.junit.Test;

/**
* Server should discard repeated workflow task failures and let the workflow task to time out
Copy link
Contributor

@Spikhalskiy Spikhalskiy Mar 1, 2023

Choose a reason for hiding this comment

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

Is this a relevant comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, copy/paste leftovers. I'll remove it.

@jeffschoner-stripe jeffschoner-stripe force-pushed the test-service-terminate-if-running branch from 632f37b to 76aa3cd Compare March 1, 2023 02:43
@jeffschoner-stripe
Copy link
Contributor Author

@Spikhalskiy Removed that comment, and asserted the expected exception.

@Spikhalskiy Spikhalskiy merged commit db81b4d into temporalio:master Mar 1, 2023
@jeffschoner-stripe jeffschoner-stripe deleted the test-service-terminate-if-running branch March 1, 2023 17:20
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.

Add support for TerminateIfRunning WorkflowIdReusePolicy in Test Server
2 participants