https://kotlinlang.org logo
#kotest
Title
# kotest
s

Sebastian Schuberth

11/27/2021, 2:36 PM
After upgrading to Kotest 5.0.0 (from 4.6.3) I'm seeing some unit test fail that use Wiremock to start / stop a server in
beforeSpec {}
/
afterSpec {}
, see https://dev.azure.com/oss-review-toolkit/ort/_build/results?buildId=6317&view=ms.vs[…]ld-test-results-tab&runId=38928&resultId=100025&paneView=debug. Is anyone else experiencing problems with Kotest 5 & Wiremock?
The issue apparently cannot be reproduced when just running the single test on its own; it only appears when also running other tests that use Wiremock.
To reproduce, checkout https://github.com/oss-review-toolkit/ort/tree/kotest-upgrade and run
./gradlew :advisor:test
.
b

Big Chungus

11/27/2021, 2:46 PM
Smells like some leaking race condition.
Or maybe your mocks are not cleaned up from other tests. Are you using shared instance of wiremock for all your tests?
s

Sebastian Schuberth

11/27/2021, 2:54 PM
Each spec uses its own
WireMockServer
for all its contained tests.
e

Emil Kantis

11/27/2021, 3:29 PM
Is it always failing with connecting to port 8080? Your wiremock server says it should use a dynamic port, so not sure where the 8080 comes from?
s

Sebastian Schuberth

11/27/2021, 3:38 PM
Good catch about the 8080, it actually should be a random port...
Looks like calling
configureFor()
in
beforeTest()
instead of in
beforeSpec()
solved it...
2 Views