This is an automated email from the ASF dual-hosted git repository.
lcwik pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new eca12f8 [BEAM-3436] Fix RetryHttpRequestInitializerTest to use fake
clock/sleeper instead of actually waiting. (#4407)
eca12f8 is described below
commit eca12f84faa29f23f00f351e16b43563cf699d9a
Author: Lukasz Cwik <[email protected]>
AuthorDate: Fri Jan 12 21:12:20 2018 -0800
[BEAM-3436] Fix RetryHttpRequestInitializerTest to use fake clock/sleeper
instead of actually waiting. (#4407)
* [BEAM-3436] Fix RetryHttpRequestInitializerTest to use fake clock/sleeper
instead of actually waiting.
* fixup!
---
.../beam/sdk/util/RetryHttpRequestInitializerTest.java | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
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 13a9309..87996cb 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.io.IOException;
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 class RetryHttpRequestInitializerTest {
*/
@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 class RetryHttpRequestInitializerTest {
}
}).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");
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].