fix(test): fix TChannel span test flakiness by awaiting async spans and explicitly setting worker tracer - #1078
Closed
shijiesheng with Copilot wants to merge 1 commit into
Closed
fix(test): fix TChannel span test flakiness by awaiting async spans and explicitly setting worker tracer#1078shijiesheng with Copilot wants to merge 1 commit into
shijiesheng with Copilot wants to merge 1 commit into
Conversation
Copilot
AI
changed the title
[WIP] Investigate failing unit test in cadence-java-client
fix(test): fix TChannel span test flakiness by awaiting async spans and explicitly setting worker tracer
Aug 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tests
testStartWorkflowTchannelandtestSignalWithStartWorkflowTchannelwere failing because (1) TChannel finishes client spans asynchronously in response callbacks — spans may not be visible the moment the calling thread resumes — and (2) the worker's tracer was not reliably inheritingmockTracerfrom service options due toinstanceof NoopTracercheck fragility from transitive opentracing-noop version conflicts.What changed?
FakeWorkflowServiceRule: AddedawaitSpan(operationName)— pollsfinishedSpans()up to 5s to handle TChannel's async span completion in unit testsWorkflowClientInternalTest: Switched assertions to useawaitSpaninstead of readingfinishedSpans()directlyStartWorkflowTest(docker integration tests):awaitSpans()with 30s timeout intestStartWorkflowHelperandtestSignalWithStartWorkflowHelperto handle async span visibilitymockTracertoWorkerOptionswhenshouldPropagate=truerather than relying onWorker.java'sinstanceof NoopTracerfallback, which can silently fail when classpath contains mismatched opentracing-noop versionsWhy?
TChannel spans are finalized in a response callback thread, not the caller thread. Tests that read
finishedSpans()synchronously after a TChannel call can see incomplete span state. Additionally,Worker.java's automatic tracer propagation viainstanceof NoopTraceris fragile under dependency version conflicts betweentchannel-core's transitive opentracing and the test'sopentracing-mock.How did you test it?
Changes validated against the CI test run that exposed the failures (job 94609211566).
Potential risks
None — test-only changes.
Release notes
None.
Documentation Changes
None.