Search code examples
javawindowsdockerdocker-desktoptestcontainers

Testcontainers - containers started up correctly, but Junit tests not starting on Windows (probably since 1909 update)


The issue I am experiencing is Testcontainers starting up all containers correctly, but after that the tests are not running. I am not getting relevant errors in the logs either.

Interesting thing is that everything works fine with same Java projects on a Linux machine. There the tests are just starting up and running fine.

My current setup, where the issue occurs is as follows:

  • Gradle version 6.x (was failing also on older versions)
  • Testcontainers version 1.13.0 (was failing also on older versions)
  • Java 11 and 13 (different projects experience same issue)
  • Windows >= 1909
  • Docker Desktop 2.2.0.5

So as I mentioned before tests are running fine on Linux but not on Windows. Some month ago the tests were running fine on Windows as well. At some point they no longer did. And it seems to me that it was around the time where I updated the Windows machine to 1909. Unfortunately, I'm not completely sure about that.

Anyone some suggestions/ideas about what could be wrong and where I could look to find further information?


Solution

  • At the end, it was some stupid fault on my side. Two things happened.

    The new Postgres Docker image I'm using changed its authentication mechanism and therefore the application was no longer able to connect to the database, "POSTGRES_HOST_AUTH_METHOD = trust" needed.

    Even with the environment variable added, it was not possible to connect. That was because I had another postgres running on my laptop on the same port which I forgot about.