nielm commented on code in PR #22023:
URL: https://github.com/apache/beam/pull/22023#discussion_r906145815


##########
sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/spanner/SpannerIOWriteExceptionHandlingTest.java:
##########
@@ -171,9 +163,21 @@ public void testExceptionHandlingForSimpleWrite() throws 
InterruptedException {
     try {
       pipeline.run().waitUntilFinish();
     } finally {
-      verify(SpannerIO.WriteToSpannerFn.sleeper, 
times(callsToSleeper)).sleep(anyLong());
-      verify(serviceFactory.mockDatabaseClient(), times(callsToWrite))
-          .writeAtLeastOnceWithOptions(any(), 
any(Options.ReadQueryUpdateTransactionOption.class));
+      if (exceptionErrorcode == ErrorCode.DEADLINE_EXCEEDED) {
+        // Due to randomOffset retry is done by most likely but not always 9 
times.
+        int sleepCalled =
+            
Mockito.mockingDetails(SpannerIO.WriteToSpannerFn.sleeper).getInvocations().size();
+        assertTrue(sleepCalled >= 8);
+        assertTrue(sleepCalled <= 10);

Review Comment:
   That was more effort than I was prepared to do - I was just going to test 
that steeps >= 8 and  writes >= 9!



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to