aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wfar...@apache.org
Subject aurora git commit: Make testTaskChangedWithOldStateError more robust
Date Mon, 13 Nov 2017 22:46:50 GMT
Repository: aurora
Updated Branches:
  refs/heads/master bd1218867 -> fb64df240


Make testTaskChangedWithOldStateError more robust

Reviewed at https://reviews.apache.org/r/63760/


Project: http://git-wip-us.apache.org/repos/asf/aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/fb64df24
Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/fb64df24
Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/fb64df24

Branch: refs/heads/master
Commit: fb64df2402327a487ab3ce14554e150c917bb6a5
Parents: bd12188
Author: Bill Farner <wfarner@apache.org>
Authored: Mon Nov 13 14:46:45 2017 -0800
Committer: Bill Farner <wfarner@apache.org>
Committed: Mon Nov 13 14:46:45 2017 -0800

----------------------------------------------------------------------
 .../aurora/scheduler/events/WebhookTest.java       | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/fb64df24/src/test/java/org/apache/aurora/scheduler/events/WebhookTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/events/WebhookTest.java b/src/test/java/org/apache/aurora/scheduler/events/WebhookTest.java
index 2906b08..adeff89 100644
--- a/src/test/java/org/apache/aurora/scheduler/events/WebhookTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/events/WebhookTest.java
@@ -19,6 +19,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ExecutionException;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
@@ -180,16 +181,20 @@ public class WebhookTest {
 
   @Test
   public void testTaskChangedWithOldStateError() throws Exception {
-    // We have a special handler here to cause a TimeoutException to trigger `onThrowable`
+    // We have a special handler here to trigger `onThrowable` on the client.
     jettyServer.setHandler(new AbstractHandler() {
       @Override
       public void handle(String target, Request baseRequest, HttpServletRequest request,
                          HttpServletResponse response) throws IOException, ServletException
{
-        try {
-          Thread.sleep(TIMEOUT + 100);
-        } catch (InterruptedException e) {
-          // Should never get here.
-        }
+
+        Stream.of(jettyServer.getConnectors())
+            .forEach(c -> {
+              try {
+                c.stop();
+              } catch (Exception e) {
+                throw new RuntimeException(e);
+              }
+            });
       }
     });
     jettyServer.start();


Mime
View raw message