mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
feat(ecs): inject the AWS SDK baseline env into launched task containers (#1697)
* test(stepfunctions): pass ecs:runTask ctor args in AslExecutorPathIntrinsicsTest Same one-line fix as #1696: AslExecutor gained EcsService/EcsJsonHandler ctor params in #1564 but this test (from #1558) was not updated, breaking test compilation on main. Included here so this PR's CI is green independently of #1696; resolves cleanly once #1696 merges (identical change). * feat(ecs): inject the AWS SDK baseline env into launched task containers Launched ECS task containers previously received only their task-definition and override environment. An AWS SDK running inside such a container therefore had no AWS_ENDPOINT_URL (so it targeted real AWS instead of the emulator), no region, and an empty credential-provider chain. Lambda containers already avoid this because ContainerLauncher injects those variables. Extract that baseline into a shared LaunchedContainerAwsEnv helper and apply it to ECS tasks too: - LaunchedContainerAwsEnv (core/common/docker): builds the KEY=value baseline — AWS_DEFAULT_REGION/AWS_REGION, credentials (a mounted ~/.aws dir when configured, otherwise placeholder credentials from Floci's own env falling back to test/test/test), and FLOCI_HOSTNAME/FLOCI_ENDPOINT/AWS_ENDPOINT_URL from ContainerReachableEndpoint. - ContainerLauncher (Lambda): replace the inline region/credentials/endpoint block with the shared helper. The resulting environment is byte-for-byte identical to before; only the source of the entries moved. - EcsContainerManager (ECS): prepend the baseline to each task container's environment as overridable defaults (task-def and RunTask containerOverride values still win on key conflict), and enable withHostDockerInternalOnLinux() + withEmbeddedDns() so the endpoint hostname resolves to Floci from inside the task container, the same way Lambda containers do. Credentials are injected as env placeholders (as ContainerLauncher already does for Lambda), not via the real ECS task-role container-credentials metadata endpoint; emulating that endpoint would be a reasonable follow-up. Adds LaunchedContainerAwsEnvTest and EcsContainerManagerAwsBaselineTest, and updates the existing launcher/manager constructor call-sites. * refactor(ecs): address review feedback on LaunchedContainerAwsEnv - Drop the unused single-argument constructor that stored a null ContainerReachableEndpoint and would NPE on any sdkBaselineEnv call (Greptile P1), along with the vestigial EmulatorConfig field/param it carried — the helper only needs ContainerReachableEndpoint. - Remove the now-dead null guard in EcsContainerManager.buildEnvVars (the real sdkBaselineEnv never returns null) and instead stub the mocked helper with List.of() in the ECS unit tests, making the contract explicit (Greptile P2). * docs: regenerate action tables
This commit is contained in:
1 parent
54b378ed6c
commit
291752c36e
10 files changed
+363
-37
No files matched your search
+95
@@ -0,0 +1,95 @@
|
||||
package io.github.hectorvent.floci.core.common.docker;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link LaunchedContainerAwsEnv#sdkBaselineEnv}: the AWS SDK baseline
|
||||
* (region, credentials and the Floci endpoint) injected into every container Floci launches.
|
||||
* The Floci endpoint is stubbed via {@link ContainerReachableEndpoint} so the test does not
|
||||
* depend on host networking.
|
||||
*/
|
||||
class LaunchedContainerAwsEnvTest {
|
||||
|
||||
private LaunchedContainerAwsEnv awsEnvWithEndpoint(String baseUrl) {
|
||||
ContainerReachableEndpoint endpoint = mock(ContainerReachableEndpoint.class);
|
||||
when(endpoint.baseUrl()).thenReturn(baseUrl);
|
||||
return new LaunchedContainerAwsEnv(endpoint);
|
||||
}
|
||||
|
||||
@Test
|
||||
void injectsRegionEndpointAndPlaceholderCredentialsWhenNoConfigDir() {
|
||||
LaunchedContainerAwsEnv awsEnv = awsEnvWithEndpoint("http://localhost:4566");
|
||||
|
||||
List<String> env = awsEnv.sdkBaselineEnv("us-east-1", Optional.empty());
|
||||
|
||||
assertTrue(env.contains("AWS_DEFAULT_REGION=us-east-1"));
|
||||
assertTrue(env.contains("AWS_REGION=us-east-1"));
|
||||
|
||||
// Floci endpoint the SDK should target, reachable from inside the container.
|
||||
assertTrue(env.contains("FLOCI_HOSTNAME=localhost"));
|
||||
assertTrue(env.contains("FLOCI_ENDPOINT=http://localhost:4566"));
|
||||
assertTrue(env.contains("AWS_ENDPOINT_URL=http://localhost:4566"));
|
||||
|
||||
// Placeholder credentials: the host env var when set, otherwise "test".
|
||||
String expectedAk = System.getenv("AWS_ACCESS_KEY_ID") != null ? System.getenv("AWS_ACCESS_KEY_ID") : "test";
|
||||
String expectedSk = System.getenv("AWS_SECRET_ACCESS_KEY") != null ? System.getenv("AWS_SECRET_ACCESS_KEY") : "test";
|
||||
String expectedSt = System.getenv("AWS_SESSION_TOKEN") != null ? System.getenv("AWS_SESSION_TOKEN") : "test";
|
||||
assertTrue(env.contains("AWS_ACCESS_KEY_ID=" + expectedAk));
|
||||
assertTrue(env.contains("AWS_SECRET_ACCESS_KEY=" + expectedSk));
|
||||
assertTrue(env.contains("AWS_SESSION_TOKEN=" + expectedSt));
|
||||
|
||||
// No mounted-config file paths when credentials are injected directly.
|
||||
assertTrue(env.stream().noneMatch(e -> e.startsWith("AWS_SHARED_CREDENTIALS_FILE=")));
|
||||
assertTrue(env.stream().noneMatch(e -> e.startsWith("AWS_CONFIG_FILE=")));
|
||||
}
|
||||
|
||||
@Test
|
||||
void pointsSdkAtMountedConfigDirAndSkipsPlaceholderCredentials() {
|
||||
LaunchedContainerAwsEnv awsEnv = awsEnvWithEndpoint("http://localhost:4566");
|
||||
|
||||
List<String> env = awsEnv.sdkBaselineEnv("eu-west-1", Optional.of("/opt/aws-config"));
|
||||
|
||||
assertTrue(env.contains("AWS_DEFAULT_REGION=eu-west-1"));
|
||||
assertTrue(env.contains("AWS_REGION=eu-west-1"));
|
||||
|
||||
// A mounted ~/.aws directory: point the SDK at explicit file paths, discover credentials there.
|
||||
assertTrue(env.contains("AWS_SHARED_CREDENTIALS_FILE=/opt/aws-config/credentials"));
|
||||
assertTrue(env.contains("AWS_CONFIG_FILE=/opt/aws-config/config"));
|
||||
|
||||
// Credentials must not be injected when the SDK discovers them from the mounted directory.
|
||||
assertTrue(env.stream().noneMatch(e -> e.startsWith("AWS_ACCESS_KEY_ID=")));
|
||||
assertTrue(env.stream().noneMatch(e -> e.startsWith("AWS_SECRET_ACCESS_KEY=")));
|
||||
assertTrue(env.stream().noneMatch(e -> e.startsWith("AWS_SESSION_TOKEN=")));
|
||||
|
||||
assertTrue(env.contains("AWS_ENDPOINT_URL=http://localhost:4566"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void blankConfigDirFallsBackToPlaceholderCredentials() {
|
||||
LaunchedContainerAwsEnv awsEnv = awsEnvWithEndpoint("http://localhost:4566");
|
||||
|
||||
List<String> env = awsEnv.sdkBaselineEnv("us-east-1", Optional.of(" "));
|
||||
|
||||
// A blank directory is treated as "not mounted": inject placeholder credentials instead.
|
||||
assertTrue(env.stream().anyMatch(e -> e.startsWith("AWS_ACCESS_KEY_ID=")));
|
||||
assertTrue(env.stream().noneMatch(e -> e.startsWith("AWS_SHARED_CREDENTIALS_FILE=")));
|
||||
}
|
||||
|
||||
@Test
|
||||
void derivesFlociHostnameFromEndpointHost() {
|
||||
LaunchedContainerAwsEnv awsEnv = awsEnvWithEndpoint("https://host.docker.internal:4566");
|
||||
|
||||
List<String> env = awsEnv.sdkBaselineEnv("us-east-1", Optional.empty());
|
||||
|
||||
assertEquals(1, env.stream().filter(e -> e.equals("FLOCI_HOSTNAME=host.docker.internal")).count());
|
||||
assertTrue(env.contains("AWS_ENDPOINT_URL=https://host.docker.internal:4566"));
|
||||
}
|
||||
}
|
||||
+151
@@ -0,0 +1,151 @@
|
||||
package io.github.hectorvent.floci.services.ecs.container;
|
||||
|
||||
import io.github.hectorvent.floci.config.EmulatorConfig;
|
||||
import io.github.hectorvent.floci.core.common.RegionResolver;
|
||||
import io.github.hectorvent.floci.core.common.docker.ContainerBuilder;
|
||||
import io.github.hectorvent.floci.core.common.docker.ContainerDetector;
|
||||
import io.github.hectorvent.floci.core.common.docker.ContainerLifecycleManager;
|
||||
import io.github.hectorvent.floci.core.common.docker.ContainerLifecycleManager.ContainerInfo;
|
||||
import io.github.hectorvent.floci.core.common.docker.ContainerLogStreamer;
|
||||
import io.github.hectorvent.floci.core.common.docker.LaunchedContainerAwsEnv;
|
||||
import io.github.hectorvent.floci.services.ecs.model.ContainerDefinition;
|
||||
import io.github.hectorvent.floci.services.ecs.model.ContainerOverride;
|
||||
import io.github.hectorvent.floci.services.ecs.model.EcsTask;
|
||||
import io.github.hectorvent.floci.services.ecs.model.KeyValuePair;
|
||||
import io.github.hectorvent.floci.services.ecs.model.TaskDefinition;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Unit tests for the AWS SDK baseline environment injected into ECS task containers by
|
||||
* {@link EcsContainerManager#startTask}. The baseline (region, credentials and the Floci
|
||||
* endpoint) is added as an <em>overridable default</em>: it is present unless the task
|
||||
* definition or a RunTask {@code containerOverride} sets the same key, in which case the
|
||||
* explicit value wins so a task's own configuration is never clobbered.
|
||||
*
|
||||
* <p>The container builder, lifecycle manager and {@link LaunchedContainerAwsEnv} are mocked,
|
||||
* so the test asserts the env that <em>would</em> be handed to Docker without launching a
|
||||
* container — runnable under {@code mvn test} (CI) with no Docker daemon.
|
||||
*/
|
||||
class EcsContainerManagerAwsBaselineTest {
|
||||
|
||||
private ContainerBuilder containerBuilder;
|
||||
private ContainerBuilder.Builder builder;
|
||||
private LaunchedContainerAwsEnv awsEnv;
|
||||
private EcsContainerManager manager;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
builder = mock(ContainerBuilder.Builder.class, RETURNS_SELF);
|
||||
containerBuilder = mock(ContainerBuilder.class);
|
||||
when(containerBuilder.newContainer(anyString())).thenReturn(builder);
|
||||
|
||||
ContainerLifecycleManager lifecycleManager = mock(ContainerLifecycleManager.class);
|
||||
when(lifecycleManager.createAndStart(any()))
|
||||
.thenReturn(new ContainerInfo("docker-id", Map.of()));
|
||||
|
||||
ContainerLogStreamer logStreamer = mock(ContainerLogStreamer.class);
|
||||
ContainerDetector containerDetector = mock(ContainerDetector.class);
|
||||
EmulatorConfig config = mock(EmulatorConfig.class, RETURNS_DEEP_STUBS);
|
||||
RegionResolver regionResolver = mock(RegionResolver.class);
|
||||
|
||||
awsEnv = mock(LaunchedContainerAwsEnv.class);
|
||||
when(awsEnv.sdkBaselineEnv(anyString(), any())).thenReturn(List.of(
|
||||
"AWS_DEFAULT_REGION=us-east-1",
|
||||
"AWS_REGION=us-east-1",
|
||||
"AWS_ACCESS_KEY_ID=test",
|
||||
"AWS_ENDPOINT_URL=http://localhost:4566"));
|
||||
|
||||
manager = new EcsContainerManager(containerBuilder, lifecycleManager, logStreamer,
|
||||
containerDetector, config, regionResolver, awsEnv);
|
||||
}
|
||||
|
||||
@Test
|
||||
void injectsAwsBaselineAsOverridableDefaults() {
|
||||
ContainerDefinition app = containerDef("app", "app:latest",
|
||||
// Task def overrides one baseline key (AWS_REGION) and adds its own key.
|
||||
List.of(new KeyValuePair("AWS_REGION", "eu-west-1"),
|
||||
new KeyValuePair("APP_ONLY", "1")));
|
||||
|
||||
TaskDefinition taskDef = new TaskDefinition();
|
||||
taskDef.setFamily("test-family");
|
||||
taskDef.setContainerDefinitions(List.of(app));
|
||||
|
||||
EcsTask task = new EcsTask();
|
||||
task.setTaskArn("arn:aws:ecs:us-east-1:000000000000:task/test-cluster/abc123");
|
||||
|
||||
manager.startTask(task, taskDef, null, "us-east-1");
|
||||
|
||||
// The baseline is resolved for the task's region.
|
||||
verify(awsEnv).sdkBaselineEnv(eq("us-east-1"), any());
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
ArgumentCaptor<List<String>> envCaptor = ArgumentCaptor.forClass(List.class);
|
||||
verify(builder).withEnv(envCaptor.capture());
|
||||
List<String> env = envCaptor.getValue();
|
||||
|
||||
// Baseline entries are injected...
|
||||
assertTrue(env.contains("AWS_ENDPOINT_URL=http://localhost:4566"),
|
||||
"AWS endpoint baseline should be injected into the task container");
|
||||
assertTrue(env.contains("AWS_ACCESS_KEY_ID=test"),
|
||||
"credential baseline should be injected when not overridden");
|
||||
// ...but the task def wins on a key conflict (baseline is overridable).
|
||||
assertTrue(env.contains("AWS_REGION=eu-west-1"),
|
||||
"task-def value should override the baseline on key conflict");
|
||||
assertFalse(env.contains("AWS_REGION=us-east-1"),
|
||||
"overridden baseline value should not remain");
|
||||
// Task-def-only entries are preserved.
|
||||
assertTrue(env.contains("APP_ONLY=1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void runTaskOverrideWinsOverBaseline() {
|
||||
ContainerDefinition app = containerDef("app", "app:latest", List.of());
|
||||
|
||||
TaskDefinition taskDef = new TaskDefinition();
|
||||
taskDef.setFamily("test-family");
|
||||
taskDef.setContainerDefinitions(List.of(app));
|
||||
|
||||
ContainerOverride override = new ContainerOverride();
|
||||
override.setName("app");
|
||||
override.setEnvironment(List.of(new KeyValuePair("AWS_ENDPOINT_URL", "http://override:9999")));
|
||||
|
||||
EcsTask task = new EcsTask();
|
||||
task.setTaskArn("arn:aws:ecs:us-east-1:000000000000:task/test-cluster/abc123");
|
||||
|
||||
manager.startTask(task, taskDef, List.of(override), "us-east-1");
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
ArgumentCaptor<List<String>> envCaptor = ArgumentCaptor.forClass(List.class);
|
||||
verify(builder).withEnv(envCaptor.capture());
|
||||
List<String> env = envCaptor.getValue();
|
||||
|
||||
assertTrue(env.contains("AWS_ENDPOINT_URL=http://override:9999"),
|
||||
"RunTask containerOverride should win over the baseline");
|
||||
assertFalse(env.contains("AWS_ENDPOINT_URL=http://localhost:4566"),
|
||||
"overridden baseline endpoint should not remain");
|
||||
}
|
||||
|
||||
private static ContainerDefinition containerDef(String name, String image, List<KeyValuePair> env) {
|
||||
ContainerDefinition def = new ContainerDefinition();
|
||||
def.setName(name);
|
||||
def.setImage(image);
|
||||
def.setEnvironment(env);
|
||||
return def;
|
||||
}
|
||||
}
|
||||
+4
-1
@@ -7,6 +7,7 @@ import io.github.hectorvent.floci.core.common.docker.ContainerDetector;
|
||||
import io.github.hectorvent.floci.core.common.docker.ContainerLifecycleManager;
|
||||
import io.github.hectorvent.floci.core.common.docker.ContainerLifecycleManager.ContainerInfo;
|
||||
import io.github.hectorvent.floci.core.common.docker.ContainerLogStreamer;
|
||||
import io.github.hectorvent.floci.core.common.docker.LaunchedContainerAwsEnv;
|
||||
import io.github.hectorvent.floci.services.ecs.model.ContainerDefinition;
|
||||
import io.github.hectorvent.floci.services.ecs.model.ContainerOverride;
|
||||
import io.github.hectorvent.floci.services.ecs.model.EcsTask;
|
||||
@@ -63,9 +64,11 @@ class EcsContainerManagerOverridesTest {
|
||||
ContainerDetector containerDetector = mock(ContainerDetector.class);
|
||||
EmulatorConfig config = mock(EmulatorConfig.class, RETURNS_DEEP_STUBS);
|
||||
RegionResolver regionResolver = mock(RegionResolver.class);
|
||||
LaunchedContainerAwsEnv awsEnv = mock(LaunchedContainerAwsEnv.class);
|
||||
when(awsEnv.sdkBaselineEnv(any(), any())).thenReturn(List.of());
|
||||
|
||||
manager = new EcsContainerManager(containerBuilder, lifecycleManager, logStreamer,
|
||||
containerDetector, config, regionResolver);
|
||||
containerDetector, config, regionResolver, awsEnv);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+4
-1
@@ -8,6 +8,7 @@ import io.github.hectorvent.floci.core.common.docker.ContainerDetector;
|
||||
import io.github.hectorvent.floci.core.common.docker.ContainerLifecycleManager;
|
||||
import io.github.hectorvent.floci.core.common.docker.ContainerLifecycleManager.ContainerInfo;
|
||||
import io.github.hectorvent.floci.core.common.docker.ContainerLogStreamer;
|
||||
import io.github.hectorvent.floci.core.common.docker.LaunchedContainerAwsEnv;
|
||||
import io.github.hectorvent.floci.services.ecs.model.ContainerDefinition;
|
||||
import io.github.hectorvent.floci.services.ecs.model.EcsTask;
|
||||
import io.github.hectorvent.floci.services.ecs.model.PortMapping;
|
||||
@@ -71,9 +72,11 @@ class EcsContainerManagerPortMappingsTest {
|
||||
containerDetector = mock(ContainerDetector.class);
|
||||
EmulatorConfig config = mock(EmulatorConfig.class, RETURNS_DEEP_STUBS);
|
||||
RegionResolver regionResolver = mock(RegionResolver.class);
|
||||
LaunchedContainerAwsEnv awsEnv = mock(LaunchedContainerAwsEnv.class);
|
||||
when(awsEnv.sdkBaselineEnv(any(), any())).thenReturn(List.of());
|
||||
|
||||
manager = new EcsContainerManager(containerBuilder, lifecycleManager, logStreamer,
|
||||
containerDetector, config, regionResolver);
|
||||
containerDetector, config, regionResolver, awsEnv);
|
||||
}
|
||||
|
||||
private void startWith(List<PortMapping> portMappings) {
|
||||
|
||||
+4
-1
@@ -7,6 +7,7 @@ import io.github.hectorvent.floci.core.common.docker.ContainerDetector;
|
||||
import io.github.hectorvent.floci.core.common.docker.ContainerLifecycleManager;
|
||||
import io.github.hectorvent.floci.core.common.docker.ContainerLifecycleManager.ContainerInfo;
|
||||
import io.github.hectorvent.floci.core.common.docker.ContainerLogStreamer;
|
||||
import io.github.hectorvent.floci.core.common.docker.LaunchedContainerAwsEnv;
|
||||
import io.github.hectorvent.floci.services.ecs.model.ContainerDefinition;
|
||||
import io.github.hectorvent.floci.services.ecs.model.EcsTask;
|
||||
import io.github.hectorvent.floci.services.ecs.model.EfsVolumeConfiguration;
|
||||
@@ -65,9 +66,11 @@ class EcsContainerManagerVolumesTest {
|
||||
ContainerDetector containerDetector = mock(ContainerDetector.class);
|
||||
EmulatorConfig config = mock(EmulatorConfig.class, RETURNS_DEEP_STUBS);
|
||||
RegionResolver regionResolver = mock(RegionResolver.class);
|
||||
LaunchedContainerAwsEnv awsEnv = mock(LaunchedContainerAwsEnv.class);
|
||||
when(awsEnv.sdkBaselineEnv(any(), any())).thenReturn(List.of());
|
||||
|
||||
manager = new EcsContainerManager(containerBuilder, lifecycleManager, logStreamer,
|
||||
containerDetector, config, regionResolver);
|
||||
containerDetector, config, regionResolver, awsEnv);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -9,6 +9,7 @@ import io.github.hectorvent.floci.core.common.docker.ContainerLifecycleManager;
|
||||
import io.github.hectorvent.floci.core.common.docker.ContainerLogStreamer;
|
||||
import io.github.hectorvent.floci.core.common.docker.ContainerSpec;
|
||||
import io.github.hectorvent.floci.core.common.docker.DockerHostResolver;
|
||||
import io.github.hectorvent.floci.core.common.docker.LaunchedContainerAwsEnv;
|
||||
import io.github.hectorvent.floci.core.storage.InMemoryStorage;
|
||||
import io.github.hectorvent.floci.services.ecr.registry.EcrRegistryManager;
|
||||
import io.github.hectorvent.floci.services.lambda.launcher.ContainerLauncher;
|
||||
@@ -247,9 +248,10 @@ class LambdaImageConfigTest {
|
||||
ContainerBuilder containerBuilder = new ContainerBuilder(config, dockerHostResolver, embeddedDnsServer);
|
||||
ContainerReachableEndpoint reachableEndpoint =
|
||||
new ContainerReachableEndpoint(config, dockerHostResolver, embeddedDnsServer);
|
||||
LaunchedContainerAwsEnv awsEnv = new LaunchedContainerAwsEnv(reachableEndpoint);
|
||||
launcher = new ContainerLauncher(containerBuilder, lifecycleManager, logStreamer, imageResolver,
|
||||
runtimeApiServerFactory, dockerHostResolver, config, ecrRegistryManager,
|
||||
mock(io.github.hectorvent.floci.services.lambda.LambdaLayerService.class), reachableEndpoint);
|
||||
mock(io.github.hectorvent.floci.services.lambda.LambdaLayerService.class), awsEnv);
|
||||
|
||||
when(runtimeApiServerFactory.create()).thenReturn(runtimeApiServer);
|
||||
when(runtimeApiServer.getPort()).thenReturn(9000);
|
||||
|
||||
+3
-1
@@ -8,6 +8,7 @@ import io.github.hectorvent.floci.core.common.docker.ContainerLogStreamer;
|
||||
import io.github.hectorvent.floci.core.common.docker.ContainerReachableEndpoint;
|
||||
import io.github.hectorvent.floci.core.common.docker.ContainerSpec;
|
||||
import io.github.hectorvent.floci.core.common.docker.DockerHostResolver;
|
||||
import io.github.hectorvent.floci.core.common.docker.LaunchedContainerAwsEnv;
|
||||
import io.github.hectorvent.floci.services.ecr.registry.EcrRegistryManager;
|
||||
import io.github.hectorvent.floci.services.lambda.model.LambdaFunction;
|
||||
import io.github.hectorvent.floci.services.lambda.runtime.RuntimeApiServer;
|
||||
@@ -86,9 +87,10 @@ class ContainerLauncherTest {
|
||||
ContainerBuilder containerBuilder = new ContainerBuilder(config, dockerHostResolver, embeddedDnsServer);
|
||||
ContainerReachableEndpoint reachableEndpoint =
|
||||
new ContainerReachableEndpoint(config, dockerHostResolver, embeddedDnsServer);
|
||||
LaunchedContainerAwsEnv awsEnv = new LaunchedContainerAwsEnv(reachableEndpoint);
|
||||
launcher = new ContainerLauncher(containerBuilder, lifecycleManager, logStreamer, imageResolver,
|
||||
runtimeApiServerFactory, dockerHostResolver, config, ecrRegistryManager,
|
||||
mock(io.github.hectorvent.floci.services.lambda.LambdaLayerService.class), reachableEndpoint);
|
||||
mock(io.github.hectorvent.floci.services.lambda.LambdaLayerService.class), awsEnv);
|
||||
|
||||
when(runtimeApiServerFactory.create()).thenReturn(runtimeApiServer);
|
||||
when(runtimeApiServer.getPort()).thenReturn(9000);
|
||||
|
||||
Reference in new issue
Block a user