This is an automated email from the ASF dual-hosted git repository.
davsclaus 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 023e6aeadb5 CAMEL-19118: camel-health - Liveness check default false
023e6aeadb5 is described below
commit 023e6aeadb5f6a47a8d283a75e0f0813a1cfd1f2
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Mar 9 09:32:46 2023 +0100
CAMEL-19118: camel-health - Liveness check default false
---
.../health/CamelMicroProfileHealthCheckTest.java | 33 +++++++++-------------
...MicroProfileHealthSupervisedRoutesMainTest.java | 2 +-
.../health/CamelMicroProfileHealthTestSupport.java | 10 +++++++
3 files changed, 25 insertions(+), 20 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 cc96892509e..b0c5136bef8 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
@@ -51,12 +51,16 @@ public class CamelMicroProfileHealthCheckTest extends
CamelMicroProfileHealthTes
assertEquals(Status.UP.name(), healthObject.getString("status"));
JsonArray checks = healthObject.getJsonArray("checks");
- assertEquals(1, checks.size());
+ assertEquals(2, checks.size());
assertHealthCheckOutput("context", Status.UP, checks.getJsonObject(0),
checksJson -> {
assertEquals("health-context",
checksJson.getString("context.name"));
assertEquals(ServiceStatus.Started.name(),
checksJson.getString("context.status"));
});
+ assertHealthCheckOutput("context", Status.UP, checks.getJsonObject(1),
checksJson -> {
+ assertEquals("health-context",
checksJson.getString("context.name"));
+ assertEquals(ServiceStatus.Started.name(),
checksJson.getString("context.status"));
+ });
}
@Test
@@ -72,12 +76,16 @@ public class CamelMicroProfileHealthCheckTest extends
CamelMicroProfileHealthTes
assertEquals(Status.DOWN.name(), healthObject.getString("status"));
JsonArray checks = healthObject.getJsonArray("checks");
- assertEquals(1, checks.size());
+ assertEquals(2, checks.size());
assertHealthCheckOutput("context", Status.DOWN,
checks.getJsonObject(0), checksJson -> {
assertEquals("health-context",
checksJson.getString("context.name"));
assertEquals(ServiceStatus.Stopped.name(),
checksJson.getString("context.status"));
});
+ assertHealthCheckOutput("context", Status.DOWN,
checks.getJsonObject(1), checksJson -> {
+ assertEquals("health-context",
checksJson.getString("context.name"));
+ assertEquals(ServiceStatus.Stopped.name(),
checksJson.getString("context.status"));
+ });
}
@Test
@@ -224,10 +232,9 @@ public class CamelMicroProfileHealthCheckTest extends
CamelMicroProfileHealthTes
JsonObject healthObject = getHealthJson(health);
assertEquals(Status.UP.name(), healthObject.getString("status"));
JsonArray checks = healthObject.getJsonArray("checks");
- assertEquals(2, checks.size());
+ assertEquals(1, checks.size());
assertHealthCheckOutput("test-check", Status.UP,
checks.getJsonObject(0));
- assertHealthCheckOutput("test-check", Status.UP,
checks.getJsonObject(1));
}
@Test
@@ -246,12 +253,10 @@ public class CamelMicroProfileHealthCheckTest extends
CamelMicroProfileHealthTes
JsonObject healthObject = getHealthJson(health);
assertEquals(Status.UP.name(), healthObject.getString("status"));
JsonArray checks = healthObject.getJsonArray("checks");
- assertEquals(2, checks.size());
+ assertEquals(1, checks.size());
assertHealthCheckOutput("test-check", Status.UP,
checks.getJsonObject(0));
- assertHealthCheckOutput("test-check", Status.UP,
checks.getJsonObject(1));
-
for (int i = 0; i < 5; i++) {
healthCheckRegistry.unregister(check);
}
@@ -281,17 +286,12 @@ public class CamelMicroProfileHealthCheckTest extends
CamelMicroProfileHealthTes
JsonObject healthObject = getHealthJson(health);
assertEquals(Status.DOWN.name(), healthObject.getString("status"));
JsonArray checks = healthObject.getJsonArray("checks");
- assertEquals(2, checks.size());
+ assertEquals(1, checks.size());
assertHealthCheckOutput(CamelMicroProfileHealthCheck.class.getName(),
Status.DOWN, checks.getJsonObject(0),
jsonObject -> {
assertEquals(errorMessage,
jsonObject.getString("rootCause"));
});
-
- assertHealthCheckOutput(CamelMicroProfileHealthCheck.class.getName(),
Status.DOWN, checks.getJsonObject(1),
- jsonObject -> {
- assertEquals(errorMessage,
jsonObject.getString("rootCause"));
- });
}
@Test
@@ -313,17 +313,12 @@ public class CamelMicroProfileHealthCheckTest extends
CamelMicroProfileHealthTes
JsonObject healthObject = getHealthJson(health);
assertEquals(Status.DOWN.name(), healthObject.getString("status"));
JsonArray checks = healthObject.getJsonArray("checks");
- assertEquals(2, checks.size());
+ assertEquals(1, checks.size());
assertHealthCheckOutput("exception-check", Status.DOWN,
checks.getJsonObject(0), jsonObject -> {
assertEquals(errorMessage, jsonObject.getString("error.message"));
assertNotNull(jsonObject.getString("error.stacktrace"));
});
-
- assertHealthCheckOutput("exception-check", Status.DOWN,
checks.getJsonObject(1), jsonObject -> {
- assertEquals(errorMessage, jsonObject.getString("error.message"));
- assertNotNull(jsonObject.getString("error.stacktrace"));
- });
}
@Test
diff --git
a/components/camel-microprofile/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthSupervisedRoutesMainTest.java
b/components/camel-microprofile/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthSupervisedRoutesMainTest.java
index a22dda8f2f2..7fe261ff741 100644
---
a/components/camel-microprofile/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthSupervisedRoutesMainTest.java
+++
b/components/camel-microprofile/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthSupervisedRoutesMainTest.java
@@ -67,7 +67,7 @@ public class CamelMicroProfileHealthSupervisedRoutesMainTest {
assertEquals(Status.UP.name(), healthObject.getString("status"));
JsonArray checks = healthObject.getJsonArray("checks");
- assertEquals(4, checks.size());
+ assertEquals(5, checks.size());
Optional<JsonObject> camelRoutesCheck =
findHealthCheck("camel-routes", checks);
camelRoutesCheck.ifPresentOrElse(check -> {
diff --git
a/components/camel-microprofile/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthTestSupport.java
b/components/camel-microprofile/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthTestSupport.java
index bbb8e023370..8b7ea6869da 100644
---
a/components/camel-microprofile/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthTestSupport.java
+++
b/components/camel-microprofile/camel-microprofile-health/src/test/java/org/apache/camel/microprofile/health/CamelMicroProfileHealthTestSupport.java
@@ -121,6 +121,11 @@ public class CamelMicroProfileHealthTestSupport extends
CamelTestSupport {
consumer.accept(builder);
}
+ @Override
+ public boolean isLiveness() {
+ return true;
+ }
+
@Override
public boolean isReadiness() {
return false;
@@ -137,6 +142,11 @@ public class CamelMicroProfileHealthTestSupport extends
CamelTestSupport {
consumer.accept(builder);
}
+ @Override
+ public boolean isReadiness() {
+ return true;
+ }
+
@Override
public boolean isLiveness() {
return false;