ihji commented on a change in pull request #12106:
URL: https://github.com/apache/beam/pull/12106#discussion_r462534513



##########
File path: 
sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryServicesImplTest.java
##########
@@ -733,26 +734,29 @@ public void testInsertOtherRetry() throws Throwable {
     when(response.getContent())
         .thenReturn(toStream(errorWithReasonAndStatus("actually forbidden", 
403)))
         .thenReturn(toStream(new TableDataInsertAllResponse()));
-
-    DatasetServiceImpl dataService =
-        new DatasetServiceImpl(bigquery, PipelineOptionsFactory.create());
-    dataService.insertAll(
-        ref,
-        rows,
-        null,
-        BackOffAdapter.toGcpBackOff(TEST_BACKOFF.backoff()),
-        TEST_BACKOFF,
-        new MockSleeper(),
-        InsertRetryPolicy.alwaysRetry(),
-        null,
-        null,
-        false,
-        false,
-        false);
-    verify(response, times(2)).getStatusCode();
-    verify(response, times(2)).getContent();
-    verify(response, times(2)).getContentType();
-    expectedLogs.verifyInfo("BigQuery insertAll error, retrying:");
+    try {
+      DatasetServiceImpl dataService =
+          new DatasetServiceImpl(bigquery, PipelineOptionsFactory.create());
+      dataService.insertAll(
+          ref,
+          rows,
+          null,
+          BackOffAdapter.toGcpBackOff(TEST_BACKOFF.backoff()),
+          TEST_BACKOFF,
+          new MockSleeper(),
+          InsertRetryPolicy.alwaysRetry(),
+          null,
+          null,
+          false,
+          false,
+          false);
+      fail();
+    } catch (RuntimeException e) {
+      assertTrue(e instanceof RuntimeException);

Review comment:
       I think it looks better to use `thrown.expect` and 
`thrown.expectMessage` instead of `assertTrue` with `instanceof`.

##########
File path: 
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryServicesImpl.java
##########
@@ -806,6 +811,19 @@ public void deleteDataset(String projectId, String 
datasetId)
                         try {
                           return insert.execute().getInsertErrors();
                         } catch (IOException e) {
+                          GoogleJsonError.ErrorInfo errorInfo = 
getErrorInfo(e);
+                          if (errorInfo == null) {
+                            throw e;
+                          }
+                          /**
+                           * TODO:Check for quotaExceededError The check will 
be replaced by

Review comment:
       TODO(BEAM-10584): Check for QUOTA_EXCEEDED error will be replaced by




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to