From 08224c1fdaf42c5938c6450e0a425c51b0017a8f Mon Sep 17 00:00:00 2001 From: naleeha Date: Tue, 10 Sep 2024 11:55:48 +0100 Subject: [PATCH] #1434 putting delay on ws test startup to fix failing test on build --- .../org/finos/vuu/wsapi/helpers/TestStartUp.scala | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/vuu/src/test/scala/org/finos/vuu/wsapi/helpers/TestStartUp.scala b/vuu/src/test/scala/org/finos/vuu/wsapi/helpers/TestStartUp.scala index b06237883..80b4c3998 100644 --- a/vuu/src/test/scala/org/finos/vuu/wsapi/helpers/TestStartUp.scala +++ b/vuu/src/test/scala/org/finos/vuu/wsapi/helpers/TestStartUp.scala @@ -11,6 +11,8 @@ import org.finos.vuu.net.json.JsonVsSerializer import org.finos.vuu.net.ws.WebSocketClient import org.finos.vuu.net.{AlwaysHappyLoginValidator, ViewServerClient, WebSocketViewServerClient} +import scala.util.Random + class TestStartUp(moduleFactoryFunc: () => ViewServerModule)( implicit val timeProvider: Clock, implicit val lifecycle: LifecycleContainer, @@ -23,7 +25,7 @@ class TestStartUp(moduleFactoryFunc: () => ViewServerModule)( lifecycle.autoShutdownHook() - val rand = new scala.util.Random + val rand = new Random val http = rand.between(10011, 10500) val ws = rand.between(10011, 10500) @@ -31,7 +33,6 @@ class TestStartUp(moduleFactoryFunc: () => ViewServerModule)( val config = VuuServerConfig( VuuHttp2ServerOptions() - .withWebRoot("vuu/src/main/resources/www") .withSslDisabled() .withDirectoryListings(true) .withPort(http), @@ -61,6 +62,12 @@ class TestStartUp(moduleFactoryFunc: () => ViewServerModule)( //lifecycle registration is done in constructor of service classes, so sequence of create is important lifecycle.start() + WaitForWebSocketConnectionToBeEstablished() + vuuClient } + + private def WaitForWebSocketConnectionToBeEstablished(): Unit = { + Thread.sleep(200) + } }