Skip to content
This repository was archived by the owner on Feb 24, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,12 @@ ConnectionWorkerPool getTestOnlyConnectionWorkerPool() {
return connectionWorkerPool;
}

// A method to clear the static connectio pool to avoid making pool visible to other tests.
@VisibleForTesting
static void clearConnectionPool() {
connectionPoolMap.clear();
}

/** A builder of {@link StreamWriter}s. */
public static final class Builder {
private static final long DEFAULT_MAX_INFLIGHT_REQUESTS = 1000L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class ConnectionWorkerPoolTest {
private static MockServiceHelper serviceHelper;
private BigQueryWriteSettings clientSettings;

private static final String TEST_TRACE_ID = "home:job1";
private static final String TEST_TRACE_ID = "DATAFLOW:job_id";
private static final String TEST_STREAM_1 = "projects/p1/datasets/d1/tables/t1/streams/_default";
private static final String TEST_STREAM_2 = "projects/p1/datasets/d1/tables/t2/streams/_default";

Expand Down Expand Up @@ -372,6 +372,7 @@ public void testToTableName() {
@Test
public void testCloseExternalClient()
throws IOException, InterruptedException, ExecutionException {
StreamWriter.clearConnectionPool();
// Try append 100 requests.
long appendCount = 100L;
// testBigQueryWrite is used to
Expand Down Expand Up @@ -417,6 +418,10 @@ public void testCloseExternalClient()
assertThat(response.getAppendResult().getOffset().getValue()).isEqualTo(i);
}
assertThat(testBigQueryWrite.getAppendRequests().size()).isEqualTo(appendCount * 2);
for (int i = 0; i < streamWriterList.size(); i++) {
streamWriterList.get(i).close();
}
StreamWriter.clearConnectionPool();
}

private AppendRowsResponse createAppendResponse(long offset) {
Expand Down