diff --git a/google-cloud-bigtable/pom.xml b/google-cloud-bigtable/pom.xml index 1c1895bb28..6f0bcd731e 100644 --- a/google-cloud-bigtable/pom.xml +++ b/google-cloud-bigtable/pom.xml @@ -350,6 +350,7 @@ org.apache.maven.plugins maven-failsafe-plugin + false 1 none @@ -556,6 +557,43 @@ + + bigtable-traffic-director-cfe-it + + + + maven-failsafe-plugin + + + traffic-director-cfe-it + + integration-test + verify + + + false + + + cloud + ${bigtable.cfe-data-endpoint} + ${bigtable.cfe-admin-endpoint} + ${bigtable.enable-grpc-logs} + ${project.build.directory}/test-grpc-logs/traffic-director-cfe-it + REQUIRE_TRAFFIC_DIRECTOR_CFE + + + com.google.cloud.bigtable.**.it.*IT + + ${project.build.directory}/failsafe-reports/failsafe-summary-traffic-director-cfe-it.xml + ${project.build.directory}/failsafe-reports/traffic-director-cfe-it + + + + + + + + bigtable-directpath-ipv4only-it diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/test_helpers/env/AbstractTestEnv.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/test_helpers/env/AbstractTestEnv.java index fd363099d9..025e1238e9 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/test_helpers/env/AbstractTestEnv.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/test_helpers/env/AbstractTestEnv.java @@ -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 } diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/test_helpers/env/CloudEnv.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/test_helpers/env/CloudEnv.java index ba0fda8b2c..287ad2a0fb 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/test_helpers/env/CloudEnv.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/test_helpers/env/CloudEnv.java @@ -127,6 +127,7 @@ private CloudEnv( setupRemoteAddrInterceptor(dataSettings.stubSettings()); configureUserAgent(dataSettings.stubSettings()); + configureDirectPath(dataSettings.stubSettings()); this.tableAdminSettings = BigtableTableAdminSettings.newBuilder().setProjectId(projectId).setInstanceId(instanceId); @@ -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", @@ -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: @@ -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());