-
Notifications
You must be signed in to change notification settings - Fork 867
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
functional tests testing queries + nexus tasks with versioning-3 #7015
base: main
Are you sure you want to change the base?
Conversation
@@ -361,5 +361,6 @@ func MutableStateToGetResponse( | |||
InheritedBuildId: mutableState.GetInheritedBuildId(), | |||
MostRecentWorkerVersionStamp: mostRecentWorkerVersionStamp, | |||
TransitionHistory: mutableState.GetExecutionInfo().TransitionHistory, | |||
VersioningInfo: mutableState.GetExecutionInfo().VersioningInfo, |
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 we might have forgotten to add this while making the versioning-3 changes - this is required for query tasks
@@ -239,9 +247,6 @@ func (p *workflowTaskPoller) pollTask( | |||
} | |||
|
|||
events = history.Events | |||
if len(events) == 0 { |
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.
This required to be removed - I found out that sticky queries do not get sent "partial" histories and are sent empty histories
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.
cc @stephanos. Instead of removing it, should we skip the check for sticky queues only?
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, I think that would be better!
@@ -239,9 +247,6 @@ func (p *workflowTaskPoller) pollTask( | |||
} | |||
|
|||
events = history.Events | |||
if len(events) == 0 { |
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.
cc @stephanos. Instead of removing it, should we skip the check for sticky queues only?
s.verifyWorkflowVersioning(tv, vbUnpinned, tv.Deployment(), nil, nil) | ||
if sticky { | ||
s.verifyWorkflowStickyQueue(we, tv.StickyTaskQueue()) | ||
} |
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.
Let's add a query redirect step to this test. After this line, we should change the current deployment, and query the wf and make sure the new deployment's poller receives the query.
@@ -125,9 +146,123 @@ func (p *TaskPoller) PollAndHandleWorkflowTask( | |||
// If no task is available, it returns NoTaskAvailable. | |||
func (p *workflowTaskPoller) HandleTask( |
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.
Most of the time we do not work with queries, it seems a little to much to impose the nested TaskCompletedResponse on all usages. Why not keep all these methods untouched and add a HandleQueryTask
instead:
func (p *workflowTaskPoller) HandleQueryTask(tv *testvars.TestVars,
handler func(task *workflowservice.PollWorkflowTaskQueueResponse) (*workflowservice.RespondQueryTaskCompletedResponse, error)
TaskCompletedRequest struct { | ||
WorkflowTaskCompletedRequest *workflowservice.RespondWorkflowTaskCompletedRequest | ||
QueryTaskCompletedRequest *workflowservice.RespondQueryTaskCompletedRequest | ||
} | ||
TaskCompletedResponse struct { | ||
WorkflowTaskCompletedResponse *workflowservice.RespondWorkflowTaskCompletedResponse | ||
QueryTaskCompletedResponse *workflowservice.RespondQueryTaskCompletedResponse | ||
} |
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.
Hm, I'm not sure this is the right direction. I understand that the current API doesn't work for these Queries, but 95% of the time, the task poller will probably only deal with WFTs. Right now, without thinking longer about it, I see three other directions:
- Create a dedicated, exported function just for queries.
- Change the return type to any and require type assertions.
- Hide the fact that there's a "legacy" query (AFAIU) and use the "new" query API; but inside the taskpoller do the right thing auto-magically
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.
(1) would be the easiest and clearest; let me know if that's a feasible option. I haven't worked with this Query API before.
tv *testvars.TestVars, | ||
handler func(task *workflowservice.PollNexusTaskQueueResponse) (*workflowservice.RespondNexusTaskCompletedRequest, error), | ||
opts ...optionFunc, | ||
) (*workflowservice.RespondNexusTaskCompletedResponse, error) { |
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.
^ Nexus handlers look good to me 👍 (having said that, I've never used Nexus APIs)
@@ -239,9 +247,6 @@ func (p *workflowTaskPoller) pollTask( | |||
} | |||
|
|||
events = history.Events | |||
if len(events) == 0 { |
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, I think that would be better!
What changed?
taskPoller
to now consider query and nexus tasksWhy?
How did you test it?
Potential risks
Documentation
Is hotfix candidate?
No