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

Forbid loading of a test's ApplicationContext in AOT mode if AOT processing failed #29579

Closed
1 task done
sbrannen opened this issue Nov 25, 2022 · 0 comments
Closed
1 task done
Assignees
Labels
in: test Issues in the test module theme: aot An issue related to Ahead-of-time processing type: enhancement A general enhancement
Milestone

Comments

@sbrannen
Copy link
Member

sbrannen commented Nov 25, 2022

Overview

If AOT processing of a test's ApplicationContext failed, we should immediately fail an attempt to load the corresponding context when running in AOT mode.

For example, if a test class uses Spring Boot's @MockBean, AOT processing of that test's context will fail with a WARN log message, and there will no mapping from that test class to an AOT-generated ApplicationContextInitializer (ACI). Consequently, when the test suite is run in AOT mode that particular test class will fail with a confusing stack trace due to the fact that Spring Boot's SpringApplication attempts to locate a "main" ACI instead of the missing "test" ACI.

The TestContext framework should therefore never attempt to load an ApplicationContext in "JVM mode" while running in "AOT mode".

Deliverables

  • Rework the logic in DefaultCacheAwareContextLoaderDelegate.loadContext(...) to fail fast if an AOT-generated ACI cannot be found while running in AOT mode.
@sbrannen sbrannen added in: test Issues in the test module type: enhancement A general enhancement theme: aot An issue related to Ahead-of-time processing labels Nov 25, 2022
@sbrannen sbrannen added this to the 6.0.3 milestone Nov 25, 2022
@sbrannen sbrannen self-assigned this Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: test Issues in the test module theme: aot An issue related to Ahead-of-time processing type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant