This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch camel-main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/camel-main by this push:
new f058fd3379 Fix observability-services tests management port discovery
f058fd3379 is described below
commit f058fd3379d27d12f4abd5df4965dcdbb6d2fd80
Author: James Netherton <[email protected]>
AuthorDate: Wed Apr 30 09:04:37 2025 +0100
Fix observability-services tests management port discovery
---
.../it/ObservabilityServicesIT.java | 6 +++++-
.../it/ObservabilityServicesTest.java | 17 +++++++++++++----
2 files changed, 18 insertions(+), 5 deletions(-)
diff --git
a/integration-tests/observability-services/src/test/java/org/apache/camel/quarkus/component/observabilityservices/it/ObservabilityServicesIT.java
b/integration-tests/observability-services/src/test/java/org/apache/camel/quarkus/component/observabilityservices/it/ObservabilityServicesIT.java
index 043b40ec5d..a6825cf486 100644
---
a/integration-tests/observability-services/src/test/java/org/apache/camel/quarkus/component/observabilityservices/it/ObservabilityServicesIT.java
+++
b/integration-tests/observability-services/src/test/java/org/apache/camel/quarkus/component/observabilityservices/it/ObservabilityServicesIT.java
@@ -17,8 +17,12 @@
package org.apache.camel.quarkus.component.observabilityservices.it;
import io.quarkus.test.junit.QuarkusIntegrationTest;
+import org.eclipse.microprofile.config.ConfigProvider;
@QuarkusIntegrationTest
class ObservabilityServicesIT extends ObservabilityServicesTest {
-
+ @Override
+ Integer getManagementPort() {
+ return ConfigProvider.getConfig().getValue("quarkus.management.port",
Integer.class);
+ }
}
diff --git
a/integration-tests/observability-services/src/test/java/org/apache/camel/quarkus/component/observabilityservices/it/ObservabilityServicesTest.java
b/integration-tests/observability-services/src/test/java/org/apache/camel/quarkus/component/observabilityservices/it/ObservabilityServicesTest.java
index 47c00ab2dd..da781d31e2 100644
---
a/integration-tests/observability-services/src/test/java/org/apache/camel/quarkus/component/observabilityservices/it/ObservabilityServicesTest.java
+++
b/integration-tests/observability-services/src/test/java/org/apache/camel/quarkus/component/observabilityservices/it/ObservabilityServicesTest.java
@@ -26,6 +26,7 @@ import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
import org.apache.http.HttpStatus;
+import org.eclipse.microprofile.config.ConfigProvider;
import org.junit.jupiter.api.Test;
import static org.awaitility.Awaitility.await;
@@ -41,7 +42,7 @@ class ObservabilityServicesTest {
@Test
void testHealthUpStatus() {
// Use testing management port
- RestAssured.when().get("http://localhost:9001/observe/health").then()
+ RestAssured.when().get(getManagementEndpointUrl("health")).then()
.contentType(ContentType.JSON)
.header("Content-Type", containsString("charset=UTF-8"))
.body("status", is("UP"),
@@ -55,7 +56,7 @@ class ObservabilityServicesTest {
@Test
void testLivenessUpStatus() {
// Use testing management port
-
RestAssured.when().get("http://localhost:9001/observe/health/live").then()
+ RestAssured.when().get(getManagementEndpointUrl("health/live")).then()
.contentType(ContentType.JSON)
.header("Content-Type", containsString("charset=UTF-8"))
.body("status", is("UP"),
@@ -65,7 +66,7 @@ class ObservabilityServicesTest {
@Test
void testReadinessUpStatus() {
// Use testing management port
-
RestAssured.when().get("http://localhost:9001/observe/health/ready").then()
+ RestAssured.when().get(getManagementEndpointUrl("health/ready")).then()
.contentType(ContentType.JSON)
.header("Content-Type", containsString("charset=UTF-8"))
.body("status", is("UP"),
@@ -75,7 +76,7 @@ class ObservabilityServicesTest {
@Test
void testMetricsStatus() {
// Use testing management port
- RestAssured.when().get("http://localhost:9001/observe/metrics").then()
+ RestAssured.when().get(getManagementEndpointUrl("metrics")).then()
.header("Content-Type",
containsString("application/openmetrics-text"))
.statusCode(HttpStatus.SC_OK);
}
@@ -137,6 +138,14 @@ class ObservabilityServicesTest {
.body(is("observability-services-context"));
}
+ Integer getManagementPort() {
+ return
ConfigProvider.getConfig().getValue("quarkus.management.test-port",
Integer.class);
+ }
+
+ String getManagementEndpointUrl(String path) {
+ return "http://localhost:%d/observe/%s".formatted(getManagementPort(),
path);
+ }
+
static List<Map<String, String>> getSpans() {
return RestAssured.given()
.get("/spans/export")