Skip to content

Commit

Permalink
finos#1434 putting delay on ws test startup to fix failing test on build
Browse files Browse the repository at this point in the history
  • Loading branch information
naleeha committed Sep 10, 2024
1 parent 09ef16f commit e322468
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions vuu/src/test/scala/org/finos/vuu/wsapi/helpers/TestStartUp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -23,15 +25,14 @@ 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)

val module: ViewServerModule = moduleFactoryFunc()

val config = VuuServerConfig(
VuuHttp2ServerOptions()
.withWebRoot("vuu/src/main/resources/www")
.withSslDisabled()
.withDirectoryListings(true)
.withPort(http),
Expand Down Expand Up @@ -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)
}
}

0 comments on commit e322468

Please sign in to comment.