Skip to content

test(spanner): unflake GrpcResultSetTest - #14901

Merged
sakthivelmanii merged 1 commit into
mainfrom
unflake-grpcresultsettest
Nov 3, 2026
Merged

sakthivelmanii merged 1 commit into
mainfrom
unflake-grpcresultsettest

Conversation

@sakthivelmanii

Copy link
Copy Markdown
Contributor

Problem

  • GrpcResultSetTest.closeWhileStreamIsStartingInvokesOnDoneSynchronously hardcodes new OpenCensusSpan(BlankSpan.INSTANCE) as the parent span passed to ResumableStreamIterator, while TraceWrapper dispatches span creation based on the JVM-global SpannerOptions.getActiveTracingFramework().
  • When another test class in the same Surefire JVM fork enables OpenTelemetry tracing via SpannerOptions.enableOpenTelemetryTraces() without resetting it afterward, TraceWrapper.spanBuilderWithExplicitParent casts the parent span to OpenTelemetrySpan and throws a ClassCastException.

Solution

  • Create a shared TraceWrapper instance in closeWhileStreamIsStartingInvokesOnDoneSynchronously and pass tracer.getBlankSpan() as the parent span to ResumableStreamIterator so the parent span type always matches the active tracing framework.
  • Remove the unused io.opencensus.trace.BlankSpan import.
Use TraceWrapper.getBlankSpan() instead of hardcoding OpenCensusSpan in closeWhileStreamIsStartingInvokesOnDoneSynchronously so the parent span type always matches the active JVM tracing framework even when earlier tests enable OpenTelemetry.
@sakthivelmanii
sakthivelmanii requested a review from a team as a code owner November 3, 2026 08:42
@sakthivelmanii
sakthivelmanii enabled auto-merge (squash) November 3, 2026 08:42
@sakthivelmanii
sakthivelmanii requested a review from a team as a code owner November 3, 2026 08:42
@sakthivelmanii

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request updates GrpcResultSetTest.java to dynamically resolve the blank span type using a shared TraceWrapper instance, rather than hardcoding an OpenCensusSpan with BlankSpan.INSTANCE. This ensures compatibility with the active JVM-global tracing framework, which may vary depending on other tests. Additionally, the unused BlankSpan import was removed. There are no review comments to address, so I have no further feedback to provide.

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request updates GrpcResultSetTest.java to dynamically resolve the parent span type based on the active tracing framework. Instead of hardcoding an OpenCensus BlankSpan, it now instantiates a TraceWrapper and retrieves a blank span from it, preventing potential type mismatches caused by JVM-global tracing state. I have no feedback to provide as there are no review comments.

@sakthivelmanii
sakthivelmanii merged commit b3ce1c9 into main Nov 3, 2026
198 of 200 checks passed
@sakthivelmanii
sakthivelmanii deleted the unflake-grpcresultsettest branch November 3, 2026 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants