Skip to content

impl(gax-internal): use universe_domain when creating gRPC/HTTP transport#5302

Open
alvarowolfx wants to merge 15 commits intogoogleapis:mainfrom
alvarowolfx:impl-gax-universe-domain-transport
Open

impl(gax-internal): use universe_domain when creating gRPC/HTTP transport#5302
alvarowolfx wants to merge 15 commits intogoogleapis:mainfrom
alvarowolfx:impl-gax-universe-domain-transport

Conversation

@alvarowolfx
Copy link
Copy Markdown
Contributor

Towards #3646

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 6, 2026

Codecov Report

❌ Patch coverage is 96.55172% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.73%. Comparing base (df1db4d) to head (70e57b0).
⚠️ Report is 21 commits behind head on main.

Files with missing lines Patch % Lines
src/gax-internal/src/host.rs 92.98% 4 Missing ⚠️
src/gax-internal/src/http.rs 97.72% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5302      +/-   ##
==========================================
- Coverage   97.74%   97.73%   -0.01%     
==========================================
  Files         216      216              
  Lines       47482    47601     +119     
==========================================
+ Hits        46412    46525     +113     
- Misses       1070     1076       +6     

☔ 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 7, 2026 15:13
@alvarowolfx alvarowolfx requested a review from a team as a code owner April 7, 2026 15:13
Comment thread src/gax-internal/src/grpc.rs Outdated

mockall::mock! {
#[derive(Debug)]
Credentials {}
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.

Aside, non-blocking: We don't need to define this more than once per crate.

And we could even put it in google-cloud-test-utils to define it once for all tests

Comment thread src/gax-internal/src/host.rs Outdated
Comment thread src/gax-internal/src/host.rs Outdated
@alvarowolfx alvarowolfx requested a review from a team as a code owner April 10, 2026 17:37
@alvarowolfx alvarowolfx requested a review from dbolduc April 13, 2026 19:22
@alvarowolfx
Copy link
Copy Markdown
Contributor Author

Split gax changes into #5419

@alvarowolfx alvarowolfx requested review from dbolduc and removed request for dbolduc April 15, 2026 21:20
Comment thread src/gax-internal/src/host.rs Outdated
Comment on lines +64 to +66
// For non GDU environments, endpoint takes priority if provided.
// And we don't treat regional/locational endpoints specially.
return Ok((custom_origin, custom_host));
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.

is private.my-custom-ud.com a thing? Or restricted.my-custom-ud.com?

In which case we would want to use like <service>.my-custom-ud.com as the host, but this would use private.my-custom-ud.com.

Duckie found b/361611906 for me. Seems like yes?

Copy link
Copy Markdown
Member

@dbolduc dbolduc Apr 17, 2026

Choose a reason for hiding this comment

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

Don't be afraid to scrap this whole origin_and_header function. I wrote it and it was not my finest work.

(My memory is that I was trying to make it as efficient as possible, but (1) that is not so important for client-construction vs. like per request, (2) it made the code inflexible.).

let (Some(prefix), Some(service)) = (
custom_host.strip_suffix(".googleapis.com"),
default_host.strip_suffix(".googleapis.com"),
custom_host.strip_suffix(&universe_suffix),
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.

I think this fails to strip the suffix on the .with_endpoint("foo.googleapis.com").with_universe_domain("my-custom.ud") case and then it returns "foo.custom.ud", when it should return "foo.googleapis.com".

Assuming I know what the caller is supplying to this function.

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.

yeah, that's the conflicting thing that I'm stuck on this feature. You commented that before on #5302 (comment).

I'm trying to make the code look good and pass the test cases for localhost and the scenario that you described.

#[test_case("localhost:5678", "test.googleapis.com"; "emulator")]
#[test_case("https://localhost:5678", "test.googleapis.com"; "emulator with scheme")]
#[test_case("https://test.googleapis.com", "test.googleapis.com"; "GDU endpoint with universe domain") ]
#[test_case("https://test.another-universe.com", "test.another-universe.com"; "endpoint priority") ]
fn header_universe_domain(input: &str, want: &str) -> anyhow::Result<()> {
    let got = header(
        Some(input),
        "https://test.googleapis.com",
        "my-custom-universe.com",
    )?;
    assert_eq!(got, want, "input={input:?}");
    Ok(())
}

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