Skip to content

armgit / floci

Public Imported from GitHub
0

Light, fluffy, and always free - The AWS Local Emulator alternative

feat(ssm): publish parameter change events (#5262)

Mario Toffia89317831bb1c
diff --git a/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SsmParameterStoreEventsTest.java b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SsmParameterStoreEventsTest.java
new file mode 100644
index 0000000000..319674e649
--- /dev/null
+++ b/compatibility-tests/sdk-test-java/src/test/java/com/floci/test/SsmParameterStoreEventsTest.java
@@ -0,0 +1,70 @@
+package com.floci.test;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import software.amazon.awssdk.services.eventbridge.EventBridgeClient;
+import software.amazon.awssdk.services.eventbridge.model.DeleteRuleRequest;
+import software.amazon.awssdk.services.eventbridge.model.PutRuleRequest;
+import software.amazon.awssdk.services.eventbridge.model.PutTargetsRequest;
+import software.amazon.awssdk.services.eventbridge.model.RemoveTargetsRequest;
+import software.amazon.awssdk.services.eventbridge.model.Target;
+import software.amazon.awssdk.services.sqs.SqsClient;
+import software.amazon.awssdk.services.sqs.model.CreateQueueRequest;
+import software.amazon.awssdk.services.sqs.model.DeleteQueueRequest;
+import software.amazon.awssdk.services.sqs.model.GetQueueAttributesRequest;
+import software.amazon.awssdk.services.sqs.model.Message;
+import software.amazon.awssdk.services.sqs.model.QueueAttributeName;
+import software.amazon.awssdk.services.sqs.model.ReceiveMessageRequest;
+import software.amazon.awssdk.services.ssm.SsmClient;
+import software.amazon.awssdk.services.ssm.model.DeleteParameterRequest;
+import software.amazon.awssdk.services.ssm.model.ParameterType;
+import software.amazon.awssdk.services.ssm.model.PutParameterRequest;
+
+import java.util.List;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+@DisplayName("SSM Parameter Store Change events")
+class SsmParameterStoreEventsTest {
+
+ @Test
+ @DisplayName("PutParameter publishes a Parameter Store Change event to the default bus")
+ void putParameterPublishesParameterStoreChangeEvent() throws Exception {
+ String name = "/" + TestFixtures.uniqueName("sdk-ssm-events") + "/param";
+ String rule = TestFixtures.uniqueName("ssm-events");
+ try (SsmClient ssm = TestFixtures.ssmClient();
+ EventBridgeClient eventBridge = TestFixtures.eventBridgeClient();
+ SqsClient sqs = TestFixtures.sqsClient()) {
+ String queueUrl = sqs.createQueue(CreateQueueRequest.builder().queueName(rule).build()).queueUrl();
+ String queueArn = sqs.getQueueAttributes(GetQueueAttributesRequest.builder()
+ .queueUrl(queueUrl).attributeNames(QueueAttributeName.QUEUE_ARN).build())
+ .attributes().get(QueueAttributeName.QUEUE_ARN);
+ eventBridge.putRule(PutRuleRequest.builder().name(rule)
+ .eventPattern("{\"source\":[\"aws.ssm\"],\"detail\":{\"name\":[\"" + name + "\"]}}")
+ .build());
+ eventBridge.putTargets(PutTargetsRequest.builder().rule(rule)
+ .targets(Target.builder().id("1").arn(queueArn).build()).build());
+ try {
+ ssm.putParameter(PutParameterRequest.builder()
+ .name(name).value("v").type(ParameterType.STRING).build());
+
+ List<Message> messages = sqs.receiveMessage(ReceiveMessageRequest.builder()
+ .queueUrl(queueUrl).maxNumberOfMessages(10).waitTimeSeconds(5).build()).messages();
+ assertThat(messages).hasSize(1);
+ JsonNode event = new ObjectMapper().readTree(messages.get(0).body());
+ assertThat(event.path("source").asText()).isEqualTo("aws.ssm");
+ assertThat(event.path("detail-type").asText()).isEqualTo("Parameter Store Change");
+ assertThat(event.path("detail").path("operation").asText()).isEqualTo("Create");
+ assertThat(event.path("detail").path("name").asText()).isEqualTo(name);
+ assertThat(event.path("detail").path("type").asText()).isEqualTo("String");
+ } finally {
+ eventBridge.removeTargets(RemoveTargetsRequest.builder().rule(rule).ids("1").build());
+ eventBridge.deleteRule(DeleteRuleRequest.builder().name(rule).build());
+ sqs.deleteQueue(DeleteQueueRequest.builder().queueUrl(queueUrl).build());
+ ssm.deleteParameter(DeleteParameterRequest.builder().name(name).build());
+ }
+ }
+ }
+}
diff --git a/docs/services/ssm.md b/docs/services/ssm.md
index aefca5ac3d..ac6f30c8b8 100644
--- a/docs/services/ssm.md
+++ b/docs/services/ssm.md
@@ -173,3 +173,24 @@ All AWS parameter types are accepted: `String`, `StringList`, `SecureString`.
!!! note
`SecureString` parameters are stored as-is without actual KMS encryption in Floci. The type is preserved and returned correctly, but the value is not encrypted at rest.
+
+## Parameter Store Change events
+
+Like AWS, Floci publishes a `Parameter Store Change` event (`source: aws.ssm`) to the account's
+**default** EventBridge bus after a successful parameter write, so a rule matching `aws.ssm` fires
+from Parameter Store activity. `resources` holds the parameter ARN, and the event carries the
+account and region of the call.
+
+| Call | Events | `detail` |
+|---|---|---|
+| `PutParameter`, new name | one `Create` | `operation`, `name`, `type`, and `description` when set |
+| `PutParameter` overwriting an existing name | one `Update`, even when the value is unchanged | as for `Create` |
+| `DeleteParameter` | one `Delete` | as for `Create` |
+| `DeleteParameters` | one `Delete` per deleted name, none for a missing name | as for `Create` |
+| `LabelParameterVersion` | one `LabelParameterVersion` per valid label it attaches or moves | as for `Create`, from the labelled version, plus `label`, `fromVersion` (the version the label left as a string, `""` for a new label) and `toVersion` |
+| `UnlabelParameterVersion` | one `UnlabelParameterVersion` when it removes a label, none otherwise | as for `Create`, from the unlabelled version, plus `labels` (the labels removed), `fromVersion` (that version as a string) and `toVersion` (`""`) |
+
+Parameters a CloudFormation stack creates or deletes publish the same events. A call that fails,
+such as a `PutParameter` on an existing name without `Overwrite`, publishes nothing, and so do
+`AddTagsToResource`, a label already on the requested version and an invalid label. Publishing
+is best effort: a delivery failure is logged and never fails or undoes the write.
diff --git a/src/main/java/io/github/hectorvent/floci/services/codepipeline/CodePipelineEventPublisher.java b/src/main/java/io/github/hectorvent/floci/services/codepipeline/CodePipelineEventPublisher.java
index 19767d4280..a6b8dfd40e 100644
--- a/src/main/java/io/github/hectorvent/floci/services/codepipeline/CodePipelineEventPublisher.java
+++ b/src/main/java/io/github/hectorvent/floci/services/codepipeline/CodePipelineEventPublisher.java
@@ -1,7 +1,6 @@
package io.github.hectorvent.floci.services.codepipeline;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.github.hectorvent.floci.core.common.AwsArnUtils;
import io.github.hectorvent.floci.core.common.AwsRegionFacts;
@@ -18,7 +17,6 @@ import org.jboss.logging.Logger;
import java.time.Instant;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -171,18 +169,9 @@ public class CodePipelineEventPublisher {
private void publish(CodePipelineExecution execution, String detailType, ObjectNode detail) {
try {
- Map<String, Object> entry = new HashMap<>();
- entry.put("Source", "aws.codepipeline");
- entry.put("DetailType", detailType);
- entry.put("Detail", detail.toString());
- entry.put("EventBusName", "default");
- entry.put("Region", execution.getRegion());
- // Always emit Resources (possibly empty): EventBridge pattern matching reads the
- // key unconditionally for rules with a "resources" filter.
- ArrayNode resources = mapper.createArrayNode();
- resources.add(AwsArnUtils.Arn.of("codepipeline", execution.getRegion(),
- execution.getAccountId(), execution.getPipelineName()).toString());
- entry.put("Resources", resources);
+ Map<String, Object> entry = EventBridgeService.serviceEventEntry("aws.codepipeline", detailType,
+ detail.toString(), AwsArnUtils.Arn.of("codepipeline", execution.getRegion(),
+ execution.getAccountId(), execution.getPipelineName()).toString());
// This runs on a pipeline-execution worker thread with no request context, so the
// two-argument overload would fall back to the default (management) account and a
// member account's EventBridge rules would never see the event. Name the bus's
diff --git a/src/main/java/io/github/hectorvent/floci/services/ecs/EcsEventPublisher.java b/src/main/java/io/github/hectorvent/floci/services/ecs/EcsEventPublisher.java
index afefadcde9..6a5f80b897 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ecs/EcsEventPublisher.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ecs/EcsEventPublisher.java
@@ -14,9 +14,7 @@ import jakarta.inject.Inject;
import org.jboss.logging.Logger;
import java.time.Instant;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
/**
* Publishes AWS-shaped {@code aws.ecs} lifecycle events to the default EventBridge bus.
@@ -120,16 +118,8 @@ public class EcsEventPublisher {
private void putEvent(String detailType, String resourceArn, ObjectNode detail, String region)
throws Exception {
- ArrayNode resources = objectMapper.createArrayNode();
- if (resourceArn != null) {
- resources.add(resourceArn);
- }
- Map<String, Object> entry = new HashMap<>();
- entry.put("Source", SOURCE);
- entry.put("DetailType", detailType);
- entry.put("Detail", objectMapper.writeValueAsString(detail));
- entry.put("Resources", resources);
- eventBridgeService.putEvents(List.of(entry), effectiveRegion(region));
+ eventBridgeService.putEvents(List.of(EventBridgeService.serviceEventEntry(SOURCE, detailType,
+ objectMapper.writeValueAsString(detail), resourceArn)), effectiveRegion(region));
}
private String effectiveRegion(String region) {
diff --git a/src/main/java/io/github/hectorvent/floci/services/eventbridge/EventBridgeService.java b/src/main/java/io/github/hectorvent/floci/services/eventbridge/EventBridgeService.java
index cf3c88bf6c..eb13cb1dab 100644
--- a/src/main/java/io/github/hectorvent/floci/services/eventbridge/EventBridgeService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/eventbridge/EventBridgeService.java
@@ -7,6 +7,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.databind.node.TextNode;
import io.github.hectorvent.floci.config.EmulatorConfig;
@@ -766,6 +767,26 @@ public class EventBridgeService implements ResourceProvider {
public record PutEventsResult(int failedCount, List<Map<String, String>> entries) {}
+ /**
+ * The entry an AWS service sends on its own behalf, for {@link #putEvents}. {@code Resources} is
+ * always present, because rule matching reads it for any rule with a {@code resources} filter,
+ * and holds {@code resourceArn} unless that is null or blank. With no {@code EventBusName} the
+ * entry goes to the default bus; the map is mutable so a caller can name another.
+ */
+ public static Map<String, Object> serviceEventEntry(String source, String detailType, String detail,
+ String resourceArn) {
+ ArrayNode resources = JsonNodeFactory.instance.arrayNode();
+ if (resourceArn != null && !resourceArn.isBlank()) {
+ resources.add(resourceArn);
+ }
+ Map<String, Object> entry = new HashMap<>();
+ entry.put("Source", source);
+ entry.put("DetailType", detailType);
+ entry.put("Detail", detail);
+ entry.put("Resources", resources);
+ return entry;
+ }
+
public PutEventsResult putEvents(List<Map<String, Object>> entries, String region) {
return putEvents(entries, region, null);
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/redshiftdata/RedshiftDataEventPublisher.java b/src/main/java/io/github/hectorvent/floci/services/redshiftdata/RedshiftDataEventPublisher.java
index 4323b7f8ff..f48a0a99f5 100644
--- a/src/main/java/io/github/hectorvent/floci/services/redshiftdata/RedshiftDataEventPublisher.java
+++ b/src/main/java/io/github/hectorvent/floci/services/redshiftdata/RedshiftDataEventPublisher.java
@@ -9,7 +9,6 @@ import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import org.jboss.logging.Logger;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -47,12 +46,8 @@ class RedshiftDataEventPublisher {
detail.put("state", statement.status.name());
detail.put("rows", statement.resultRows);
detail.put("expireAt", statement.expiresAt.getEpochSecond());
- Map<String, Object> entry = new HashMap<>();
- entry.put("Source", "aws.redshift-data");
- entry.put("DetailType", "Redshift Data Statement Status Change");
- entry.put("Detail", detail.toString());
- entry.put("EventBusName", "default");
- entry.put("Resources", mapper.createArrayNode().add(statement.resourceArn));
+ Map<String, Object> entry = EventBridgeService.serviceEventEntry("aws.redshift-data",
+ "Redshift Data Statement Status Change", detail.toString(), statement.resourceArn);
EventBridgeService.PutEventsResult result = events.putEvents(List.of(entry), statement.region, statement.accountId);
if (result.failedCount() > 0) {
LOG.warnv("EventBridge rejected event for statement {0}, account {1}, region {2}: {3}",
diff --git a/src/main/java/io/github/hectorvent/floci/services/ses/SesEventPublisher.java b/src/main/java/io/github/hectorvent/floci/services/ses/SesEventPublisher.java
index 5bd6cbc13f..219b7862c4 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ses/SesEventPublisher.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ses/SesEventPublisher.java
@@ -1,7 +1,6 @@
package io.github.hectorvent.floci.services.ses;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.github.hectorvent.floci.core.common.AwsArnUtils;
import io.github.hectorvent.floci.core.common.AwsException;
@@ -27,7 +26,6 @@ import org.jboss.logging.Logger;
import java.nio.charset.StandardCharsets;
import java.time.Instant;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -248,21 +246,9 @@ public class SesEventPublisher {
}
String region = AwsArnUtils.regionOrDefault(busArn, defaultRegion);
try {
- Map<String, Object> entry = new HashMap<>();
- entry.put("Source", "aws.ses");
- entry.put("DetailType", SesEventPayload.eventBridgeDetailType(eventType));
- entry.put("Detail", payloadJson);
+ Map<String, Object> entry = EventBridgeService.serviceEventEntry("aws.ses",
+ SesEventPayload.eventBridgeDetailType(eventType), payloadJson, sourceArn);
entry.put("EventBusName", busName);
- entry.put("Region", region);
- // Always emit Resources (possibly empty) — EventBridgeService.matchesPattern
- // casts entry.get("Resources") to ArrayNode unconditionally for any rule with
- // a "resources" filter; an absent key NPEs and silently turns the rule into
- // a no-match.
- ArrayNode resources = objectMapper.createArrayNode();
- if (sourceArn != null && !sourceArn.isBlank()) {
- resources.add(sourceArn);
- }
- entry.put("Resources", resources);
EventBridgeService.PutEventsResult result =
eventBridgeService.putEvents(List.of(entry), region);
if (result.failedCount() > 0) {
diff --git a/src/main/java/io/github/hectorvent/floci/services/ssm/SsmEventPublisher.java b/src/main/java/io/github/hectorvent/floci/services/ssm/SsmEventPublisher.java
new file mode 100644
index 0000000000..135a22b3e3
--- /dev/null
+++ b/src/main/java/io/github/hectorvent/floci/services/ssm/SsmEventPublisher.java
@@ -0,0 +1,86 @@
+package io.github.hectorvent.floci.services.ssm;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import io.github.hectorvent.floci.services.eventbridge.EventBridgeService;
+import io.github.hectorvent.floci.services.ssm.model.Parameter;
+import io.github.hectorvent.floci.services.ssm.model.ParameterHistory;
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+import org.jboss.logging.Logger;
+
+import java.util.List;
+
+/**
+ * Publishes the {@code aws.ssm} Parameter Store Change events AWS sends to the default EventBridge bus
+ * after a successful parameter mutation. Best effort: a publishing failure is logged and never undoes
+ * the write.
+ */
+@ApplicationScoped
+public class SsmEventPublisher {
+
+ private static final Logger LOG = Logger.getLogger(SsmEventPublisher.class);
+ private static final String SOURCE = "aws.ssm";
+ private static final String DETAIL_TYPE = "Parameter Store Change";
+
+ private final EventBridgeService eventBridgeService;
+ private final ObjectMapper objectMapper;
+
+ /** A null {@code eventBridgeService} publishes nothing, for SsmService's test constructors. */
+ @Inject
+ public SsmEventPublisher(EventBridgeService eventBridgeService, ObjectMapper objectMapper) {
+ this.eventBridgeService = eventBridgeService;
+ this.objectMapper = objectMapper;
+ }
+
+ /** {@code operation} is Create, Update or Delete. */
+ public void parameterChanged(String operation, Parameter parameter, String region) {
+ publish(parameter.getArn(),
+ detail(operation, parameter.getName(), parameter.getType(), parameter.getDescription()), region);
+ }
+
+ /** {@code fromVersion} is empty when the label was not on any version before. */
+ public void labelChanged(String arn, ParameterHistory labelled, String label, String fromVersion, String region) {
+ ObjectNode detail = detail("LabelParameterVersion", labelled.getName(), labelled.getType(),
+ labelled.getDescription());
+ detail.put("label", label);
+ detail.put("fromVersion", fromVersion);
+ detail.put("toVersion", String.valueOf(labelled.getVersion()));
+ publish(arn, detail, region);
+ }
+
+ /** One event per call, listing every label it removed from {@code unlabelled}. */
+ public void labelsRemoved(String arn, ParameterHistory unlabelled, List<String> labels, String region) {
+ ObjectNode detail = detail("UnlabelParameterVersion", unlabelled.getName(), unlabelled.getType(),
+ unlabelled.getDescription());
+ ArrayNode removed = detail.putArray("labels");
+ labels.forEach(removed::add);
+ detail.put("fromVersion", String.valueOf(unlabelled.getVersion()));
+ detail.put("toVersion", "");
+ publish(arn, detail, region);
+ }
+
+ private ObjectNode detail(String operation, String name, String type, String description) {
+ ObjectNode detail = objectMapper.createObjectNode();
+ detail.put("operation", operation);
+ detail.put("name", name);
+ detail.put("type", type);
+ if (description != null) {
+ detail.put("description", description);
+ }
+ return detail;
+ }
+
+ private void publish(String arn, ObjectNode detail, String region) {
+ if (eventBridgeService == null) {
+ return;
+ }
+ try {
+ eventBridgeService.putEvents(List.of(EventBridgeService.serviceEventEntry(SOURCE, DETAIL_TYPE,
+ objectMapper.writeValueAsString(detail), arn)), region);
+ } catch (Exception e) {
+ LOG.warnv(e, "Failed to publish Parameter Store Change for {0}", arn);
+ }
+ }
+}
diff --git a/src/main/java/io/github/hectorvent/floci/services/ssm/SsmService.java b/src/main/java/io/github/hectorvent/floci/services/ssm/SsmService.java
index c4d787d5c7..3c29deb7d7 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ssm/SsmService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ssm/SsmService.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.ssm;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -91,10 +92,12 @@ public class SsmService implements ResourceProvider {
private final RegionResolver regionResolver;
private final Ec2ImageCatalog imageCatalog;
private final SecretsManagerService secretsManager;
+ private final SsmEventPublisher eventPublisher;
@Inject
public SsmService(StorageFactory storageFactory, EmulatorConfig config, RegionResolver regionResolver,
- Ec2ImageCatalog imageCatalog, SecretsManagerService secretsManager) {
+ Ec2ImageCatalog imageCatalog, SecretsManagerService secretsManager,
+ SsmEventPublisher eventPublisher) {
this(
storageFactory.create("ssm", "ssm-parameters.json",
new TypeReference<>() {
@@ -117,7 +120,8 @@ public class SsmService implements ResourceProvider {
config.services().ssm().maxParameterHistory(),
regionResolver,
imageCatalog,
- secretsManager
+ secretsManager,
+ eventPublisher
);
}
@@ -177,6 +181,20 @@ public class SsmService implements ResourceProvider {
StorageBackend<String, SsmAssociation> associationStore,
int maxParameterHistory, RegionResolver regionResolver,
Ec2ImageCatalog imageCatalog, SecretsManagerService secretsManager) {
+ this(parameterStore, historyStore, documentPermissionStore, documentStore, serviceSettingStore,
+ associationStore, maxParameterHistory, regionResolver, imageCatalog, secretsManager,
+ new SsmEventPublisher(null, new ObjectMapper()));
+ }
+
+ SsmService(StorageBackend<String, Parameter> parameterStore,
+ StorageBackend<String, List<ParameterHistory>> historyStore,
+ StorageBackend<String, List<String>> documentPermissionStore,
+ StorageBackend<String, SsmDocument> documentStore,
+ StorageBackend<String, ServiceSetting> serviceSettingStore,
+ StorageBackend<String, SsmAssociation> associationStore,
+ int maxParameterHistory, RegionResolver regionResolver,
+ Ec2ImageCatalog imageCatalog, SecretsManagerService secretsManager,
+ SsmEventPublisher eventPublisher) {
this.parameterStore = parameterStore;
this.historyStore = historyStore;
this.documentPermissionStore = documentPermissionStore;
@@ -187,6 +205,7 @@ public class SsmService implements ResourceProvider {
this.regionResolver = regionResolver;
this.imageCatalog = imageCatalog;
this.secretsManager = secretsManager;
+ this.eventPublisher = eventPublisher;
}
/**
@@ -255,14 +274,18 @@ public class SsmService implements ResourceProvider {
}
}
+ Parameter stored;
// Same monitor as the other synchronized SSM writers: the version read and the write are one step.
synchronized (this) {
- return storeParameter(name, value, type, description, overwrite, tags, keyId, allowedPattern,
+ stored = storeParameter(name, value, type, description, overwrite, tags, keyId, allowedPattern,
tier, policies, region);
}
+ // A new parameter starts at version 1, an overwrite never does.
+ eventPublisher.parameterChanged(stored.getVersion() == 1 ? "Create" : "Update", stored, region);
+ return stored.getVersion();
}
- private long storeParameter(String name, String value, String type, String description,
+ private Parameter storeParameter(String name, String value, String type, String description,
boolean overwrite, Map<String, String> tags, String keyId, String allowedPattern,
String tier, List<JsonNode> policies, String region) {
String storageKey = regionKey(region, name);
@@ -311,7 +334,7 @@ public class SsmService implements ResourceProvider {
addHistory(storageKey, parameter);
LOG.infov("Put parameter: {0} in region {1} (version {2})", name, region, version);
- return version;
+ return parameter;
}
/** AWS's form is {@code parameter/<name>} whether or not the name starts with a slash. */
@@ -570,27 +593,35 @@ public class SsmService implements ResourceProvider {
return !paramName.substring(normalizedPath.length()).contains("/");
}
- public synchronized void deleteParameter(String name, String region) {
+ public void deleteParameter(String name, String region) {
String storageKey = regionKey(region, name);
- if (parameterStore.get(storageKey).isEmpty()) {
- throw new AwsException("ParameterNotFound",
- "Parameter " + name + " not found.", 400);
+ Parameter removed;
+ synchronized (this) {
+ removed = parameterStore.get(storageKey).orElseThrow(() ->
+ new AwsException("ParameterNotFound", "Parameter " + name + " not found.", 400));
+ parameterStore.delete(storageKey);
+ historyStore.delete(storageKey);
}
- parameterStore.delete(storageKey);
- historyStore.delete(storageKey);
+ eventPublisher.parameterChanged("Delete", removed, region);
LOG.infov("Deleted parameter: {0}", name);
}
- public synchronized List<String> deleteParameters(List<String> names, String region) {
+ public List<String> deleteParameters(List<String> names, String region) {
List<String> deleted = new ArrayList<>();
- for (String name : names) {
- String storageKey = regionKey(region, name);
- if (parameterStore.get(storageKey).isPresent()) {
- parameterStore.delete(storageKey);
- historyStore.delete(storageKey);
- deleted.add(name);
+ List<Parameter> removed = new ArrayList<>();
+ synchronized (this) {
+ for (String name : names) {
+ String storageKey = regionKey(region, name);
+ Optional<Parameter> parameter = parameterStore.get(storageKey);
+ if (parameter.isPresent()) {
+ parameterStore.delete(storageKey);
+ historyStore.delete(storageKey);
+ deleted.add(name);
+ removed.add(parameter.get());
+ }
}
}
+ removed.forEach(parameter -> eventPublisher.parameterChanged("Delete", parameter, region));
return deleted;
}
@@ -694,8 +725,18 @@ public class SsmService implements ResourceProvider {
public record LabelParameterVersionResult(long parameterVersion, List<String> invalidLabels) {}
- public synchronized LabelParameterVersionResult labelParameterVersion(String name, Long parameterVersion,
+ public LabelParameterVersionResult labelParameterVersion(String name, Long parameterVersion,
List<String> labels, String region) {
+ List<Runnable> events = new ArrayList<>();
+ LabelParameterVersionResult result = applyLabels(name, parameterVersion, labels, region, events);
+ events.forEach(Runnable::run);
+ return result;
+ }
+
+ /** Collects the events instead of publishing them: EventBridge delivers to targets while it runs. */
+ private synchronized LabelParameterVersionResult applyLabels(String name, Long parameterVersion,
+ List<String> labels, String region,
+ List<Runnable> events) {
validateLabelList(labels);
String storageKey = regionKey(region, name);
@@ -744,9 +785,11 @@ public class SsmService implements ResourceProvider {
: new ArrayList<>();
int newLabelCount = targetLabels.size();
+ Map<String, String> fromVersions = new LinkedHashMap<>();
for (String validLabel : validLabels) {
if (!targetLabels.contains(validLabel)) {
newLabelCount++;
+ fromVersions.put(validLabel, "");
}
}
if (newLabelCount > 10) {
@@ -756,6 +799,9 @@ public class SsmService implements ResourceProvider {
for (ParameterHistory h : updatedHistory) {
if (h.getVersion() != targetVersion && h.getLabels() != null) {
+ for (String label : h.getLabels()) {
+ fromVersions.computeIfPresent(label, (key, from) -> String.valueOf(h.getVersion()));
+ }
List<String> otherLabels = new ArrayList<>(h.getLabels());
if (otherLabels.removeAll(validLabels)) {
h.setLabels(otherLabels);
@@ -771,11 +817,14 @@ public class SsmService implements ResourceProvider {
targetCopy.setLabels(targetLabels);
historyStore.put(storageKey, updatedHistory);
+ ParameterHistory labelled = targetCopy;
+ fromVersions.forEach((label, from) ->
+ events.add(() -> eventPublisher.labelChanged(current.getArn(), labelled, label, from, region)));
LOG.infov("Labeled parameter {0} version {1} with labels {2}", name, targetVersion, validLabels);
return new LabelParameterVersionResult(targetVersion, invalidLabels);
}
- public synchronized LabelParameterVersionResult labelParameterVersion(String name, long parameterVersion,
+ public LabelParameterVersionResult labelParameterVersion(String name, long parameterVersion,
List<String> labels, String region) {
return labelParameterVersion(name, Long.valueOf(parameterVersion), labels, region);
}
@@ -789,8 +838,18 @@ public class SsmService implements ResourceProvider {
* {@code invalidLabels} the order of the request, and error messages echo the name as sent
* although the lookup ignores surrounding whitespace.
*/
- public synchronized UnlabelParameterVersionResult unlabelParameterVersion(String name, long parameterVersion,
- List<String> labels, String region) {
+ public UnlabelParameterVersionResult unlabelParameterVersion(String name, long parameterVersion,
+ List<String> labels, String region) {
+ List<Runnable> events = new ArrayList<>();
+ UnlabelParameterVersionResult result = removeLabels(name, parameterVersion, labels, region, events);
+ events.forEach(Runnable::run);
+ return result;
+ }
+
+ /** Collects the event instead of publishing it, as {@link #applyLabels} does. */
+ private synchronized UnlabelParameterVersionResult removeLabels(String name, long parameterVersion,
+ List<String> labels, String region,
+ List<Runnable> events) {
validateLabelList(labels);
String trimmed = name.strip();
if (AwsArnUtils.isArn(trimmed)) {
@@ -809,9 +868,8 @@ public class SsmService implements ResourceProvider {
}
String storageKey = regionKey(region, trimmed);
- if (parameterStore.get(storageKey).isEmpty()) {
- throw new AwsException("ParameterNotFound", "Parameter " + name + " not found.", 400);
- }
+ Parameter current = parameterStore.get(storageKey).orElseThrow(() ->
+ new AwsException("ParameterNotFound", "Parameter " + name + " not found.", 400));
List<ParameterHistory> existingHistory = historyStore.get(storageKey).orElse(List.of());
List<ParameterHistory> updatedHistory = new ArrayList<>(existingHistory.size());
@@ -840,6 +898,8 @@ public class SsmService implements ResourceProvider {
targetLabels.removeAll(requested);
targetCopy.setLabels(targetLabels);
historyStore.put(storageKey, updatedHistory);
+ ParameterHistory unlabelled = targetCopy;
+ events.add(() -> eventPublisher.labelsRemoved(current.getArn(), unlabelled, removedLabels, region));
LOG.infov("Removed labels {0} from parameter {1} version {2}", removedLabels, trimmed, parameterVersion);
}
return new UnlabelParameterVersionResult(removedLabels, invalidLabels);
diff --git a/src/main/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsEventPublisher.java b/src/main/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsEventPublisher.java
index 413645cb86..ff98293b36 100644
--- a/src/main/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsEventPublisher.java
+++ b/src/main/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsEventPublisher.java
@@ -2,7 +2,6 @@ package io.github.hectorvent.floci.services.stepfunctions;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.github.hectorvent.floci.core.common.AwsArnUtils;
import io.github.hectorvent.floci.core.common.RegionResolver;
@@ -12,7 +11,6 @@ import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import org.jboss.logging.Logger;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -56,16 +54,8 @@ public class StepFunctionsEventPublisher {
public void emitStatusChange(Execution exec) {
String executionArn = exec.getExecutionArn();
try {
- ObjectNode detail = buildDetail(exec);
- ArrayNode resources = objectMapper.createArrayNode();
- if (executionArn != null) {
- resources.add(executionArn);
- }
- Map<String, Object> entry = new HashMap<>();
- entry.put("Source", SOURCE);
- entry.put("DetailType", DETAIL_TYPE);
- entry.put("Detail", objectMapper.writeValueAsString(detail));
- entry.put("Resources", resources);
+ Map<String, Object> entry = EventBridgeService.serviceEventEntry(SOURCE, DETAIL_TYPE,
+ objectMapper.writeValueAsString(buildDetail(exec)), executionArn);
EventBridgeService.PutEventsResult result = eventBridgeService.putEvents(List.of(entry),
AwsArnUtils.regionOrDefault(executionArn, regionResolver.getDefaultRegion()));
if (result != null && result.failedCount() > 0) {
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/AcmCfnIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/AcmCfnIntegrationTest.java
index 64cacfa9ea..8f0927fae0 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/AcmCfnIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/AcmCfnIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayApiKeyCfnIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayApiKeyCfnIntegrationTest.java
index 9f99ef2bfc..23fa25748e 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayApiKeyCfnIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayApiKeyCfnIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.ValidatableResponse;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayCfnMockCorsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayCfnMockCorsIntegrationTest.java
index d2c9640c58..c39c40d5b5 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayCfnMockCorsIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayCfnMockCorsIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayDomainCfnIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayDomainCfnIntegrationTest.java
index 946de23558..f298c4ab0c 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayDomainCfnIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayDomainCfnIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayGatewayResponseCfnIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayGatewayResponseCfnIntegrationTest.java
index 90101987e2..e75fa3417e 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayGatewayResponseCfnIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayGatewayResponseCfnIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayResourceCfnReplacementIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayResourceCfnReplacementIntegrationTest.java
index e9018feb5f..aa860e79b2 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayResourceCfnReplacementIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayResourceCfnReplacementIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.ValidatableResponse;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayResourceCfnUpdateIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayResourceCfnUpdateIntegrationTest.java
index 0255044d3f..5bb32e87eb 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayResourceCfnUpdateIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayResourceCfnUpdateIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.ValidatableResponse;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayRestApiCfnUpdateIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayRestApiCfnUpdateIntegrationTest.java
index 702cdd09e7..1887dc4953 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayRestApiCfnUpdateIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayRestApiCfnUpdateIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.BeforeAll;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayUsagePlanCfnIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayUsagePlanCfnIntegrationTest.java
index 5eb00f65e9..75a9b2c2eb 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayUsagePlanCfnIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayUsagePlanCfnIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
import io.github.hectorvent.floci.services.apigateway.ApiGatewayService;
import io.github.hectorvent.floci.services.apigateway.model.UsagePlan;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayV2DomainCfnIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayV2DomainCfnIntegrationTest.java
index 0cb82cd035..64aba50409 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayV2DomainCfnIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayV2DomainCfnIntegrationTest.java
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.sun.net.httpserver.HttpServer;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.CloudFormationSettingsProfile;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/AppSyncCfnIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/AppSyncCfnIntegrationTest.java
index 1977d1d3ce..48a0c61e7b 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/AppSyncCfnIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/AppSyncCfnIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.SidecarContainersProfile;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/AutoScalingScalingPolicyCfnIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/AutoScalingScalingPolicyCfnIntegrationTest.java
index 15d4f060b4..36ba451091 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/AutoScalingScalingPolicyCfnIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/AutoScalingScalingPolicyCfnIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
import io.github.hectorvent.floci.services.autoscaling.AutoScalingService;
import io.github.hectorvent.floci.services.autoscaling.model.ScalingPolicy;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.ValidatableResponse;
import io.restassured.specification.RequestSpecification;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/BackupVaultCfnIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/BackupVaultCfnIntegrationTest.java
index 13ae0caeb4..83e266b65e 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/BackupVaultCfnIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/BackupVaultCfnIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.ValidatableResponse;
import io.restassured.specification.RequestSpecification;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CfnCustomDomainEnsureHostIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CfnCustomDomainEnsureHostIntegrationTest.java
index 1fd33840f4..3d63d0ba2e 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CfnCustomDomainEnsureHostIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CfnCustomDomainEnsureHostIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.config.TlsCertificateManager;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.InjectMock;
import io.quarkus.test.junit.QuarkusTest;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CfnUnchangedResourceUpdateIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CfnUnchangedResourceUpdateIntegrationTest.java
index d1aa9c0acf..c174cdd793 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CfnUnchangedResourceUpdateIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CfnUnchangedResourceUpdateIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationAsgLaunchTemplateIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationAsgLaunchTemplateIntegrationTest.java
index 6b1d893006..4760449f35 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationAsgLaunchTemplateIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationAsgLaunchTemplateIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationBatchIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationBatchIntegrationTest.java
index fd9d2c30d7..4607fef08a 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationBatchIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationBatchIntegrationTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.cloudformation;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationBedrockAgentCoreIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationBedrockAgentCoreIntegrationTest.java
index 8e536de931..9ca4475455 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationBedrockAgentCoreIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationBedrockAgentCoreIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.ValidatableResponse;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationChangeSetArnIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationChangeSetArnIntegrationTest.java
index 1d8d7af6dd..c33e1ec66f 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationChangeSetArnIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationChangeSetArnIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationCloudFrontKeysAndFunctionsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationCloudFrontKeysAndFunctionsIntegrationTest.java
index da59eb5a29..9d0a3af44f 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationCloudFrontKeysAndFunctionsIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationCloudFrontKeysAndFunctionsIntegrationTest.java
@@ -6,6 +6,7 @@ import io.github.hectorvent.floci.services.cloudfront.CloudFrontService;
import io.github.hectorvent.floci.services.cloudfront.model.CloudFrontFunction;
import io.github.hectorvent.floci.services.cloudfront.model.KeyGroup;
import io.github.hectorvent.floci.services.cloudfront.model.PublicKey;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import jakarta.inject.Inject;
import org.junit.jupiter.api.Test;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationCloudFrontPoliciesIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationCloudFrontPoliciesIntegrationTest.java
index 5f60828815..cf19a45704 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationCloudFrontPoliciesIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationCloudFrontPoliciesIntegrationTest.java
@@ -8,6 +8,7 @@ import io.github.hectorvent.floci.services.cloudfront.model.Distribution;
import io.github.hectorvent.floci.services.cloudfront.model.OriginAccessControl;
import io.github.hectorvent.floci.services.cloudfront.model.OriginRequestPolicy;
import io.github.hectorvent.floci.services.cloudfront.model.ResponseHeadersPolicy;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import jakarta.inject.Inject;
import org.junit.jupiter.api.Test;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationCloudWatchDashboardIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationCloudWatchDashboardIntegrationTest.java
index c1d1b448e7..524673bfa9 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationCloudWatchDashboardIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationCloudWatchDashboardIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
import io.github.hectorvent.floci.services.cloudwatch.dashboards.CloudWatchDashboardsService;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.mockito.InjectSpy;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationCognitoUpdateRollbackIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationCognitoUpdateRollbackIntegrationTest.java
index a432df1111..d77ecfb2e0 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationCognitoUpdateRollbackIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationCognitoUpdateRollbackIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationCognitoUserPoolGroupIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationCognitoUserPoolGroupIntegrationTest.java
index 52be27fcc5..047c7579f6 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationCognitoUserPoolGroupIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationCognitoUserPoolGroupIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
import io.restassured.config.EncoderConfig;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationCognitoUserPoolUserIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationCognitoUserPoolUserIntegrationTest.java
index c171c31442..e722bcd0a7 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationCognitoUserPoolUserIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationCognitoUserPoolUserIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.ValidatableResponse;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationContinueUpdateRollbackIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationContinueUpdateRollbackIntegrationTest.java
index 6fb56968dc..64732625ea 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationContinueUpdateRollbackIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationContinueUpdateRollbackIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
import io.github.hectorvent.floci.services.cloudwatch.dashboards.CloudWatchDashboardsService;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.mockito.InjectSpy;
import io.restassured.RestAssured;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDeleteAfterFailedRollbackIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDeleteAfterFailedRollbackIntegrationTest.java
index 432a257bb1..ddf5fd33cf 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDeleteAfterFailedRollbackIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDeleteAfterFailedRollbackIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
import io.restassured.config.EncoderConfig;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDeleteIdempotencyIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDeleteIdempotencyIntegrationTest.java
index 43582efdd4..9c1535e71e 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDeleteIdempotencyIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDeleteIdempotencyIntegrationTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.cloudformation;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.BeforeAll;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDeletedStackByNameIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDeletedStackByNameIntegrationTest.java
index 960dc339dc..664b4dee02 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDeletedStackByNameIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDeletedStackByNameIntegrationTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.cloudformation;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
import io.restassured.specification.RequestSpecification;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDescribeStackResourcesFilterIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDescribeStackResourcesFilterIntegrationTest.java
index ed60ff2fe9..d2597d7a52 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDescribeStackResourcesFilterIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDescribeStackResourcesFilterIntegrationTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.cloudformation;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.Test;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDsqlIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDsqlIntegrationTest.java
index 7599c3fd5d..50d8561e17 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDsqlIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDsqlIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.Test;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDynamoDbGlobalTableIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDynamoDbGlobalTableIntegrationTest.java
index c2dade00c6..e84d7c62df 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDynamoDbGlobalTableIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDynamoDbGlobalTableIntegrationTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.cloudformation;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.path.json.JsonPath;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDynamoDbReplicaIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDynamoDbReplicaIntegrationTest.java
index 70c9757fc4..f9af6335c4 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDynamoDbReplicaIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDynamoDbReplicaIntegrationTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.cloudformation;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.BeforeAll;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDynamoDbTimeToLiveIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDynamoDbTimeToLiveIntegrationTest.java
index 2e5e603185..d4a6c12a79 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDynamoDbTimeToLiveIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDynamoDbTimeToLiveIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.services.dynamodb.DynamoDbService;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.mockito.InjectSpy;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationEc2NetworkingIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationEc2NetworkingIntegrationTest.java
index efc0f16a70..e66cd52957 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationEc2NetworkingIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationEc2NetworkingIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.specification.RequestSpecification;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationEcsLinuxParametersIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationEcsLinuxParametersIntegrationTest.java
index 7fb7482119..824d5c852f 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationEcsLinuxParametersIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationEcsLinuxParametersIntegrationTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.cloudformation;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.QuarkusTestProfile;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationEcsTaskDefinitionModelIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationEcsTaskDefinitionModelIntegrationTest.java
index c21ed1b125..c95f1a182e 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationEcsTaskDefinitionModelIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationEcsTaskDefinitionModelIntegrationTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.cloudformation;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.PartitionCleanup;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationElbV2ReplacementIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationElbV2ReplacementIntegrationTest.java
index bc47ca2431..fce4e16b36 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationElbV2ReplacementIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationElbV2ReplacementIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.services.ec2.Ec2Service;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.BeforeAll;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationElbV2SubnetMappingsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationElbV2SubnetMappingsIntegrationTest.java
index 00caace5b0..1d35586569 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationElbV2SubnetMappingsIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationElbV2SubnetMappingsIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.ValidatableResponse;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationElbV2SubnetUpdateIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationElbV2SubnetUpdateIntegrationTest.java
index 657165a780..a217f69c95 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationElbV2SubnetUpdateIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationElbV2SubnetUpdateIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.XmlParser;
import io.github.hectorvent.floci.services.elbv2.ElbV2Service;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.mockito.InjectSpy;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationEventBusIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationEventBusIntegrationTest.java
index 6a9ad743ab..fea6277138 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationEventBusIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationEventBusIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.BeforeAll;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationEventsRuleTargetIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationEventsRuleTargetIntegrationTest.java
index 6f193c3556..0da9886329 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationEventsRuleTargetIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationEventsRuleTargetIntegrationTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.cloudformation;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.path.json.JsonPath;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationGetStackOutputEnforcementIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationGetStackOutputEnforcementIntegrationTest.java
index 1731545489..723d88a5a1 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationGetStackOutputEnforcementIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationGetStackOutputEnforcementIntegrationTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.cloudformation;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.EnforcementFixtures;
import io.github.hectorvent.floci.testing.IamEnforcementProfile;
import io.github.hectorvent.floci.testing.PartitionCleanup;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationGetStackOutputIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationGetStackOutputIntegrationTest.java
index f115594566..047418f690 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationGetStackOutputIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationGetStackOutputIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.services.s3.S3Service;
import io.github.hectorvent.floci.services.ssm.SsmService;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.EnforcementFixtures;
import io.github.hectorvent.floci.testing.PartitionCleanup;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationIamQuotaRollbackIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationIamQuotaRollbackIntegrationTest.java
index 393ea969dd..2d99455968 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationIamQuotaRollbackIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationIamQuotaRollbackIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.services.iam.IamService;
import io.github.hectorvent.floci.services.iam.IamService.InlinePolicyChange;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.mockito.InjectSpy;
import io.restassured.response.Response;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationIamRoleInlinePoliciesIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationIamRoleInlinePoliciesIntegrationTest.java
index 9d6f00ec05..63aa80c7e3 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationIamRoleInlinePoliciesIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationIamRoleInlinePoliciesIntegrationTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.cloudformation;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaAddressingIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaAddressingIntegrationTest.java
index bbe9f20005..5aeb22a198 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaAddressingIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaAddressingIntegrationTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.cloudformation;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaDurableConfigIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaDurableConfigIntegrationTest.java
index c3df4ab254..380b47364c 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaDurableConfigIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaDurableConfigIntegrationTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.cloudformation;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaEventInvokeConfigIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaEventInvokeConfigIntegrationTest.java
index 7989521ea2..fc9172c1ff 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaEventInvokeConfigIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaEventInvokeConfigIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaHotReloadIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaHotReloadIntegrationTest.java
index 2ad4f2a995..2c03304474 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaHotReloadIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaHotReloadIntegrationTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.cloudformation;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.ValidatableResponse;
import org.junit.jupiter.api.Test;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaLoggingConfigIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaLoggingConfigIntegrationTest.java
index 388d398b25..5beba64081 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaLoggingConfigIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaLoggingConfigIntegrationTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.cloudformation;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.PartitionCleanup;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.specification.RequestSpecification;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaObjectPropertyIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaObjectPropertyIntegrationTest.java
index 8665ac79b4..35acd9eb33 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaObjectPropertyIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaObjectPropertyIntegrationTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.cloudformation;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.PartitionCleanup;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.specification.RequestSpecification;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLaunchConfigurationMetadataValidationIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLaunchConfigurationMetadataValidationIntegrationTest.java
index dbe7cf2b94..23c37dfe1a 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLaunchConfigurationMetadataValidationIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLaunchConfigurationMetadataValidationIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.EnforcementFixtures;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.specification.RequestSpecification;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLaunchTemplateIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLaunchTemplateIntegrationTest.java
index 4d0698bd41..e299194b61 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLaunchTemplateIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLaunchTemplateIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.services.ec2.Ec2Service;
import io.github.hectorvent.floci.services.ec2.model.Instance;
import io.github.hectorvent.floci.services.ec2.model.LaunchTemplateData;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import jakarta.inject.Inject;
import org.junit.jupiter.api.Test;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLogsMetricFilterIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLogsMetricFilterIntegrationTest.java
index 819a1a6b73..2de65f88fa 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLogsMetricFilterIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLogsMetricFilterIntegrationTest.java
@@ -10,6 +10,7 @@ import io.github.hectorvent.floci.services.cloudwatch.logs.CloudWatchLogsMetricF
import io.github.hectorvent.floci.services.cloudwatch.logs.CloudWatchLogsMetricFilterService.MutationOutcome;
import io.github.hectorvent.floci.services.cloudwatch.logs.CloudWatchLogsMetricFilterService.MutationResult;
import io.github.hectorvent.floci.services.cloudwatch.logs.model.MetricFilter;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.mockito.InjectSpy;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationNamedResourceIdenticalUpdateIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationNamedResourceIdenticalUpdateIntegrationTest.java
index b5ae679015..f0f22b7a2b 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationNamedResourceIdenticalUpdateIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationNamedResourceIdenticalUpdateIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
import io.restassured.specification.RequestSpecification;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationNatGatewayLeftoverIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationNatGatewayLeftoverIntegrationTest.java
index 6b70dc305e..25a36ad1ae 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationNatGatewayLeftoverIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationNatGatewayLeftoverIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.XmlParser;
import io.github.hectorvent.floci.services.ec2.Ec2Service;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.mockito.InjectSpy;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationNestedStackLeftoverIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationNestedStackLeftoverIntegrationTest.java
index 0fc4587c14..e1f553813b 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationNestedStackLeftoverIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationNestedStackLeftoverIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.XmlParser;
import io.github.hectorvent.floci.services.ec2.Ec2Service;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.mockito.InjectSpy;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationNoChangesIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationNoChangesIntegrationTest.java
index 662dce443c..33578faf08 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationNoChangesIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationNoChangesIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
import io.github.hectorvent.floci.services.s3.S3Service;
import io.github.hectorvent.floci.services.ssm.SsmService;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.ValidatableResponse;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationNullValuesIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationNullValuesIntegrationTest.java
index 26fa02994e..49e5598227 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationNullValuesIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationNullValuesIntegrationTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.cloudformation;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
import io.restassured.specification.RequestSpecification;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationParameterValuesIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationParameterValuesIntegrationTest.java
index fb776802bd..bc9c54dd48 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationParameterValuesIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationParameterValuesIntegrationTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.cloudformation;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationPersistenceIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationPersistenceIntegrationTest.java
index d64defb538..5c78194d1e 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationPersistenceIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationPersistenceIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.cloudformation;
import com.fasterxml.jackson.core.type.TypeReference;
import io.github.hectorvent.floci.core.storage.PersistentStorage;
import io.github.hectorvent.floci.services.cloudformation.model.Stack;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.PartitionCleanup;
import io.github.hectorvent.floci.testing.PersistentStorageProfile;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationPipesCleanupIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationPipesCleanupIntegrationTest.java
index 60a673b064..46f05f6600 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationPipesCleanupIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationPipesCleanupIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.services.pipes.PipesService;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.mockito.InjectSpy;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationRdsAssociatedRolesIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationRdsAssociatedRolesIntegrationTest.java
index 30243595d1..20eec109ad 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationRdsAssociatedRolesIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationRdsAssociatedRolesIntegrationTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.cloudformation;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RdsMockProfile;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationRdsDynamicReferenceIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationRdsDynamicReferenceIntegrationTest.java
index d82fd1ef71..e50ddc63e4 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationRdsDynamicReferenceIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationRdsDynamicReferenceIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import com.fasterxml.jackson.databind.ObjectMapper;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RdsMockProfile;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationResourceConditionIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationResourceConditionIntegrationTest.java
index bdb4a24e6a..8a70863979 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationResourceConditionIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationResourceConditionIntegrationTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.cloudformation;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.BeforeAll;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationRollbackCompleteUpdateIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationRollbackCompleteUpdateIntegrationTest.java
index ce7698b7e3..3618786c7b 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationRollbackCompleteUpdateIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationRollbackCompleteUpdateIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.BeforeAll;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationRoute53RecordSetIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationRoute53RecordSetIntegrationTest.java
index c842e953b5..fe37337c92 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationRoute53RecordSetIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationRoute53RecordSetIntegrationTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.cloudformation;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.BeforeAll;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationS3BucketNotificationIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationS3BucketNotificationIntegrationTest.java
index 4fb3bec85c..433647ed21 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationS3BucketNotificationIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationS3BucketNotificationIntegrationTest.java
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.hectorvent.floci.services.sqs.SqsService;
import io.github.hectorvent.floci.services.sqs.model.Message;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.http.ContentType;
import io.restassured.response.ValidatableResponse;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSamEventInvokeConfigIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSamEventInvokeConfigIntegrationTest.java
index 36b6603d89..13cebc2b29 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSamEventInvokeConfigIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSamEventInvokeConfigIntegrationTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.cloudformation;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.path.xml.XmlPath;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSchedulerScheduleIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSchedulerScheduleIntegrationTest.java
index 3dc1811b2d..6e479e3025 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSchedulerScheduleIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSchedulerScheduleIntegrationTest.java
@@ -12,6 +12,7 @@ import io.github.hectorvent.floci.services.scheduler.model.ScheduleRequest;
import io.github.hectorvent.floci.services.sqs.SqsService;
import io.github.hectorvent.floci.services.sqs.model.Message;
import io.github.hectorvent.floci.services.sqs.model.Queue;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.mockito.InjectSpy;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSecretTargetAttachmentIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSecretTargetAttachmentIntegrationTest.java
index e31d355b29..10c3f1bd8a 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSecretTargetAttachmentIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSecretTargetAttachmentIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.cloudformation;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RdsMockProfile;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSsmParameterIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSsmParameterIntegrationTest.java
index 8edf0b4f72..6960490933 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSsmParameterIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSsmParameterIntegrationTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.cloudformation;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.path.xml.XmlPath;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSsmRollbackIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSsmRollbackIntegrationTest.java
index c4dacd2640..4a38d7729e 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSsmRollbackIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationSsmRollbackIntegrationTest.java
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.XmlParser;
import io.github.hectorvent.floci.services.ssm.SsmService;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.mockito.InjectSpy;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationStackIdUpdateIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationStackIdUpdateIntegrationTest.java
index ffbb61fc04..0c3641351b 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationStackIdUpdateIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationStackIdUpdateIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.config.EmulatorConfig;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.path.xml.XmlPath;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationTransferServerIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationTransferServerIntegrationTest.java
index 0ce7622841..85321225f5 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationTransferServerIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationTransferServerIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
import io.github.hectorvent.floci.services.cloudformation.model.StackResource;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.ValidatableResponse;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationTransferUserIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationTransferUserIntegrationTest.java
index 829f225d29..10fb1cf9f6 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationTransferUserIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationTransferUserIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.ValidatableResponse;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationUnsupportedResourceTypeStrictIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationUnsupportedResourceTypeStrictIntegrationTest.java
index 62ae936ff6..f9708a1668 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationUnsupportedResourceTypeStrictIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationUnsupportedResourceTypeStrictIntegrationTest.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.cloudformation;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.CloudFormationSettingsProfile;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationUpdateStackTagsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationUpdateStackTagsIntegrationTest.java
index 36fe778255..2f08299078 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationUpdateStackTagsIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationUpdateStackTagsIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.Test;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationVpcEndpointIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationVpcEndpointIntegrationTest.java
index 8f918a5685..9d44e40672 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationVpcEndpointIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationVpcEndpointIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationVpcReplacementIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationVpcReplacementIntegrationTest.java
index a4bc5af2fb..5cad5fc3cd 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationVpcReplacementIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationVpcReplacementIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.path.xml.XmlPath;
import io.restassured.specification.RequestSpecification;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudMapCfnIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudMapCfnIntegrationTest.java
index f5058910ca..52d8a9c8c1 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudMapCfnIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudMapCfnIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.cloudformation;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.Response;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CodePipelineCfnIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CodePipelineCfnIntegrationTest.java
index a7fc9ba45c..89046cf87b 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CodePipelineCfnIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CodePipelineCfnIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.BeforeAll;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CognitoCfnIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CognitoCfnIntegrationTest.java
index f20d27f9e8..6812b93329 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CognitoCfnIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CognitoCfnIntegrationTest.java
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.cloudformation;
import com.fasterxml.jackson.databind.JsonNode;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.specification.RequestSpecification;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CognitoResourceServerCfnIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CognitoResourceServerCfnIntegrationTest.java
index 96eeb570fe..67974e8cdd 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CognitoResourceServerCfnIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CognitoResourceServerCfnIntegrationTest.java
@@ -8,6 +8,7 @@ import io.github.hectorvent.floci.core.common.XmlParser;
import io.github.hectorvent.floci.services.cloudformation.model.Stack;
import io.github.hectorvent.floci.services.cloudformation.provisioners.CfnRollback;
import io.github.hectorvent.floci.services.cognito.CognitoService;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.mockito.InjectSpy;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ElastiCacheCfnIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ElastiCacheCfnIntegrationTest.java
index acec325a69..d454fddf60 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ElastiCacheCfnIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ElastiCacheCfnIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.DockerAvailability;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.common.http.TestHTTPResource;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ElastiCacheServerlessCfnIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ElastiCacheServerlessCfnIntegrationTest.java
index d1b1649495..351d5515f7 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ElastiCacheServerlessCfnIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ElastiCacheServerlessCfnIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.github.hectorvent.floci.testing.SidecarContainersProfile;
import io.quarkus.test.common.http.TestHTTPResource;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/GuardDutyMalwareProtectionPlanCfnIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/GuardDutyMalwareProtectionPlanCfnIntegrationTest.java
index 5dd08c041b..72c9dfdf0c 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/GuardDutyMalwareProtectionPlanCfnIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/GuardDutyMalwareProtectionPlanCfnIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.ValidatableResponse;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/IotCfnIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/IotCfnIntegrationTest.java
index 6eebc31105..bae2c1024a 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/IotCfnIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/IotCfnIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.ValidatableResponse;
import io.restassured.specification.RequestSpecification;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/IotDomainConfigurationCfnIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/IotDomainConfigurationCfnIntegrationTest.java
index 930e0c01f8..525325f8d8 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/IotDomainConfigurationCfnIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/IotDomainConfigurationCfnIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.cloudformation;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.specification.RequestSpecification;
import org.junit.jupiter.api.Test;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/RedshiftClusterCfnIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/RedshiftClusterCfnIntegrationTest.java
index a905212e5b..c30685929d 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/RedshiftClusterCfnIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/RedshiftClusterCfnIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.specification.RequestSpecification;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/RedshiftServerlessCfnIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/RedshiftServerlessCfnIntegrationTest.java
index 098fdb28a3..f99cc0e84d 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/RedshiftServerlessCfnIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/RedshiftServerlessCfnIntegrationTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
import io.github.hectorvent.floci.services.redshift.model.Endpoint;
import io.github.hectorvent.floci.services.redshiftserverless.RedshiftServerlessRuntime;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.InjectMock;
import io.quarkus.test.junit.QuarkusTest;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/SnsFifoThroughputScopeCfnIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/SnsFifoThroughputScopeCfnIntegrationTest.java
index 2157ac69fc..aaacf1b171 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/SnsFifoThroughputScopeCfnIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/SnsFifoThroughputScopeCfnIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.ValidatableResponse;
import io.restassured.specification.RequestSpecification;
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/SnsTopicPolicyCfnIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/SnsTopicPolicyCfnIntegrationTest.java
index 968e5368af..eee51af3d5 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/SnsTopicPolicyCfnIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/SnsTopicPolicyCfnIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.XmlParser;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.response.ValidatableResponse;
import io.restassured.specification.RequestSpecification;
diff --git a/src/test/java/io/github/hectorvent/floci/services/eventbridge/EventBridgeServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/eventbridge/EventBridgeServiceTest.java
index 2b908ff604..98fdc85d0e 100644
--- a/src/test/java/io/github/hectorvent/floci/services/eventbridge/EventBridgeServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/eventbridge/EventBridgeServiceTest.java
@@ -1556,4 +1556,17 @@ class EventBridgeServiceTest {
assertEquals("Parameter Source is not valid. Reason: Source is a required argument.",
result.entries().get(0).get("ErrorMessage"));
}
+
+ @Test
+ void serviceEventEntryCarriesTheResourceAndAnEmptyResourcesListWithoutOne() {
+ Map<String, Object> entry = EventBridgeService.serviceEventEntry("aws.ssm", "Parameter Store Change",
+ "{\"operation\":\"Create\"}", "arn:aws:ssm:us-east-1:000000000000:parameter/a");
+
+ assertEquals(Map.of("Source", "aws.ssm", "DetailType", "Parameter Store Change",
+ "Detail", "{\"operation\":\"Create\"}",
+ "Resources", new ObjectMapper().createArrayNode().add("arn:aws:ssm:us-east-1:000000000000:parameter/a")),
+ entry);
+ assertEquals(0, ((ArrayNode) EventBridgeService.serviceEventEntry("s", "d", "{}", null).get("Resources")).size());
+ assertEquals(0, ((ArrayNode) EventBridgeService.serviceEventEntry("s", "d", "{}", " ").get("Resources")).size());
+ }
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/ssm/SsmIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ssm/SsmIntegrationTest.java
index 81f008f418..6d2a072248 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ssm/SsmIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ssm/SsmIntegrationTest.java
@@ -1,9 +1,13 @@
package io.github.hectorvent.floci.services.ssm;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
+import io.restassured.response.ValidatableResponse;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
@@ -14,14 +18,17 @@ import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import java.time.Duration;
+import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.stream.Stream;
+import static io.github.hectorvent.floci.testing.CfnRequests.cfn;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.*;
import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTimeoutPreemptively;
@QuarkusTest
@@ -29,6 +36,7 @@ import static org.junit.jupiter.api.Assertions.assertTimeoutPreemptively;
class SsmIntegrationTest {
private static final String SSM_CONTENT_TYPE = "application/x-amz-json-1.1";
+ private static final ObjectMapper MAPPER = new ObjectMapper();
@BeforeAll
static void configureRestAssured() {
@@ -2315,6 +2323,138 @@ class SsmIntegrationTest {
.then();
}
+ @Test
+ void parameterChangesArePublishedToTheDefaultEventBus() throws Exception {
+ String suffix = Long.toString(System.nanoTime(), 36);
+ String base = "/events-" + suffix;
+ String queueUrl = given()
+ .contentType("application/x-www-form-urlencoded")
+ .formParam("Action", "CreateQueue")
+ .formParam("QueueName", "ssm-events-" + suffix)
+ .when()
+ .post("/")
+ .then()
+ .statusCode(200)
+ .extract().xmlPath().getString("CreateQueueResponse.CreateQueueResult.QueueUrl");
+ String queueArn = given()
+ .contentType("application/x-www-form-urlencoded")
+ .formParam("Action", "GetQueueAttributes")
+ .formParam("QueueUrl", queueUrl)
+ .formParam("AttributeName.1", "QueueArn")
+ .when()
+ .post("/")
+ .then()
+ .statusCode(200)
+ .extract().xmlPath().getString("**.find { it.Name == 'QueueArn' }.Value");
+ String pattern = "{\"source\":[\"aws.ssm\"],\"detail-type\":[\"Parameter Store Change\"],"
+ + "\"detail\":{\"name\":[{\"prefix\":\"" + base + "/\"}]}}";
+ events("PutRule", MAPPER.createObjectNode().put("Name", "ssm-events-" + suffix).put("EventPattern", pattern));
+ events("PutTargets", MAPPER.readTree("{\"Rule\":\"ssm-events-" + suffix + "\","
+ + "\"Targets\":[{\"Id\":\"1\",\"Arn\":\"" + queueArn + "\"}]}"));
+
+ ssm("PutParameter", "{\"Name\":\"" + base + "/a\",\"Value\":\"v1\",\"Type\":\"String\",\"Description\":\"d\"}")
+ .statusCode(200);
+ ssm("PutParameter", "{\"Name\":\"" + base + "/a\",\"Value\":\"v2\",\"Type\":\"String\",\"Description\":\"d\","
+ + "\"Overwrite\":true}")
+ .statusCode(200);
+ ssm("LabelParameterVersion", "{\"Name\":\"" + base + "/a\",\"ParameterVersion\":2,\"Labels\":[\"stable\"]}")
+ .statusCode(200);
+ ssm("UnlabelParameterVersion", "{\"Name\":\"" + base + "/a\",\"ParameterVersion\":2,\"Labels\":[\"stable\"]}")
+ .statusCode(200);
+ ssm("PutParameter", "{\"Name\":\"" + base + "/a\",\"Value\":\"v3\",\"Type\":\"String\"}")
+ .statusCode(400)
+ .body("__type", equalTo("ParameterAlreadyExists"));
+ String arn = ssm("GetParameter", "{\"Name\":\"" + base + "/a\"}").statusCode(200)
+ .extract().path("Parameter.ARN");
+ ssm("DeleteParameter", "{\"Name\":\"" + base + "/a\"}").statusCode(200);
+ ssm("PutParameter", "{\"Name\":\"" + base + "/b\",\"Value\":\"v\",\"Type\":\"String\"}").statusCode(200);
+ ssm("DeleteParameters", "{\"Names\":[\"" + base + "/b\",\"" + base + "/missing\"]}").statusCode(200);
+
+ String stack = "ssm-events-" + suffix;
+ cfn("CreateStack", stack).formParam("TemplateBody", "{\"Resources\":{\"P\":{\"Type\":\"AWS::SSM::Parameter\","
+ + "\"Properties\":{\"Name\":\"" + base + "/cfn\",\"Type\":\"String\",\"Value\":\"v\"}}}}")
+ .when().post("/").then().statusCode(200);
+ CfnStackWaits.awaitStatus(stack, "CREATE_COMPLETE");
+ cfn("DeleteStack", stack).when().post("/").then().statusCode(200);
+
+ List<JsonNode> received = receiveEvents(queueUrl, 9);
+ assertEquals(List.of("Create " + base + "/a", "Update " + base + "/a",
+ "LabelParameterVersion " + base + "/a", "UnlabelParameterVersion " + base + "/a",
+ "Delete " + base + "/a",
+ "Create " + base + "/b", "Delete " + base + "/b",
+ "Create " + base + "/cfn", "Delete " + base + "/cfn"),
+ received.stream().map(e -> e.at("/detail/operation").asText() + " " + e.at("/detail/name").asText())
+ .toList());
+ JsonNode created = received.getFirst();
+ assertEquals("aws.ssm", created.path("source").asText());
+ assertEquals("Parameter Store Change", created.path("detail-type").asText());
+ assertEquals(arn, created.at("/resources/0").asText());
+ assertEquals("us-east-1", created.path("region").asText());
+ assertFalse(created.path("account").asText().isEmpty());
+ assertEquals(MAPPER.readTree("{\"operation\":\"Create\",\"name\":\"" + base + "/a\",\"type\":\"String\","
+ + "\"description\":\"d\"}"), created.path("detail"));
+ assertEquals(MAPPER.readTree("{\"operation\":\"LabelParameterVersion\",\"name\":\"" + base + "/a\","
+ + "\"type\":\"String\",\"description\":\"d\",\"label\":\"stable\",\"fromVersion\":\"\",\"toVersion\":\"2\"}"),
+ received.get(2).path("detail"));
+ assertEquals(MAPPER.readTree("{\"operation\":\"UnlabelParameterVersion\",\"name\":\"" + base + "/a\","
+ + "\"type\":\"String\",\"description\":\"d\",\"labels\":[\"stable\"],\"fromVersion\":\"2\",\"toVersion\":\"\"}"),
+ received.get(3).path("detail"));
+
+ events("RemoveTargets", MAPPER.readTree("{\"Rule\":\"ssm-events-" + suffix + "\",\"Ids\":[\"1\"]}"));
+ events("DeleteRule", MAPPER.createObjectNode().put("Name", "ssm-events-" + suffix));
+ given()
+ .contentType("application/x-www-form-urlencoded")
+ .formParam("Action", "DeleteQueue")
+ .formParam("QueueUrl", queueUrl)
+ .when()
+ .post("/")
+ .then()
+ .statusCode(200);
+ }
+
+ private static ValidatableResponse ssm(String action, String body) {
+ return given()
+ .header("X-Amz-Target", "AmazonSSM." + action)
+ .contentType(SSM_CONTENT_TYPE)
+ .body(body)
+ .when()
+ .post("/")
+ .then();
+ }
+
+ private static void events(String action, JsonNode body) {
+ given()
+ .header("X-Amz-Target", "AWSEvents." + action)
+ .contentType(SSM_CONTENT_TYPE)
+ .body(body.toString())
+ .when()
+ .post("/")
+ .then()
+ .statusCode(200);
+ }
+
+ private static List<JsonNode> receiveEvents(String queueUrl, int expected) throws Exception {
+ List<JsonNode> received = new ArrayList<>();
+ long deadline = System.currentTimeMillis() + 10_000;
+ while (received.size() < expected && System.currentTimeMillis() < deadline) {
+ List<String> bodies = given()
+ .contentType("application/x-www-form-urlencoded")
+ .formParam("Action", "ReceiveMessage")
+ .formParam("QueueUrl", queueUrl)
+ .formParam("MaxNumberOfMessages", "10")
+ .formParam("WaitTimeSeconds", "1")
+ .when()
+ .post("/")
+ .then()
+ .statusCode(200)
+ .extract().xmlPath().getList("ReceiveMessageResponse.ReceiveMessageResult.Message.Body");
+ for (String body : bodies) {
+ received.add(MAPPER.readTree(body));
+ }
+ }
+ return received;
+ }
+
private io.restassured.response.ValidatableResponse describeParameters(String body) {
return given()
.header("X-Amz-Target", "AmazonSSM.DescribeParameters")
diff --git a/src/test/java/io/github/hectorvent/floci/services/ssm/SsmServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/ssm/SsmServiceTest.java
index 1aba24c204..f9a3e55c36 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ssm/SsmServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ssm/SsmServiceTest.java
@@ -1,9 +1,12 @@
package io.github.hectorvent.floci.services.ssm;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.core.storage.InMemoryStorage;
import io.github.hectorvent.floci.core.storage.StorageBackend;
+import io.github.hectorvent.floci.services.eventbridge.EventBridgeService;
import io.github.hectorvent.floci.services.secretsmanager.SecretsManagerService;
import io.github.hectorvent.floci.services.secretsmanager.model.Secret;
import io.github.hectorvent.floci.services.secretsmanager.model.SecretVersion;
@@ -17,6 +20,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.time.Instant;
+import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -32,11 +36,18 @@ import java.util.concurrent.TimeoutException;
import java.util.function.Predicate;
import static org.junit.jupiter.api.Assertions.*;
+import static org.mockito.ArgumentMatchers.anyList;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
class SsmServiceTest {
+ private static final ObjectMapper MAPPER = new ObjectMapper();
+
+ private final List<Map<String, Object>> events = new ArrayList<>();
private SsmService ssmService;
@BeforeEach
@@ -1693,6 +1704,184 @@ class SsmServiceTest {
assertEquals("ParameterNotFound", ex.getErrorCode());
}
+ @Test
+ void putParameterPublishesCreateWithTheDescription() throws Exception {
+ SsmService service = serviceRecordingEvents();
+
+ service.putParameter("/events/a", "v", "SecureString", "the db", false, "us-east-1");
+
+ assertEquals(1, events.size());
+ assertEvent(events.getFirst(), service.getParameter("/events/a", "us-east-1").getArn(),
+ Map.of("operation", "Create", "name", "/events/a", "type", "SecureString",
+ "description", "the db"));
+ }
+
+ @Test
+ void putParameterOverwritePublishesUpdateEvenForTheSameValue() throws Exception {
+ SsmService service = serviceRecordingEvents();
+ service.putParameter("/events/a", "v", "String", null, false, "us-east-1");
+
+ service.putParameter("/events/a", "v", "String", null, true, "us-east-1");
+
+ assertEquals(2, events.size());
+ assertEvent(events.get(1), service.getParameter("/events/a", "us-east-1").getArn(),
+ Map.of("operation", "Update", "name", "/events/a", "type", "String"));
+ }
+
+ @Test
+ void failedPutParameterPublishesNothing() {
+ SsmService service = serviceRecordingEvents();
+ service.putParameter("/events/a", "v", "String", null, false, "us-east-1");
+ events.clear();
+
+ assertThrows(AwsException.class, () ->
+ service.putParameter("/events/a", "w", "String", null, false, "us-east-1"));
+
+ assertTrue(events.isEmpty());
+ }
+
+ @Test
+ void deleteParameterPublishesDeleteWithTheDeletedParametersFields() throws Exception {
+ SsmService service = serviceRecordingEvents();
+ service.putParameter("/events/a", "x,y", "StringList", "list", false, "us-east-1");
+ String arn = service.getParameter("/events/a", "us-east-1").getArn();
+ events.clear();
+
+ service.deleteParameter("/events/a", "us-east-1");
+ assertThrows(AwsException.class, () -> service.deleteParameter("/events/a", "us-east-1"));
+
+ assertEquals(1, events.size());
+ assertEvent(events.getFirst(), arn,
+ Map.of("operation", "Delete", "name", "/events/a", "type", "StringList", "description", "list"));
+ }
+
+ @Test
+ void deleteParametersPublishesOneDeletePerDeletedName() throws Exception {
+ SsmService service = serviceRecordingEvents();
+ service.putParameter("/events/a", "v", "String", null, false, "us-east-1");
+ String arn = service.getParameter("/events/a", "us-east-1").getArn();
+ events.clear();
+
+ service.deleteParameters(List.of("/events/a", "/events/missing"), "us-east-1");
+
+ assertEquals(1, events.size());
+ assertEvent(events.getFirst(), arn, Map.of("operation", "Delete", "name", "/events/a", "type", "String"));
+ }
+
+ @Test
+ void labelParameterVersionPublishesOnlyLabelsThatAreAttachedOrMoved() throws Exception {
+ SsmService service = serviceRecordingEvents();
+ service.putParameter("/events/a", "v1", "String", null, false, "us-east-1");
+ service.putParameter("/events/a", "v2", "String", null, true, "us-east-1");
+ String arn = service.getParameter("/events/a", "us-east-1").getArn();
+ events.clear();
+
+ service.labelParameterVersion("/events/a", 1L, List.of("a"), "us-east-1");
+ service.labelParameterVersion("/events/a", 2L, List.of("a", "b", "1abc", "awsx"), "us-east-1");
+ service.labelParameterVersion("/events/a", 2L, List.of("a"), "us-east-1");
+
+ assertEquals(3, events.size());
+ assertEvent(events.get(0), arn, labelDetail("a", "", "1"));
+ assertEvent(events.get(1), arn, labelDetail("a", "1", "2"));
+ assertEvent(events.get(2), arn, labelDetail("b", "", "2"));
+ }
+
+ @Test
+ void labelParameterVersionPublishesTheLabelledVersionsTypeAndDescription() throws Exception {
+ SsmService service = serviceRecordingEvents();
+ service.putParameter("/events/a", "v", "String", "one", false, "us-east-1");
+ service.putParameter("/events/a", "x,y", "StringList", "two", true, "us-east-1");
+ String arn = service.getParameter("/events/a", "us-east-1").getArn();
+ events.clear();
+
+ service.labelParameterVersion("/events/a", 1L, List.of("old"), "us-east-1");
+
+ assertEquals(1, events.size());
+ assertEvent(events.getFirst(), arn, Map.of("operation", "LabelParameterVersion", "name", "/events/a",
+ "type", "String", "description", "one", "label", "old", "fromVersion", "", "toVersion", "1"));
+ }
+
+ @Test
+ void unlabelParameterVersionPublishesOneEventWithTheLabelsItRemoved() throws Exception {
+ SsmService service = serviceRecordingEvents();
+ service.putParameter("/events/a", "v", "String", "one", false, "us-east-1");
+ service.putParameter("/events/a", "w", "String", null, true, "us-east-1");
+ service.labelParameterVersion("/events/a", 1L, List.of("x", "y"), "us-east-1");
+ String arn = service.getParameter("/events/a", "us-east-1").getArn();
+ events.clear();
+
+ service.unlabelParameterVersion("/events/a", 1L, List.of("y", "missing"), "us-east-1");
+ service.unlabelParameterVersion("/events/a", 2L, List.of("x"), "us-east-1");
+
+ assertEquals(1, events.size());
+ assertEvent(events.getFirst(), arn, Map.of("operation", "UnlabelParameterVersion", "name", "/events/a",
+ "type", "String", "description", "one", "labels", List.of("y"), "fromVersion", "1", "toVersion", ""));
+ }
+
+ @Test
+ void writesPublishOutsideTheServiceMonitor() {
+ EventBridgeService eventBridge = mock(EventBridgeService.class);
+ SsmService service = serviceWith(eventBridge);
+ List<Boolean> monitorHeld = new ArrayList<>();
+ when(eventBridge.putEvents(anyList(), anyString())).thenAnswer(invocation -> {
+ monitorHeld.add(Thread.holdsLock(service));
+ return null;
+ });
+ service.putParameter("/events/a", "v", "String", null, false, "us-east-1");
+ service.putParameter("/events/b", "v", "String", null, false, "us-east-1");
+
+ service.labelParameterVersion("/events/a", 1L, List.of("a"), "us-east-1");
+ service.labelParameterVersion("/events/a", 1, List.of("b"), "us-east-1");
+ service.unlabelParameterVersion("/events/a", 1, List.of("b"), "us-east-1");
+ service.deleteParameter("/events/a", "us-east-1");
+ service.deleteParameters(List.of("/events/b"), "us-east-1");
+
+ assertEquals(List.of(false, false, false, false, false, false, false), monitorHeld);
+ }
+
+ @Test
+ void aFailingEventBusNeitherFailsNorUndoesTheWrite() {
+ EventBridgeService eventBridge = mock(EventBridgeService.class);
+ when(eventBridge.putEvents(anyList(), anyString())).thenThrow(new RuntimeException("bus down"));
+ SsmService service = serviceWith(eventBridge);
+
+ assertEquals(1, service.putParameter("/events/a", "v", "String", null, false, "us-east-1"));
+
+ verify(eventBridge).putEvents(anyList(), eq("us-east-1"));
+ assertEquals("v", service.getParameter("/events/a", "us-east-1").getValue());
+ }
+
+ private SsmService serviceRecordingEvents() {
+ EventBridgeService eventBridge = mock(EventBridgeService.class);
+ when(eventBridge.putEvents(anyList(), eq("us-east-1"))).thenAnswer(invocation -> {
+ events.addAll(invocation.getArgument(0));
+ return null;
+ });
+ return serviceWith(eventBridge);
+ }
+
+ private static SsmService serviceWith(EventBridgeService eventBridge) {
+ return new SsmService(new InMemoryStorage<>(), new InMemoryStorage<>(), new InMemoryStorage<>(),
+ new InMemoryStorage<>(), new InMemoryStorage<>(), new InMemoryStorage<>(), 5,
+ new RegionResolver("us-east-1", "000000000000"), null, null,
+ new SsmEventPublisher(eventBridge, MAPPER));
+ }
+
+ private static Map<String, String> labelDetail(String label, String fromVersion, String toVersion) {
+ return Map.of("operation", "LabelParameterVersion", "name", "/events/a", "type", "String",
+ "label", label, "fromVersion", fromVersion, "toVersion", toVersion);
+ }
+
+ private static void assertEvent(Map<String, Object> entry, String arn, Map<String, ?> detail)
+ throws Exception {
+ assertEquals("aws.ssm", entry.get("Source"));
+ assertEquals("Parameter Store Change", entry.get("DetailType"));
+ JsonNode expectedResources = MAPPER.valueToTree(List.of(arn));
+ assertEquals(expectedResources, MAPPER.valueToTree(entry.get("Resources")));
+ JsonNode expectedDetail = MAPPER.valueToTree(detail);
+ assertEquals(expectedDetail, MAPPER.readTree((String) entry.get("Detail")));
+ }
+
private List<String> describedNames(List<ParameterStringFilter> filters, String region) {
return ssmService.describeParameters(filters, region).stream().map(Parameter::getName).toList();
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CfnStackWaits.java b/src/test/java/io/github/hectorvent/floci/testing/CfnStackWaits.java
similarity index 92%
rename from src/test/java/io/github/hectorvent/floci/services/cloudformation/CfnStackWaits.java
rename to src/test/java/io/github/hectorvent/floci/testing/CfnStackWaits.java
index d3a7fafabb..ff2bea8791 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CfnStackWaits.java
+++ b/src/test/java/io/github/hectorvent/floci/testing/CfnStackWaits.java
@@ -1,4 +1,4 @@
-package io.github.hectorvent.floci.services.cloudformation;
+package io.github.hectorvent.floci.testing;
import io.restassured.path.xml.XmlPath;
import io.restassured.path.xml.element.Node;
@@ -18,13 +18,13 @@ import static org.junit.jupiter.api.Assertions.fail;
* DeleteStack answers before the stack is gone. The deletion runs on an executor, so a test
* that looks at the stack's resources right after the answer races it.
*/
-final class CfnStackWaits {
+public final class CfnStackWaits {
private CfnStackWaits() {
}
/** What DescribeStacks reported: the status and, when present, the StackStatusReason. */
- record StackState(String status, String reason) {
+ public record StackState(String status, String reason) {
}
private static final Set<String> TERMINAL = Set.of(
@@ -40,11 +40,11 @@ final class CfnStackWaits {
* stack does not exist) fails at once with the error body rather than polling the clock out;
* ten seconds without a terminal status fails too.
*/
- static StackState awaitTerminal(String stackName) {
+ public static StackState awaitTerminal(String stackName) {
return awaitTerminal(stackName, null);
}
- static StackState awaitTerminal(String stackName, String authorization) {
+ public static StackState awaitTerminal(String stackName, String authorization) {
long deadline = System.currentTimeMillis() + 10_000;
StackState last = new StackState(null, "");
while (System.currentTimeMillis() < deadline) {
@@ -82,7 +82,7 @@ final class CfnStackWaits {
* terminal status fails at once with its reason, as do a DescribeStacks that is not 200 and ten
* seconds without the expected status.
*/
- static StackState awaitStatus(String stackName, String expectedStatus) {
+ public static StackState awaitStatus(String stackName, String expectedStatus) {
long deadline = System.currentTimeMillis() + 10_000;
StackState last = new StackState(null, "");
while (System.currentTimeMillis() < deadline) {
@@ -122,11 +122,11 @@ final class CfnStackWaits {
* stack's own reason only names the failed resource, as on AWS, so the failure's message is read
* here. Fails when DescribeStackEvents is not 200 or no resource failed in that operation.
*/
- static String failedResourceReason(String stackName) {
+ public static String failedResourceReason(String stackName) {
return failedResourceReason(stackName, null);
}
- static String failedResourceReason(String stackName, String authorization) {
+ public static String failedResourceReason(String stackName, String authorization) {
RequestSpecification request = given()
.contentType("application/x-www-form-urlencoded")
.formParam("Action", "DescribeStackEvents")
@@ -166,11 +166,11 @@ final class CfnStackWaits {
* Waits until DescribeStacks answers 400, which is how a missing stack is reported. Fails on
* DELETE_FAILED or after ten seconds.
*/
- static void awaitStackDeleted(String stackName) {
+ public static void awaitStackDeleted(String stackName) {
awaitStackDeleted(stackName, null);
}
- static void awaitStackDeleted(String stackName, String authorization) {
+ public static void awaitStackDeleted(String stackName, String authorization) {
long deadline = System.currentTimeMillis() + 10_000;
String body = "";
while (System.currentTimeMillis() < deadline) {