fix(ecs): pass LaunchedContainerAwsEnv to EcsContainerManager in volumes test (#1784)

PR #1697 added a seventh constructor parameter to EcsContainerManager but
branched from a commit predating PR #1686, which added two inline
constructions of the six-parameter form. Neither PR conflicted textually,
so both merged green and left main failing at testCompile.

Hoist the existing LaunchedContainerAwsEnv mock from setUp() into a field
so the two inline call sites can reuse it. Reusing the field also carries
the sdkBaselineEnv stub those tests need, since startTask iterates the
returned list and an unstubbed mock would NPE.
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-07-09 00:46:59 -05:00
1 parent acedc30017
commit ebf5a2e847
1 file changed
+4 -3
@@ -50,6 +50,7 @@ class EcsContainerManagerVolumesTest {
private ContainerBuilder containerBuilder;
private ContainerBuilder.Builder builder;
private ContainerLifecycleManager lifecycleManager;
private LaunchedContainerAwsEnv awsEnv;
private EcsContainerManager manager;
@BeforeEach
@@ -66,7 +67,7 @@ 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);
awsEnv = mock(LaunchedContainerAwsEnv.class);
when(awsEnv.sdkBaselineEnv(any(), any())).thenReturn(List.of());
manager = new EcsContainerManager(containerBuilder, lifecycleManager, logStreamer,
@@ -159,7 +160,7 @@ class EcsContainerManagerVolumesTest {
when(cfg.storage().efs().initImage()).thenReturn("busybox:stable");
EcsContainerManager configured = new EcsContainerManager(containerBuilder, lifecycleManager,
mock(ContainerLogStreamer.class), mock(ContainerDetector.class), cfg,
mock(RegionResolver.class));
mock(RegionResolver.class), awsEnv);
ContainerDefinition app = new ContainerDefinition();
app.setName("app");
@@ -192,7 +193,7 @@ class EcsContainerManagerVolumesTest {
when(cfg.storage().efs().mountGroupAdd()).thenReturn(OptionalInt.of(2000));
EcsContainerManager configured = new EcsContainerManager(containerBuilder, lifecycleManager,
mock(ContainerLogStreamer.class), mock(ContainerDetector.class), cfg,
mock(RegionResolver.class));
mock(RegionResolver.class), awsEnv);
ContainerDefinition app = new ContainerDefinition();
app.setName("app");