fix(stepfunctions): refuse an unsupported ecs:runTask pattern before launching the task (#8545)

ecs:runTask supports request-response, .sync and .waitForTaskToken. A
.sync:2 resource used to launch the task and only then fail the state
with "Unsupported ecs:runTask mode", leaving the task running unmonitored.
The pattern is now checked before RunTask is called, and the state fails
with the same "Unsupported resource" error as other unsupported
integrations.
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-11-16 00:43:26 -04:00
1 parent fc141d12d6
commit 9392bd54af
2 files changed
+20 -6

No files matched your search

@@ -34,6 +34,7 @@ import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.timeout;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -120,6 +121,19 @@ class AslExecutorEcsRunTaskModeTest {
assertEquals("AmazonECS.Unknown", execution.getError());
}
@Test
void syncTwoIsRefusedBeforeAnyTaskIsLaunched() {
launchOneTask();
Execution execution = run("arn:aws:states:::ecs:runTask.sync:2",
"{\"TaskDefinition\":\"my-task-def\"}");
assertEquals("FAILED", execution.getStatus());
assertEquals("States.TaskFailed", execution.getError());
assertEquals("Unsupported resource: arn:aws:states:::ecs:runTask.sync:2", execution.getCause());
verify(ecsService, never()).runTask(any(), any(), anyInt(), any(), any(), any(), any(), any(), any());
}
@Test
void networkConfigurationIsThreadedThroughToRunTask() throws Exception {
when(ecsService.runTask(any(), any(), anyInt(), any(), any(), any(), any(), any(), any()))