[ 
https://issues.apache.org/jira/browse/BEAM-3436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16324970#comment-16324970
 ] 

ASF GitHub Bot commented on BEAM-3436:
--------------------------------------

lukecwik closed pull request #4407: [BEAM-3436] Fix 
RetryHttpRequestInitializerTest to use fake clock/sleeper instead of actually 
waiting.
URL: https://github.com/apache/beam/pull/4407
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/sdks/java/extensions/google-cloud-platform-core/src/test/java/org/apache/beam/sdk/util/RetryHttpRequestInitializerTest.java
 
b/sdks/java/extensions/google-cloud-platform-core/src/test/java/org/apache/beam/sdk/util/RetryHttpRequestInitializerTest.java
index 13a9309038e..87996cbbe79 100644
--- 
a/sdks/java/extensions/google-cloud-platform-core/src/test/java/org/apache/beam/sdk/util/RetryHttpRequestInitializerTest.java
+++ 
b/sdks/java/extensions/google-cloud-platform-core/src/test/java/org/apache/beam/sdk/util/RetryHttpRequestInitializerTest.java
@@ -48,6 +48,7 @@
 import java.net.SocketTimeoutException;
 import java.security.PrivateKey;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.concurrent.atomic.AtomicLong;
 import org.apache.beam.sdk.testing.ExpectedLogs;
 import org.hamcrest.Matchers;
@@ -255,6 +256,7 @@ public Integer answer(InvocationOnMock invocation) {
    */
   @Test
   public void testIOExceptionHandlerIsInvokedOnTimeout() throws Exception {
+    FastNanoClockAndSleeper fakeClockAndSleeper = new 
FastNanoClockAndSleeper();
     // Counts the number of calls to execute the HTTP request.
     final AtomicLong executeCount = new AtomicLong();
 
@@ -273,10 +275,18 @@ public LowLevelHttpResponse execute() throws IOException {
           }
         }).build();
 
-    // A sample HTTP request to Google Cloud Storage that uses both default 
Transport and default
-    // RetryHttpInitializer.
+    // A sample HTTP request to Google Cloud Storage that uses both a default 
Transport and
+    // effectively a default RetryHttpRequestInitializer (same args as default 
with fake
+    // clock/sleeper).
     Storage storage = new Storage.Builder(
-        transport, Transport.getJsonFactory(), new 
RetryHttpRequestInitializer()).build();
+        transport,
+        Transport.getJsonFactory(),
+        new RetryHttpRequestInitializer(
+            fakeClockAndSleeper,
+            fakeClockAndSleeper,
+            Collections.<Integer>emptyList(),
+            null)
+    ).build();
 
     Get getRequest = storage.objects().get("gs://fake", "file");
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> RetryHttpRequestInitializerTest takes 4min to complete
> ------------------------------------------------------
>
>                 Key: BEAM-3436
>                 URL: https://issues.apache.org/jira/browse/BEAM-3436
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-java-extensions, testing
>    Affects Versions: 2.2.0
>            Reporter: Ismaël Mejía
>            Assignee: Luke Cwik
>             Fix For: 2.3.0
>
>
> The class RetryHttpRequestInitializerTest that is part of the 
> beam-sdks-java-extensions-google-cloud-platform-core takes too long to 
> execute 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to