Skip to content

Conversation

@mkouba
Copy link
Contributor

@mkouba mkouba commented Sep 29, 2025

This is a follow-up to #50164.

We introduce the QuarkusComponentTestCallbacks service provider that can be used to contribute additional logic to QuarkusComponentTestExtension (I choose the name "callbacks" to keep consistency with quarkus-junit5).

In the second commit we add a few bytecode transformations in order to support quarkus-panache-mock functionality in a QuarkusComponentTest.

- this service provider can be used to contribute additional logic to
QuarkusComponentTestExtension
@quarkus-bot

This comment has been minimized.

@github-actions
Copy link

github-actions bot commented Sep 29, 2025

🙈 The PR is closed and the preview is expired.

@Ladicek
Copy link
Contributor

Ladicek commented Sep 29, 2025

The ArC/component test code looks OK, but I don't know the Panache / Panache Mock code nearly well enough to be able to approve.

@mkouba
Copy link
Contributor Author

mkouba commented Sep 29, 2025

The ArC/component test code looks OK, but I don't know the Panache / Panache Mock code nearly well enough to be able to approve.

Fair enough.

In the quarkus-panache-mock integration we simply take all Panache entities (defined by @MockPanacheEntities) and modify user-defined static methods and add methods from the PanacheEntityBase to the entity class. The modified method looks like:

if (!PanacheMock.IsMockEnabled)
   throw new RuntimeException("Panache mock not enabled");
if (!PanacheMock.isMocked(TestClass.class))
   throw new RuntimeException("FooEntity not mocked");
try {
   return (int)PanacheMock.mockMethod(FooEntity.class, "foo", new Class<?>[] {int.class}, new Object[] {arg});
} catch (PanacheMock.InvokeRealMethodException e) {
   throw new RuntimeException("Unstubbed method called", e);
}

@quarkus-bot

This comment has been minimized.

Copy link
Contributor

@Ladicek Ladicek left a comment

Choose a reason for hiding this comment

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

As mentioned yesterday, the ArC/Component Test part LGTM. I'm specifically not approving the Panache Mock part :-)

@mkouba
Copy link
Contributor Author

mkouba commented Sep 30, 2025

As mentioned yesterday, the ArC/Component Test part LGTM. I'm specifically not approving the Panache Mock part :-)

Of course! I was just trying to explain the principle and enlighten you ;-).

Copy link
Member

@FroMage FroMage left a comment

Choose a reason for hiding this comment

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

Also… I'm afraid you're missing the HR version 😬

@mkouba
Copy link
Contributor Author

mkouba commented Sep 30, 2025

Also… I'm afraid you're missing the HR version 😬

Yes, that's intentional. We don't support Mongo stuff etc. as well. I have a NOTE in the docs locally.

@mkouba mkouba force-pushed the component-callbacks branch from e3a1f38 to ef47508 Compare September 30, 2025 14:07
@quarkus-bot

This comment has been minimized.

@quarkus-bot

This comment has been minimized.

@quarkus-bot
Copy link

quarkus-bot bot commented Sep 30, 2025

Status for workflow Quarkus CI

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

✅ 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.


Flaky tests - Develocity

⚙️ JVM Tests - JDK 17

📦 extensions/smallrye-reactive-messaging/deployment

io.quarkus.smallrye.reactivemessaging.hotreload.ConnectorChangeTest.testUpdatingConnector - History

  • Expecting actual: ["-4","-5","-6","-7","-8","-9","-10","-11"] to start with: ["-3", "-4", "-5", "-6"] - java.lang.AssertionError
java.lang.AssertionError: 

Expecting actual:
  ["-4","-5","-6","-7","-8","-9","-10","-11"]
to start with:
  ["-3", "-4", "-5", "-6"]

	at io.quarkus.smallrye.reactivemessaging.hotreload.ConnectorChangeTest.testUpdatingConnector(ConnectorChangeTest.java:36)

⚙️ JVM Tests - JDK 21

📦 extensions/smallrye-openapi/deployment

io.quarkus.smallrye.openapi.test.vertx.OpenApiHttpRootPathCorsTestCase.testCorsFilterProperties - History

  • 1 expectation failed. Expected status code <200> but was <500>. - java.lang.AssertionError
java.lang.AssertionError: 
1 expectation failed.
Expected status code <200> but was <500>.

	at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486)
	at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:73)

📦 test-framework/jacoco/runtime

io.quarkus.jacoco.runtime.DataFileWatchTest.waitForDataFileThatNeverAppears - History

  • Expecting value to be false but was true - org.opentest4j.AssertionFailedError
org.opentest4j.AssertionFailedError: 

Expecting value to be false but was true
	at io.quarkus.jacoco.runtime.DataFileWatchTest.waitForDataFileThatNeverAppears(DataFileWatchTest.java:208)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)

⚙️ JVM Tests - JDK 17 Windows

📦 extensions/micrometer-opentelemetry/deployment

io.quarkus.micrometer.opentelemetry.deployment.compatibility.MicrometerTimedInterceptorTest.testTimeMethod - History

  • Stream has no elements - java.lang.IllegalArgumentException
java.lang.IllegalArgumentException: Stream has no elements
	at io.quarkus.micrometer.opentelemetry.deployment.common.MetricDataFilter.lambda$lastReading$2(MetricDataFilter.java:213)
	at java.base/java.util.Optional.orElseThrow(Optional.java:403)
	at io.quarkus.micrometer.opentelemetry.deployment.common.MetricDataFilter.lastReading(MetricDataFilter.java:213)
	at io.quarkus.micrometer.opentelemetry.deployment.common.MetricDataFilter.lastReadingDataPoint(MetricDataFilter.java:231)
	at io.quarkus.micrometer.opentelemetry.deployment.compatibility.MicrometerTimedInterceptorTest.testTimeMethod(MicrometerTimedInterceptorTest.java:77)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at io.quarkus.test.QuarkusUnitTest.runExtensionMethod(QuarkusUnitTest.java:534)

io.quarkus.micrometer.opentelemetry.deployment.compatibility.MicrometerTimedInterceptorTest.testTimeMethod_Async - History

  • Stream has no elements - java.lang.IllegalArgumentException
java.lang.IllegalArgumentException: Stream has no elements
	at io.quarkus.micrometer.opentelemetry.deployment.common.MetricDataFilter.lastReadingDataPoint(MetricDataFilter.java:236)
	at io.quarkus.micrometer.opentelemetry.deployment.compatibility.MicrometerTimedInterceptorTest.testTimeMethod_Async(MicrometerTimedInterceptorTest.java:126)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at io.quarkus.test.QuarkusUnitTest.runExtensionMethod(QuarkusUnitTest.java:534)
	at io.quarkus.test.QuarkusUnitTest.interceptTestMethod(QuarkusUnitTest.java:448)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

@quarkus-bot
Copy link

quarkus-bot bot commented Oct 1, 2025

Status for workflow Quarkus Documentation CI

This is the status report for running Quarkus Documentation CI on commit ef47508.

✅ 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.

@mkouba mkouba requested a review from FroMage October 1, 2025 15:36
@FroMage FroMage merged commit 425cc05 into quarkusio:main Oct 2, 2025
77 of 79 checks passed
@quarkus-bot quarkus-bot bot added this to the 3.29 - main milestone Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants