Skip to content

Commit c6baf76

Browse files
committed
feat(bigtable): set peer_info to true in FeatureFlags
Adds `peer_info` to the Google Cloud Bigtable `FeatureFlags`, indicating that the client supports peer information. Updates all `FeatureFlags` unit tests to exhaustively check all set `FeatureFlags` fields in the decoded metadata.
1 parent cf931ff commit c6baf76

2 files changed

Lines changed: 38 additions & 4 deletions

File tree

google/cloud/bigtable/internal/bigtable_stub_factory.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ std::string CreateFeaturesMetadata(bool is_direct_path) {
5656
proto.set_mutate_rows_rate_limit2(true);
5757
proto.set_routing_cookie(true);
5858
proto.set_retry_info(true);
59+
proto.set_peer_info(true);
5960
if (is_direct_path) {
6061
proto.set_traffic_director_enabled(true);
6162
proto.set_direct_access_requested(true);

google/cloud/bigtable/internal/bigtable_stub_factory_test.cc

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,21 @@ TEST(BigtableStubFactory, FeaturesFlagsCloudDirectPath) {
300300
auto headers = fixture.GetMetadata(context);
301301
auto it = headers.find("bigtable-features");
302302
EXPECT_NE(it, headers.end());
303+
if (it == headers.end())
304+
return internal::AbortedError("header not found");
303305
auto decoded = internal::UrlsafeBase64Decode(it->second);
304306
EXPECT_STATUS_OK(decoded);
305307
if (!decoded) return internal::AbortedError("fail to decode");
306308
google::bigtable::v2::FeatureFlags proto;
307309
EXPECT_TRUE(proto.ParseFromArray(
308310
decoded->data(), static_cast<int>(decoded->size())));
311+
EXPECT_TRUE(proto.reverse_scans());
312+
EXPECT_TRUE(proto.last_scanned_row_responses());
313+
EXPECT_TRUE(proto.mutate_rows_rate_limit());
314+
EXPECT_TRUE(proto.mutate_rows_rate_limit2());
315+
EXPECT_TRUE(proto.routing_cookie());
316+
EXPECT_TRUE(proto.retry_info());
317+
EXPECT_TRUE(proto.peer_info());
309318
EXPECT_TRUE(proto.traffic_director_enabled());
310319
EXPECT_TRUE(proto.direct_access_requested());
311320
return internal::AbortedError("fail");
@@ -341,11 +350,20 @@ TEST(BigtableStubFactory, FeaturesFlagsBigtableDirectPath) {
341350
auto it = headers.find("bigtable-features");
342351
EXPECT_NE(it, headers.end());
343352
auto decoded = internal::UrlsafeBase64Decode(it->second);
353+
if (it == headers.end())
354+
return internal::AbortedError("header not found");
344355
EXPECT_STATUS_OK(decoded);
345356
if (!decoded) return internal::AbortedError("fail to decode");
346357
google::bigtable::v2::FeatureFlags proto;
347358
EXPECT_TRUE(proto.ParseFromArray(
348359
decoded->data(), static_cast<int>(decoded->size())));
360+
EXPECT_TRUE(proto.reverse_scans());
361+
EXPECT_TRUE(proto.last_scanned_row_responses());
362+
EXPECT_TRUE(proto.mutate_rows_rate_limit());
363+
EXPECT_TRUE(proto.mutate_rows_rate_limit2());
364+
EXPECT_TRUE(proto.routing_cookie());
365+
EXPECT_TRUE(proto.retry_info());
366+
EXPECT_TRUE(proto.peer_info());
349367
EXPECT_TRUE(proto.traffic_director_enabled());
350368
EXPECT_TRUE(proto.direct_access_requested());
351369
return internal::AbortedError("fail");
@@ -378,10 +396,25 @@ TEST(BigtableStubFactory, FeaturesFlags) {
378396
google::bigtable::v2::MutateRowRequest const&) {
379397
ValidateMetadataFixture fixture;
380398
auto headers = fixture.GetMetadata(context);
381-
EXPECT_THAT(
382-
headers,
383-
Contains(Pair("bigtable-features",
384-
AllOf(Not(IsEmpty()), IsWebSafeBase64()))));
399+
auto it = headers.find("bigtable-features");
400+
EXPECT_NE(it, headers.end());
401+
if (it == headers.end())
402+
return internal::AbortedError("header not found");
403+
auto decoded = internal::UrlsafeBase64Decode(it->second);
404+
EXPECT_STATUS_OK(decoded);
405+
if (!decoded) return internal::AbortedError("fail to decode");
406+
google::bigtable::v2::FeatureFlags proto;
407+
EXPECT_TRUE(proto.ParseFromArray(
408+
decoded->data(), static_cast<int>(decoded->size())));
409+
EXPECT_TRUE(proto.reverse_scans());
410+
EXPECT_TRUE(proto.last_scanned_row_responses());
411+
EXPECT_TRUE(proto.mutate_rows_rate_limit());
412+
EXPECT_TRUE(proto.mutate_rows_rate_limit2());
413+
EXPECT_TRUE(proto.routing_cookie());
414+
EXPECT_TRUE(proto.retry_info());
415+
EXPECT_TRUE(proto.peer_info());
416+
EXPECT_FALSE(proto.traffic_director_enabled());
417+
EXPECT_FALSE(proto.direct_access_requested());
385418
return internal::AbortedError("fail");
386419
});
387420
return mock;

0 commit comments

Comments
 (0)