Skip to content

impl(gax-internal): add universe_domain mod helper #5243

Merged
alvarowolfx merged 3 commits intogoogleapis:mainfrom
alvarowolfx:impl-gax-internal-universe-domain-mod
Apr 6, 2026
Merged

impl(gax-internal): add universe_domain mod helper #5243
alvarowolfx merged 3 commits intogoogleapis:mainfrom
alvarowolfx:impl-gax-internal-universe-domain-mod

Conversation

@alvarowolfx
Copy link
Copy Markdown
Contributor

Towards #3646

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 2, 2026

Codecov Report

❌ Patch coverage is 98.36066% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 98.02%. Comparing base (93eebe7) to head (c2f0df4).
⚠️ Report is 21 commits behind head on main.

Files with missing lines Patch % Lines
src/gax-internal/src/universe_domain.rs 98.36% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5243   +/-   ##
=======================================
  Coverage   98.02%   98.02%           
=======================================
  Files         214      215    +1     
  Lines       44645    44706   +61     
=======================================
+ Hits        43764    43824   +60     
- Misses        881      882    +1     

☔ View full report in Codecov by Sentry.
📢 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.

@alvarowolfx alvarowolfx marked this pull request as ready for review April 2, 2026 15:10
@alvarowolfx alvarowolfx requested a review from a team as a code owner April 2, 2026 15:10
Copy link
Copy Markdown
Member

@dbolduc dbolduc left a comment

Choose a reason for hiding this comment

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

I think you should split the test. And then I had a question on what behavior we want for one of the cases.

Comment thread src/gax-internal/src/universe_domain.rs Outdated
Comment thread src/gax-internal/src/universe_domain.rs Outdated
Comment thread src/gax-internal/src/universe_domain.rs Outdated
.unwrap_or(DEFAULT_UNIVERSE_DOMAIN)
.to_string();

let cred_universe = cred_universe.as_deref().unwrap_or(DEFAULT_UNIVERSE_DOMAIN);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So if my creds have no universe, and my client has a non-GDU universe, that is a fail. Should it be?

(There is not a test case for this)

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.

Yes, it should be a fail. No universe means GDU. If the client provides a non GDU, it's mismatch. I've added a test case.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No universe means GDU

This implies to me that we messed up the Credentials::universe_domain() API. It should return a String instead of an Option<String>... oh well, too late to fix.

Copy link
Copy Markdown
Contributor Author

@alvarowolfx alvarowolfx left a comment

Choose a reason for hiding this comment

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

I pushed a commit addressing review comments and also answered the question around the credential having no universe domain (which mean it's GDU)

Comment thread src/gax-internal/src/universe_domain.rs Outdated
.unwrap_or(DEFAULT_UNIVERSE_DOMAIN)
.to_string();

let cred_universe = cred_universe.as_deref().unwrap_or(DEFAULT_UNIVERSE_DOMAIN);
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.

Yes, it should be a fail. No universe means GDU. If the client provides a non GDU, it's mismatch. I've added a test case.

Comment thread src/gax-internal/src/universe_domain.rs Outdated
Comment thread src/gax-internal/src/universe_domain.rs Outdated
let cred = mock_credentials(cred_domain);

let universe_domain = resolve(client_override, &cred).await?;
assert_eq!(universe_domain.as_str(), expected, "{universe_domain:?}");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit:

Suggested change
assert_eq!(universe_domain.as_str(), expected, "{universe_domain:?}");
assert_eq!(universe_domain, expected);

Comment thread src/gax-internal/src/universe_domain.rs Outdated
.unwrap_or(DEFAULT_UNIVERSE_DOMAIN)
.to_string();

let cred_universe = cred_universe.as_deref().unwrap_or(DEFAULT_UNIVERSE_DOMAIN);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No universe means GDU

This implies to me that we messed up the Credentials::universe_domain() API. It should return a String instead of an Option<String>... oh well, too late to fix.

@alvarowolfx alvarowolfx merged commit 8715c6c into googleapis:main Apr 6, 2026
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants