diff --git a/docs/services/step-functions.md b/docs/services/step-functions.md index d800068601..073b82008a 100644 --- a/docs/services/step-functions.md +++ b/docs/services/step-functions.md @@ -439,6 +439,23 @@ Local, the execution starts and fails with `States.Runtime` only if the state th it is entered. This keeps a generated mock file usable when the collection it was built from is empty and the state is never reached. +## Executions abandoned by a restart + +An execution runs in the Floci process. When Floci restarts while an execution is `RUNNING`, +no worker survives it, so at startup every execution still stored as `RUNNING` is aborted with no +error and no cause, the shape AWS returns for `StopExecution` called without them: +`DescribeExecution` reports `status` `ABORTED` and a `stopDate`, and leaves the `error` and `cause` +keys out. How many executions the sweep retired is reported once, as a `WARN` log line. Executions +of every account are swept, each written back under its own account. Executions that already +reached a terminal status are left untouched, and so is the status and `stopDate` of one this sweep +aborted on an earlier boot. + +Execution histories are held in memory, not in storage. The events recorded before the restart are +gone, so the execution cannot be resumed, and `GetExecutionHistory` reports a single +`ExecutionAborted` event, with an empty `executionAbortedEventDetails`, only for the boot that +aborted it: after a further restart the execution is already terminal, no event is written, and the +history is empty while `DescribeExecution` still reports the status and `stopDate`. + ## Configuration | Variable | Default | Description | diff --git a/src/main/java/io/github/hectorvent/floci/lifecycle/EmulatorLifecycle.java b/src/main/java/io/github/hectorvent/floci/lifecycle/EmulatorLifecycle.java index 2e2229071e..f14a0573c4 100644 --- a/src/main/java/io/github/hectorvent/floci/lifecycle/EmulatorLifecycle.java +++ b/src/main/java/io/github/hectorvent/floci/lifecycle/EmulatorLifecycle.java @@ -28,6 +28,7 @@ import io.github.hectorvent.floci.services.appsync.graphql.SchemaCreationWorker; import io.github.hectorvent.floci.services.elb.ElbClassicService; import io.github.hectorvent.floci.services.elbv2.ElbV2Service; import io.github.hectorvent.floci.services.rds.RdsService; +import io.github.hectorvent.floci.services.stepfunctions.StepFunctionsService; import io.github.hectorvent.floci.services.memorydb.container.MemoryDbContainerManager; import io.github.hectorvent.floci.services.memorydb.proxy.MemoryDbProxyManager; import io.github.hectorvent.floci.services.rds.container.RdsContainerManager; @@ -94,6 +95,7 @@ public class EmulatorLifecycle { private final FlociUiManager flociUiManager; private final InitLifecycleState initLifecycleState; private final SchemaCreationWorker schemaCreationWorker; + private final StepFunctionsService stepFunctionsService; private final jakarta.enterprise.inject.Instance containerTeardowns; private final PersistentPathValidator persistentPathValidator; @@ -127,6 +129,7 @@ public class EmulatorLifecycle { FlociUiManager flociUiManager, InitLifecycleState initLifecycleState, SchemaCreationWorker schemaCreationWorker, + StepFunctionsService stepFunctionsService, jakarta.enterprise.inject.Instance containerTeardowns, PersistentPathValidator persistentPathValidator) { this.storageFactory = storageFactory; @@ -159,6 +162,7 @@ public class EmulatorLifecycle { this.flociUiManager = flociUiManager; this.initLifecycleState = initLifecycleState; this.schemaCreationWorker = schemaCreationWorker; + this.stepFunctionsService = stepFunctionsService; this.containerTeardowns = containerTeardowns; this.persistentPathValidator = persistentPathValidator; } @@ -191,6 +195,7 @@ public class EmulatorLifecycle { } schemaCreationWorker.recoverOrphans(); schemaCreationWorker.rehydrateSchemas(); + stepFunctionsService.abortAbandonedExecutions(); sqsPoller.startPersistedPollers(); kinesisPoller.startPersistedPollers(); diff --git a/src/main/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsService.java b/src/main/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsService.java index 60a9235da0..2e43f0dd88 100644 --- a/src/main/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsService.java +++ b/src/main/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsService.java @@ -7,6 +7,7 @@ import io.github.hectorvent.floci.core.common.RegionResolver; import io.github.hectorvent.floci.core.resource.ExplorerResource; import io.github.hectorvent.floci.core.resource.ResourceProvider; import io.github.hectorvent.floci.core.resource.SupportedResourceType; +import io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend; import io.github.hectorvent.floci.core.storage.StorageBackend; import io.github.hectorvent.floci.core.storage.StorageFactory; import com.fasterxml.jackson.core.type.TypeReference; @@ -43,7 +44,8 @@ public class StepFunctionsService implements Resettable, ResourceProvider { private static final Logger LOG = Logger.getLogger(StepFunctionsService.class); private final StorageBackend stateMachineStore; - private final StorageBackend executionStore; + // Account-aware: the startup sweep has no request context and must reach every account. + private final AccountAwareStorageBackend executionStore; private final StorageBackend activityStore; private final StorageBackend mapRunStore; private final Map historyCache = new ConcurrentHashMap<>(); @@ -705,36 +707,86 @@ public class StepFunctionsService implements Resettable, ResourceProvider { /** * Aborts a running execution. The caller's {@code error} and {@code cause} land on the * Execution itself, not only on the history event, so DescribeExecution reports them. - * - *

The worker thread may still be inside a state when this runs. It shares this Execution - * instance and reads the status it publishes here, so the writes are made under the same - * monitor the worker's terminal write takes: ABORTED is the status that stands. - * - *

ExecutionAborted seals the history for the same reason: the worker still has the state it - * is inside left to record, and those events belong to an execution the caller has already - * been told is finished. + * {@link #markAborted} carries the terminal write and the reasons it is made under the + * Execution's own monitor. */ public void stopExecution(String arn, String cause, String error) { Execution exec = describeExecution(arn); + if (!markAborted(arn, exec, error, cause)) { + return; + } + executionStore.put(arn, exec); + } + + /** + * Retires the executions a restart abandoned: they came back from storage as RUNNING with no + * worker behind them, and their only other writers, the worker and StopExecution, are gone. + * Called once at startup, before any request is served, so it takes no lock beyond the one + * {@link #markAborted} takes on each Execution. + * + *

Scans every account and writes each execution back under the account that owns it: startup + * has no request context, so the account-scoped accessors would silently cover only the + * configured default account. + * + *

Aborts with no error and no cause, the shape AWS returns for StopExecution called without + * them: the status is the whole report. The WARN below is where the reason lives. + */ + public void abortAbandonedExecutions() { + int abandonedCount = 0; + for (AccountAwareStorageBackend.AccountEntry entry + : executionStore.scanAllAccountEntries(key -> true)) { + if (!markAborted(entry.key(), entry.value(), null, null)) { + continue; + } + executionStore.putForAccount(entry.accountId(), entry.key(), entry.value()); + abandonedCount++; + } + if (abandonedCount > 0) { + LOG.warnv("Aborted {0} Step Functions execution(s) left RUNNING by a restart", + abandonedCount); + } + } + + /** + * Writes the terminal ABORTED status on a running execution and seals the history filed under + * {@code arn}, returning false when the execution is already terminal. The key is the caller's + * because it is the one GetExecutionHistory looks the history up by: StopExecution has the ARN + * it was called with, the startup sweep has the storage key the entry came under. Persisting + * the execution is the caller's too, because StopExecution writes it under the caller's account + * and the sweep writes it under the account that owns the entry. + * + *

The worker thread may still be inside a state when StopExecution runs. It shares this + * Execution instance and reads the status published here, so the writes are made under the same + * monitor the worker's terminal write takes: ABORTED is the status that stands. + * + *

ExecutionAborted seals the history for the same reason: the worker still has the state it + * is inside left to record, and those events belong to an execution the caller has already been + * told is finished. + */ + private boolean markAborted(String arn, Execution exec, String error, String cause) { synchronized (exec) { if (!"RUNNING".equals(exec.getStatus())) { - return; + return false; } exec.setError(error); exec.setCause(cause); exec.setStopDate(System.currentTimeMillis() / 1000.0); exec.setStatus("ABORTED"); } - executionStore.put(arn, exec); Map details = new HashMap<>(); - if (error != null) details.put("error", error); - if (cause != null) details.put("cause", cause); + if (error != null) { + details.put("error", error); + } + if (cause != null) { + details.put("cause", cause); + } // An execution can outlive its history: the executions are stored, the histories are held in // memory only, so a restart in persistent mode brings a RUNNING execution back with nothing // behind it. The abort still gets recorded, against a history that starts here. historyCache.computeIfAbsent(arn, key -> new ExecutionHistory()) .sealWith("ExecutionAborted", details); + return true; } public List getExecutionHistory(String arn) { diff --git a/src/test/java/io/github/hectorvent/floci/lifecycle/EmulatorLifecycleTest.java b/src/test/java/io/github/hectorvent/floci/lifecycle/EmulatorLifecycleTest.java index aa2c6c6de6..795aa12b24 100644 --- a/src/test/java/io/github/hectorvent/floci/lifecycle/EmulatorLifecycleTest.java +++ b/src/test/java/io/github/hectorvent/floci/lifecycle/EmulatorLifecycleTest.java @@ -91,6 +91,7 @@ class EmulatorLifecycleTest { @Mock private PersistentPathValidator persistentPathValidator; @Mock private EmulatorConfig.TlsConfig tlsConfig; @Mock private io.github.hectorvent.floci.services.appsync.graphql.SchemaCreationWorker schemaCreationWorker; + @Mock private io.github.hectorvent.floci.services.stepfunctions.StepFunctionsService stepFunctionsService; @Mock private jakarta.enterprise.inject.Instance containerTeardowns; private EmulatorLifecycle emulatorLifecycle; @@ -120,7 +121,7 @@ class EmulatorLifecycleTest { rabbitMqManager, flinkContainerManager, rdsService, elbV2Service, elbClassicService, initializationHooksRunner, sqsPoller, kinesisPoller, dynamodbStreamsPoller, pipesService, ec2MetadataServer, ecrRegistryManager, flociUiManager, initLifecycleState, - schemaCreationWorker, containerTeardowns, persistentPathValidator); + schemaCreationWorker, stepFunctionsService, containerTeardowns, persistentPathValidator); Mockito.lenient().when(containerTeardowns.iterator()) .thenReturn(java.util.Collections.emptyIterator()); } @@ -223,6 +224,20 @@ class EmulatorLifecycleTest { inOrder.verify(schemaCreationWorker).rehydrateSchemas(); } + @Test + @DisplayName("Should abort abandoned Step Functions executions after loading storage") + void shouldAbortAbandonedStepFunctionsExecutionsAfterStorageLoad() { + stubStorageConfig(); + when(initializationHooksRunner.hasHooks(InitializationHook.START)).thenReturn(false); + when(initializationHooksRunner.hasHooks(InitializationHook.READY)).thenReturn(false); + + emulatorLifecycle.onStart(Mockito.mock(StartupEvent.class)); + + var inOrder = Mockito.inOrder(storageFactory, stepFunctionsService); + inOrder.verify(storageFactory).loadAll(); + inOrder.verify(stepFunctionsService).abortAbandonedExecutions(); + } + @Test @DisplayName("Should validate the persistent path after BOOT hooks and before loading storage") void shouldValidatePersistentPathBeforeStorageLoad() { diff --git a/src/test/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsServicePersistenceTest.java b/src/test/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsServicePersistenceTest.java new file mode 100644 index 0000000000..8cbf72e92a --- /dev/null +++ b/src/test/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsServicePersistenceTest.java @@ -0,0 +1,248 @@ +package io.github.hectorvent.floci.services.stepfunctions; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.github.hectorvent.floci.core.common.RegionResolver; +import io.github.hectorvent.floci.core.storage.AccountAwareStorageBackend; +import io.github.hectorvent.floci.core.storage.StorageBackend; +import io.github.hectorvent.floci.core.storage.StorageFactory; +import io.github.hectorvent.floci.services.stepfunctions.model.Execution; +import io.github.hectorvent.floci.services.stepfunctions.model.HistoryEvent; +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.LogRecord; +import java.util.logging.Logger; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.Mockito.verifyNoInteractions; + +/** Verifies executions abandoned by a restart reach a terminal status when the emulator comes back. */ +class StepFunctionsServicePersistenceTest { + + private static final String DEFAULT_ACCOUNT = "000000000000"; + private static final String OTHER_ACCOUNT = "222222222222"; + private static final String EXECUTION_ARN = + "arn:aws:states:us-east-1:000000000000:execution:TestStateMachine:HelloWorld"; + private static final String OTHER_ACCOUNT_EXECUTION_ARN = + "arn:aws:states:us-east-1:222222222222:execution:TestStateMachine:HelloWorld"; + private static final String STATE_MACHINE_ARN = + "arn:aws:states:us-east-1:000000000000:stateMachine:TestStateMachine"; + private static final double EPOCH_SECONDS_2023_11_14 = 1700000000.0; + private static final double EPOCH_SECONDS_2100_01_01 = 4102444800.0; + + private final AslExecutor aslExecutor = Mockito.mock(AslExecutor.class); + private final SfnMockLoader mockLoader = Mockito.mock(SfnMockLoader.class); + private final RegionResolver regionResolver = Mockito.mock(RegionResolver.class); + + @Test + void abandonedRunningExecutionIsAbortedOnRestart() { + SharedStorageFactory storage = new SharedStorageFactory(); + AccountAwareStorageBackend executions = executionStore(storage); + StepFunctionsService beforeRestart = serviceWithStorage(storage); + executions.putForAccount(DEFAULT_ACCOUNT, EXECUTION_ARN, running(EXECUTION_ARN)); + assertEquals("RUNNING", beforeRestart.describeExecution(EXECUTION_ARN).getStatus()); + + StepFunctionsService afterRestart = serviceWithStorage(storage); + afterRestart.abortAbandonedExecutions(); + + // The shape AWS returns for an execution stopped with no error and no cause: the status is + // the whole report, and error and cause are left off DescribeExecution and off the event. + Execution reloaded = afterRestart.describeExecution(EXECUTION_ARN); + assertEquals("ABORTED", reloaded.getStatus()); + assertNull(reloaded.getError()); + assertNull(reloaded.getCause()); + assertStopDateInEpochSeconds(reloaded.getStopDate()); + + List history = afterRestart.getExecutionHistory(EXECUTION_ARN); + assertEquals(1, history.size()); + HistoryEvent aborted = history.getFirst(); + assertEquals("ExecutionAborted", aborted.getType()); + assertEquals(1L, aborted.getId()); + assertEquals(Long.valueOf(0L), aborted.getPreviousEventId()); + assertEquals(Map.of(), aborted.getDetails()); + + verifyNoInteractions(aslExecutor, mockLoader, regionResolver); + } + + @Test + void abandonedExecutionOfAnotherAccountStaysInItsOwnAccount() { + SharedStorageFactory storage = new SharedStorageFactory(); + AccountAwareStorageBackend executions = executionStore(storage); + executions.putForAccount(OTHER_ACCOUNT, OTHER_ACCOUNT_EXECUTION_ARN, + running(OTHER_ACCOUNT_EXECUTION_ARN)); + + List logRecords = new ArrayList<>(); + Handler collector = collectorInto(logRecords); + Logger serviceLogger = Logger.getLogger(StepFunctionsService.class.getName()); + serviceLogger.addHandler(collector); + try { + serviceWithStorage(storage).abortAbandonedExecutions(); + } finally { + serviceLogger.removeHandler(collector); + } + + List warnings = warningsIn(logRecords); + assertEquals(1, warnings.size(), + "expected one WARN record for the sweep, got: " + formattedAll(logRecords)); + assertTrue(formatted(warnings.getFirst()).contains("1"), + "expected the WARN record to name how many executions were aborted, got: " + + formatted(warnings.getFirst())); + + Optional owned = + executions.getForAccount(OTHER_ACCOUNT, OTHER_ACCOUNT_EXECUTION_ARN); + assertTrue(owned.isPresent()); + assertEquals("ABORTED", owned.get().getStatus()); + assertNull(owned.get().getError()); + assertNull(owned.get().getCause()); + assertStopDateInEpochSeconds(owned.get().getStopDate()); + assertEquals(Optional.empty(), + executions.getForAccount(DEFAULT_ACCOUNT, OTHER_ACCOUNT_EXECUTION_ARN)); + + verifyNoInteractions(aslExecutor, mockLoader, regionResolver); + } + + @Test + void terminalExecutionsAreUntouchedAndTheSweepIsIdempotent() { + SharedStorageFactory storage = new SharedStorageFactory(); + AccountAwareStorageBackend executions = executionStore(storage); + Execution succeeded = running("arn:aws:states:us-east-1:000000000000:execution:" + + "TestStateMachine:HelloWorldDone"); + succeeded.setStatus("SUCCEEDED"); + succeeded.setOutput("{\"greeting\":\"hello\"}"); + succeeded.setStopDate(1700000000.0); + executions.putForAccount(DEFAULT_ACCOUNT, succeeded.getExecutionArn(), succeeded); + executions.putForAccount(DEFAULT_ACCOUNT, EXECUTION_ARN, running(EXECUTION_ARN)); + + StepFunctionsService afterRestart = serviceWithStorage(storage); + afterRestart.abortAbandonedExecutions(); + Double stopDateOfFirstSweep = + afterRestart.describeExecution(EXECUTION_ARN).getStopDate(); + + // Nothing is RUNNING any more, so the second sweep retires nothing and says nothing: a WARN + // on every clean boot is the noise the repo's logging rule forbids. + List logRecords = new ArrayList<>(); + Handler collector = collectorInto(logRecords); + Logger serviceLogger = Logger.getLogger(StepFunctionsService.class.getName()); + serviceLogger.addHandler(collector); + try { + afterRestart.abortAbandonedExecutions(); + } finally { + serviceLogger.removeHandler(collector); + } + assertEquals(List.of(), warningsIn(logRecords), + "expected no WARN record from a sweep that found nothing RUNNING, got: " + + formattedAll(logRecords)); + + Execution untouched = afterRestart.describeExecution(succeeded.getExecutionArn()); + assertEquals("SUCCEEDED", untouched.getStatus()); + assertEquals("{\"greeting\":\"hello\"}", untouched.getOutput()); + assertEquals(Double.valueOf(1700000000.0), untouched.getStopDate()); + assertEquals(List.of(), afterRestart.getExecutionHistory(succeeded.getExecutionArn())); + + Execution abandoned = afterRestart.describeExecution(EXECUTION_ARN); + assertEquals("ABORTED", abandoned.getStatus()); + assertEquals(stopDateOfFirstSweep, abandoned.getStopDate()); + assertEquals(1, afterRestart.getExecutionHistory(EXECUTION_ARN).size()); + + verifyNoInteractions(aslExecutor, mockLoader, regionResolver); + } + + private static Handler collectorInto(List records) { + Handler collector = new Handler() { + @Override + public void publish(LogRecord record) { + records.add(record); + } + + @Override + public void flush() { + } + + @Override + public void close() { + } + }; + collector.setLevel(Level.ALL); + return collector; + } + + private static List warningsIn(List records) { + // The level is compared by value: under JBoss LogManager the record carries its own WARN + // instance, not the java.util.logging constant. + return records.stream() + .filter(record -> record.getLevel().intValue() == Level.WARNING.intValue()) + .toList(); + } + + private static List formattedAll(List records) { + return records.stream().map(StepFunctionsServicePersistenceTest::formatted).toList(); + } + + /** + * A stopDate DescribeExecution can report: epoch seconds, between 2023-11-14 and 2100-01-01. + * Both bounds are literals, so a stopDate written in another unit fails here. + */ + private static void assertStopDateInEpochSeconds(Double stopDate) { + assertNotNull(stopDate); + assertTrue(stopDate > EPOCH_SECONDS_2023_11_14 && stopDate < EPOCH_SECONDS_2100_01_01, + "stopDate is not a plausible epoch-seconds instant: " + stopDate); + } + + /** The record as a reader sees it, whether the handler receives it formatted or as a pattern. */ + private static String formatted(LogRecord record) { + Object[] parameters = record.getParameters(); + if (parameters == null || parameters.length == 0) { + return String.valueOf(record.getMessage()); + } + return MessageFormat.format(record.getMessage(), parameters); + } + + private static Execution running(String executionArn) { + Execution execution = new Execution(); + execution.setExecutionArn(executionArn); + execution.setStateMachineArn(STATE_MACHINE_ARN); + execution.setName("HelloWorld"); + execution.setInput("{}"); + execution.setStatus("RUNNING"); + return execution; + } + + private StepFunctionsService serviceWithStorage(StorageFactory storage) { + return new StepFunctionsService(storage, regionResolver, aslExecutor, + new ObjectMapper(), mockLoader); + } + + private static AccountAwareStorageBackend executionStore(SharedStorageFactory storage) { + return storage.create("stepfunctions", "sfn-executions.json", + new TypeReference>() {}); + } + + private static final class SharedStorageFactory extends StorageFactory { + private final Map> stores = new HashMap<>(); + + private SharedStorageFactory() { + super(null, null); + } + + @Override + @SuppressWarnings("unchecked") + public AccountAwareStorageBackend create(String serviceName, + String fileName, + TypeReference> typeReference) { + return (AccountAwareStorageBackend) stores.computeIfAbsent( + fileName, ignored -> AccountAwareStorageBackend.inMemory(DEFAULT_ACCOUNT)); + } + } +} diff --git a/src/test/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsStopExecutionIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsStopExecutionIntegrationTest.java index 846f002cef..80bdb4445c 100644 --- a/src/test/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsStopExecutionIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/stepfunctions/StepFunctionsStopExecutionIntegrationTest.java @@ -15,6 +15,7 @@ import java.util.UUID; import static io.restassured.RestAssured.given; import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; /** * Guards that {@code StopExecution} stops the execution instead of relabelling it: the status, @@ -94,6 +95,40 @@ class StepFunctionsStopExecutionIntegrationTest { assertEquals(stopDate, described.jsonPath().getDouble("stopDate")); } + /** + * Measured against us-east-1: an abort with no error and no cause leaves both keys out of + * {@code DescribeExecution} and carries an empty {@code executionAbortedEventDetails}. This is + * the terminal write the startup sweep of abandoned executions makes as well. + */ + @Test + void abortWithNoReasonOmitsErrorAndCause() throws Exception { + String executionArn = startWaitingExecution("stop-without-reason"); + Thread.sleep(300); + + given() + .header("X-Amz-Target", "AWSStepFunctions.StopExecution") + .contentType(SFN_CONTENT_TYPE) + .body(""" + {"executionArn": "%s"} + """.formatted(executionArn)) + .when() + .post("/") + .then() + .statusCode(200); + + Map described = describeExecution(executionArn).jsonPath().getMap("$"); + assertEquals("ABORTED", described.get("status")); + // Absent, not null: a null value would leave the key in place and here it is gone. + assertFalse(described.containsKey("error"), "DescribeExecution kept error: " + described); + assertFalse(described.containsKey("cause"), "DescribeExecution kept cause: " + described); + + List> events = + getExecutionHistory(executionArn).jsonPath().getList("events"); + Map aborted = events.get(events.size() - 1); + assertEquals("ExecutionAborted", aborted.get("type")); + assertEquals(Map.of(), aborted.get("executionAbortedEventDetails")); + } + @Test void abortedExecutionEndsItsHistoryAtExecutionAborted() throws Exception { String executionArn = startWaitingExecution("stop-ends-history");