Skip to content

Fixed flaky test TerminatedWorkflowTest.testShouldReturnQueryResultAfterWorkflowTimeout - #3116

Open
maciejdudko wants to merge 2 commits into
temporalio:mainfrom
maciejdudko:test-fix-TerminatedWorkflowTest
Open

maciejdudko wants to merge 2 commits into
temporalio:mainfrom
maciejdudko:test-fix-TerminatedWorkflowTest

Conversation

@maciejdudko

Copy link
Copy Markdown
Contributor

What was changed

Fixed flaky test TerminatedWorkflowTest.testShouldReturnQueryResultAfterWorkflowTimeout.

Why?

It was causing multiple CI failures due to tight timing, e.g. https://github.com/temporalio/sdk-java/actions/runs/36925028394/job/110742314341?pr=3112

Checklist

  1. Closes Flaky testShouldReturnQueryResultAfterWorkflowTimeout #630

  2. How was this tested:

Test passes with both in-memory server and CLI.

@maciejdudko
maciejdudko requested a review from a team as a code owner October 2, 2026 14:52
@maciejdudko maciejdudko added the skip-changelog PR changes do not require changelog updates label Oct 2, 2026
workflow.start();

WorkflowExecution execution = workflow.getExecution();
if (testWorkflowRule

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition is going to check shortly after starting the workflow and possibly not give the task to the worker on the first few iterations. Should we wait for the workflow to close via timeout before checking there is a WFT started?

@maciejdudko maciejdudko Oct 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought streamHistory is going to keep waiting for more events. Apparently not. Going to replace it with direct GetWorkflowExecutionHistory RPC call streaming history after execution timeout.

The previous (flaky) version waited for the timeout, but sometimes the server reached the timeout before issuing the first task, and then queries didn't work. The idea here is to ensure the workflow task was issued before the timeout, and if not, try again.

@maciejdudko
maciejdudko force-pushed the test-fix-TerminatedWorkflowTest branch from 8d01244 to dfed318 Compare October 2, 2026 20:32

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog PR changes do not require changelog updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky testShouldReturnQueryResultAfterWorkflowTimeout

2 participants