-
Notifications
You must be signed in to change notification settings - Fork 228
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 conflict options for starting Nexus operations in test framework #1828
Conversation
@@ -216,6 +216,7 @@ type ( | |||
WaitForCancellation bool | |||
WorkflowIDReusePolicy enumspb.WorkflowIdReusePolicy | |||
WorkflowIDConflictPolicy enumspb.WorkflowIdConflictPolicy | |||
OnConflictOptions *OnConflictOptions |
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'm adding this WorkflowOptions
, but not sure if I should. I need because the Nexus handler workflow is executed in the test framework as a child workflow, and I need this to resolve workflow ID conflict, ie., starting the same operation multiple times.
I can see this is used in certain operations. For example, I saw WorkflowOptions
is built for ExecuteChildWorkflow
, and OnConflictOptions
is not an options for executing child workflow.
Btw, WorkflowIDConflictPolicy
was added here a while ago, but I didn't see any usage of this field anywhere... I'm using it now here though.
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.
WorkflowIDConflictPolicy
is not supported for child workflows temporalio/temporal#6799 so yeah it probably shouldn't have been added here.
Is it reasonable to refactor the Nexus handler workflow to not be a "child" in the test framework?
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.
Agreed, we shouldn't add an unused field here (even if there happens to be another unused field here)
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 think Rodrigo is saying it is no longer an unused field, but I guess it is unused when executing outside the test enviorment?
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.
Yes, WorkflowIDConflictPolicy
is unused since it was added in #1563, but I need it now with this PR.
As for not being a child workflow, I'm not sure how we would be able to run the Nexus workflow without it since the test environment only allows to run one main/root workflow at a time. cc: @bergundy
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.
Oh, my mistake, I thought this was user-facing child workflow options or something. If this is an internal
only thing I have no opinion/preference, will defer to Quinn.
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.
WorkflowOptions
is somewhat user facing, isn't it? The user could get it from the workflow context.
The two fields I mentioned, it's only used in the test environment. Maybe I could just make them unexported?
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.
How can users get WorkflowOptions
from the workflow context?
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.
Well, it's not exported, but technically, the user could write directly ctx.Value("wfEnvOptions")
.
Otherwise, it seems it's only for internal
.
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.
Yeah I think the only reason the type is even exported anyway is for the nexus test environment and maybe the PHP SDK
1ee8bda
to
1210104
Compare
b357b6a
to
61ba3ed
Compare
1210104
to
45f6370
Compare
test/nexus_test.go
Outdated
@@ -1264,6 +1265,137 @@ func TestWorkflowTestSuite_WorkflowRunOperation_WithCancel(t *testing.T) { | |||
} | |||
} | |||
|
|||
func TestWorkflowTestSuite_WorkflowRunOperation_MultipleCallers_NoAttachCallback(t *testing.T) { |
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.
Need to wait for this test to pass before merging this or #1797
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.
There was a bug in the Nexus error handling that caused the issue. I fixed in this PR.
45f6370
to
ffadd11
Compare
61ba3ed
to
25c0d55
Compare
Approved but still need @Quinn-With-Two-Ns approval |
ffadd11
to
8ceb55c
Compare
f1c62f7
to
46de52d
Compare
Oh sorry not this PR, the other one 🤦 |
a2f83e1
to
c1e2dab
Compare
8ceb55c
to
66dc27e
Compare
c1e2dab
to
e7c005b
Compare
What was changed
Support OnConflictOptions when starting Nexus operation in test framework.
Why?
Checklist
Closes
How was this tested: