fix(docker): open long-lived exec streams on the streaming Docker pool (#8950)

* fix(docker): open long-lived exec streams on the streaming Docker pool

CodeBuild build phases, SSM run commands, ECS Exec sessions, the EKS audit log follower, ECR garbage collection, EC2 and EKS user data scripts and EMR bootstrap actions held a control-plane connection for as long as their exec ran, so enough of them could leave the short Docker calls waiting for a lease. Their exec starts now use the @StreamingDocker client: ContainerLifecycleManager exposes getStreamingDockerClient(), CodeBuildRunner and SsmDirectCommandExecutor inject it, and UserDataPipeline and ContainerExec take it beside the control-plane client. Neither transport replays an exec start and both exempt it from the response timeout, so only the pool changes; creating, inspecting and resizing an exec stay on the control plane. The connection pool docs, the environment variable tables, the application.yml comment and the javadocs now name these streams.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* fix(codebuild): close a timed-out phase's output stream, and drop the test-only constructor

runPhase discarded the callback of its exec start, so a phase that timed out or was interrupted left its output stream open, now holding a streaming connection for as long as the command ran on; it is now closed. ContainerLifecycleManager's public four-argument constructor existed only so tests could pass one client for both pools; it goes, and those tests name both clients through the injected constructor.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* test(docker): give the reachability test the streaming client the constructor now takes

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

#8951 added ContainerLifecycleManagerReachabilityTest with the four-argument constructor this branch removes, so the two no longer compiled together on main.

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-11-19 07:50:43 -06:00
1 parent aabe2247c5
commit ad0e47910f
54 files changed
+322 -113

No files matched your search

@@ -36,7 +36,7 @@ class ContainerConcurrentRemovalTest {
private final Closeable waitStream = mock(Closeable.class);
private final ConflictException conflict = new ConflictException("removal already in progress");
private final ContainerLifecycleManager manager = new ContainerLifecycleManager(
docker, mock(ImageCacheService.class), mock(ContainerDetector.class), mock(EmulatorConfig.class));
docker, docker, mock(ImageCacheService.class), mock(ContainerDetector.class), mock(EmulatorConfig.class));
private void removalConflict(boolean running) {
StopContainerCmd stop = mock(StopContainerCmd.class, RETURNS_SELF);
@@ -49,6 +49,23 @@ public final class ContainerExecStubs {
public static List<List<String>> completeEveryExec(DockerClient dockerClient, String containerId,
List<Long> exitCodes, String stdout, String stderr,
List<List<String>> envs) {
return completeEveryExec(dockerClient, dockerClient, containerId, exitCodes, stdout, stderr, envs);
}
/**
* As {@link #completeEveryExec(DockerClient, String, long, String, String)}, the execs created and inspected
* on {@code dockerClient} and startable on either client, so a test can verify which one each start used.
*/
public static List<List<String>> completeEveryExec(DockerClient dockerClient, DockerClient streamingDockerClient,
String containerId, long exitCode, String stdout,
String stderr) {
return completeEveryExec(dockerClient, streamingDockerClient, containerId, List.of(exitCode), stdout, stderr,
new ArrayList<>());
}
private static List<List<String>> completeEveryExec(DockerClient dockerClient, DockerClient streamingDockerClient,
String containerId, List<Long> exitCodes, String stdout,
String stderr, List<List<String>> envs) {
String execId = "exec-" + containerId;
List<List<String>> commands = new ArrayList<>();
@@ -79,6 +96,9 @@ public final class ContainerExecStubs {
return callback;
});
when(dockerClient.execStartCmd(execId)).thenReturn(startCmd);
if (streamingDockerClient != dockerClient) {
when(streamingDockerClient.execStartCmd(execId)).thenReturn(startCmd);
}
InspectExecCmd inspectCmd = mock(InspectExecCmd.class);
InspectExecResponse inspectResponse = mock(InspectExecResponse.class);
@@ -137,7 +137,7 @@ class ContainerLifecycleManagerCpuLimitTest {
ImageCacheService imageCacheService = mock(ImageCacheService.class);
when(imageCacheService.ensureImageExists(any())).thenAnswer(invocation -> invocation.getArgument(0));
new ContainerLifecycleManager(dockerClient, imageCacheService, mock(ContainerDetector.class), config)
new ContainerLifecycleManager(dockerClient, dockerClient, imageCacheService, mock(ContainerDetector.class), config)
.create(spec);
verify(createCmd).withHostName("ip-10-1-0-1.ec2.internal");
@@ -162,7 +162,7 @@ class ContainerLifecycleManagerCpuLimitTest {
ImageCacheService imageCacheService = mock(ImageCacheService.class);
when(imageCacheService.ensureImageExists(any())).thenAnswer(invocation -> invocation.getArgument(0));
ContainerLifecycleManager manager = new ContainerLifecycleManager(
dockerClient, imageCacheService, mock(ContainerDetector.class), config);
dockerClient, dockerClient, imageCacheService, mock(ContainerDetector.class), config);
manager.create(spec);
@@ -468,6 +468,6 @@ class ContainerLifecycleManagerCreateConflictRecoveryTest {
private ContainerLifecycleManager manager() {
return new ContainerLifecycleManager(
dockerClient, imageCacheService, containerDetector, config);
dockerClient, dockerClient, imageCacheService, containerDetector, config);
}
}
@@ -114,6 +114,6 @@ class ContainerLifecycleManagerCreateRejectionTest {
private ContainerLifecycleManager manager() {
return new ContainerLifecycleManager(
dockerClient, imageCacheService, containerDetector, config);
dockerClient, dockerClient, imageCacheService, containerDetector, config);
}
}
@@ -106,7 +106,7 @@ class ContainerLifecycleManagerDeviceRequestTest {
private ContainerLifecycleManager manager() {
return new ContainerLifecycleManager(
dockerClient, imageCacheService, containerDetector, config);
dockerClient, dockerClient, imageCacheService, containerDetector, config);
}
private static ContainerSpec specWithDeviceRequests(List<DeviceRequest> deviceRequests) {
@@ -30,7 +30,7 @@ class ContainerLifecycleManagerEphemeralTest {
images = mock(ImageCacheService.class);
when(images.ensureImageExists(spec.image())).thenReturn("image-id");
EmulatorConfig config = mock(EmulatorConfig.class, RETURNS_DEEP_STUBS);
manager = spy(new ContainerLifecycleManager(docker, images, mock(ContainerDetector.class), config));
manager = spy(new ContainerLifecycleManager(docker, docker, images, mock(ContainerDetector.class), config));
create = mock(CreateContainerCmd.class, RETURNS_SELF);
CreateContainerResponse response = new CreateContainerResponse();
response.setId("owned-id");
@@ -43,7 +43,7 @@ class ContainerLifecycleManagerImageLabelsTest {
EmulatorConfig config;
private ContainerLifecycleManager manager() {
return new ContainerLifecycleManager(dockerClient, imageCacheService, containerDetector, config);
return new ContainerLifecycleManager(dockerClient, dockerClient, imageCacheService, containerDetector, config);
}
private void imageInspectReturns(Map<String, String> labels) {
@@ -21,7 +21,7 @@ import static org.mockito.Mockito.when;
class ContainerLifecycleManagerImagesTest {
private final DockerClient docker = mock(DockerClient.class);
private final ContainerLifecycleManager manager = new ContainerLifecycleManager(docker, null, null, null);
private final ContainerLifecycleManager manager = new ContainerLifecycleManager(docker, docker, null, null, null);
@Test
void aCommitNamesTheImageAndSetsItsUserAndLabels() {
@@ -289,7 +289,7 @@ class ContainerLifecycleManagerLabelsTest {
private ContainerLifecycleManager manager() {
return new ContainerLifecycleManager(
dockerClient, imageCacheService, containerDetector, config);
dockerClient, dockerClient, imageCacheService, containerDetector, config);
}
private static ContainerSpec specWithLabels(Map<String, String> labels) {
@@ -47,7 +47,7 @@ class ContainerLifecycleManagerLastLogLinesTest {
@BeforeEach
void setUp() {
manager = new ContainerLifecycleManager(dockerClient, imageCacheService, containerDetector, config);
manager = new ContainerLifecycleManager(dockerClient, dockerClient, imageCacheService, containerDetector, config);
when(dockerClient.logContainerCmd("c1")).thenReturn(logs);
}
@@ -202,7 +202,7 @@ class ContainerLifecycleManagerLinuxOptionsTest {
private ContainerLifecycleManager manager() {
return new ContainerLifecycleManager(
dockerClient, imageCacheService, containerDetector, config);
dockerClient, dockerClient, imageCacheService, containerDetector, config);
}
private CreateContainerCmd stubCreateContainer() {
@@ -44,7 +44,7 @@ class ContainerLifecycleManagerLivenessTest {
@BeforeEach
void setUp() {
manager = new ContainerLifecycleManager(
dockerClient, imageCacheService, containerDetector, config);
dockerClient, dockerClient, imageCacheService, containerDetector, config);
when(dockerClient.inspectContainerCmd("c1")).thenReturn(inspectCmd);
}
@@ -605,7 +605,7 @@ class ContainerLifecycleManagerNetworkTest {
}
private ContainerLifecycleManager manager() {
return new ContainerLifecycleManager(dockerClient, imageCacheService, containerDetector, config);
return new ContainerLifecycleManager(dockerClient, dockerClient, imageCacheService, containerDetector, config);
}
private static ContainerSpec spec(String networkMode, Map<Integer, Integer> portBindings,
@@ -141,7 +141,7 @@ class ContainerLifecycleManagerPortBindingTest {
ImageCacheService imageCacheService = mock(ImageCacheService.class);
when(imageCacheService.ensureImageExists(any())).thenAnswer(invocation -> invocation.getArgument(0));
ContainerLifecycleManager manager = new ContainerLifecycleManager(
dockerClient, imageCacheService, mock(ContainerDetector.class), config);
dockerClient, dockerClient, imageCacheService, mock(ContainerDetector.class), config);
manager.create(spec);
@@ -16,7 +16,10 @@ class ContainerLifecycleManagerReachabilityTest {
DockerClient docker = mock(DockerClient.class);
when(docker.pingCmd()).thenReturn(mock(PingCmd.class));
assertTrue(new ContainerLifecycleManager(docker, null, null, null).isDockerReachable());
DockerClient streaming = mock(DockerClient.class);
ContainerLifecycleManager manager = new ContainerLifecycleManager(docker, streaming, null, null, null);
assertTrue(manager.isDockerReachable());
}
// Catches: a missing daemon surfacing as an exception from the probe, which callers use to tell a
@@ -28,6 +31,9 @@ class ContainerLifecycleManagerReachabilityTest {
when(ping.exec()).thenThrow(new RuntimeException("java.net.SocketException: No such file or directory"));
when(docker.pingCmd()).thenReturn(ping);
assertFalse(new ContainerLifecycleManager(docker, null, null, null).isDockerReachable());
DockerClient streaming = mock(DockerClient.class);
ContainerLifecycleManager manager = new ContainerLifecycleManager(docker, streaming, null, null, null);
assertFalse(manager.isDockerReachable());
}
}
@@ -57,7 +57,7 @@ class ContainerLifecycleManagerStartFailureTest {
@BeforeEach
void setUp() {
manager = spy(new ContainerLifecycleManager(
dockerClient, imageCacheService, containerDetector, config));
dockerClient, dockerClient, imageCacheService, containerDetector, config));
}
@Test
@@ -74,7 +74,7 @@ class ContainerLifecycleManagerStartTest {
private ContainerLifecycleManager manager(DockerClient docker) {
return new ContainerLifecycleManager(
docker, imageCacheService, containerDetector, config);
docker, docker, imageCacheService, containerDetector, config);
}
@Test
@@ -38,7 +38,7 @@ class ContainerLifecycleManagerTeardownTest {
void strictRemovalRetainsLogStreamForRetryWithOptionalAnonymousVolumeCleanup(boolean removeAnonymousVolumes)
throws Exception {
DockerClient docker = mock(DockerClient.class);
ContainerLifecycleManager manager = new ContainerLifecycleManager(docker, null, null, null);
ContainerLifecycleManager manager = new ContainerLifecycleManager(docker, docker, null, null, null);
StopContainerCmd stop = mock(StopContainerCmd.class);
when(docker.stopContainerCmd("retry")).thenReturn(stop);
when(stop.withTimeout(5)).thenReturn(stop);
@@ -65,7 +65,7 @@ class ContainerLifecycleManagerTeardownTest {
@Test
void confirmedRemovalAnswersWhetherTheContainerIsGoneAndKeepsTheLogStreamUntilItIs() throws Exception {
DockerClient docker = mock(DockerClient.class);
ContainerLifecycleManager manager = new ContainerLifecycleManager(docker, null, null, null);
ContainerLifecycleManager manager = new ContainerLifecycleManager(docker, docker, null, null, null);
StopContainerCmd stop = mock(StopContainerCmd.class);
when(docker.stopContainerCmd("held")).thenReturn(stop);
when(stop.withTimeout(5)).thenReturn(stop);
@@ -87,7 +87,7 @@ class ContainerLifecycleManagerTeardownTest {
@ValueSource(strings = {"strict", "strict-volumes", "best-effort", "stop-only"})
void laterOwnedStopsReachDockerWhileEarlierRemovalsAreBlocked(String mode) throws Exception {
DockerClient docker = mock(DockerClient.class);
ContainerLifecycleManager manager = new ContainerLifecycleManager(docker, null, null, null);
ContainerLifecycleManager manager = new ContainerLifecycleManager(docker, docker, null, null, null);
StopContainerCmd stop = mock(StopContainerCmd.class);
CountDownLatch ninthStop = new CountDownLatch(1);
when(docker.stopContainerCmd(anyString())).thenReturn(stop);
@@ -160,7 +160,7 @@ class ContainerLifecycleManagerTeardownTest {
@Test
void aContainerThatHadAlreadyExitedCountsAsStopped() throws Exception {
DockerClient docker = mock(DockerClient.class);
ContainerLifecycleManager manager = new ContainerLifecycleManager(docker, null, null, null);
ContainerLifecycleManager manager = new ContainerLifecycleManager(docker, docker, null, null, null);
StopContainerCmd stop = mock(StopContainerCmd.class);
when(docker.stopContainerCmd(anyString())).thenReturn(stop);
when(stop.withTimeout(anyInt())).thenReturn(stop);
@@ -183,7 +183,7 @@ class ContainerLifecycleManagerTeardownTest {
@Test
void aStopLeavesTheContainerInPlaceAndCountsAnExitedOrMissingOneAsStopped() {
DockerClient docker = mock(DockerClient.class);
ContainerLifecycleManager manager = new ContainerLifecycleManager(docker, null, null, null);
ContainerLifecycleManager manager = new ContainerLifecycleManager(docker, docker, null, null, null);
StopContainerCmd stop = mock(StopContainerCmd.class);
when(docker.stopContainerCmd(anyString())).thenReturn(stop);
when(stop.withTimeout(anyInt())).thenReturn(stop);
@@ -63,7 +63,7 @@ class ContainerLifecycleManagerVolumeTest {
@BeforeEach
void setUp() {
manager = new ContainerLifecycleManager(
dockerClient, imageCacheService, containerDetector, config);
dockerClient, dockerClient, imageCacheService, containerDetector, config);
}
@Test
@@ -75,7 +75,7 @@ class ContainerLifecycleManagerVolumesFromTest {
ImageCacheService imageCacheService = mock(ImageCacheService.class);
when(imageCacheService.ensureImageExists(any())).thenAnswer(invocation -> invocation.getArgument(0));
ContainerLifecycleManager manager = new ContainerLifecycleManager(
dockerClient, imageCacheService, mock(ContainerDetector.class), config);
dockerClient, dockerClient, imageCacheService, mock(ContainerDetector.class), config);
manager.create(spec);
@@ -73,11 +73,13 @@ class UserDataPipelineTest {
}
return null;
});
List<List<String>> commands = ContainerExecStubs.completeEveryExec(docker, "container-id", 0L,
// The script's output stays open for as long as it runs, so it streams on the streaming client.
DockerClient streaming = mock(DockerClient.class);
List<List<String>> commands = ContainerExecStubs.completeEveryExec(docker, streaming, "container-id", 0L,
"bootstrap complete\n", "");
List<String> output = new ArrayList<>();
UserDataPipeline.ExecutionResult result = UserDataPipeline.executeUserData(docker, "container-id",
UserDataPipeline.ExecutionResult result = UserDataPipeline.executeUserData(docker, streaming, "container-id",
"test instance", script, Duration.ofSeconds(1), output::add, null, 0L);
assertTrue(result.isSuccess(), result.getFailureMessage());
@@ -87,7 +89,8 @@ class UserDataPipelineTest {
assertEquals(List.of(List.of(UserDataPipeline.USER_DATA_SCRIPT_PATH)), commands);
assertEquals(List.of("bootstrap complete"), output);
verify(copyCmd, times(2)).withRemotePath("/var/lib");
verify(docker).execStartCmd("exec-container-id");
verify(streaming).execStartCmd("exec-container-id");
verify(docker, never()).execStartCmd(anyString());
}
@Test
@@ -97,7 +100,7 @@ class UserDataPipelineTest {
when(docker.copyArchiveToContainerCmd("container-id")).thenReturn(copyCmd);
when(copyCmd.exec()).thenThrow(new NotFoundException("Could not find the file /var/lib in container"));
UserDataPipeline.ExecutionResult result = UserDataPipeline.executeUserData(docker, "container-id",
UserDataPipeline.ExecutionResult result = UserDataPipeline.executeUserData(docker, docker, "container-id",
"test instance", "#!/bin/sh\nexit 0\n", Duration.ofSeconds(1), null, null);
assertFalse(result.isSuccess());
@@ -176,7 +176,7 @@ class ReposiliteSidecarManagerTest {
@Test
void failedStopRetainsTheManagedEndpointForCleanupRetry() throws Exception {
DockerClient docker = mock(DockerClient.class);
ContainerLifecycleManager lifecycle = new ContainerLifecycleManager(docker, null, null, null);
ContainerLifecycleManager lifecycle = new ContainerLifecycleManager(docker, docker, null, null, null);
StopContainerCmd stop = mock(StopContainerCmd.class);
when(docker.stopContainerCmd("retained-reposilite")).thenReturn(stop);
when(stop.withTimeout(5)).thenReturn(stop);
@@ -141,7 +141,7 @@ class VerdaccioSidecarManagerTest {
when(docker.removeContainerCmd("tracked-verdaccio-1")).thenReturn(remove);
when(remove.withForce(true)).thenReturn(remove);
doThrow(new IllegalStateException("Docker removal failed")).doNothing().when(remove).exec();
ContainerLifecycleManager realLifecycle = new ContainerLifecycleManager(docker, null, null, null);
ContainerLifecycleManager realLifecycle = new ContainerLifecycleManager(docker, docker, null, null, null);
VerdaccioSidecarManager manager = new VerdaccioSidecarManager(containerBuilder, realLifecycle, config,
new CodeArtifactContainerRuns(realLifecycle, config).containers());
seedPooledContainer(manager, "npm-repo-1", "tracked-verdaccio-1", "http://127.0.0.1:1");
@@ -195,7 +195,7 @@ class CodeBuildRunnerServiceRoleTest {
when(server.start()).thenReturn(CompletableFuture.completedFuture(null));
EcsCredentialsProxy proxy = mock(EcsCredentialsProxy.class);
CodeBuildRunner runner = spy(new CodeBuildRunner(docker, containerBuilder, lifecycle, logStreamer,
CodeBuildRunner runner = spy(new CodeBuildRunner(docker, docker, containerBuilder, lifecycle, logStreamer,
null, null, null, config, mock(ContainerDetector.class), regionResolver, endpoint,
mock(Ec2Service.class),
new CodeBuildRoleCredentials(credentials, server, proxy, new EcsTaskLinkLocalAddresses())));
@@ -177,7 +177,7 @@ class CodeBuildRunnerSourceFailureTest {
CodeBuildRoleCredentials roleCredentials = mock(CodeBuildRoleCredentials.class);
when(roleCredentials.provision(anyString(), anyString(), nullable(String.class), anyString(), any()))
.thenReturn(new CodeBuildRoleCredentials.BuildCredentials(Map.of(), null));
CodeBuildRunner runner = spy(new CodeBuildRunner(docker, containerBuilder, lifecycle, logStreamer,
CodeBuildRunner runner = spy(new CodeBuildRunner(docker, docker, containerBuilder, lifecycle, logStreamer,
s3, null, null, config, mock(ContainerDetector.class), regionResolver, endpoint, ec2,
roleCredentials));
doReturn(CodeBuildRunner.PhaseResult.ofSuccess()).when(runner)
@@ -24,6 +24,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.RETURNS_SELF;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
class CodeBuildRunnerTest {
@@ -35,9 +36,11 @@ class CodeBuildRunnerTest {
// 2.5 GiB in total: more than a single Java byte array can hold.
int chunkCount = 320;
String lastLine = "error: build step failed\n";
DockerClient dockerClient = dockerClientStreaming(chunk, chunkCount, lastLine, 2L);
CodeBuildRunner runner = new CodeBuildRunner(dockerClient, null, null, null, null, null, null, null, null, null, null,
null, null);
DockerClient dockerClient = mock(DockerClient.class);
DockerClient streamingDockerClient = mock(DockerClient.class);
stubPhase(dockerClient, streamingDockerClient, chunk, chunkCount, lastLine, 2L);
CodeBuildRunner runner = new CodeBuildRunner(dockerClient, streamingDockerClient, null, null, null, null, null,
null, null, null, null, null, null, null);
CodeBuildRunner.PhaseResult result = runner.runPhase("container-1", "/src", List.of(),
List.of("./build.sh"), 60, new AtomicBoolean(false));
@@ -47,11 +50,39 @@ class CodeBuildRunnerTest {
assertEquals("Exit code 2: " + expectedTail, result.errorMessage());
}
// Catches: a timed-out phase leaving its exec's output stream open, so it held a streaming
// connection for as long as the command ran on.
@Test
@SuppressWarnings("unchecked")
void aPhaseThatTimesOutClosesItsOutputStream() throws Exception {
DockerClient dockerClient = mock(DockerClient.class);
DockerClient streamingDockerClient = mock(DockerClient.class);
ExecCreateCmd createCmd = mock(ExecCreateCmd.class, RETURNS_SELF);
ExecCreateCmdResponse createResponse = mock(ExecCreateCmdResponse.class);
when(createResponse.getId()).thenReturn("exec-1");
when(createCmd.exec()).thenReturn(createResponse);
when(dockerClient.execCreateCmd("container-1")).thenReturn(createCmd);
ExecStartCmd startCmd = mock(ExecStartCmd.class);
ResultCallback.Adapter<Frame> neverCompletes = mock(ResultCallback.Adapter.class);
when(startCmd.exec(any())).thenReturn(neverCompletes);
when(streamingDockerClient.execStartCmd("exec-1")).thenReturn(startCmd);
CodeBuildRunner runner = new CodeBuildRunner(dockerClient, streamingDockerClient, null, null, null, null, null,
null, null, null, null, null, null, null);
CodeBuildRunner.PhaseResult result = runner.runPhase("container-1", "/src", List.of(),
List.of("./build.sh"), 0, new AtomicBoolean(false));
assertEquals("Phase timed out after 0 minutes", result.errorMessage());
verify(neverCompletes).close();
}
@Test
void failureMessageIgnoresLongTrailingWhitespace() {
DockerClient dockerClient = dockerClientStreaming(new byte[0], 0, "tests failed" + "\n".repeat(10_000), 1L);
CodeBuildRunner runner = new CodeBuildRunner(dockerClient, null, null, null, null, null, null, null, null, null, null,
null, null);
DockerClient dockerClient = mock(DockerClient.class);
DockerClient streamingDockerClient = mock(DockerClient.class);
stubPhase(dockerClient, streamingDockerClient, new byte[0], 0, "tests failed" + "\n".repeat(10_000), 1L);
CodeBuildRunner runner = new CodeBuildRunner(dockerClient, streamingDockerClient, null, null, null, null, null,
null, null, null, null, null, null, null);
CodeBuildRunner.PhaseResult result = runner.runPhase("container-1", "/src", List.of(),
List.of("./test.sh"), 60, new AtomicBoolean(false));
@@ -67,14 +98,18 @@ class CodeBuildRunnerTest {
when(config.port()).thenReturn(4566);
ContainerDetector containerDetector = mock(ContainerDetector.class);
ContainerReachableEndpoint endpoint = new ContainerReachableEndpoint(config, null, null, null, 4811);
CodeBuildRunner runner = new CodeBuildRunner(null, null, null, null, null, null, null,
CodeBuildRunner runner = new CodeBuildRunner(null, null, null, null, null, null, null, null,
config, containerDetector, null, endpoint, null, null);
assertEquals("http://host.docker.internal:4811", runner.resolveEndpointUrl());
}
private static DockerClient dockerClientStreaming(byte[] chunk, int chunkCount, String lastLine, long exitCode) {
DockerClient dockerClient = mock(DockerClient.class);
/**
* The exec is created and inspected on the control-plane client and its output streamed on the
* streaming client, so a phase whose output took a control-plane lease would find no stub.
*/
private static void stubPhase(DockerClient dockerClient, DockerClient streamingDockerClient, byte[] chunk,
int chunkCount, String lastLine, long exitCode) {
ExecCreateCmd createCmd = mock(ExecCreateCmd.class, RETURNS_SELF);
ExecCreateCmdResponse createResponse = mock(ExecCreateCmdResponse.class);
@@ -92,13 +127,12 @@ class CodeBuildRunnerTest {
callback.onComplete();
return callback;
});
when(dockerClient.execStartCmd("exec-1")).thenReturn(startCmd);
when(streamingDockerClient.execStartCmd("exec-1")).thenReturn(startCmd);
InspectExecCmd inspectCmd = mock(InspectExecCmd.class);
InspectExecResponse inspectResponse = mock(InspectExecResponse.class);
when(inspectResponse.getExitCodeLong()).thenReturn(exitCode);
when(inspectCmd.exec()).thenReturn(inspectResponse);
when(dockerClient.inspectExecCmd("exec-1")).thenReturn(inspectCmd);
return dockerClient;
}
}
@@ -33,7 +33,7 @@ class CodeBuildSourceCopyTest {
uploads.consumedBytes = 8;
uploads.failure = new RuntimeException(new IOException("Broken pipe"));
new CodeBuildRunner(docker, null, null, null, null, null, null, null, null, null, null, null, null)
new CodeBuildRunner(docker, docker, null, null, null, null, null, null, null, null, null, null, null, null)
.copySourceToContainer("build-container", workspace, "/codebuild/output/src/src", 0);
assertEquals(2, uploads.commands.size());
@@ -58,7 +58,8 @@ class CodeBuildSourceCopyTest {
uploads.failure = new RuntimeException(new IOException("Broken pipe"));
RuntimeException failure = assertThrows(RuntimeException.class, () ->
new CodeBuildRunner(docker, null, null, null, null, null, null, null, null, null, null, null, null)
new CodeBuildRunner(docker, docker, null, null, null, null, null, null, null, null, null, null, null,
null)
.copySourceToContainer("build-container", workspace, "/codebuild/output/src/src", 0));
assertEquals(6, uploads.commands.size());
@@ -74,7 +75,8 @@ class CodeBuildSourceCopyTest {
uploads.failure = new IllegalStateException("No such container");
RuntimeException failure = assertThrows(RuntimeException.class, () ->
new CodeBuildRunner(docker, null, null, null, null, null, null, null, null, null, null, null, null)
new CodeBuildRunner(docker, docker, null, null, null, null, null, null, null, null, null, null, null,
null)
.copySourceToContainer("build-container", workspace, "/codebuild/output/src/src", 0));
assertTrue(failure.getMessage().contains("No such container"));
@@ -85,7 +87,7 @@ class CodeBuildSourceCopyTest {
void skipsEmptyWorkspace(@TempDir Path workspace) {
DockerClient docker = mock(DockerClient.class);
new CodeBuildRunner(docker, null, null, null, null, null, null, null, null, null, null, null, null)
new CodeBuildRunner(docker, docker, null, null, null, null, null, null, null, null, null, null, null, null)
.copySourceToContainer("build-container", workspace, "/codebuild/output/src/src");
verifyNoInteractions(docker);
@@ -51,6 +51,7 @@ import org.junit.jupiter.api.io.TempDir;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.mockito.ArgumentCaptor;
import org.mockito.stubbing.Answer;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
@@ -1662,6 +1663,9 @@ class Ec2ContainerManagerTest {
verify(harness.logStreamer, timeout(2000)).streamToCloudWatchLogs(
any(String.class), any(String.class), eq("us-west-2"), eq(TEST_USER_DATA_OUTPUT)
);
// The script's output holds its connection for as long as it runs, so it uses the streaming pool.
verify(harness.streamingDockerClient).execStartCmd("userdata-exec");
verify(harness.dockerClient, never()).execStartCmd("userdata-exec");
}
@Test
@@ -2602,6 +2606,8 @@ class Ec2ContainerManagerTest {
DockerClient dockerClient = mock(DockerClient.class);
stubDockerPing(dockerClient, true);
DockerClient streamingDockerClient = mock(DockerClient.class);
when(lifecycleManager.getStreamingDockerClient()).thenReturn(streamingDockerClient);
Ec2MetadataServer metadataServer = mock(Ec2MetadataServer.class);
ContainerLogStreamer logStreamer = mock(ContainerLogStreamer.class);
Ec2PortForwardManager portForwardManager = mock(Ec2PortForwardManager.class);
@@ -2641,8 +2647,9 @@ class Ec2ContainerManagerTest {
reachableEndpoint,
executor,
userDataTimeout);
return new LaunchHarness(manager, lifecycleManager, dockerClient, metadataServer, logStreamer, builder,
portAllocator, portForwardManager, config, vpcNetworkManager, new CopyOnWriteArrayList<>());
return new LaunchHarness(manager, lifecycleManager, dockerClient, streamingDockerClient, metadataServer,
logStreamer, builder, portAllocator, portForwardManager, config, vpcNetworkManager,
new CopyOnWriteArrayList<>());
}
// ── startup reconciliation of EC2 containers orphaned by a previous run ──────
@@ -2836,7 +2843,7 @@ class Ec2ContainerManagerTest {
? userDataExec : metadataExec;
});
when(harness.dockerClient().execStartCmd(anyString())).thenAnswer(invocation -> {
Answer<ExecStartCmd> start = invocation -> {
String execId = invocation.getArgument(0);
ExecStartCmd execStart = mock(ExecStartCmd.class);
when(execStart.exec(any())).thenAnswer(startInvocation -> {
@@ -2851,7 +2858,9 @@ class Ec2ContainerManagerTest {
return callback;
});
return execStart;
});
};
when(harness.dockerClient().execStartCmd(anyString())).thenAnswer(start);
when(harness.streamingDockerClient().execStartCmd(anyString())).thenAnswer(start);
InspectExecCmd inspectExec = mock(InspectExecCmd.class);
InspectExecResponse inspectExecResponse = mock(InspectExecResponse.class);
@@ -3180,6 +3189,7 @@ class Ec2ContainerManagerTest {
private record LaunchHarness(Ec2ContainerManager manager,
ContainerLifecycleManager lifecycleManager,
DockerClient dockerClient,
DockerClient streamingDockerClient,
Ec2MetadataServer metadataServer,
ContainerLogStreamer logStreamer,
ContainerBuilder.Builder builder,
@@ -3214,7 +3224,8 @@ class Ec2ContainerManagerTest {
return metadataExec;
});
when(dockerClient.execStartCmd(anyString())).thenAnswer(invocation -> {
// Startable on either client, so a test can verify which pool each exec's output used.
Answer<ExecStartCmd> start = invocation -> {
String execId = invocation.getArgument(0);
ExecStartCmd execStart = mock(ExecStartCmd.class);
when(execStart.exec(any())).thenAnswer(startInvocation -> {
@@ -3231,7 +3242,9 @@ class Ec2ContainerManagerTest {
return callback;
});
return execStart;
});
};
when(dockerClient.execStartCmd(anyString())).thenAnswer(start);
when(streamingDockerClient.execStartCmd(anyString())).thenAnswer(start);
InspectExecCmd inspectExec = mock(InspectExecCmd.class);
InspectExecResponse inspectExecResponse = mock(InspectExecResponse.class);
@@ -1040,7 +1040,10 @@ class EcrRegistryManagerTest {
when(execCreateCmd.exec()).thenReturn(execResponse);
when(execResponse.getId()).thenReturn("gc-exec-1");
ExecStartCmd execStartCmd = Mockito.mock(ExecStartCmd.class, Mockito.RETURNS_SELF);
when(dockerClient.execStartCmd("gc-exec-1")).thenReturn(execStartCmd);
// The collection's output holds its connection for minutes, so it streams on the streaming client.
DockerClient streamingDockerClient = Mockito.mock(DockerClient.class);
when(lifecycleManager.getStreamingDockerClient()).thenReturn(streamingDockerClient);
when(streamingDockerClient.execStartCmd("gc-exec-1")).thenReturn(execStartCmd);
ResultCallback.Adapter<Frame> execCallback = Mockito.mock(ResultCallback.Adapter.class);
when(execStartCmd.exec(any())).thenReturn(execCallback);
when(execCallback.awaitCompletion(anyLong(), any())).thenReturn(false);
@@ -71,10 +71,13 @@ class EcsExecChannelHandlerTest {
}
return attach;
});
when(docker.execStartCmd("exec-1")).thenReturn(startCmd);
// The session's stream holds its connection for as long as the session, so it uses the streaming client.
DockerClient streamingDocker = mock(DockerClient.class);
when(streamingDocker.execStartCmd("exec-1")).thenReturn(startCmd);
ContainerLifecycleManager lifecycleManager = mock(ContainerLifecycleManager.class);
when(lifecycleManager.getDockerClient()).thenReturn(docker);
when(lifecycleManager.getStreamingDockerClient()).thenReturn(streamingDocker);
Router router = Router.router(vertx);
new EcsExecChannelHandler(sessions, lifecycleManager, new ObjectMapper(), vertx).init(router);
@@ -11,6 +11,7 @@ import io.floci.aws.config.EmulatorConfig;
import io.floci.aws.core.common.RegionResolver;
import io.floci.aws.core.common.docker.ContainerBuilder;
import io.floci.aws.core.common.docker.ContainerDetector;
import io.floci.aws.core.common.docker.ContainerExecStubs;
import io.floci.aws.core.common.docker.ContainerLifecycleManager;
import io.floci.aws.core.common.docker.ContainerLifecycleManager.ContainerInfo;
import io.floci.aws.core.common.docker.ContainerLogStreamer;
@@ -232,6 +233,25 @@ class EksClusterGuestSetupTest {
assertEquals(new EksClusterManager.SetUpNode(CONTAINER_ID, null), waiting.get(10, TimeUnit.SECONDS));
}
// Catches: a node group's user data script, which may run for minutes, holding a control-plane
// connection for as long as it runs instead of a streaming one.
@Test
void userDataOutputStreamsOnTheStreamingClient() {
DockerClient streaming = Mockito.mock(DockerClient.class);
when(lifecycleManager.getStreamingDockerClient()).thenReturn(streaming);
ContainerExecStubs.completeEveryExec(dockerClient, streaming, CONTAINER_ID, 0, "joined\n", "");
Cluster cluster = cluster();
manager.startCluster(cluster);
manager.setUpGuest(cluster);
UserDataPipeline.ExecutionResult result =
manager.executeUserData(cluster, "workers", "#!/bin/bash\necho joined\n");
assertTrue(result.isSuccess(), result.getFailureMessage());
verify(streaming).execStartCmd("exec-" + CONTAINER_ID);
verify(dockerClient, never()).execStartCmd("exec-" + CONTAINER_ID);
}
@Test
void userDataFollowsANodeReplacedWhileItWaits() throws Exception {
Cluster cluster = cluster();
@@ -323,7 +343,10 @@ class EksClusterGuestSetupTest {
when(docker.execCreateCmd(anyString())).thenReturn(execCreateCmd);
when(execCreateCmd.exec()).thenReturn(execCreate);
ExecStartCmd execStartCmd = Mockito.mock(ExecStartCmd.class, Mockito.RETURNS_SELF);
when(docker.execStartCmd("exec-123")).thenReturn(execStartCmd);
// The audit follower runs tail -F for the cluster's lifetime, so it streams on the streaming client.
DockerClient streamingDocker = Mockito.mock(DockerClient.class);
when(lifecycleManager.getStreamingDockerClient()).thenReturn(streamingDocker);
when(streamingDocker.execStartCmd("exec-123")).thenReturn(execStartCmd);
ResultCallback.Adapter<?> auditFollower = Mockito.mock(ResultCallback.Adapter.class);
Mockito.doReturn(auditFollower).when(execStartCmd).exec(any());
RegionResolver regionResolver = Mockito.mock(RegionResolver.class);
@@ -4573,7 +4573,10 @@ class EksClusterManagerTest {
when(execCreateCmd.exec()).thenReturn(execCreate);
ExecStartCmd execStartCmd = Mockito.mock(ExecStartCmd.class, Mockito.RETURNS_SELF);
when(dockerClient.execStartCmd("exec-123")).thenReturn(execStartCmd);
// The audit follower runs tail -F for the cluster's lifetime, so it streams on the streaming client.
DockerClient streamingDockerClient = Mockito.mock(DockerClient.class);
when(lifecycleManager.getStreamingDockerClient()).thenReturn(streamingDockerClient);
when(streamingDockerClient.execStartCmd("exec-123")).thenReturn(execStartCmd);
ResultCallback.Adapter<?> mockAuditHandle = Mockito.mock(ResultCallback.Adapter.class);
Mockito.doReturn(mockAuditHandle).when(execStartCmd).exec(any());
@@ -83,6 +83,7 @@ class EmrBootstrapRunnerTest {
void setUp() {
when(builder.newContainer(anyString())).thenReturn(spec);
when(lifecycle.getDockerClient()).thenReturn(docker);
when(lifecycle.getStreamingDockerClient()).thenReturn(docker);
when(lifecycle.createAndStart(any()))
.thenReturn(new ContainerLifecycleManager.ContainerInfo(CONTAINER, Map.of()));
when(roleCredentials.forRole(any(), any(), any())).thenReturn(Optional.empty());
@@ -104,6 +105,20 @@ class EmrBootstrapRunnerTest {
});
}
// Catches: a bootstrap action, a user's script with no timeout, holding a control-plane connection for
// as long as it runs instead of a streaming one.
@Test
void eachActionsOutputStreamsOnTheStreamingClient() {
DockerClient streaming = mock(DockerClient.class);
when(lifecycle.getStreamingDockerClient()).thenReturn(streaming);
ContainerExecStubs.completeEveryExec(docker, streaming, CONTAINER, 0, "installed\n", "");
runner.run(bootstrap(null, action("s3://bucket/bootstrap/install.sh"),
action("s3n://bucket/bootstrap/jars.sh")), () -> false);
verify(streaming, times(2)).execStartCmd(anyString());
}
@Test
void eachActionRunsInTurnAsRootThenTheContainerIsKeptAsTheImageTheStepsRunIn() {
List<List<String>> commands = ContainerExecStubs.completeEveryExec(docker, CONTAINER, 0, "installed\n", "");
@@ -99,7 +99,7 @@ class RdsBackendEndpointRefreshIntegrationTest {
ContainerDetector detector = mock(ContainerDetector.class);
when(detector.isRunningInContainer()).thenReturn(true);
lifecycleManager = new ContainerLifecycleManager(
dockerClient, mock(ImageCacheService.class), detector, mock(EmulatorConfig.class));
dockerClient, dockerClient, mock(ImageCacheService.class), detector, mock(EmulatorConfig.class));
}
@AfterAll
@@ -39,6 +39,9 @@ class SsmDirectCommandExecutorTest {
@Test
void executesRunShellScriptInsideEc2Container() throws Exception {
DockerClient dockerClient = mock(DockerClient.class);
// The command's output holds its connection for as long as the command runs, so it streams on
// the streaming client while the exec is created and inspected on the control-plane one.
DockerClient streamingDockerClient = mock(DockerClient.class);
Ec2Service ec2Service = mock(Ec2Service.class);
Instance instance = instance("i-container", "container-1");
when(ec2Service.findInstanceById("i-container")).thenReturn(instance);
@@ -61,7 +64,7 @@ class SsmDirectCommandExecutorTest {
resultCallback.onComplete();
return resultCallback;
});
when(dockerClient.execStartCmd("exec-1")).thenReturn(execStart);
when(streamingDockerClient.execStartCmd("exec-1")).thenReturn(execStart);
InspectExecCmd inspectExec = mock(InspectExecCmd.class);
InspectExecResponse inspectExecResponse = mock(InspectExecResponse.class);
@@ -69,7 +72,8 @@ class SsmDirectCommandExecutorTest {
when(inspectExec.exec()).thenReturn(inspectExecResponse);
when(dockerClient.inspectExecCmd("exec-1")).thenReturn(inspectExec);
SsmDirectCommandExecutor executor = new SsmDirectCommandExecutor(dockerClient, ec2Service);
SsmDirectCommandExecutor executor = new SsmDirectCommandExecutor(dockerClient, streamingDockerClient,
ec2Service);
Optional<SsmDirectCommandExecutor.ExecutionResult> result = executor.executeIfSupported(
"i-container",
"AWS-RunShellScript",
@@ -125,7 +129,7 @@ class SsmDirectCommandExecutorTest {
Ec2Service ec2Service = mock(Ec2Service.class);
when(ec2Service.findInstanceById("i-agent")).thenReturn(null);
SsmDirectCommandExecutor executor = new SsmDirectCommandExecutor(dockerClient, ec2Service);
SsmDirectCommandExecutor executor = new SsmDirectCommandExecutor(dockerClient, dockerClient, ec2Service);
Optional<SsmDirectCommandExecutor.ExecutionResult> result = executor.executeIfSupported(
"i-agent",
"AWS-RunShellScript",
@@ -151,7 +155,7 @@ class SsmDirectCommandExecutorTest {
when(ec2Service.isInstanceContainerRunning("i-running")).thenReturn(true);
when(ec2Service.isInstanceContainerRunning("i-stopped")).thenReturn(false);
SsmDirectCommandExecutor executor = new SsmDirectCommandExecutor(dockerClient, ec2Service);
SsmDirectCommandExecutor executor = new SsmDirectCommandExecutor(dockerClient, dockerClient, ec2Service);
assertTrue(executor.isContainerBacked("i-running"));
assertFalse(executor.isContainerBacked("i-stopped"));
@@ -163,7 +167,7 @@ class SsmDirectCommandExecutorTest {
DockerClient dockerClient = mock(DockerClient.class);
Ec2Service ec2Service = mock(Ec2Service.class);
SsmDirectCommandExecutor executor = new SsmDirectCommandExecutor(dockerClient, ec2Service);
SsmDirectCommandExecutor executor = new SsmDirectCommandExecutor(dockerClient, dockerClient, ec2Service);
Optional<SsmDirectCommandExecutor.ExecutionResult> result = executor.executeIfSupported(
"i-container",
"AWS-RunPowerShellScript",
@@ -181,7 +185,7 @@ class SsmDirectCommandExecutorTest {
when(ec2Service.findInstanceById("i-container")).thenReturn(instance);
when(ec2Service.isInstanceContainerRunning("i-container")).thenReturn(true);
SsmDirectCommandExecutor executor = new SsmDirectCommandExecutor(dockerClient, ec2Service);
SsmDirectCommandExecutor executor = new SsmDirectCommandExecutor(dockerClient, dockerClient, ec2Service);
Optional<SsmDirectCommandExecutor.ExecutionResult> result = executor.executeIfSupported(
"i-container",
"AWS-RunShellScript",
@@ -225,7 +229,7 @@ class SsmDirectCommandExecutorTest {
when(inspectExec.exec()).thenReturn(inspectExecResponse);
when(dockerClient.inspectExecCmd("exec-1")).thenReturn(inspectExec);
SsmDirectCommandExecutor executor = new SsmDirectCommandExecutor(dockerClient, ec2Service);
SsmDirectCommandExecutor executor = new SsmDirectCommandExecutor(dockerClient, dockerClient, ec2Service);
Optional<SsmDirectCommandExecutor.ExecutionResult> result = executor.executeIfSupported(
"i-container",
"AWS-RunShellScript",
@@ -258,7 +262,7 @@ class SsmDirectCommandExecutorTest {
when(execStart.exec(any())).thenReturn(callback);
when(dockerClient.execStartCmd("exec-1")).thenReturn(execStart);
SsmDirectCommandExecutor executor = new SsmDirectCommandExecutor(dockerClient, ec2Service);
SsmDirectCommandExecutor executor = new SsmDirectCommandExecutor(dockerClient, dockerClient, ec2Service);
Optional<SsmDirectCommandExecutor.ExecutionResult> result = executor.executeIfSupported(
"i-container",
"AWS-RunShellScript",
@@ -302,7 +306,7 @@ class SsmDirectCommandExecutorTest {
when(inspectExec.exec()).thenReturn(inspectExecResponse);
when(dockerClient.inspectExecCmd("exec-1")).thenReturn(inspectExec);
SsmDirectCommandExecutor executor = new SsmDirectCommandExecutor(dockerClient, ec2Service);
SsmDirectCommandExecutor executor = new SsmDirectCommandExecutor(dockerClient, dockerClient, ec2Service);
Optional<SsmDirectCommandExecutor.ExecutionResult> result = executor.executeIfSupported(
"i-container",
"AWS-RunShellScript",
@@ -349,7 +353,7 @@ class SsmDirectCommandExecutorTest {
when(inspectExec.exec()).thenReturn(inspectExecResponse);
when(dockerClient.inspectExecCmd("exec-1")).thenReturn(inspectExec);
SsmDirectCommandExecutor executor = new SsmDirectCommandExecutor(dockerClient, ec2Service);
SsmDirectCommandExecutor executor = new SsmDirectCommandExecutor(dockerClient, dockerClient, ec2Service);
Optional<SsmDirectCommandExecutor.ExecutionResult> result = executor.executeIfSupported(
"i-container",
"AWS-RunShellScript",
@@ -395,7 +399,7 @@ class SsmDirectCommandExecutorTest {
when(inspectExec.exec()).thenReturn(inspectExecResponse);
when(dockerClient.inspectExecCmd("exec-1")).thenReturn(inspectExec);
SsmDirectCommandExecutor executor = new SsmDirectCommandExecutor(dockerClient, ec2Service);
SsmDirectCommandExecutor executor = new SsmDirectCommandExecutor(dockerClient, dockerClient, ec2Service);
Optional<SsmDirectCommandExecutor.ExecutionResult> result = executor.executeIfSupported(
"i-container",
"AWS-RunShellScript",
@@ -415,7 +419,7 @@ class SsmDirectCommandExecutorTest {
when(ec2Service.findInstanceById("111122223333", "i-container")).thenReturn(instance);
when(ec2Service.isInstanceContainerRunning("111122223333", "i-container")).thenReturn(true);
SsmDirectCommandExecutor executor = new SsmDirectCommandExecutor(dockerClient, ec2Service);
SsmDirectCommandExecutor executor = new SsmDirectCommandExecutor(dockerClient, dockerClient, ec2Service);
assertTrue(executor.supports("111122223333", "i-container", "AWS-RunShellScript"));
assertFalse(executor.supports("444455556666", "i-container", "AWS-RunShellScript"));
}
@@ -140,7 +140,7 @@ class SsmTimeoutDockerIntegrationTest {
instance.setDockerContainerId(container.containerId());
when(ec2.findInstanceById("i-timeout")).thenReturn(instance);
when(ec2.isInstanceContainerRunning("i-timeout")).thenReturn(true);
SsmDirectCommandExecutor executor = new SsmDirectCommandExecutor(docker, ec2);
SsmDirectCommandExecutor executor = new SsmDirectCommandExecutor(docker, docker, ec2);
if (!descendantsOnly) {
for (int code : List.of(124, 137, 143)) {
SsmDirectCommandExecutor.ExecutionResult result = executor.executeIfSupported("i-timeout",
@@ -49,7 +49,7 @@ class SsmTimeoutSdkIntegrationTest extends SsmCommandIntegrationFixture {
instance.setDockerContainerId(container.containerId());
when(ec2.findInstanceById(account, instanceId)).thenReturn(instance);
when(ec2.isInstanceContainerRunning(account, instanceId)).thenReturn(true);
SsmDirectCommandExecutor actual = new SsmDirectCommandExecutor(docker, ec2);
SsmDirectCommandExecutor actual = new SsmDirectCommandExecutor(docker, docker, ec2);
when(executor.supports(account, instanceId, "AWS-RunShellScript")).thenReturn(true);
when(executor.executeIfSupported(eq(account), eq(instanceId), eq("AWS-RunShellScript"), any(), anyInt()))
.thenAnswer(call -> actual.executeIfSupported(call.getArgument(0), call.getArgument(1),