Skip to content

Commit c6c3f01

Browse files
authored
impl(GCS+gRPC): by default use gRPC for metadata (#11712)
1 parent 5e88b3f commit c6c3f01

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

google/cloud/storage/grpc_plugin.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ google::cloud::storage::Client DefaultGrpcClient(Options opts) {
2626
using ::google::cloud::internal::GetEnv;
2727
auto const config = GetEnv("GOOGLE_CLOUD_CPP_STORAGE_GRPC_CONFIG")
2828
.value_or(opts.get<GrpcPluginOption>());
29-
if (config == "none" || config.empty()) {
29+
if (config == "none") {
3030
return google::cloud::storage::Client(std::move(opts));
3131
}
32-
if (config == "metadata") {
32+
if (config == "metadata" || config.empty()) {
3333
opts = google::cloud::storage_internal::DefaultOptionsGrpc(std::move(opts));
3434
return storage::internal::ClientImplDetails::CreateClient(
3535
storage_internal::GrpcClient::Create(opts));

google/cloud/storage/grpc_plugin_test.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ TEST(GrpcPluginTest, EnvironmentOverrides) {
7676
ASSERT_THAT(grpc, IsNull());
7777
}
7878

79-
TEST(GrpcPluginTest, UnsetConfigCreatesCurl) {
79+
TEST(GrpcPluginTest, UnsetConfigCreatesMetadata) {
8080
// Explicitly disable logging, which may be enabled by our CI builds.
8181
auto logging =
8282
ScopedEnvironment("CLOUD_STORAGE_ENABLE_TRACING", absl::nullopt);
@@ -86,8 +86,8 @@ TEST(GrpcPluginTest, UnsetConfigCreatesCurl) {
8686
auto const* const retry =
8787
dynamic_cast<RetryClient*>(ClientImplDetails::GetRawClient(client).get());
8888
ASSERT_THAT(retry, NotNull());
89-
auto const* const rest = dynamic_cast<RestClient*>(retry->client().get());
90-
ASSERT_THAT(rest, NotNull());
89+
auto const* const grpc = dynamic_cast<GrpcClient*>(retry->client().get());
90+
ASSERT_THAT(grpc, NotNull());
9191
}
9292

9393
TEST(GrpcPluginTest, NoneConfigCreatesCurl) {

google/cloud/storage/tests/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ cc_proto_library(
3535
)
3636

3737
VARIATIONS = {
38-
"default": {},
38+
"default": {"GOOGLE_CLOUD_CPP_STORAGE_GRPC_CONFIG": "none"},
3939
"grpc-media": {"GOOGLE_CLOUD_CPP_STORAGE_GRPC_CONFIG": "media"},
40-
"grpc-metadata": {"GOOGLE_CLOUD_CPP_STORAGE_GRPC_CONFIG": "metadata"},
40+
"grpc-metadata": {"GOOGLE_CLOUD_CPP_STORAGE_GRPC_CONFIG": ""},
4141
"legacy-http": {"GOOGLE_CLOUD_CPP_STORAGE_USE_LEGACY_HTTP": "yes"},
4242
}
4343

0 commit comments

Comments
 (0)