Skip to content

Commit e1c7804

Browse files
test: add test to ensure that feature flags are sent during a ping and warm rpc (#2425)
Change-Id: I7d8ac74eae66d34de453b0cd799f45474d6ff0f7 Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://togithub.com/googleapis/java-bigtable/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) - [ ] Rollback plan is reviewed and LGTMed - [ ] All new data plane features have a completed end to end testing plan Fixes #<issue_number_goes_here> ☕️ If you write sample code, please follow the [samples format]( https://togithub.com/GoogleCloudPlatform/java-docs-samples/blob/main/SAMPLE_FORMAT.md).
1 parent 7b6e3be commit e1c7804

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubTest.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
import com.google.cloud.bigtable.data.v2.stub.metrics.NoopMetricsProvider;
8888
import com.google.cloud.bigtable.data.v2.stub.sql.ExecuteQueryCallable;
8989
import com.google.cloud.bigtable.data.v2.stub.sql.SqlServerStream;
90+
import com.google.common.base.Preconditions;
9091
import com.google.common.collect.ImmutableMap;
9192
import com.google.common.collect.Queues;
9293
import com.google.common.io.BaseEncoding;
@@ -285,6 +286,28 @@ public void testFeatureFlags() throws InterruptedException, IOException, Executi
285286
assertThat(featureFlags.getLastScannedRowResponses()).isTrue();
286287
}
287288

289+
@Test
290+
public void testPingAndWarmFeatureFlags()
291+
throws InterruptedException, IOException, ExecutionException {
292+
EnhancedBigtableStubSettings settings =
293+
defaultSettings.toBuilder().setRefreshingChannel(true).build();
294+
try (EnhancedBigtableStub ignored = EnhancedBigtableStub.create(settings)) {
295+
Preconditions.checkState(
296+
!fakeDataService.pingRequests.isEmpty(), "Ping request was not sent during setup");
297+
Metadata metadata = metadataInterceptor.headers.take();
298+
299+
String encodedFeatureFlags =
300+
metadata.get(Key.of("bigtable-features", Metadata.ASCII_STRING_MARSHALLER));
301+
FeatureFlags featureFlags =
302+
FeatureFlags.parseFrom(BaseEncoding.base64Url().decode(encodedFeatureFlags));
303+
304+
assertThat(featureFlags.getReverseScans()).isTrue();
305+
assertThat(featureFlags.getLastScannedRowResponses()).isTrue();
306+
assertThat(featureFlags.getRoutingCookie()).isTrue();
307+
assertThat(featureFlags.getRetryInfo()).isTrue();
308+
}
309+
}
310+
288311
@Test
289312
public void testCheckAndMutateRequestResponseConversion()
290313
throws ExecutionException, InterruptedException {

0 commit comments

Comments
 (0)