This is an automated email from the ASF dual-hosted git repository.
apupier pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 2ebfe842b18b CAMEL-25088: camel-microprofile-health - fix
testHealthCheckUncheckedException after AbstractHealthCheck exception handling
change
2ebfe842b18b is described below
commit 2ebfe842b18bdf8cb2a276bad05ee6384a176b2d
Author: Aurélien Pupier <[email protected]>
AuthorDate: Tue Sep 29 15:22:17 2026 +0200
CAMEL-25088: camel-microprofile-health - fix
testHealthCheckUncheckedException after AbstractHealthCheck exception
handling change
Commit a37f972c0f45 (CAMEL-25088: camel-health - Health checks: fix bugs
found in a deep review) added a try/catch inside
AbstractHealthCheck.doCall()
so that unchecked exceptions thrown by a health check implementation are
now
caught at the Camel layer:
try {
doCall(builder, options);
} catch (Exception e) {
builder.down();
builder.error(e);
builder.message("Health check failed due to: " +
e.getMessage());
}
Before this change, an unchecked exception propagated out of
AbstractHealthCheck.call() and was caught by SmallRye Health's own
exception
handling, which reported the check under the class name
CamelMicroProfileHealthCheck and stored the exception as a 'rootCause'
data
entry.
After this change, the exception is handled inside AbstractHealthCheck
before
control returns to CamelMicroProfileHealthCheck.call(). The result flows
through CamelMicroProfileHealthHelper.applyHealthDetail() just like a
checked
exception, so the check is reported under its own ID ('exception-check')
and
the error is stored under the standard 'error.message' key.
Update testHealthCheckUncheckedException to assert the new behaviour:
- expected name: 'exception-check' (was: CamelMicroProfileHealthCheck
class name)
- expected data key: 'error.message' (was: 'rootCause')
there was this regression:
```
org.opentest4j.AssertionFailedError: expected:
<org.apache.camel.microprofile.health.CamelMicroProfileHealthCheck> but
was: <exception-check>
at
org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1199)
at
org.apache.camel.microprofile.health.CamelMicroProfileHealthTestHelper.assertHealthCheckOutput(CamelMicroProfileHealthTestHelper.java:77)
at
org.apache.camel.microprofile.health.CamelMicroProfileHealthTestSupport.assertHealthCheckOutput(CamelMicroProfileHealthTestSupport.java:97)
at
org.apache.camel.microprofile.health.CamelMicroProfileHealthCheckTest.testHealthCheckUncheckedException(CamelMicroProfileHealthCheckTest.java:291)
```
Co-authored-with: IBM Bob 2.1.0
Signed-off-by: Aurélien Pupier <[email protected]>
---
.../camel/microprofile/health/CamelMicroProfileHealthCheckTest.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git
a/components/camel-microprofile/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthCheckTest.java
b/components/camel-microprofile/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthCheckTest.java
index 1b6fb7ece8ae..0a04f0aa82ae 100644
---
a/components/camel-microprofile/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthCheckTest.java
+++
b/components/camel-microprofile/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthCheckTest.java
@@ -288,9 +288,9 @@ public class CamelMicroProfileHealthCheckTest extends
CamelMicroProfileHealthTes
JsonArray checks = healthObject.getJsonArray("checks");
assertEquals(1, checks.size());
- assertHealthCheckOutput(CamelMicroProfileHealthCheck.class.getName(),
Status.DOWN, checks.getJsonObject(0),
+ assertHealthCheckOutput("exception-check", Status.DOWN,
checks.getJsonObject(0),
jsonObject -> {
- assertEquals(errorMessage,
jsonObject.getString("rootCause"));
+ assertEquals(errorMessage,
jsonObject.getString("error.message"));
});
}