Skip to content

armgit / floci

Public Imported from GitHub
0

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

test(ecs): let the Docker test containers exit on SIGTERM instead of sitting out stopTimeout (#4211)

Priamo Germosen620d71765353
diff --git a/src/test/java/io/github/hectorvent/floci/services/ecs/container/EcsContainerManagerStatsDockerIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ecs/container/EcsContainerManagerStatsDockerIntegrationTest.java
index 7816330294..11160dd97c 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ecs/container/EcsContainerManagerStatsDockerIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ecs/container/EcsContainerManagerStatsDockerIntegrationTest.java
@@ -118,7 +118,9 @@ class EcsContainerManagerStatsDockerIntegrationTest {
ContainerDefinition definition = new ContainerDefinition();
definition.setName(name);
definition.setImage(BUSYBOX_IMAGE);
- definition.setCommand(List.of("sleep", "60"));
+ // PID 1 gets no default SIGTERM handler, so a bare "sleep 60" sits out the whole
+ // stopTimeout grace period on teardown, once per container in the task.
+ definition.setCommand(List.of("sh", "-c", "trap 'exit 0' TERM; sleep 60 & wait"));
return definition;
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/ecs/exec/EcsExecChannelDockerIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ecs/exec/EcsExecChannelDockerIntegrationTest.java
index 3e4a4f7c89..f6f386051c 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ecs/exec/EcsExecChannelDockerIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ecs/exec/EcsExecChannelDockerIntegrationTest.java
@@ -67,7 +67,9 @@ class EcsExecChannelDockerIntegrationTest {
ContainerDefinition app = new ContainerDefinition();
app.setName("app");
app.setImage(BUSYBOX_IMAGE);
- app.setCommand(List.of("sleep", "120"));
+ // PID 1 gets no default SIGTERM handler, so a bare "sleep 120" sits out the whole
+ // stopTimeout grace period on teardown.
+ app.setCommand(List.of("sh", "-c", "trap 'exit 0' TERM; sleep 120 & wait"));
TaskDefinition taskDefinition = new TaskDefinition();
taskDefinition.setFamily("exec-docker-" + suffix);