Skip to content

armgit / floci

Public Imported from GitHub
0

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

test(eks): let the IMDS and pod identity test containers exit on SIGTERM (#4228)

Priamo Germosenacafe73a2c21
diff --git a/src/test/java/io/github/hectorvent/floci/services/eks/EksImdsDockerIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/eks/EksImdsDockerIntegrationTest.java
index afb55bfdc1..47ac97bc24 100644
--- a/src/test/java/io/github/hectorvent/floci/services/eks/EksImdsDockerIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/eks/EksImdsDockerIntegrationTest.java
@@ -108,7 +108,9 @@ class EksImdsDockerIntegrationTest {
.withName("floci-eks-imds-test-" + clusterName)
.withPrivileged(true)
.withHostDockerInternalOnLinux()
- .withCmd(List.of("sleep", "300"))
+ // PID 1 gets no default SIGTERM handler, so a bare "sleep 300" sits out the
+ // whole stopAndRemove grace period when @AfterEach tears the container down.
+ .withCmd(List.of("sh", "-c", "trap 'exit 0' TERM; sleep 300 & wait"))
.build();
containerId = lifecycleManager.createAndStart(spec).containerId();
diff --git a/src/test/java/io/github/hectorvent/floci/services/eks/EksPodIdentityDockerIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/eks/EksPodIdentityDockerIntegrationTest.java
index aedc52b524..8b512e3093 100644
--- a/src/test/java/io/github/hectorvent/floci/services/eks/EksPodIdentityDockerIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/eks/EksPodIdentityDockerIntegrationTest.java
@@ -154,7 +154,9 @@ class EksPodIdentityDockerIntegrationTest {
.withName("floci-eks-pi-test-" + clusterName)
.withPrivileged(true)
.withHostDockerInternalOnLinux()
- .withCmd(List.of("sleep", "300"))
+ // PID 1 gets no default SIGTERM handler, so a bare "sleep 300" sits out the
+ // whole stopAndRemove grace period when @AfterEach tears the container down.
+ .withCmd(List.of("sh", "-c", "trap 'exit 0' TERM; sleep 300 & wait"))
.build();
containerId = lifecycleManager.createAndStart(spec).containerId();