Skip to content

impl(bigtable): include universe domain in directpath health checks - #16704

Closed
scotthart wants to merge 3 commits into
googleapis:mainfrom
scotthart:bigtable_dp_ud
Closed

scotthart wants to merge 3 commits into
googleapis:mainfrom
scotthart:bigtable_dp_ud

Conversation

@scotthart

Copy link
Copy Markdown
Member

No description provided.

@scotthart
scotthart requested a review from a team as a code owner November 22, 2026 20:22
@product-auto-label product-auto-label Bot added the api: bigtable Issues related to the Bigtable API. label Nov 22, 2026

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

Copy link
Copy Markdown

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 refactors the DirectPath and CloudPath options configuration to properly respect the universe domain option and the GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable, moving the setup functions to defaults.cc and adding corresponding unit tests. The review identified a critical use-after-move bug in DirectPathProber::Probe where probe_options is moved inside an if block but subsequently accessed. Additionally, several unit tests in directpath_prober_test.cc contain weak assertions wrapped in conditional checks that should be simplified to assert directly using testing::Optional.

std::string const& peer_address,
std::shared_ptr<grpc::AuthContext const> const& auth_context) {
std::shared_ptr<BigtableStub> effective_stub = stub;
Options probe_options = options;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Declaring probe_options outside the if block and then using it after the block (e.g., at lines 150 and 166) introduces a use-after-move bug.

Inside the if (!effective_stub) block, probe_options is moved into CreateDefaultBigtableStub(auth, std::move(probe_options)) (which is called right after line 137). This leaves probe_options in an unspecified/empty state, so subsequent accesses to it (such as retrieving the timeout or passing it to PingAndWarm) will use empty options.

To fix this, pass probe_options by value (without std::move) to CreateDefaultBigtableStub inside the if block, as it is still needed for the subsequent PingAndWarm call.

Comment on lines +578 to +580
if (captured_authority.has_value()) {
EXPECT_THAT(captured_authority, Optional(Eq("bigtable.googleapis.com")));
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The if (captured_authority.has_value()) check makes this assertion weak. If captured_authority is std::nullopt (which would indicate a failure), the test will silently skip the assertion and pass.

Since testing::Optional already verifies that the optional contains a value, you can safely remove the if check and assert directly.

  EXPECT_THAT(captured_authority, Optional(Eq("bigtable.googleapis.com")));

Comment on lines +609 to +611
if (captured_authority.has_value()) {
EXPECT_THAT(captured_authority, Optional(Eq("bigtable.ud.net")));
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The if (captured_authority.has_value()) check makes this assertion weak. If captured_authority is std::nullopt (which would indicate a failure), the test will silently skip the assertion and pass.

Since testing::Optional already verifies that the optional contains a value, you can safely remove the if check and assert directly.

  EXPECT_THAT(captured_authority, Optional(Eq("bigtable.ud.net")));

Comment on lines +642 to +644
if (captured_authority.has_value()) {
EXPECT_THAT(captured_authority, Optional(Eq("bigtable.ud-env-var.net")));
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The if (captured_authority.has_value()) check makes this assertion weak. If captured_authority is std::nullopt (which would indicate a failure), the test will silently skip the assertion and pass.

Since testing::Optional already verifies that the optional contains a value, you can safely remove the if check and assert directly.

  EXPECT_THAT(captured_authority, Optional(Eq("bigtable.ud-env-var.net")));

@codecov

codecov Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.76%. Comparing base (eb5ee8c) to head (7e14f39).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16704      +/-   ##
==========================================
+ Coverage   92.74%   92.76%   +0.01%     
==========================================
  Files        2271     2271              
  Lines      227219   227478     +259     
==========================================
+ Hits       210734   211018     +284     
+ Misses      16485    16460      -25     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@scotthart scotthart closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigtable Issues related to the Bigtable API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants