spring-petclinic icon indicating copy to clipboard operation
spring-petclinic copied to clipboard

PostgresIntegrationTests fails sometimes (maybe on a stale volume?)

Open dgraham10009 opened this issue 10 months ago • 4 comments

spring-petclinic PostgresIntegrationTests.testFindAll » IllegalState

remove PostgresIntegrationTests.java, no issue

dgraham10009 avatar Apr 23 '24 17:04 dgraham10009

+1 - only got when making the container however.

JamesGoodger avatar May 02 '24 04:05 JamesGoodger

It fails for me when I have an old volume from a previous test run with an older version of postgres. Impossible to say if your problem is the same, but if it is you can just delete the volume (e.g. by docker compose rm postgres service). See https://github.com/spring-projects/spring-boot/issues/38763 for progress on workarounds other than manually deleting.

dsyer avatar May 16 '24 12:05 dsyer

Don't know if this is the same issue as what you encountered, but I think it's good to share:

I noticed some peculiarity about this failure. That is, on Ubuntu 22.04/24.04:

  • If Docker isn't installed, build succeeds (because it skips test cases needing Docker)
  • If Docker is installed by APT, build fails with 2 test errors
  • If Docker is installed by Snap, build succeeds

The cause I identified: PostgreSQL test cases use docker compose (Compose v2) to set up its environment. This is bundled in the Snap version of Docker, but not in the APT version (even if you also installed the docker-compose package, you'll only get docker-compose (legacy compose), not docker compose. See https://docs.docker.com/compose/migrate/)

So my workaround is to ensure docker compose exists in environment before building. The solution should be more advanced detection of tools in the build script (e.g. skip PostgreSQL tests if docker compose is not present, with a warning), but I'm not familiar with Java or Maven, so I can't help on that.

slackingfred avatar Jul 16 '24 16:07 slackingfred

Thanks for the detail. It’s not the same problem though, and Spring Boot explicitly requires the newer version of docker, so it’s kind of expected, I think (and also therefore not a problem with the Pet Clinic project). If the error you got wasn’t clear about what was wrong I would take it up with the Spring Boot project directly if I were you.

dsyer avatar Jul 16 '24 20:07 dsyer