Repository navigation
test(spanner): unflake ChannelPoolBuiltInMetricsTest - #15054
Merged
Merged
Conversation
Isolate ChannelPoolBuiltInMetricsTest from ambient process environment variables by installing an empty SpannerOptions.SpannerEnvironment in setUp(), matching tearDown()'s SpannerOptions.useDefaultEnvironment().
sakthivelmanii
enabled auto-merge (squash)
November 17, 2026 14:10
Contributor
Author
|
/gemini review |
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the setUp method in ChannelPoolBuiltInMetricsTest.java to initialize a default SpannerEnvironment using SpannerOptions.useEnvironment(). There are no review comments to address, and I have no additional feedback to provide.
olavloite
approved these changes
Nov 17, 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.
Problem
ChannelPoolBuiltInMetricsTest.tearDown()resetsSpannerOptions.useDefaultEnvironment(), and four individual DirectPath and environment-variable tests overrideSpannerOptions.useEnvironment(...), butsetUp()does not isolate the test suite from ambient process environment variables.GOOGLE_SPANNER_ENABLE_DIRECT_ACCESS=trueis exported in the process environment,SpannerOptions.newBuilder()readsSpannerEnvironmentImpl.isEnableDirectAccess() == trueand enables GCP fallback (setupGcpFallback), creating bothdirectpathandcloudpathgrpc-gcpchannel pools instead of a singlecloudpathpool and causing six CloudPath-expecting unit tests (adminCallsDoNotReportChannelLoad,channelCountIsReportedForTheDataPoolOnly,channelLoadIsReportedWithTheDatabaseOfTheCall,channelPoolMetricsConvertToCloudMonitoringTimeSeries,dynamicPoolReportsDynamicPoolModeAndChannelLoad, andeachClientReportsItsOwnPoolUntilItIsClosed) to fail deterministically.Solution
SpannerOptions.useEnvironment(new SpannerOptions.SpannerEnvironment() {});inChannelPoolBuiltInMetricsTest.setUp()(matchingMetricsProviderTest.setUp()and pairing symmetrically withSpannerOptions.useDefaultEnvironment()intearDown()) so all tests start from a hermeticSpannerEnvironmentregardless of ambient environment variables while still allowing individual tests to install customSpannerEnvironmentoverrides.