From b76978ff7e68f15052dba8a82016ca1d545464cf Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 30 Dec 2016 12:22:37 -0800 Subject: [PATCH] Try to prevent Travis build failures Update LiveReloadServerTests which seems to be failing intermittently on Travis. --- .../livereload/LiveReloadServerTests.java | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/livereload/LiveReloadServerTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/livereload/LiveReloadServerTests.java index 79df32a07f8..5fd384e9f2f 100644 --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/livereload/LiveReloadServerTests.java +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/livereload/LiveReloadServerTests.java @@ -83,9 +83,8 @@ public class LiveReloadServerTests { @Test public void triggerReload() throws Exception { LiveReloadWebSocketHandler handler = connect(); - handler.setExpectedMessageCount(1); this.server.triggerReload(); - handler.awaitMessages(); + Thread.sleep(200); this.server.stop(); assertThat(handler.getMessages().get(0)) .contains("http://livereload.com/protocols/official-7"); @@ -208,8 +207,6 @@ public class LiveReloadServerTests { private final CountDownLatch helloLatch = new CountDownLatch(2); - private CountDownLatch messagesLatch; - private final List messages = new ArrayList(); private int pongCount; @@ -229,19 +226,12 @@ public class LiveReloadServerTests { Thread.sleep(200); } - public void setExpectedMessageCount(int count) { - this.messagesLatch = new CountDownLatch(count); - } - @Override protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception { if (message.getPayload().contains("hello")) { this.helloLatch.countDown(); } - if (this.messagesLatch != null) { - this.messagesLatch.countDown(); - } this.messages.add(message.getPayload()); } @@ -265,10 +255,6 @@ public class LiveReloadServerTests { this.session.close(); } - public void awaitMessages() throws InterruptedException { - this.messagesLatch.await(1, TimeUnit.MINUTES); - } - public List getMessages() { return this.messages; }