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

valdar pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git


The following commit(s) were added to refs/heads/main by this push:
     new b4e43b3  Fix AWS2 Cloud Watch test issues due to LocalStack bug
b4e43b3 is described below

commit b4e43b3a64ac3fe2b8b1052e30fbd918a960613e
Author: Otavio Rodolfo Piske <opi...@redhat.com>
AuthorDate: Fri May 14 15:54:55 2021 +0200

    Fix AWS2 Cloud Watch test issues due to LocalStack bug
    
    Dimensions are not working correctly in LocalStack's implementation of 
cloud watch in LocalStack 0.12.10. This forces the test to use 0.12.9.1
---
 .../aws/v2/cw/sink/CamelSinkAWSCWITCase.java           | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git 
a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/cw/sink/CamelSinkAWSCWITCase.java
 
b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/cw/sink/CamelSinkAWSCWITCase.java
index 550ea47..f6447da 100644
--- 
a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/cw/sink/CamelSinkAWSCWITCase.java
+++ 
b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/cw/sink/CamelSinkAWSCWITCase.java
@@ -30,7 +30,10 @@ import 
org.apache.camel.kafkaconnector.common.test.StringMessageProducer;
 import org.apache.camel.kafkaconnector.common.utils.TestUtils;
 import org.apache.camel.test.infra.aws.common.services.AWSService;
 import org.apache.camel.test.infra.aws2.clients.AWSSDKClientUtils;
+import org.apache.camel.test.infra.aws2.services.AWSLocalContainerService;
+import org.apache.camel.test.infra.aws2.services.AWSRemoteService;
 import org.apache.camel.test.infra.aws2.services.AWSServiceFactory;
+import org.apache.camel.test.infra.aws2.services.Service;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.TestInstance;
@@ -53,7 +56,13 @@ import static org.junit.jupiter.api.Assertions.fail;
 public class CamelSinkAWSCWITCase extends CamelSinkTestSupport {
 
     @RegisterExtension
-    public static AWSService awsService = 
AWSServiceFactory.createCloudWatchService();
+    public static AWSService awsService = AWSServiceFactory
+            .builder()
+            .addRemoteMapping(AWSRemoteService::new)
+            .addLocalMapping(CustomAWSCloudWatchLocalContainerService::new)
+            .withPropertyNameFormat("%s-service.instance.type")
+            .build();
+
     private static final Logger LOG = 
LoggerFactory.getLogger(CamelSinkAWSCWITCase.class);
 
     private CloudWatchClient client;
@@ -63,6 +72,13 @@ public class CamelSinkAWSCWITCase extends 
CamelSinkTestSupport {
     private volatile int received;
     private final int expect = 10;
 
+    // Dimensions are broken in localstack implementation of CloudWatch 0.12.10
+    private static class CustomAWSCloudWatchLocalContainerService extends 
AWSLocalContainerService {
+        public CustomAWSCloudWatchLocalContainerService() {
+            super("localstack/localstack:0.12.9.1", Service.CLOUD_WATCH);
+        }
+    }
+
     private static class CustomProducer extends StringMessageProducer {
         public CustomProducer(String bootstrapServer, String topicName, int 
count) {
             super(bootstrapServer, topicName, count);

Reply via email to