Skip to content

Commit fe2eff7

Browse files
authored
fix: patch jwt audience for test (#4491)
1 parent 888b74d commit fe2eff7

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

bigtable-client-core-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/BigtableOptionsFactory.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package com.google.cloud.bigtable.hbase;
1717

1818
import com.google.api.core.BetaApi;
19+
import com.google.api.core.InternalApi;
1920
import com.google.api.core.InternalExtensionOnly;
2021
import com.google.common.annotations.VisibleForTesting;
2122

@@ -341,4 +342,8 @@ public class BigtableOptionsFactory {
341342
/** Sets if client side metrics should be enabled. Client side metrics is enabled by default. */
342343
public static final String BIGTABLE_ENABLE_CLIENT_SIDE_METRICS =
343344
"google.bigtable.enable.client.side.metrics";
345+
346+
/** Override jwt audience in test environment. * */
347+
@InternalApi
348+
public static final String BIGTABLE_JWT_AUDIENCE_KEY = "google.bigtable.jwt.audience";
344349
}

bigtable-client-core-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/wrappers/veneer/BigtableHBaseVeneerSettings.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import static com.google.cloud.bigtable.hbase.BigtableOptionsFactory.BIGTABLE_ENABLE_BULK_MUTATION_FLOW_CONTROL;
3333
import static com.google.cloud.bigtable.hbase.BigtableOptionsFactory.BIGTABLE_ENABLE_CLIENT_SIDE_METRICS;
3434
import static com.google.cloud.bigtable.hbase.BigtableOptionsFactory.BIGTABLE_HOST_KEY;
35+
import static com.google.cloud.bigtable.hbase.BigtableOptionsFactory.BIGTABLE_JWT_AUDIENCE_KEY;
3536
import static com.google.cloud.bigtable.hbase.BigtableOptionsFactory.BIGTABLE_MUTATE_RPC_ATTEMPT_TIMEOUT_MS_KEY;
3637
import static com.google.cloud.bigtable.hbase.BigtableOptionsFactory.BIGTABLE_MUTATE_RPC_TIMEOUT_MS_KEY;
3738
import static com.google.cloud.bigtable.hbase.BigtableOptionsFactory.BIGTABLE_NULL_CREDENTIAL_ENABLE_KEY;
@@ -83,6 +84,7 @@
8384
import com.google.cloud.bigtable.data.v2.models.Row;
8485
import com.google.cloud.bigtable.data.v2.stub.BigtableBatchingCallSettings;
8586
import com.google.cloud.bigtable.data.v2.stub.BigtableBulkReadRowsCallSettings;
87+
import com.google.cloud.bigtable.data.v2.stub.EnhancedBigtableStubSettings;
8688
import com.google.cloud.bigtable.data.v2.stub.metrics.NoopMetricsProvider;
8789
import com.google.cloud.bigtable.hbase.BigtableConfiguration;
8890
import com.google.cloud.bigtable.hbase.BigtableExtendedConfiguration;
@@ -461,6 +463,8 @@ private void configureConnection(
461463
Optional<String> hostOverride = Optional.fromNullable(configuration.get(endpointKey));
462464
Optional<String> portOverride = Optional.fromNullable(configuration.get(BIGTABLE_PORT_KEY));
463465
Optional<String> endpointOverride = Optional.absent();
466+
Optional<String> jwtAudienceOverride =
467+
Optional.fromNullable(configuration.get(BIGTABLE_JWT_AUDIENCE_KEY));
464468

465469
if (hostOverride.isPresent() || portOverride.isPresent()) {
466470
endpointOverride =
@@ -478,6 +482,12 @@ private void configureConnection(
478482
LOG.debug("%s is configured at %s", endpointKey, endpointOverride);
479483
}
480484

485+
if (jwtAudienceOverride.isPresent()
486+
&& stubSettings instanceof EnhancedBigtableStubSettings.Builder) {
487+
((EnhancedBigtableStubSettings.Builder) stubSettings)
488+
.setJwtAudience(jwtAudienceOverride.get());
489+
}
490+
481491
final InstantiatingGrpcChannelProvider.Builder channelProvider =
482492
((InstantiatingGrpcChannelProvider) stubSettings.getTransportChannelProvider()).toBuilder();
483493

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ limitations under the License.
5555
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
5656

5757
<!-- core dependency versions -->
58-
<bigtable.version>2.57.3</bigtable.version>
59-
<google-cloud-bigtable-emulator.version>0.185.0</google-cloud-bigtable-emulator.version>
58+
<bigtable.version>2.58.2</bigtable.version>
59+
<google-cloud-bigtable-emulator.version>0.195.2</google-cloud-bigtable-emulator.version>
6060
<bigtable-metrics-api.version>1.29.2</bigtable-metrics-api.version>
6161
<!-- Optional dep for bigtable-metrics-api used for tests -->
6262
<dropwizard-metrics.version>4.2.22</dropwizard-metrics.version>

0 commit comments

Comments
 (0)