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

functional tests testing queries + nexus tasks with versioning-3 #7015

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Shivs11
Copy link
Member

@Shivs11 Shivs11 commented Dec 19, 2024

What changed?

  • various functional tests (sticky, no-sticky) testing Query + Nexus tasks routing with versioning-3
  • refactored taskPoller to now consider query and nexus tasks

Why?

  • more testing

How did you test it?

  • no feature related line changes so N/A

Potential risks

  • none: shall reduce risks if not for anything

Documentation

Is hotfix candidate?

No

@Shivs11 Shivs11 requested a review from a team as a code owner December 19, 2024 19:09
@Shivs11 Shivs11 requested review from ShahabT, carlydf and dnr and removed request for carlydf December 19, 2024 19:09
@@ -361,5 +361,6 @@ func MutableStateToGetResponse(
InheritedBuildId: mutableState.GetInheritedBuildId(),
MostRecentWorkerVersionStamp: mostRecentWorkerVersionStamp,
TransitionHistory: mutableState.GetExecutionInfo().TransitionHistory,
VersioningInfo: mutableState.GetExecutionInfo().VersioningInfo,
Copy link
Member Author

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 {
Copy link
Member Author

@Shivs11 Shivs11 Dec 19, 2024

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

Copy link
Collaborator

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?

Copy link
Contributor

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!

@Shivs11 Shivs11 changed the title Added functional tests testing queries for versioning-3 functional tests testing queries + nexus tasks with versioning-3 Dec 20, 2024
@@ -239,9 +247,6 @@ func (p *workflowTaskPoller) pollTask(
}

events = history.Events
if len(events) == 0 {
Copy link
Collaborator

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())
}
Copy link
Collaborator

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(
Copy link
Collaborator

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)

Comment on lines +70 to +77
TaskCompletedRequest struct {
WorkflowTaskCompletedRequest *workflowservice.RespondWorkflowTaskCompletedRequest
QueryTaskCompletedRequest *workflowservice.RespondQueryTaskCompletedRequest
}
TaskCompletedResponse struct {
WorkflowTaskCompletedResponse *workflowservice.RespondWorkflowTaskCompletedResponse
QueryTaskCompletedResponse *workflowservice.RespondQueryTaskCompletedResponse
}
Copy link
Contributor

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:

  1. Create a dedicated, exported function just for queries.
  2. Change the return type to any and require type assertions.
  3. 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

Copy link
Contributor

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) {
Copy link
Contributor

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 {
Copy link
Contributor

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!

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.

3 participants