[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(common): use FQDN for the metadata service #13139

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion google/cloud/internal/compute_engine_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ std::string GceMetadataScheme() { return "http"; }

std::string GceMetadataHostname() {
return google::cloud::internal::GetEnv(GceMetadataHostnameEnvVar())
.value_or("metadata.google.internal");
.value_or("metadata.google.internal.");
}

} // namespace internal
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/internal/compute_engine_util_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ TEST(ComputeEngineUtilTest, CanOverrideGceMetadataHostname) {
// If not overridden for testing, we should get the actual hostname.
google::cloud::testing_util::ScopedEnvironment gce_metadata_hostname_unset(
GceMetadataHostnameEnvVar(), {});
EXPECT_EQ(std::string("metadata.google.internal"), GceMetadataHostname());
EXPECT_EQ(std::string("metadata.google.internal."), GceMetadataHostname());
}

} // namespace
Expand Down
4 changes: 2 additions & 2 deletions google/cloud/internal/unified_rest_credentials_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ TEST(UnifiedRestCredentialsTest, AdcIsComputeEngine) {
auto client = std::make_unique<MockRestClient>();
auto expected_request = AllOf(
Property(&RestRequest::path,
absl::StrCat("http://metadata.google.internal/",
absl::StrCat("http://metadata.google.internal./",
"computeMetadata/v1/instance/service-accounts/",
"default/")),
Property(&RestRequest::headers,
Expand All @@ -250,7 +250,7 @@ TEST(UnifiedRestCredentialsTest, AdcIsComputeEngine) {
auto client = std::make_unique<MockRestClient>();
auto expected_request = AllOf(
Property(&RestRequest::path,
absl::StrCat("http://metadata.google.internal/",
absl::StrCat("http://metadata.google.internal./",
"computeMetadata/v1/instance/service-accounts/",
"default/", "token")),
Property(&RestRequest::headers,
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/storage/internal/compute_engine_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace internal {

std::string GceMetadataHostname() {
return google::cloud::internal::GetEnv(GceMetadataHostnameEnvVar())
.value_or("metadata.google.internal");
.value_or("metadata.google.internal.");
}

} // namespace internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ TEST_F(ComputeEngineUtilTest, CanOverrideGceMetadataHostname) {
// If not overridden for testing, we should get the actual hostname.
google::cloud::testing_util::ScopedEnvironment gce_metadata_hostname_unset(
GceMetadataHostnameEnvVar(), {});
EXPECT_EQ(std::string("metadata.google.internal"), GceMetadataHostname());
EXPECT_EQ(std::string("metadata.google.internal."), GceMetadataHostname());
}

} // namespace
Expand Down