spring-petclinic
spring-petclinic copied to clipboard
PostgresIntegrationTests fails sometimes (maybe on a stale volume?)
spring-petclinic PostgresIntegrationTests.testFindAll » IllegalState
remove PostgresIntegrationTests.java, no issue
+1 - only got when making the container however.
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.
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.
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.