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

Load MockitoConfiguration parent-first to make it work in continuous testing #23112

Merged
merged 1 commit into from
Jan 23, 2022
Merged

Load MockitoConfiguration parent-first to make it work in continuous testing #23112

merged 1 commit into from
Jan 23, 2022

Conversation

famod
Copy link
Member

@famod famod commented Jan 22, 2022

Moves the class to a separate new module to reduce the blast radius.

Fixes #23109

What I don't get is why it works without this in regular testing. So maybe there is another, less ugly fix?

/cc @aloubyansky

…testing

Moves the class to a separate new module to reduce the blast radius.
@quarkus-bot quarkus-bot bot added area/core area/dependencies Pull requests that update a dependency file area/testing labels Jan 22, 2022
@famod
Copy link
Member Author

famod commented Jan 22, 2022

Btw, the move to a separate module is not just a precautionary measure, it's actually required to avoid failures like:

2022-01-22T01:39:12.0674921Z [INFO] Running io.quarkus.it.panache.DuplicateMethodTest
2022-01-22T01:39:18.0949236Z [ERROR] Tests run: 2, Failures: 0, Errors: 1, Skipped: 1, Time elapsed: 6 s <<< FAILURE! - in io.quarkus.it.panache.DuplicateMethodTest
2022-01-22T01:39:18.0952409Z [ERROR] io.quarkus.it.panache.DuplicateMethodTest.shouldNotDuplicateMethodsInRepository  Time elapsed: 0.092 s  <<< ERROR!
2022-01-22T01:39:18.0955347Z java.lang.RuntimeException: java.util.ServiceConfigurationError: io.quarkus.test.junit.buildchain.TestBuildChainCustomizerProducer: io.quarkus.test.junit.mockito.internal.UnremoveableMockTestBuildChainCustomizerProducer not a subtype
2022-01-22T01:39:18.0956822Z 	at io.quarkus.test.junit.QuarkusTestExtension.throwBootFailureException(QuarkusTestExtension.java:626)
2022-01-22T01:39:18.0957726Z 	at io.quarkus.test.junit.QuarkusTestExtension.interceptTestClassConstructor(QuarkusTestExtension.java:699)
2022-01-22T01:39:18.0958850Z 	at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
2022-01-22T01:39:18.0960039Z 	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
[...]

See also: https://github.com/famod/quarkus/actions/runs/1731130863

@famod
Copy link
Member Author

famod commented Jan 23, 2022

Would be nice to have this in 2.7.0 (so I added the backport label), but let's see what comes up during review.

Copy link
Member

@stuartwdouglas stuartwdouglas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problematic code is here: https://github.com/mockito/mockito/blob/main/src/main/java/org/mockito/internal/configuration/ClassPathLoader.java#L60

In regular testing the mockito classes are still on the system class path, so the config class can still be loaded (but not from the Quarkus CL). In continuous testing mode they are not on the class path, so it cannot be loaded.

Moving this to parent first means that it will be added to the system class path and everything works as expected. This is the correct thing to do anyway IMHO, as it was already being used in a parent first manner.

@stuartwdouglas stuartwdouglas merged commit 685d832 into quarkusio:main Jan 23, 2022
@quarkus-bot quarkus-bot bot added this to the 2.8 - main milestone Jan 23, 2022
@famod famod deleted the ct-mockito-config-2 branch January 23, 2022 22:20
@gsmet gsmet modified the milestones: 2.8 - main, 2.7.0.Final Jan 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core area/dependencies Pull requests that update a dependency file area/testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auto-mocking Uni does not work in continuous testing, failing tests that work in normal testing
3 participants