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

fix: parallel execution and verbose grpc logs #1004

Merged
merged 2 commits into from Sep 13, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 30 additions & 3 deletions google-cloud-bigtable/pom.xml
Expand Up @@ -279,6 +279,28 @@
</dependencies>

<profiles>
<profile>
<!-- Enable per-test verbose grpc logs
However, parallel test execution must be disabled to allow TestEnvRule to add/remove the
appender -->
<id>enable-verbose-grpc-logs</id>
<properties>
<bigtable.enable-grpc-logs>true</bigtable.enable-grpc-logs>
<!-- NOTE: bigtable.grpc-log-dir is configured separately for each execution -->
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<forkCount>1</forkCount>
<parallel>none</parallel>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>bigtable-emulator-it</id>
<activation>
Expand Down Expand Up @@ -587,11 +609,11 @@
<!-- enabled by profiles -->
<skip>true</skip>

<!-- Enable concurrent test execution by default -->
<parallel>classes</parallel>
<forkCount>2C</forkCount>
<threadCount>1</threadCount>
<reuseForks>true</reuseForks>
<threadCount>10</threadCount>

<!-- print full stacktraces by default -->
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
Expand All @@ -602,6 +624,11 @@
<configuration>
<!-- enable the ability to skip unit tests, while running integration tests -->
<skipTests>${skipUnitTests}</skipTests>

<!-- Enable concurrent test execution by default -->
<parallel>classes</parallel>
<threadCount>10</threadCount>

<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
Expand Down
Expand Up @@ -25,6 +25,7 @@
import com.google.cloud.bigtable.admin.v2.models.Cluster;
import com.google.cloud.bigtable.admin.v2.models.Instance;
import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableSet;
import java.io.IOException;
Expand Down Expand Up @@ -69,6 +70,8 @@
public class TestEnvRule implements TestRule {

private static final Logger LOGGER = Logger.getLogger(TestEnvRule.class.getName());
private static final Boolean BIGTABLE_ENABLE_VERBOSE_GRPC_LOGS =
Boolean.getBoolean("enable-verbose-grpc-logs");
private static final String BIGTABLE_GRPC_LOG_DIR = System.getProperty("bigtable.grpc-log-dir");
private static final String BIGTABLE_EMULATOR_HOST_ENV_VAR = "BIGTABLE_EMULATOR_HOST";
private static final String ENV_PROPERTY = "bigtable.env";
Expand Down Expand Up @@ -122,9 +125,14 @@ protected void before(Description description) throws Throwable {
}

private void configureLogging(Description description) throws IOException {
if (Strings.isNullOrEmpty(BIGTABLE_GRPC_LOG_DIR)) {
if (!BIGTABLE_ENABLE_VERBOSE_GRPC_LOGS) {
return;
}
Preconditions.checkState(
igorbernstein2 marked this conversation as resolved.
Show resolved Hide resolved
!Strings.isNullOrEmpty(BIGTABLE_GRPC_LOG_DIR),
"The property "
+ BIGTABLE_GRPC_LOG_DIR
+ " must be set when verbose grpc logs are enabled");

Files.createDirectories(Paths.get(BIGTABLE_GRPC_LOG_DIR));

Expand Down