I am getting ```09:58:23.088 [main] DEBUG org.tes...
# kotest
t
I am getting
Copy code
09:58:23.088 [main] DEBUG org.testcontainers.utility.TestcontainersConfiguration - Testcontainers configuration overrides will be loaded from file:/Users/marco/.testcontainers.properties
~~~ Kotest Configuration ~~~
-> Parallelization factor: 1
-> Default test timeout: 600000ms
-> Default test order: Sequential
-> Default isolation mode: SingleInstance
-> Global soft assertations: False
-> Write spec failure file: False
-> Fail on ignored tests: False
-> Spec execution order: SpecExecutionOrder
-> Extensions
  - io.kotest.spring.SpringAutowireConstructorExtension
  - io.kotest.engine.extensions.SystemPropertyTagExtension
  - io.kotest.core.extensions.RuntimeTagExtension
  - io.kotest.engine.extensions.RuntimeTagExpressionExtension
  - io.kotest.engine.extensions.SpecifiedTagsTagExtension
-> Listeners
  - io.kotest.provided.PostgresListener
  - io.kotest.spring.SpringListener
  - class io.kotest.provided.ProjectConfig$listeners$1
  - class io.kotest.engine.config.LoadConfigFromClasspathKt$toDetectedConfig$beforeAfterAllListener$1


Process finished with exit code 0
on some tests, while others run correctly. is there something I can do to increase verbose(ness) and understand what is going on? I upgraded the kotlin plugin (the jetbrains one) to 1.4, but still run on kotlin 1.3. I already even tried to upgrade to kotlin 1.4 and kotest 4.2.0 but still getting this weird behavior. I am using latest kotest plugin, 1.16
s
When did this start happening
t
I think after the upgrade to kotlin plugin 1.4. problem is, is not I run all tests in idea manually all the time and the tests affected did not change in a while so it could be earlier.
however, I think I fixed it
I have a custom project listener
Copy code
object PostgresListener : ProjectListener {
  private val withNetworkAliases = PostgreSQLContainerProvider().newInstance("10")
    .withNetwork(Network.SHARED)
    .withNetworkAliases("db")

  override suspend fun beforeProject() {
    withContext(<http://Dispatchers.IO|Dispatchers.IO>) {
      withNetworkAliases.start()
      System.setProperty("spring.datasource.url", "jdbc:postgresql://${withNetworkAliases.connectionString()}")
      System.setProperty("spring.datasource.username", withNetworkAliases.getUsername())
      System.setProperty("spring.datasource.password", withNetworkAliases.getPassword())
      System.setProperty("spring.flyway.schemas", withNetworkAliases.getDatabaseName())
    }
  }

  override suspend fun afterProject() {
    withContext(<http://Dispatchers.IO|Dispatchers.IO>) {
      withNetworkAliases.stop()
    }
  }

  private fun JdbcDatabaseContainer<*>.connectionString() = "${getHost()}:${getFirstMappedPort()}/${getDatabaseName()}"

  override val name = "PostgresListener"
}
I don’t know why I did
withContext(<http://Dispatchers.IO|Dispatchers.IO>)
, the git comment only says
upgrade to kotest 4.1
, but if I remove it it all works fine
ofc, I have no idea why
s
That is odd
I'll add a test to ensure a duspatcher in after project doesn't do anything crazy
t
tnx 🙂