diff --git a/google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1alpha2/StreamWriterTest.java b/google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1alpha2/StreamWriterTest.java index 7a96b87829..aa998725a3 100644 --- a/google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1alpha2/StreamWriterTest.java +++ b/google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1alpha2/StreamWriterTest.java @@ -834,68 +834,4 @@ public void testExistingClient() throws Exception { client.shutdown(); client.awaitTermination(1, TimeUnit.MINUTES); } - - @Test - public void testFlushAll() throws Exception { - StreamWriter writer = - getTestStreamWriterBuilder() - .setBatchingSettings( - StreamWriter.Builder.DEFAULT_BATCHING_SETTINGS - .toBuilder() - .setElementCountThreshold(2L) - .setDelayThreshold(Duration.ofSeconds(100000)) - .build()) - .build(); - - testBigQueryWrite.addResponse(AppendRowsResponse.newBuilder().setOffset(0).build()); - testBigQueryWrite.addResponse(AppendRowsResponse.newBuilder().setOffset(2).build()); - testBigQueryWrite.addResponse(AppendRowsResponse.newBuilder().setOffset(3).build()); - - ApiFuture appendFuture1 = sendTestMessage(writer, new String[] {"A"}); - ApiFuture appendFuture2 = sendTestMessage(writer, new String[] {"B"}); - ApiFuture appendFuture3 = sendTestMessage(writer, new String[] {"C"}); - - writer.flushAll(100000); - - assertTrue(appendFuture3.isDone()); - - writer.close(); - } - - @Test - public void testFlushAllFailed() throws Exception { - StreamWriter writer = - getTestStreamWriterBuilder() - .setBatchingSettings( - StreamWriter.Builder.DEFAULT_BATCHING_SETTINGS - .toBuilder() - .setElementCountThreshold(2L) - .setDelayThreshold(Duration.ofSeconds(100000)) - .build()) - .build(); - - testBigQueryWrite.addException(Status.DATA_LOSS.asException()); - testBigQueryWrite.addException(Status.DATA_LOSS.asException()); - testBigQueryWrite.addException(Status.DATA_LOSS.asException()); - - ApiFuture appendFuture1 = sendTestMessage(writer, new String[] {"A"}); - ApiFuture appendFuture2 = sendTestMessage(writer, new String[] {"B"}); - ApiFuture appendFuture3 = sendTestMessage(writer, new String[] {"C"}); - - assertFalse(appendFuture3.isDone()); - try { - writer.flushAll(100000); - fail("Should have thrown an Exception"); - } catch (Exception expected) { - if (expected.getCause() instanceof com.google.api.gax.rpc.DataLossException) { - LOG.info("got: " + expected.toString()); - } else { - fail("Unexpected exception:" + expected.toString()); - } - } - - assertTrue(appendFuture3.isDone()); - - writer.close(); - } }