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

test: add test to ensure that feature flags are sent during a ping and warm rpc #2425

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.37.0</version>
<version>26.50.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
import com.google.cloud.bigtable.data.v2.models.sql.Statement;
import com.google.cloud.bigtable.data.v2.stub.sql.ExecuteQueryCallable;
import com.google.cloud.bigtable.data.v2.stub.sql.SqlServerStream;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Queues;
import com.google.common.io.BaseEncoding;
Expand Down Expand Up @@ -291,6 +292,26 @@ public void testFeatureFlags() throws InterruptedException, IOException, Executi
assertThat(featureFlags.getLastScannedRowResponses()).isTrue();
}

@Test
public void testPingAndWarmFeatureFlags()
throws InterruptedException, IOException, ExecutionException {
EnhancedBigtableStubSettings settings =
defaultSettings.toBuilder().setRefreshingChannel(true).build();
try (EnhancedBigtableStub ignored = EnhancedBigtableStub.create(settings)) {
Preconditions.checkState(
!fakeDataService.pingRequests.isEmpty(), "Ping request was not sent during setup");
Metadata metadata = metadataInterceptor.headers.take();

String encodedFeatureFlags =
metadata.get(Key.of("bigtable-features", Metadata.ASCII_STRING_MARSHALLER));
FeatureFlags featureFlags =
FeatureFlags.parseFrom(BaseEncoding.base64Url().decode(encodedFeatureFlags));

assertThat(featureFlags.getReverseScans()).isTrue();
assertThat(featureFlags.getLastScannedRowResponses()).isTrue();
igorbernstein2 marked this conversation as resolved.
Show resolved Hide resolved
}
}

@Test
public void testCheckAndMutateRequestResponseConversion()
throws ExecutionException, InterruptedException {
Expand Down
Loading