Replies: 3 comments 1 reply
-
@holly-cummins help? 🙏 |
Beta Was this translation helpful? Give feedback.
-
I don't suppose you have a small reproducer, do you? :) I'm hopeful this will be fixed by WG - Test classloading #34681 part), but in my first iteration it's not fixing all use cases related to parameterized tests. |
Beta Was this translation helpful? Give feedback.
-
@holly-cummins I'll try to put together a minimal reproducer without the extension and with just a single Panache Entity. It might take a little doing but I think I can get it set up! Thank you for the info! I'm just glad that based on the info provided and your response, I feel like I have a grasp of what the issue is, so finding a solution should be possible. I was looking at other suggestions of using a delegate class. I'm thinking if I can get the utility classes to be beans and then wrap them with a delegate defined in tests, that should resolve the issue. I'm also looking at making the utilities stateless and not have them talk to the database at all. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am having an issue in tests that I think is related to classloading.
I am using Panache Active Record pattern and have a few classes that are not CDI beans but use Panache Entity methods like findById. These include builders and factories, etc.
I have my entities loading in from a Quarkus extension which has a jandex index.
At runtime my entity methods work fine, however in tests, they sometimes will fail when called outside of the scope of something annotated with the Test annotation, and they are particularly fickle if there are any static methods involved in the test class that don't have a JUnit annotation.
Most of the time I can solve the issue by just adding ActivateRequestContext around the static method, and that seems to resolve things, but not always.
I have one case currently where I have a ParameterizedTest and even if I set the test lifecycle and make the argument producing method non-static I always get the same error:
I assume that the JUnit class loader is loading my entities before Quarkus, and so none of the augmentation that would normally be done by Quarkus is done on my entities. This makes it so that calling the entity method fails because no concrete implementation has been supplied yet.
I am using Quarkus 3.8.6
Beta Was this translation helpful? Give feedback.
All reactions