Open gsmet opened 3 months ago
IIRC, QuarkusTestNgCallbacks.invokeTestNgAfterClasses
was a workaround to be able to invoke test lifecycle callbacks which was basically implemented because of the need to have Quarkus specific CL to begin with.
Actually, from the GH history, it seems like we implemented this because MP TCKs used this behavior even back then.
I'm not entirely sure there is a way to work around this problem but still from a design point of view it seems inappropriate to load classes from a closed class loader.
I don't think you can use different CL for these callbacks; it should be the same one that was used for tests. I assume there is a reason we cannot close the base CL only after these callbacks have been executed?
/cc @geoand (testing)
A possibly simple/effective workaround for this situation is to pre-load the classes that are going to be loaded at the end, before the CL is closed. It requires a little bit of manual work though.
When running CI with this PR ^ applied, I get a lot of TCK failures similar to:
This issue is that the test instances are instantiated using the base runtime of the started Quarkus app and by the time we try to execute the after classes callback, the application is stopped and the base runtime class loader is closed.
I'm not entirely sure there is a way to work around this problem but still from a design point of view it seems inappropriate to load classes from a closed class loader.
I would be interested in feedback from @mkouba @Ladicek and @manovotn .