Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker Compose support does not work in AOT-processed tests #36273

Open
wilkinsona opened this issue Jul 7, 2023 · 3 comments
Open

Docker Compose support does not work in AOT-processed tests #36273

wilkinsona opened this issue Jul 7, 2023 · 3 comments
Labels
theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Milestone

Comments

@wilkinsona
Copy link
Member

This can be reproduced using Petclinic's tests with AOT enabled:

tasks.named('test') {
  useJUnitPlatform()
  systemProperty "spring.aot.enabled", true
}

./gradlew test fails with both tests in PostgresIntegrationTests failing as they could not connect to Postgres. They try to use the default host and port rather than those of a container starter by Docker Compose.

@wilkinsona wilkinsona added the type: bug A general bug label Jul 7, 2023
@wilkinsona wilkinsona added this to the 3.1.x milestone Jul 7, 2023
@snicoll snicoll added the theme: aot An issue related to Ahead-of-time processing label Aug 24, 2023
@roxspring
Copy link

Any idea what needs to be done to fix this? Failing the PetClinic Gradle build because Docker isn't available seems really odd - I didn't think Docker was a hard requirement?

@wilkinsona wilkinsona modified the milestones: 3.1.x, 3.2.x Apr 22, 2024
@scottfrederick
Copy link
Contributor

Docker Compose support is explicitly disabled when spring.aot.enabled is true:

if (Boolean.getBoolean("spring.aot.processing") || AotDetector.useGeneratedArtifacts()) {
logger.trace("Docker Compose support disabled with AOT and native images");
return;
}

We could potentially change AotDetector.useGeneratedArtifacts() there to NativeDetector.inNativeImage() to fix this problem, but there's some history behind that in #35548 and #35676 and I'm not sure what other side-effects making that change would have.

@wilkinsona
Copy link
Member Author

Thanks, Scott. #35548 and #35676 were about preventing the Docker Compose support from breaking things by getting it to back off when AOT processing or building a native image. This issue's about removing the need for that by getting it to work after AOT processing or in a native image.

The failure that I described (not very clearly) above is occurring because the Docker Compose support has backed off, leaving the tests looking for a DB on its default host and port rather than from a Compose-managed container. If we can get this to work after AOT processing or in a native image then I think we can safely stop making the support back off in those situations.

@philwebb philwebb modified the milestones: 3.2.x, 3.3.x Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Projects
None yet
Development

No branches or pull requests

5 participants