Skip to content

Commit 1436cc5

Browse files
authored
ci: Run tests in parallel (#3171)
* chore: Add samples showcases reading a timestamp value from public dataset * docs: Add samples for using timestamps with BQStorage Read and Write API * chore: Add missing header * chore: Remove fmt plugin in samples * chore: Fix samples lint issues * chore: Add ITs for the added samples * chore: Fix commented out nested samples * chore: Address code comments * chore: Address code comments * chore: Use long for expectedRowCount * chore: Fix checkstyle issue * chore: Run tests in same thread * chore: Run certain tests single threaded * chore: Add another test to run sequentially
1 parent 9765940 commit 1436cc5

File tree

13 files changed

+38
-3
lines changed

13 files changed

+38
-3
lines changed

google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1/BigQueryReadClientTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@
5252
import org.junit.jupiter.api.BeforeAll;
5353
import org.junit.jupiter.api.BeforeEach;
5454
import org.junit.jupiter.api.Test;
55+
import org.junit.jupiter.api.parallel.Execution;
56+
import org.junit.jupiter.api.parallel.ExecutionMode;
5557

58+
@Execution(ExecutionMode.SAME_THREAD)
5659
class BigQueryReadClientTest {
5760
private static MockBigQueryRead mockBigQueryRead;
5861
private static MockServiceHelper serviceHelper;

google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1/ConnectionWorkerPoolTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@
4747
import java.util.function.Supplier;
4848
import org.junit.jupiter.api.BeforeEach;
4949
import org.junit.jupiter.api.Test;
50+
import org.junit.jupiter.api.parallel.Execution;
51+
import org.junit.jupiter.api.parallel.ExecutionMode;
5052

53+
@Execution(ExecutionMode.SAME_THREAD)
5154
class ConnectionWorkerPoolTest {
5255

5356
private FakeBigQueryWrite testBigQueryWrite;

google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1/ConnectionWorkerTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@
6464
import org.junit.jupiter.api.AfterEach;
6565
import org.junit.jupiter.api.BeforeEach;
6666
import org.junit.jupiter.api.Test;
67+
import org.junit.jupiter.api.parallel.Execution;
68+
import org.junit.jupiter.api.parallel.ExecutionMode;
6769

70+
@Execution(ExecutionMode.SAME_THREAD)
6871
class ConnectionWorkerTest {
6972
private static final Logger log = Logger.getLogger(StreamWriter.class.getName());
7073
private static final String TEST_STREAM_1 = "projects/p1/datasets/d1/tables/t1/streams/s1";

google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1/JsonStreamWriterTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@
6666
import org.junit.jupiter.api.AfterEach;
6767
import org.junit.jupiter.api.BeforeEach;
6868
import org.junit.jupiter.api.Test;
69+
import org.junit.jupiter.api.parallel.Execution;
70+
import org.junit.jupiter.api.parallel.ExecutionMode;
6971

72+
@Execution(ExecutionMode.SAME_THREAD)
7073
class JsonStreamWriterTest {
7174

7275
private static final int NUMERIC_SCALE = 9;

google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1/RequestProfilerTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@
3131
import org.junit.jupiter.api.AfterEach;
3232
import org.junit.jupiter.api.BeforeEach;
3333
import org.junit.jupiter.api.Test;
34+
import org.junit.jupiter.api.parallel.Execution;
35+
import org.junit.jupiter.api.parallel.ExecutionMode;
3436

37+
@Execution(ExecutionMode.SAME_THREAD)
3538
class RequestProfilerTest {
3639
private static final Logger log = Logger.getLogger(RequestProfiler.class.getName());
3740

@@ -164,6 +167,9 @@ void concurrentProfilingTest_1000ReqsRunTogether() throws Exception {
164167
assertTrue(reportText.contains("Request uuid: request_30 with total time"));
165168
assertTrue(reportText.contains("Request uuid: request_25 with total time"));
166169
assertTrue(reportText.contains("Request uuid: request_20 with total time"));
170+
171+
threadPool.shutdown();
172+
threadPool.awaitTermination(10, TimeUnit.SECONDS);
167173
}
168174

169175
@Test
@@ -208,5 +214,8 @@ void concurrentProfilingTest_RunWhileFlushing() throws Exception {
208214
}
209215
String reportText = profilerHook.flushAndGenerateReportText();
210216
assertTrue(reportText.contains("0 requests finished during"));
217+
218+
threadPool.shutdown();
219+
threadPool.awaitTermination(10, TimeUnit.SECONDS);
211220
}
212221
}

google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1/StreamWriterTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@
9595
import org.junit.jupiter.api.AfterEach;
9696
import org.junit.jupiter.api.BeforeEach;
9797
import org.junit.jupiter.api.Test;
98+
import org.junit.jupiter.api.parallel.Execution;
99+
import org.junit.jupiter.api.parallel.ExecutionMode;
98100

101+
@Execution(ExecutionMode.SAME_THREAD)
99102
class StreamWriterTest {
100103

101104
private static final Logger log = Logger.getLogger(StreamWriterTest.class.getName());

google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1/it/ITBigQueryStorageWriteClientTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,11 @@
9595
import org.junit.jupiter.api.AfterAll;
9696
import org.junit.jupiter.api.BeforeAll;
9797
import org.junit.jupiter.api.Test;
98+
import org.junit.jupiter.api.parallel.Execution;
99+
import org.junit.jupiter.api.parallel.ExecutionMode;
98100

99101
/** Integration tests for BigQuery Write API. */
102+
@Execution(ExecutionMode.SAME_THREAD)
100103
class ITBigQueryStorageWriteClientTest {
101104
private static final Logger LOG =
102105
Logger.getLogger(ITBigQueryStorageWriteClientTest.class.getName());

google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1/stub/ResourceHeaderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class ResourceHeaderTest {
4343

4444
private static final String TEST_STREAM_NAME = "streamName";
4545

46-
private static final String NAME = "resource-header-test:123";
46+
private static final String NAME = "resource-header-test:123-v1";
4747

4848
private static final String HEADER_NAME = "x-goog-request-params";
4949

google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta1/BigQueryStorageClientTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@
6363
import org.junit.jupiter.api.BeforeAll;
6464
import org.junit.jupiter.api.BeforeEach;
6565
import org.junit.jupiter.api.Test;
66+
import org.junit.jupiter.api.parallel.Execution;
67+
import org.junit.jupiter.api.parallel.ExecutionMode;
6668

69+
@Execution(ExecutionMode.SAME_THREAD)
6770
class BigQueryStorageClientTest {
6871
private static MockBigQueryStorage mockBigQueryStorage;
6972
private static MockServiceHelper serviceHelper;

google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta1/stub/ResourceHeaderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class ResourceHeaderTest {
5151

5252
private static final Stream TEST_STREAM = Stream.newBuilder().setName("streamName").build();
5353

54-
private static final String NAME = "resource-header-test:123";
54+
private static final String NAME = "resource-header-test:123-v1beta1";
5555

5656
private static final String HEADER_NAME = "x-goog-request-params";
5757

0 commit comments

Comments
 (0)