Skip to content

Use the runtime classloader for test config building #47190

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

Merged
merged 1 commit into from
Apr 7, 2025

Conversation

holly-cummins
Copy link
Contributor

@holly-cummins holly-cummins commented Apr 4, 2025

Resolves quarkiverse/quarkiverse#92, which was caused by #34681. It's plausible to me that this could affect other applications and extensions, too.

The symptom is

2025-04-04T01:53:40.8383132Z Caused by: java.util.ServiceConfigurationError: io.quarkiverse.asyncapi.config.channels.ChannelConfigurer: io.quarkiverse.asyncapi.config.channels.KafkaChannelConfigurer not a subtype
2025-04-04T01:53:40.8385024Z 	at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:593)
2025-04-04T01:53:40.8386031Z 	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1244)
2025-04-04T01:53:40.8387260Z 	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273)
2025-04-04T01:53:40.8388214Z 	at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
2025-04-04T01:53:40.8389384Z 	at java.base/java.util.ServiceLoader$ProviderSpliterator.tryAdvance(ServiceLoader.java:1491)
2025-04-04T01:53:40.8390397Z 	at java.base/java.util.Spliterator.forEachRemaining(Spliterator.java:332)
2025-04-04T01:53:40.8391304Z 	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
2025-04-04T01:53:40.8392508Z 	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
2025-04-04T01:53:40.8393577Z 	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
2025-04-04T01:53:40.8394652Z 	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
2025-04-04T01:53:40.8395637Z 	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
2025-04-04T01:53:40.8396833Z 	at io.quarkiverse.asyncapi.config.channels.ChannelConfigurerFactory.<clinit>(ChannelConfigurerFactory.java:17)
2025-04-04T01:53:40.8398202Z 	at io.quarkiverse.asyncapi.config.AsyncConfigSource.getMapFromAsyncApi(AsyncConfigSource.java:35)
2025-04-04T01:53:40.8400279Z 	at io.quarkiverse.asyncapi.config.AsyncConfigSource.<init>(AsyncConfigSource.java:28)

as triggered from io.quarkus.test.junit.classloading.QuarkusTestConfigProviderResolver.<init>(QuarkusTestConfigProviderResolver.java:19).

When the QuarkusTestConfigProviderResolver is initialised, the TCCL is the system classloader, which isn't the friendliest TCCL for downstream classes doing their thing. The System classloader is only used in the registerConfig call, so instead of setting an unfriendly TCCL, we can just hardcode the system classloader in that call.

Copy link

quarkus-bot bot commented Apr 4, 2025

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit 051b455.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

You can consult the Develocity build scans.


Flaky tests - Develocity

⚙️ JVM Integration Tests - JDK 17

📦 integration-tests/injectmock

io.quarkus.it.mockbean.PerClassSpyTest.testWithoutSpy - History

  • Mock accessed after inline mocks were cleared - org.mockito.exceptions.misusing.DisabledMockException
org.mockito.exceptions.misusing.DisabledMockException: Mock accessed after inline mocks were cleared
	at io.quarkus.it.mockbean.PerClassSpyTest$IdentityService.call(PerClassSpyTest.java:43)
	at io.quarkus.it.mockbean.PerClassSpyTest.testWithoutSpy(PerClassSpyTest.java:36)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at io.quarkus.test.junit.QuarkusTestExtension.runExtensionMethod(QuarkusTestExtension.java:1026)
	at io.quarkus.test.junit.QuarkusTestExtension.interceptTestMethod(QuarkusTestExtension.java:873)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

⚙️ JVM Integration Tests - JDK 17 Windows

📦 integration-tests/injectmock

io.quarkus.it.mockbean.PerClassSpyTest.testWithoutSpy - History

  • Mock accessed after inline mocks were cleared - org.mockito.exceptions.misusing.DisabledMockException
org.mockito.exceptions.misusing.DisabledMockException: Mock accessed after inline mocks were cleared
	at io.quarkus.it.mockbean.PerClassSpyTest$IdentityService.call(PerClassSpyTest.java:43)
	at io.quarkus.it.mockbean.PerClassSpyTest.testWithoutSpy(PerClassSpyTest.java:36)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at io.quarkus.test.junit.QuarkusTestExtension.runExtensionMethod(QuarkusTestExtension.java:1026)
	at io.quarkus.test.junit.QuarkusTestExtension.interceptTestMethod(QuarkusTestExtension.java:873)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

⚙️ JVM Integration Tests - JDK 21

📦 integration-tests/injectmock

io.quarkus.it.mockbean.PerClassSpyTest.testWithoutSpy - History

  • Mock accessed after inline mocks were cleared - org.mockito.exceptions.misusing.DisabledMockException
org.mockito.exceptions.misusing.DisabledMockException: Mock accessed after inline mocks were cleared
	at io.quarkus.it.mockbean.PerClassSpyTest$IdentityService.call(PerClassSpyTest.java:43)
	at io.quarkus.it.mockbean.PerClassSpyTest.testWithoutSpy(PerClassSpyTest.java:36)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at io.quarkus.test.junit.QuarkusTestExtension.runExtensionMethod(QuarkusTestExtension.java:1026)
	at io.quarkus.test.junit.QuarkusTestExtension.interceptTestMethod(QuarkusTestExtension.java:873)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)

@holly-cummins
Copy link
Contributor Author

for awareness, tagging @radcortez, although I think he's not available for a review ATM. :)

@geoand geoand merged commit 4c5720e into quarkusio:main Apr 7, 2025
55 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in WG - Test classloading Apr 7, 2025
@quarkus-bot quarkus-bot bot added this to the 3.22 - main milestone Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

[CI] - AsyncAPI + Quarkus main
2 participants