vio
04/26/2021, 1:58 PMClosedWatchServiceException
, when running multiple tests all together. I'm using ktor: 1.5.2
, and having a jetty
server. The issue is thrown when the server is restarted in following tests.
here's a code snippet to exemplify the error:
class StartStopServerTest : FreeSpec({
"server" - {
val server = embeddedServer(
factory = Jetty,
port = 8080,
module = {}
)
"start" {
server.start()
}
"stop" {
server.stop(1000, 1000)
}
"restart" {
server.start() // this fails with the error as shown in the picture
}
"stop again" {
server.stop(1000, 1000)
}
}
})
Did anybody face this as well? Appreciate any suggestions and help, thank you 🙏vio
04/27/2021, 11:47 AMvio
04/27/2021, 11:48 AM"scratch server" - {
var server = server() // instantiate
"start" {
server.start()
}
"stop" {
server.stop(10000, 10000)
}
"restart" {
server = server() // new instance
server.start()
}
"stop again" {
server.stop(1000, 1000)
}
}
fun server() =
embeddedServer(
factory = Jetty,
port = 8080,
module = {}
)