-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Allow anonymous test extension subclasses to share the test state of their parents #45818
Allow anonymous test extension subclasses to share the test state of their parents #45818
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting edge case!
Status for workflow
|
The Quarkus test infrastructure holds state about various things, including references to the currently running Quarkus application. It wants state to be shareable between tests of the same type (normal test, integration test, component test, etc), but not shareable between those different types. To do this, it uses the class name of the test extension as a key. These type all have a common parent, so it needs to be careful with checks based on the hierarchy.
This normally works well, but in my test classloading runs, I hit a problem where state should have been shared, and was not.
HibernatePropertiesTest
uses an anonymous subclass to change the behaviour ofQuarkusTestExtension
. That means it can't share state with other tests in the same project.I think we don't want to 'count' the class of anonymous classes as different, since they're clearly supposed to 'be' the superclass.
(Why did I see the problem, when
main
is working fine? It was either because my code changed the test order, or because the new logic is a bit more dependent on the state. I've already forgotten, because it was a whole day ago. However, I think it's possible for other tests running against normal-Quarkus to potentially hit this problem, if they're adventurous enough to do the subclassing. )