Skip to content

Commit 5f39dd8

Browse files
singledigitclaude
andcommitted
fix: update tests for intentional ECS/AgentCore split and multi-container strict error
- test_ecs_and_agentcore_use_same_flow_creator → assertNotEqual since AgentCore now routes to _create_agentcore_flow, not _create_ecs_container_flow - test_ecs_task_definition_falls_back_to_first_without_container_name → now expects DockerBuildFailed for multi-container TaskDef without ContainerName - Add @skipIf(IS_WINDOWS) to TestContainerImageBuild integ test — Linux container builds fail on Windows CI runners Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 9d09336 commit 5f39dd8

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

tests/integration/buildcmd/test_build_cmd_container_image.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
"""Integration test for ECS/AgentCore container image builds"""
22

3-
import os
43
import shutil
54
import tempfile
65
from pathlib import Path
76
from unittest import TestCase
7+
from unittest import skipIf
88

99
import yaml
1010

1111
from samcli.commands.build.build_context import BuildContext
12+
from tests.testing_utils import IS_WINDOWS
1213

1314

15+
@skipIf(IS_WINDOWS, "Linux container image builds are not supported on Windows CI runners")
1416
class TestContainerImageBuild(TestCase):
1517
"""Test that samdev build correctly handles ECS and AgentCore container resources."""
1618

tests/unit/lib/build_module/test_container_build_integration.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from copy import deepcopy
66

77
from samcli.lib.build.app_builder import ApplicationBuilder
8+
from samcli.lib.build.exceptions import DockerBuildFailed
89
from samcli.lib.build.build_graph import ContainerBuildDefinition
910
from samcli.lib.package.packageable_resources import (
1011
AgentCoreRuntimeImageResource,
@@ -87,16 +88,15 @@ def test_ecs_task_definition_targets_container_by_name(self):
8788
self.assertEqual(properties["ContainerDefinitions"][0]["Image"], "sidecar:latest") # unchanged
8889
self.assertEqual(properties["ContainerDefinitions"][1]["Image"], "myimage:latest") # updated
8990

90-
def test_ecs_task_definition_falls_back_to_first_without_container_name(self):
91+
def test_ecs_task_definition_raises_when_multi_container_without_container_name(self):
9192
properties = {
9293
"ContainerDefinitions": [
9394
{"Name": "web", "Image": "placeholder"},
9495
{"Name": "sidecar", "Image": "sidecar:latest"},
9596
]
9697
}
97-
ApplicationBuilder._update_built_resource("myimage:latest", properties, AWS_ECS_TASK_DEFINITION, "/path")
98-
self.assertEqual(properties["ContainerDefinitions"][0]["Image"], "myimage:latest")
99-
self.assertEqual(properties["ContainerDefinitions"][1]["Image"], "sidecar:latest")
98+
with self.assertRaises(DockerBuildFailed):
99+
ApplicationBuilder._update_built_resource("myimage:latest", properties, AWS_ECS_TASK_DEFINITION, "/path")
100100

101101
def test_agentcore_updates_nested_container_uri(self):
102102
properties = {"AgentRuntimeArtifact": {"ContainerConfiguration": {"ContainerUri": "placeholder"}}}
@@ -151,8 +151,10 @@ def test_ecs_task_definition_registered(self):
151151
def test_agentcore_registered(self):
152152
self.assertIn(AWS_BEDROCK_AGENTCORE_RUNTIME, SyncFlowFactory.GENERATOR_MAPPING)
153153

154-
def test_ecs_and_agentcore_use_same_flow_creator(self):
155-
self.assertEqual(
154+
def test_ecs_and_agentcore_use_different_flow_creators(self):
155+
# ECS uses _create_ecs_container_flow; AgentCore uses _create_agentcore_flow
156+
# (AgentCore sync is not yet implemented — it logs a warning and returns None)
157+
self.assertNotEqual(
156158
SyncFlowFactory.GENERATOR_MAPPING[AWS_ECS_TASK_DEFINITION],
157159
SyncFlowFactory.GENERATOR_MAPPING[AWS_BEDROCK_AGENTCORE_RUNTIME],
158160
)

0 commit comments

Comments
 (0)