hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject [3/4] httpcomponents-client git commit: Improved flaky test case
Date Wed, 03 Jan 2018 18:47:27 GMT
Improved flaky test case


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/commit/71060c7e
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/tree/71060c7e
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/diff/71060c7e

Branch: refs/heads/master
Commit: 71060c7ee147e6de5540fd6b72f1eefcd868ff23
Parents: b45b72e
Author: Oleg Kalnichevski <olegk@apache.org>
Authored: Wed Jan 3 15:58:34 2018 +0100
Committer: Oleg Kalnichevski <olegk@apache.org>
Committed: Wed Jan 3 19:37:19 2018 +0100

----------------------------------------------------------------------
 .../testing/async/AbstractHttpAsyncFundamentalsTest.java      | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/71060c7e/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java
----------------------------------------------------------------------
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java
b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java
index dc8839a..6f36fd8 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java
@@ -179,7 +179,9 @@ public abstract class AbstractHttpAsyncFundamentalsTest<T extends CloseableHttpA
 
                 @Override
                 public void run() {
-                    httpclient.execute(SimpleHttpRequest.get(target, "/random/2048"), callback);
+                    if (!Thread.currentThread().isInterrupted()) {
+                        httpclient.execute(SimpleHttpRequest.get(target, "/random/2048"),
callback);
+                    }
                 }
 
             });
@@ -187,6 +189,9 @@ public abstract class AbstractHttpAsyncFundamentalsTest<T extends CloseableHttpA
 
         Assert.assertThat(countDownLatch.await(TIMEOUT.getDuration(), TIMEOUT.getTimeUnit()),
CoreMatchers.equalTo(true));
 
+        executorService.shutdownNow();
+        executorService.awaitTermination(TIMEOUT.getDuration(), TIMEOUT.getTimeUnit());
+
         for (;;) {
             final SimpleHttpResponse response = resultQueue.poll();
             if (response == null) {


Mime
View raw message