-
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
Misconfigured TCCL for @TestFactory dynamic tests breaks RestAssured since Quarkus 1.5.0 #10435
Comments
For your convenience, the full stack trace of the error (with
|
Looks like Quarkus 1.6.0.Final has just been released. Reproducible on 1.6.0.Final as well. |
/cc @geoand |
I don't think there is much we can do about this case, but I'll have a look on Monday |
I looked at this and there isn't anything we can do, as the dynamic test doesn't run in the ClassLoader that QuarkusTest sets up |
The difference between 1.4.2 and 1.5.0 in this respect is that in 1.4.2 Unfortunately |
Hello , Is this issue was ever resolved or do you have any alternative to make it work ? I am also facing similar exception - |
@holly-cummins @geoand maybe something we will be able to close when we update to the new JUnit with CL fixes? Thought you might have a list :). |
Let's hope we'll be able to update. The more I think about it, the more I think it's going to be pretty difficult.... |
Any news here or at least a workaround? Important part of the stack trace is:
|
I can no longer reproduce this starting from 2.1.2.Final. I suppose this was fixed with #19293. return dynamicTest("exampleDynamicTest", () -> {
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
// actual test code goes here
}); If that does not help, you are probably facing another issue. |
you are right... It was another problem. Thanks for your hint! I build up a Test like so:
this leads to running the testee in the The code under test obviously has to run in the
|
Is this still an issue? |
@geoand asks:
@bertm said:
I've just tried the reproducer with 3.15.1, and it still works fine. However, our |
Describe the bug
RestAssured no longer initializes correctly when used in a dynamic test (
@TestFactory
withDynamicTest
) due to a classloader mismatch. I discovered this when upgrading from 1.4.2.Final to 1.5.2.Final recently.RestAssured uses the TCCL to initialize its Jackson ObjectMapper. In simple
@Test
test cases, and in the execution of the@TestFactory
method, the TCCL is theQuarkus Base Runtime Classloader
. During the execution of the dynamic test cases returned by the@TestFactory
method, the TCCL is the system classloader since 1.5.0.This leads to a mismatch between to RestAssured.class ClassLoader and the TCCL when RestAssured is used, leading to unexpected errors in test execution:
Expected behavior
@TestFactory
-produced dynamic test cases.@TestFactory
-produced dynamic test cases is the same as when executing@Test
test cases.Actual behavior
@TestFactory
-produced dynamic test cases.@TestFactory
-produced dynamic test cases differs from the one during execution of@Test
test cases.To Reproduce
Steps to reproduce the behavior:
mvn clean verify
Configuration
Not applicable.
Environment (please complete the following information):
uname -a
orver
:java -version
: reproduced on various JREs, but here's one:mvnw --version
orgradlew --version
):Additional context
The exact same test case works fine (that is, does nothing meaningful instead of throwing an error) on Quarkus 1.4.2. Substituting
platformVersion=1.5.2.Final
forplatformVersion=1.4.2.Final
in step 1. is sufficient to make the test succeed.The text was updated successfully, but these errors were encountered: