From 51ab59c057b17fcdf440d70d6daf06e672e4050f Mon Sep 17 00:00:00 2001 From: Ivan Topolnak Date: Tue, 20 May 2014 18:17:23 -0300 Subject: = spray: give more time to bind the ports when using the test server --- kamon-spray/src/test/scala/kamon/spray/TestServer.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'kamon-spray/src/test/scala') diff --git a/kamon-spray/src/test/scala/kamon/spray/TestServer.scala b/kamon-spray/src/test/scala/kamon/spray/TestServer.scala index e2d012ab..b448eb02 100644 --- a/kamon-spray/src/test/scala/kamon/spray/TestServer.scala +++ b/kamon-spray/src/test/scala/kamon/spray/TestServer.scala @@ -21,6 +21,7 @@ import spray.can.Http import akka.actor.ActorRef import akka.io.IO import akka.io.Tcp.Bound +import scala.concurrent.duration._ trait TestServer { self: TestKitBase ⇒ @@ -28,7 +29,9 @@ trait TestServer { def buildClientConnectionAndServer: (ActorRef, TestProbe) = { val serverHandler = TestProbe() IO(Http).tell(Http.Bind(listener = serverHandler.ref, interface = "127.0.0.1", port = 0), serverHandler.ref) - val bound = serverHandler.expectMsgType[Bound] + val bound = within(10 seconds) { + serverHandler.expectMsgType[Bound] + } val client = clientConnection(bound) serverHandler.expectMsgType[Http.Connected] -- cgit v1.2.3