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
@@ -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);
