Skip to content
Permalink
Browse files
fix: try to make test run a bit faster, and update some logs. (#279)
  • Loading branch information
yirutang committed May 14, 2020
1 parent 8ad4637 commit 4749b8516b8f5802091eb21fa349b1c5c58fb48a
@@ -146,7 +146,6 @@ private StreamWriter(Builder builder)
stubSettings =
BigQueryWriteSettings.newBuilder()
.setCredentialsProvider(builder.credentialsProvider)
.setExecutorProvider(builder.executorProvider)
.setTransportChannelProvider(builder.channelProvider)
.setEndpoint(builder.endpoint)
.build();
@@ -250,15 +249,14 @@ public ApiFuture<AppendRowsResponse> append(AppendRowsRequest message) {
* @throws IOException
*/
public void refreshAppend() throws IOException, InterruptedException {
LOG.info("Establish a write connection.");
synchronized (this) {
if (shutdown.get()) {
LOG.warning("Cannot refresh on a already shutdown writer.");
return;
}
// There could be a moment, stub is not yet initialized.
if (clientStream != null) {
LOG.info("Closing the stream");
LOG.info("Closing the stream " + streamName);
clientStream.closeSend();
}
messagesBatch.resetAttachSchema();
@@ -516,7 +516,7 @@ public void testStreamReconnectionExceedRetry() throws Exception {
StatusRuntimeException transientError = new StatusRuntimeException(Status.UNAVAILABLE);
testBigQueryWrite.addException(transientError);
testBigQueryWrite.addException(transientError);
ApiFuture<AppendRowsResponse> future3 = sendTestMessage(writer, new String[] {"m3"});
ApiFuture<AppendRowsResponse> future3 = sendTestMessage(writer, new String[] {"toomanyretry"});
try {
future3.get();
Assert.fail("This should fail.");
@@ -821,12 +821,11 @@ public void testBuilderInvalidArguments() {

@Test
public void testAwaitTermination() throws Exception {
StreamWriter writer =
getTestStreamWriterBuilder().setExecutorProvider(SINGLE_THREAD_EXECUTOR).build();
StreamWriter writer = getTestStreamWriterBuilder().build();
testBigQueryWrite.addResponse(AppendRowsResponse.newBuilder().build());
ApiFuture<AppendRowsResponse> appendFuture1 = sendTestMessage(writer, new String[] {"A"});
writer.shutdown();
assertTrue(writer.awaitTermination(2, TimeUnit.MINUTES));
assertTrue(writer.awaitTermination(1, TimeUnit.MINUTES));
}

@Test

0 comments on commit 4749b85

Please sign in to comment.