This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.x by this push:
new 2ff09beb85a CAMEL-19118: camel-health - Liveness check default false
2ff09beb85a is described below
commit 2ff09beb85acbd5251a96aafa54144a9062c1b30
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 a7a48e473e9..13669698f49 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 e7c240b48a2..f2ad3e66490 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 4d2ac0d67e7..8027c7f6518 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;