This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/main by this push:
new 372320043c Fixes #9233. Use container host instead of localhost in
CyberarkVaultTestResource
372320043c is described below
commit 372320043c257fa4b024bb9d524cf53cb113531f
Author: jiriOndrusek-agent <[email protected]>
AuthorDate: Thu Sep 24 13:47:59 2026 +0200
Fixes #9233. Use container host instead of localhost in
CyberarkVaultTestResource
Testcontainers may map ports on a host other than localhost (remote
DOCKER_HOST, rootless setups). Build the Conjur URL from
conjurContainer.getHost() like the other test resources do.
Co-authored-by: Jiří Ondrušek <[email protected]>
Co-authored-by: Claude Fable 5.1 <[email protected]>
---
.../component/cyberark/vault/it/CyberarkVaultTestResource.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git
a/integration-tests/cyberark-vault/src/test/java/org/apache/camel/quarkus/component/cyberark/vault/it/CyberarkVaultTestResource.java
b/integration-tests/cyberark-vault/src/test/java/org/apache/camel/quarkus/component/cyberark/vault/it/CyberarkVaultTestResource.java
index cd67ffd190..ce60a49292 100644
---
a/integration-tests/cyberark-vault/src/test/java/org/apache/camel/quarkus/component/cyberark/vault/it/CyberarkVaultTestResource.java
+++
b/integration-tests/cyberark-vault/src/test/java/org/apache/camel/quarkus/component/cyberark/vault/it/CyberarkVaultTestResource.java
@@ -128,7 +128,7 @@ public class CyberarkVaultTestResource implements
QuarkusTestResourceLifecycleMa
throw new RuntimeException("Failed to start Conjur test
environment", e);
}
- String conjurUrl = "http://localhost:" +
conjurContainer.getMappedPort(80);
+ String conjurUrl = getConjurUrl();
result.put("conjur.account", CONJUR_ACCOUNT);
result.put("conjur.url", conjurUrl);
@@ -141,6 +141,10 @@ public class CyberarkVaultTestResource implements
QuarkusTestResourceLifecycleMa
return result;
}
+ private String getConjurUrl() {
+ return "http://" + conjurContainer.getHost() + ":" +
conjurContainer.getMappedPort(CONJUR_PORT);
+ }
+
private void startPostgresContainer() {
LOGGER.info("Starting PostgreSQL container...");
@@ -291,7 +295,7 @@ public class CyberarkVaultTestResource implements
QuarkusTestResourceLifecycleMa
result.put("conjur.writer.password", writeApiKey);
// Obtain a pre-authenticated token for token-based auth testing
- String conjurUrl = "http://localhost:" +
conjurContainer.getMappedPort(80);
+ String conjurUrl = getConjurUrl();
String encodedLogin =
URLEncoder.encode(result.get("conjur.reader.username"), StandardCharsets.UTF_8);
String authUrl = String.format("%s/authn/%s/%s/authenticate",
conjurUrl, CONJUR_ACCOUNT, encodedLogin);
HttpClient httpClient = HttpClient.newHttpClient();