You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2022/11/10 10:39:42 UTC

[camel] branch main updated (c24d9a10480 -> d7cb747df9e)

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


    from c24d9a10480 Sync deps
     new 0eb1bd34b39 CAMEL-18131 - Adding health check to test conectivity
     new b23876a47a7 CAMEL-18131 - Adding static credentials test
     new d7cb747df9e CAMEL-18131 - Fixing checkstyle

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 components/camel-aws/camel-aws2-ec2/pom.xml        |  9 +++
 .../camel/component/aws2/ec2/AWS2EC2Component.java |  1 -
 .../ec2/AWS2EC2ComponentVerifierExtension.java     | 94 ----------------------
 .../camel/component/aws2/ec2/AWS2EC2Endpoint.java  | 18 +++++
 .../component/aws2/ec2/AWS2EC2HealthCheck.java}    | 40 ++++-----
 .../ec2/AWS2EC2HealthCheckProfileCredsTest.java}   | 15 ++--
 .../ec2/AWS2EC2HealthCheckStaticCredsTest.java}    | 15 ++--
 .../ec2/EC2ComponentVerifierExtensionTest.java     | 94 ----------------------
 8 files changed, 57 insertions(+), 229 deletions(-)
 delete mode 100644 components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2ComponentVerifierExtension.java
 copy components/camel-aws/{camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2ClientHealthCheck.java => camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2HealthCheck.java} (57%)
 copy components/camel-aws/{camel-aws2-eks/src/test/java/org/apache/camel/component/aws2/eks/EKS2CliientHealthCheckProfileCredsTest.java => camel-aws2-ec2/src/test/java/org/apache/camel/component/aws2/ec2/AWS2EC2HealthCheckProfileCredsTest.java} (88%)
 copy components/camel-aws/{camel-aws2-eks/src/test/java/org/apache/camel/component/aws2/eks/EKS2CliientHealthCheckStaticCredsTest.java => camel-aws2-ec2/src/test/java/org/apache/camel/component/aws2/ec2/AWS2EC2HealthCheckStaticCredsTest.java} (88%)
 delete mode 100644 components/camel-aws/camel-aws2-ec2/src/test/java/org/apache/camel/component/aws2/ec2/EC2ComponentVerifierExtensionTest.java


[camel] 02/03: CAMEL-18131 - Adding static credentials test

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit b23876a47a7ab3b3b03bcb5e998207f5a3b6d673
Author: Rhuan Rocha <rh...@gmail.com>
AuthorDate: Mon Nov 7 17:06:42 2022 -0300

    CAMEL-18131 - Adding static credentials test
    
    Signed-off-by: Rhuan Rocha <rh...@gmail.com>
---
 .../ec2/AWS2EC2HealthCheckStaticCredsTest.java     | 96 ++++++++++++++++++++++
 1 file changed, 96 insertions(+)

diff --git a/components/camel-aws/camel-aws2-ec2/src/test/java/org/apache/camel/component/aws2/ec2/AWS2EC2HealthCheckStaticCredsTest.java b/components/camel-aws/camel-aws2-ec2/src/test/java/org/apache/camel/component/aws2/ec2/AWS2EC2HealthCheckStaticCredsTest.java
new file mode 100644
index 00000000000..9e9c179cbb0
--- /dev/null
+++ b/components/camel-aws/camel-aws2-ec2/src/test/java/org/apache/camel/component/aws2/ec2/AWS2EC2HealthCheckStaticCredsTest.java
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.aws2.ec2;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.health.HealthCheck;
+import org.apache.camel.health.HealthCheckHelper;
+import org.apache.camel.health.HealthCheckRegistry;
+import org.apache.camel.impl.health.DefaultHealthCheckRegistry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Collection;
+import java.util.concurrent.TimeUnit;
+
+import static org.testcontainers.shaded.org.awaitility.Awaitility.await;
+
+public class AWS2EC2HealthCheckStaticCredsTest extends CamelTestSupport {
+
+    private static final Logger LOG = LoggerFactory.getLogger(AWS2EC2HealthCheckStaticCredsTest.class);
+
+    CamelContext context;
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        context = super.createCamelContext();
+        context.getPropertiesComponent().setLocation("ref:prop");
+
+        // install health check manually (yes a bit cumbersome)
+        HealthCheckRegistry registry = new DefaultHealthCheckRegistry();
+        registry.setCamelContext(context);
+        Object hc = registry.resolveById("context");
+        registry.register(hc);
+        hc = registry.resolveById("routes");
+        registry.register(hc);
+        hc = registry.resolveById("consumers");
+        registry.register(hc);
+        context.setExtension(HealthCheckRegistry.class, registry);
+
+        return context;
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+
+            @Override
+            public void configure() {
+                from("direct:listClusters")
+                        .to("aws2-ec2://TestDomain?operation=describeInstances&region=l&secretKey=l&accessKey=k");
+            }
+        };
+    }
+
+    @Test
+    public void testConnectivity() {
+
+        Collection<HealthCheck.Result> res = HealthCheckHelper.invokeLiveness(context);
+        boolean up = res.stream().allMatch(r -> r.getState().equals(HealthCheck.State.UP));
+        Assertions.assertTrue(up, "liveness check");
+
+        // health-check readiness should be down
+        await().atMost(20, TimeUnit.SECONDS).untilAsserted(() -> {
+            Collection<HealthCheck.Result> res2 = HealthCheckHelper.invokeReadiness(context);
+            boolean down = res2.stream().allMatch(r -> r.getState().equals(HealthCheck.State.DOWN));
+            boolean containsAws2AthenaHealthCheck = res2.stream()
+                    .filter(result -> result.getCheck().getId().startsWith("aws2-ec2-client"))
+                    .findAny()
+                    .isPresent();
+            boolean hasRegionMessage = res2.stream()
+                    .anyMatch(r -> r.getMessage().stream().anyMatch(msg -> msg.contains("region")));
+            Assertions.assertTrue(down, "liveness check");
+            Assertions.assertTrue(containsAws2AthenaHealthCheck, "aws2-ec2 check");
+            Assertions.assertTrue(hasRegionMessage, "aws2-ec2 check error message");
+        });
+
+    }
+}


[camel] 03/03: CAMEL-18131 - Fixing checkstyle

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit d7cb747df9e4dd8b6e646c4c0fdaff2f31c401ce
Author: Rhuan Rocha <rh...@gmail.com>
AuthorDate: Mon Nov 7 17:16:27 2022 -0300

    CAMEL-18131 - Fixing checkstyle
    
    Signed-off-by: Rhuan Rocha <rh...@gmail.com>
---
 .../camel/component/aws2/ec2/AWS2EC2HealthCheckStaticCredsTest.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/components/camel-aws/camel-aws2-ec2/src/test/java/org/apache/camel/component/aws2/ec2/AWS2EC2HealthCheckStaticCredsTest.java b/components/camel-aws/camel-aws2-ec2/src/test/java/org/apache/camel/component/aws2/ec2/AWS2EC2HealthCheckStaticCredsTest.java
index 9e9c179cbb0..43421678669 100644
--- a/components/camel-aws/camel-aws2-ec2/src/test/java/org/apache/camel/component/aws2/ec2/AWS2EC2HealthCheckStaticCredsTest.java
+++ b/components/camel-aws/camel-aws2-ec2/src/test/java/org/apache/camel/component/aws2/ec2/AWS2EC2HealthCheckStaticCredsTest.java
@@ -16,6 +16,9 @@
  */
 package org.apache.camel.component.aws2.ec2;
 
+import java.util.Collection;
+import java.util.concurrent.TimeUnit;
+
 import org.apache.camel.CamelContext;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.health.HealthCheck;
@@ -28,9 +31,6 @@ import org.junit.jupiter.api.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.Collection;
-import java.util.concurrent.TimeUnit;
-
 import static org.testcontainers.shaded.org.awaitility.Awaitility.await;
 
 public class AWS2EC2HealthCheckStaticCredsTest extends CamelTestSupport {


[camel] 01/03: CAMEL-18131 - Adding health check to test conectivity

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 0eb1bd34b39a2993e6f8846dfd6e4c8a6f2160a3
Author: Rhuan Rocha <rh...@gmail.com>
AuthorDate: Mon Nov 7 17:02:27 2022 -0300

    CAMEL-18131 - Adding health check to test conectivity
    
    Signed-off-by: Rhuan Rocha <rh...@gmail.com>
---
 components/camel-aws/camel-aws2-ec2/pom.xml        |  9 ++
 .../camel/component/aws2/ec2/AWS2EC2Component.java |  1 -
 .../ec2/AWS2EC2ComponentVerifierExtension.java     | 94 ---------------------
 .../camel/component/aws2/ec2/AWS2EC2Endpoint.java  | 18 ++++
 .../component/aws2/ec2/AWS2EC2HealthCheck.java     | 71 ++++++++++++++++
 .../ec2/AWS2EC2HealthCheckProfileCredsTest.java    | 96 ++++++++++++++++++++++
 .../ec2/EC2ComponentVerifierExtensionTest.java     | 94 ---------------------
 7 files changed, 194 insertions(+), 189 deletions(-)

diff --git a/components/camel-aws/camel-aws2-ec2/pom.xml b/components/camel-aws/camel-aws2-ec2/pom.xml
index 01d4bb3e7f1..20158373de1 100644
--- a/components/camel-aws/camel-aws2-ec2/pom.xml
+++ b/components/camel-aws/camel-aws2-ec2/pom.xml
@@ -50,6 +50,10 @@
             <artifactId>apache-client</artifactId>
             <version>${aws-java-sdk2-version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-health</artifactId>
+        </dependency>
 
         <!-- for testing -->
         <dependency>
@@ -76,5 +80,10 @@
             <type>test-jar</type>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.awaitility</groupId>
+            <artifactId>awaitility</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>
diff --git a/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Component.java b/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Component.java
index dfad2f68207..cdba752f706 100644
--- a/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Component.java
+++ b/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Component.java
@@ -44,7 +44,6 @@ public class AWS2EC2Component extends DefaultComponent {
     public AWS2EC2Component(CamelContext context) {
         super(context);
 
-        registerExtension(new AWS2EC2ComponentVerifierExtension());
     }
 
     @Override
diff --git a/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2ComponentVerifierExtension.java b/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2ComponentVerifierExtension.java
deleted file mode 100644
index 1f01948d9ef..00000000000
--- a/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2ComponentVerifierExtension.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.aws2.ec2;
-
-import java.util.Map;
-
-import org.apache.camel.component.extension.verifier.DefaultComponentVerifierExtension;
-import org.apache.camel.component.extension.verifier.ResultBuilder;
-import org.apache.camel.component.extension.verifier.ResultErrorBuilder;
-import org.apache.camel.component.extension.verifier.ResultErrorHelper;
-import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
-import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
-import software.amazon.awssdk.awscore.exception.AwsServiceException;
-import software.amazon.awssdk.regions.Region;
-import software.amazon.awssdk.services.ec2.Ec2Client;
-import software.amazon.awssdk.services.ec2.Ec2ClientBuilder;
-
-public class AWS2EC2ComponentVerifierExtension extends DefaultComponentVerifierExtension {
-
-    public AWS2EC2ComponentVerifierExtension() {
-        this("aws2-ec2");
-    }
-
-    public AWS2EC2ComponentVerifierExtension(String scheme) {
-        super(scheme);
-    }
-
-    // *********************************
-    // Parameters validation
-    // *********************************
-
-    @Override
-    protected Result verifyParameters(Map<String, Object> parameters) {
-
-        ResultBuilder builder = ResultBuilder.withStatusAndScope(Result.Status.OK, Scope.PARAMETERS)
-                .error(ResultErrorHelper.requiresOption("accessKey", parameters))
-                .error(ResultErrorHelper.requiresOption("secretKey", parameters))
-                .error(ResultErrorHelper.requiresOption("region", parameters));
-
-        // Validate using the catalog
-
-        super.verifyParametersAgainstCatalog(builder, parameters);
-
-        return builder.build();
-    }
-
-    // *********************************
-    // Connectivity validation
-    // *********************************
-
-    @Override
-    protected Result verifyConnectivity(Map<String, Object> parameters) {
-        ResultBuilder builder = ResultBuilder.withStatusAndScope(Result.Status.OK, Scope.CONNECTIVITY);
-
-        try {
-            AWS2EC2Configuration configuration = setProperties(new AWS2EC2Configuration(), parameters);
-            if (!Ec2Client.serviceMetadata().regions().contains(Region.of(configuration.getRegion()))) {
-                ResultErrorBuilder errorBuilder = ResultErrorBuilder.withCodeAndDescription(
-                        VerificationError.StandardCode.ILLEGAL_PARAMETER, "The service is not supported in this region");
-                return builder.error(errorBuilder.build()).build();
-            }
-            AwsBasicCredentials cred = AwsBasicCredentials.create(configuration.getAccessKey(), configuration.getSecretKey());
-            Ec2ClientBuilder clientBuilder = Ec2Client.builder();
-            Ec2Client client = clientBuilder.credentialsProvider(StaticCredentialsProvider.create(cred))
-                    .region(Region.of(configuration.getRegion())).build();
-            client.describeInstances();
-        } catch (AwsServiceException e) {
-            ResultErrorBuilder errorBuilder
-                    = ResultErrorBuilder.withCodeAndDescription(VerificationError.StandardCode.AUTHENTICATION, e.getMessage())
-                            .detail("aws_ec2_exception_message", e.getMessage())
-                            .detail(VerificationError.ExceptionAttribute.EXCEPTION_CLASS, e.getClass().getName())
-                            .detail(VerificationError.ExceptionAttribute.EXCEPTION_INSTANCE, e);
-
-            builder.error(errorBuilder.build());
-        } catch (Exception e) {
-            builder.error(ResultErrorBuilder.withException(e).build());
-        }
-        return builder.build();
-    }
-}
diff --git a/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Endpoint.java b/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Endpoint.java
index 20c4fd25ccb..e2a5c5af7db 100644
--- a/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Endpoint.java
+++ b/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Endpoint.java
@@ -22,6 +22,8 @@ import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.component.aws2.ec2.client.AWS2EC2ClientFactory;
+import org.apache.camel.health.HealthCheckHelper;
+import org.apache.camel.impl.health.ComponentsHealthCheckRepository;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.support.ScheduledPollEndpoint;
@@ -37,6 +39,8 @@ import software.amazon.awssdk.services.ec2.Ec2Client;
 public class AWS2EC2Endpoint extends ScheduledPollEndpoint {
 
     private Ec2Client ec2Client;
+    private ComponentsHealthCheckRepository healthCheckRepository;
+    private AWS2EC2HealthCheck clientHealthCheck;
 
     @UriParam
     private AWS2EC2Configuration configuration;
@@ -62,6 +66,15 @@ public class AWS2EC2Endpoint extends ScheduledPollEndpoint {
 
         ec2Client = configuration.getAmazonEc2Client() != null
                 ? configuration.getAmazonEc2Client() : AWS2EC2ClientFactory.getEc2Client(configuration).getEc2Client();
+
+        healthCheckRepository = HealthCheckHelper.getHealthCheckRepository(getCamelContext(),
+                ComponentsHealthCheckRepository.REPOSITORY_ID, ComponentsHealthCheckRepository.class);
+
+        if (healthCheckRepository != null) {
+            clientHealthCheck = new AWS2EC2HealthCheck(this, getId());
+        }
+
+        healthCheckRepository.addHealthCheck(clientHealthCheck);
     }
 
     @Override
@@ -71,6 +84,11 @@ public class AWS2EC2Endpoint extends ScheduledPollEndpoint {
                 ec2Client.close();
             }
         }
+
+        if (healthCheckRepository != null && clientHealthCheck != null) {
+            healthCheckRepository.removeHealthCheck(clientHealthCheck);
+            clientHealthCheck = null;
+        }
         super.doStop();
     }
 
diff --git a/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2HealthCheck.java b/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2HealthCheck.java
new file mode 100644
index 00000000000..5e2a16d20ec
--- /dev/null
+++ b/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2HealthCheck.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.aws2.ec2;
+
+import java.util.Map;
+
+import org.apache.camel.component.aws2.ec2.client.AWS2EC2ClientFactory;
+import org.apache.camel.health.HealthCheckResultBuilder;
+import org.apache.camel.impl.health.AbstractHealthCheck;
+import software.amazon.awssdk.awscore.exception.AwsServiceException;
+import software.amazon.awssdk.regions.Region;
+import software.amazon.awssdk.services.ec2.Ec2Client;
+
+public class AWS2EC2HealthCheck extends AbstractHealthCheck {
+
+    private final AWS2EC2Endpoint aws2EC2Endpoint;
+    private final String clientId;
+
+    public AWS2EC2HealthCheck(AWS2EC2Endpoint aws2EC2Endpoint, String clientId) {
+        super("camel", "aws2-ec2-client-" + clientId);
+        this.aws2EC2Endpoint = aws2EC2Endpoint;
+        this.clientId = clientId;
+    }
+
+    @Override
+    public boolean isLiveness() {
+        // this health check is only readiness
+        return false;
+    }
+
+    @Override
+    protected void doCall(HealthCheckResultBuilder builder, Map<String, Object> options) {
+
+        try {
+            AWS2EC2Configuration configuration = aws2EC2Endpoint.getConfiguration();
+            if (!Ec2Client.serviceMetadata().regions().contains(Region.of(configuration.getRegion()))) {
+                builder.message("The service is not supported in this region");
+                builder.down();
+                return;
+            }
+
+            Ec2Client client = AWS2EC2ClientFactory.getEc2Client(configuration).getEc2Client();
+            client.describeInstances();
+        } catch (AwsServiceException e) {
+            builder.message(e.getMessage());
+            builder.error(e);
+            builder.down();
+        } catch (Exception e) {
+            builder.error(e);
+            builder.down();
+            return;
+        }
+        builder.up();
+
+    }
+}
diff --git a/components/camel-aws/camel-aws2-ec2/src/test/java/org/apache/camel/component/aws2/ec2/AWS2EC2HealthCheckProfileCredsTest.java b/components/camel-aws/camel-aws2-ec2/src/test/java/org/apache/camel/component/aws2/ec2/AWS2EC2HealthCheckProfileCredsTest.java
new file mode 100644
index 00000000000..1693708ca12
--- /dev/null
+++ b/components/camel-aws/camel-aws2-ec2/src/test/java/org/apache/camel/component/aws2/ec2/AWS2EC2HealthCheckProfileCredsTest.java
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.aws2.ec2;
+
+import java.util.Collection;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.health.HealthCheck;
+import org.apache.camel.health.HealthCheckHelper;
+import org.apache.camel.health.HealthCheckRegistry;
+import org.apache.camel.impl.health.DefaultHealthCheckRegistry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.testcontainers.shaded.org.awaitility.Awaitility.await;
+
+public class AWS2EC2HealthCheckProfileCredsTest extends CamelTestSupport {
+
+    private static final Logger LOG = LoggerFactory.getLogger(AWS2EC2HealthCheckProfileCredsTest.class);
+
+    CamelContext context;
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        context = super.createCamelContext();
+        context.getPropertiesComponent().setLocation("ref:prop");
+
+        // install health check manually (yes a bit cumbersome)
+        HealthCheckRegistry registry = new DefaultHealthCheckRegistry();
+        registry.setCamelContext(context);
+        Object hc = registry.resolveById("context");
+        registry.register(hc);
+        hc = registry.resolveById("routes");
+        registry.register(hc);
+        hc = registry.resolveById("consumers");
+        registry.register(hc);
+        context.setExtension(HealthCheckRegistry.class, registry);
+
+        return context;
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+
+            @Override
+            public void configure() {
+                from("direct:listClusters")
+                        .to("aws2-ec2://TestDomain?operation=describeInstances&region=l&useDefaultCredentialsProvider=true");
+            }
+        };
+    }
+
+    @Test
+    public void testConnectivity() {
+
+        Collection<HealthCheck.Result> res = HealthCheckHelper.invokeLiveness(context);
+        boolean up = res.stream().allMatch(r -> r.getState().equals(HealthCheck.State.UP));
+        Assertions.assertTrue(up, "liveness check");
+
+        // health-check readiness should be down
+        await().atMost(20, TimeUnit.SECONDS).untilAsserted(() -> {
+            Collection<HealthCheck.Result> res2 = HealthCheckHelper.invokeReadiness(context);
+            boolean down = res2.stream().allMatch(r -> r.getState().equals(HealthCheck.State.DOWN));
+            boolean containsAws2AthenaHealthCheck = res2.stream()
+                    .filter(result -> result.getCheck().getId().startsWith("aws2-ec2-client"))
+                    .findAny()
+                    .isPresent();
+            boolean hasRegionMessage = res2.stream()
+                    .anyMatch(r -> r.getMessage().stream().anyMatch(msg -> msg.contains("region")));
+            Assertions.assertTrue(down, "liveness check");
+            Assertions.assertTrue(containsAws2AthenaHealthCheck, "aws2-ec2 check");
+            Assertions.assertTrue(hasRegionMessage, "aws2-ec2 check error message");
+        });
+
+    }
+}
diff --git a/components/camel-aws/camel-aws2-ec2/src/test/java/org/apache/camel/component/aws2/ec2/EC2ComponentVerifierExtensionTest.java b/components/camel-aws/camel-aws2-ec2/src/test/java/org/apache/camel/component/aws2/ec2/EC2ComponentVerifierExtensionTest.java
deleted file mode 100644
index 3d85f3dcf97..00000000000
--- a/components/camel-aws/camel-aws2-ec2/src/test/java/org/apache/camel/component/aws2/ec2/EC2ComponentVerifierExtensionTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.aws2.ec2;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.camel.Component;
-import org.apache.camel.component.extension.ComponentVerifierExtension;
-import org.apache.camel.test.junit5.CamelTestSupport;
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-public class EC2ComponentVerifierExtensionTest extends CamelTestSupport {
-
-    // *************************************************
-    // Tests (parameters)
-    // *************************************************
-    @Override
-    public boolean isUseRouteBuilder() {
-        return false;
-    }
-
-    @Test
-    public void testParameters() {
-        Component component = context().getComponent("aws2-ec2");
-
-        ComponentVerifierExtension verifier
-                = component.getExtension(ComponentVerifierExtension.class).orElseThrow(IllegalStateException::new);
-
-        Map<String, Object> parameters = new HashMap<>();
-        parameters.put("secretKey", "l");
-        parameters.put("accessKey", "k");
-        parameters.put("region", "l");
-        parameters.put("label", "test");
-        parameters.put("operation", AWS2EC2Operations.describeInstances.toString());
-
-        ComponentVerifierExtension.Result result = verifier.verify(ComponentVerifierExtension.Scope.PARAMETERS, parameters);
-
-        assertEquals(ComponentVerifierExtension.Result.Status.OK, result.getStatus());
-    }
-
-    @Test
-    public void testConnectivity() {
-        Component component = context().getComponent("aws2-ec2");
-        ComponentVerifierExtension verifier
-                = component.getExtension(ComponentVerifierExtension.class).orElseThrow(IllegalStateException::new);
-
-        Map<String, Object> parameters = new HashMap<>();
-        parameters.put("secretKey", "l");
-        parameters.put("accessKey", "k");
-        parameters.put("region", "US_EAST_1");
-        parameters.put("label", "test");
-        parameters.put("operation", AWS2EC2Operations.describeInstances.toString());
-
-        ComponentVerifierExtension.Result result = verifier.verify(ComponentVerifierExtension.Scope.CONNECTIVITY, parameters);
-
-        assertEquals(ComponentVerifierExtension.Result.Status.ERROR, result.getStatus());
-    }
-
-    @Test
-    public void testConnectivityAndRegion() {
-        Component component = context().getComponent("aws2-ec2");
-        ComponentVerifierExtension verifier
-                = component.getExtension(ComponentVerifierExtension.class).orElseThrow(IllegalStateException::new);
-
-        Map<String, Object> parameters = new HashMap<>();
-        parameters.put("secretKey", "l");
-        parameters.put("accessKey", "k");
-        parameters.put("region", "l");
-        parameters.put("label", "test");
-        parameters.put("operation", AWS2EC2Operations.describeInstances.toString());
-
-        ComponentVerifierExtension.Result result = verifier.verify(ComponentVerifierExtension.Scope.CONNECTIVITY, parameters);
-
-        assertEquals(ComponentVerifierExtension.Result.Status.ERROR, result.getStatus());
-    }
-
-}