Skip to content

Commit

Permalink
test: update profiles for DirectPath & traffic director
Browse files Browse the repository at this point in the history
Change-Id: Id25e77e4fd893299a688f03a48ef274fe793cc1c
  • Loading branch information
igorbernstein2 committed Oct 24, 2023
1 parent 2104315 commit e805af0
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
38 changes: 38 additions & 0 deletions google-cloud-bigtable/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<reuseForks>false</reuseForks>
<forkCount>1</forkCount>
<parallel>none</parallel>
</configuration>
Expand Down Expand Up @@ -556,6 +557,43 @@
</build>
</profile>

<profile>
<id>bigtable-traffic-director-cfe-it</id>
<build>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>traffic-director-cfe-it</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<skip>false</skip>

<systemPropertyVariables>
<bigtable.env>cloud</bigtable.env>
<bigtable.data-endpoint>${bigtable.cfe-data-endpoint}</bigtable.data-endpoint>
<bigtable.admin-endpoint>${bigtable.cfe-admin-endpoint}</bigtable.admin-endpoint>
<bigtable.enable-grpc-logs>${bigtable.enable-grpc-logs}</bigtable.enable-grpc-logs>
<bigtable.grpc-log-dir>${project.build.directory}/test-grpc-logs/traffic-director-cfe-it</bigtable.grpc-log-dir>
<bigtable.connection-mode>REQUIRE_TRAFFIC_DIRECTOR_CFE</bigtable.connection-mode>
</systemPropertyVariables>
<includes>
<include>com.google.cloud.bigtable.**.it.*IT</include>
</includes>
<summaryFile>${project.build.directory}/failsafe-reports/failsafe-summary-traffic-director-cfe-it.xml</summaryFile>
<reportsDirectory>${project.build.directory}/failsafe-reports/traffic-director-cfe-it</reportsDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>


<profile>
<id>bigtable-directpath-ipv4only-it</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public abstract class AbstractTestEnv {
public enum ConnectionMode {
DEFAULT,
REQUIRE_CFE,
REQUIRE_TRAFFIC_DIRECTOR_CFE,
REQUIRE_DIRECT_PATH,
REQUIRE_DIRECT_PATH_IPV4
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ private CloudEnv(

setupRemoteAddrInterceptor(dataSettings.stubSettings());
configureUserAgent(dataSettings.stubSettings());
configureDirectPath(dataSettings.stubSettings());

this.tableAdminSettings =
BigtableTableAdminSettings.newBuilder().setProjectId(projectId).setInstanceId(instanceId);
Expand Down Expand Up @@ -159,6 +160,7 @@ private void setupRemoteAddrInterceptor(StubSettings.Builder stubSettings) {
buildRemoteAddrInterceptor("DirectPath IPv4", Predicates.or(DIRECT_PATH_IPV4_MATCHER));
break;
case REQUIRE_CFE:
case REQUIRE_TRAFFIC_DIRECTOR_CFE:
interceptor =
buildRemoteAddrInterceptor(
"a CFE ip",
Expand Down Expand Up @@ -239,6 +241,7 @@ private void configureUserAgent(EnhancedBigtableStubSettings.Builder stubSetting
// nothing special
break;
case REQUIRE_CFE:
case REQUIRE_TRAFFIC_DIRECTOR_CFE:
parts.add("bigtable-directpath-disable");
break;
case REQUIRE_DIRECT_PATH:
Expand All @@ -265,6 +268,29 @@ private void configureUserAgent(EnhancedBigtableStubSettings.Builder stubSetting
stubSettings.setHeaderProvider(FixedHeaderProvider.create(newHeaders));
}

private void configureDirectPath(EnhancedBigtableStubSettings.Builder stubSettings) {
InstantiatingGrpcChannelProvider transportChannelProvider =
(InstantiatingGrpcChannelProvider) stubSettings.getTransportChannelProvider();

switch (getConnectionMode()) {
case REQUIRE_DIRECT_PATH:
case REQUIRE_DIRECT_PATH_IPV4:
case REQUIRE_TRAFFIC_DIRECTOR_CFE:
transportChannelProvider =
transportChannelProvider
.toBuilder()
.setAttemptDirectPath(true)
.setAttemptDirectPathXds()
.build();
break;
case DEFAULT:
case REQUIRE_CFE:
default:
// noop
}
stubSettings.setTransportChannelProvider(transportChannelProvider);
}

@Override
void start() throws IOException {
dataClient = BigtableDataClient.create(dataSettings.build());
Expand Down

0 comments on commit e805af0

Please sign in to comment.