From 5fa463d04b1e9ac35379f774571af6c50ce6d41a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=E2=80=9CCLOVIS=E2=80=9D=20Canet?= Date: Sun, 2 Aug 2026 12:10:29 +0200 Subject: [PATCH] test(driver-multiplatform-wire): More precise logs when the connection cannot be established --- driver-multiplatform-wire/src/commonTest/kotlin/Utils.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/driver-multiplatform-wire/src/commonTest/kotlin/Utils.kt b/driver-multiplatform-wire/src/commonTest/kotlin/Utils.kt index 84490fc0..eb1c84ce 100644 --- a/driver-multiplatform-wire/src/commonTest/kotlin/Utils.kt +++ b/driver-multiplatform-wire/src/commonTest/kotlin/Utils.kt @@ -39,6 +39,7 @@ val mongoAddress by shared { val candidateHostNames = listOf("localhost", "mongo") println(" Searching for the address of the running MongoDB instance…") + val errors = mutableListOf() for (hostName in candidateHostNames) { val address = InetSocketAddress(hostName, 27017) @@ -55,11 +56,15 @@ val mongoAddress by shared { return@coroutineScope address } catch (e: Exception) { println(" Could not connect to MongoDB on socket $address • $e") + errors += AssertionError("Could not connect to MongoDB on socket $address", e) } } manager.await().close() - error("Could not find on which port MongoDB is running.") + throw AssertionError("Could not find on which port MongoDB is running.").apply { + for (error in errors) + addSuppressed(error) + } // No need to cancel the manager, it will be killed by the exception } } -- 2.51.2