-
Notifications
You must be signed in to change notification settings - Fork 152
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
Implement test server support for sync Nexus operation commands #2176
Conversation
import org.junit.Rule; | ||
import org.junit.Test; | ||
|
||
public class NexusWorkflowTest { |
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.
I know these tests have a lot of copy-pasted code; didn't want to spend a ton of time on test design in this PR. Planning to add more coverage and refactor common code when writing async operation tests.
out.writeInt(attempt); | ||
return ByteString.copyFrom(bout.toByteArray()); | ||
} catch (IOException e) { | ||
throw Status.INTERNAL.withCause(e).withDescription(e.getMessage()).asRuntimeException(); |
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.
Does the real server also throw an INTERNAL error if the task token is bad?
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.
If this was the core Java SDK I would probably advocate for doing the try catch to a GRPC specific exception outside of toBytes
to separate the transport details from the implementation. For the test server it is fine.
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.
Ah good catch, it throws INVALID_ARGUMENT; I'll update.
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.
Actually I think serialization error is INTERNAL and deserialization is INVALID_ARGUMENT so that's what I've changed it to.
temporal-test-server/src/test/java/io/temporal/testserver/functional/NexusWorkflowTest.java
Show resolved
Hide resolved
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.
LGTM, nothing stands out as obviously wrong, but I'll admit I don't know how the nexus task state machine on the server looks and if it matches the test server. Relying on the tests to ensure we have very close behaviour here.
This Test test failure here looks problematic, seems like an upsert search attribute test was treated as a nexus operation
|
What was changed
Added test server support for Nexus operation commands, including sync completion, timeouts, failures, and retries. Added most of the stubs for implementing asynchronous operations in followup PRs.
The test server will only support worker targets, not external, so there is no added logic for making HTTP requests.
The implementation largely follows the same design as ActivityTasks.