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 aab62f3a55 Enable AWS Secret rotation on macOS local environment
aab62f3a55 is described below
commit aab62f3a5547e3c35a903c2179e9e7775a091f7a
Author: Lukas Lowinger <[email protected]>
AuthorDate: Mon Jan 19 08:16:58 2026 +0100
Enable AWS Secret rotation on macOS local environment
---
.../aws2/aws-secrets-manager/README.adoc | 8 +++
.../secrets/manager/it/AwsSecretsManagerTest.java | 74 +++++++++-------------
2 files changed, 39 insertions(+), 43 deletions(-)
diff --git a/integration-test-groups/aws2/aws-secrets-manager/README.adoc
b/integration-test-groups/aws2/aws-secrets-manager/README.adoc
index 2155d4f614..4bf10c5ad2 100644
--- a/integration-test-groups/aws2/aws-secrets-manager/README.adoc
+++ b/integration-test-groups/aws2/aws-secrets-manager/README.adoc
@@ -25,4 +25,12 @@ where
* `region` the same which you export with `AWS_REGION` env
* `account-id` can be found in the upper right corner in AWS Web UI
+== Rotating secret on macOS Docker Colima environment
+The tests were executed on macOS with Colima Docker provider.
+If you have the same environment, then you should execute (before running the
tests):
+```
+export TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=/var/run/docker.sock
+```
+
+For more info see
https://java.testcontainers.org/supported_docker_environment/.
diff --git
a/integration-test-groups/aws2/aws-secrets-manager/src/test/java/org/apache/camel/quarkus/component/aws/secrets/manager/it/AwsSecretsManagerTest.java
b/integration-test-groups/aws2/aws-secrets-manager/src/test/java/org/apache/camel/quarkus/component/aws/secrets/manager/it/AwsSecretsManagerTest.java
index bb73a05bea..38d6785760 100644
---
a/integration-test-groups/aws2/aws-secrets-manager/src/test/java/org/apache/camel/quarkus/component/aws/secrets/manager/it/AwsSecretsManagerTest.java
+++
b/integration-test-groups/aws2/aws-secrets-manager/src/test/java/org/apache/camel/quarkus/component/aws/secrets/manager/it/AwsSecretsManagerTest.java
@@ -27,7 +27,6 @@ import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
-import io.smallrye.common.os.OS;
import org.apache.camel.component.aws.secretsmanager.SecretsManagerConstants;
import org.apache.camel.component.aws.secretsmanager.SecretsManagerOperations;
import org.apache.camel.quarkus.test.EnabledIf;
@@ -130,9 +129,7 @@ public class AwsSecretsManagerTest extends
BaseAWs2TestSupport {
@Test
public void testOperations() throws IOException {
- if (canUseLambdaFunction()) {
- setupLambdaFunction();
- }
+ setupLambdaFunction();
final String secretToCreate = "loadFirst";
final String secret2ToCreate = "changeit2";
@@ -207,39 +204,37 @@ public class AwsSecretsManagerTest extends
BaseAWs2TestSupport {
assertEquals(name2ToCreate, descriptionMap.get("name"));
assertEquals(description2ToCreate,
descriptionMap.get("description"));
- if (canUseLambdaFunction()) {
- String rotateOperation =
SecretsManagerOperations.rotateSecret.toString();
- if (MockBackendUtils.startMockBackend(false)) {
- // rotate secret2 with rotation rules set to fix issue
with LocalStack
- // on real AWS use the default Camel rotateSecret
operation without POJO involved
- // this workaround is only for older LocalStack - it is
not needed in 4.12.0 (probably fixed via
https://github.com/localstack/localstack/pull/12391/)
- rotateOperation = "rotateSecretWithRotationRulesSet";
- }
-
- // rotate secret2
- RestAssured.given()
- .contentType(ContentType.JSON)
-
.body(CollectionHelper.mapOf(SecretsManagerConstants.SECRET_ID, createdArn2,
-
SecretsManagerConstants.LAMBDA_ROTATION_FUNCTION_ARN, lambdaArn))
- .post("/aws-secrets-manager/operation/" +
rotateOperation)
- .then()
- .statusCode(201)
- .body(is("true"));
-
- Awaitility.await().pollInterval(5, TimeUnit.SECONDS).atMost(1,
TimeUnit.MINUTES).untilAsserted(
- () -> {
- var secret2RotatedMap = RestAssured.given()
- .contentType(ContentType.JSON)
-
.body(Collections.singletonMap(SecretsManagerConstants.SECRET_ID,
finalCreatedArn2))
- .post("/aws-secrets-manager/operation/" +
SecretsManagerOperations.getSecret)
- .then()
- .statusCode(201)
- .extract().as(Map.class);
-
- assertEquals(secret2ToCreate + "_Rotated",
secret2RotatedMap.get("body"));
- });
+ String rotateOperation =
SecretsManagerOperations.rotateSecret.toString();
+ if (MockBackendUtils.startMockBackend(false)) {
+ // rotate secret2 with rotation rules set to fix issue with
LocalStack
+ // on real AWS use the default Camel rotateSecret operation
without POJO involved
+ // this workaround is only for older LocalStack - it is not
needed in 4.12.0 (probably fixed via
https://github.com/localstack/localstack/pull/12391/)
+ rotateOperation = "rotateSecretWithRotationRulesSet";
}
+ // rotate secret2
+ RestAssured.given()
+ .contentType(ContentType.JSON)
+
.body(CollectionHelper.mapOf(SecretsManagerConstants.SECRET_ID, createdArn2,
+
SecretsManagerConstants.LAMBDA_ROTATION_FUNCTION_ARN, lambdaArn))
+ .post("/aws-secrets-manager/operation/" + rotateOperation)
+ .then()
+ .statusCode(201)
+ .body(is("true"));
+
+ Awaitility.await().pollInterval(5, TimeUnit.SECONDS).atMost(1,
TimeUnit.MINUTES).untilAsserted(
+ () -> {
+ var secret2RotatedMap = RestAssured.given()
+ .contentType(ContentType.JSON)
+
.body(Collections.singletonMap(SecretsManagerConstants.SECRET_ID,
finalCreatedArn2))
+ .post("/aws-secrets-manager/operation/" +
SecretsManagerOperations.getSecret)
+ .then()
+ .statusCode(201)
+ .extract().as(Map.class);
+
+ assertEquals(secret2ToCreate + "_Rotated",
secret2RotatedMap.get("body"));
+ });
+
// >> delete secret 2
RestAssured.given()
.contentType(ContentType.JSON)
@@ -316,9 +311,7 @@ public class AwsSecretsManagerTest extends
BaseAWs2TestSupport {
AwsSecretsManagerUtil.deleteSecretImmediately(createdArn);
AwsSecretsManagerUtil.deleteSecretImmediately(createdArn2);
- if (canUseLambdaFunction()) {
- cleanLambdaFunction();
- }
+ cleanLambdaFunction();
}
}
@@ -377,9 +370,4 @@ public class AwsSecretsManagerTest extends
BaseAWs2TestSupport {
}
}
}
-
- private boolean canUseLambdaFunction() {
- // https://github.com/testcontainers/testcontainers-java/issues/11342
- return OS.current() != OS.MAC ||
!MockBackendUtils.startMockBackend(false);
- }
}