-
Notifications
You must be signed in to change notification settings - Fork 220
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
Add test environment support for Nexus Operations #1475
Add test environment support for Nexus Operations #1475
Conversation
7b5d3b9
to
dcfa8cf
Compare
6cadae7
to
69b8101
Compare
type isWorkflowRunOpContextKeyType struct{} | ||
|
||
// IsWorkflowRunOpContextKey is a key to mark that the current context is used within a workflow run operation. | ||
// The fake test env client verifies this key is set on the context to decide whether it should execute a method or |
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.
Why not just not have a fake test env client and instead have an always-fail one? Can you just intercept and do the test-env stuff earlier in the Nexus call instead of keeping this half-implemented fake client around that now is only used sometimes?
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.
Not without adding more hacks to WorkflowRunOperation
or exposing more information about a nexus.Service
and doing ugly type casts on registration.
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.
May need that anyways for an OnNexusOperation
mock
Do we plan to add a |
Yes, and also |
Yeah fine with my, I just wanted to make sure if not done in the PR they are tracked |
Here's the issue FTR #1491 |
42984a0
into
bergundy/nexus-operation-from-workflow
* Execute nexus operation from a workflow * Address review comments * Add test environment support for Nexus Operations (#1475) * Add test environment support for Nexus Operations * Change client to not allow any direct calls
## What was changed - Added the `temporalnexus` package and implemented the handler side for Nexus, including registering and dispatching Nexus Operations. - Added the ability to execute Nexus Operations from a workflow. - Added basic support for running Nexus Operations in the test environment. - Added memoizing to `worker.Start()` to return consistent errors to callers and avoid rerunning the function unnecessarily. - Updated the integration test's dev server to run CLI `0.14.0-nexus.0` which includes server `1.25.0-rc.0`. See the [proposal](https://github.com/temporalio/proposals/blob/b72c49b0c2278e916265b00a49638006f8fce469/nexus/sdk-go.md) for more information. Most of this code has been reviewed already in #1466, #1473, and #1475, which are all squashed in the first commit.
Test environment now supports Nexus Operations.
I've added a partial
Client
implementation for the test env to support what I predict will be the most frequently used methods.Specifically
WorkflowRunOperation
andSyncOperation
can use the client to signal and query workflows.Users can register arbitrary Nexus Operation handlers if they want to mock the operation completely.
This PR is stacked on top of the other two Nexus PRs and completes the basic functionality.