chore(ecs): fix failing ECS integration tests#36968
Conversation
- fargate/capacity-providers: wrap in IntegTest with destroy expectError - external/daemon-service: scope IntegTest to app (fix cross-stack export) - ec2/capacity-provider: wrap in IntegTest with destroy expectError - ec2/pseudo-terminal: t2.micro -> t3.micro (AZ availability) - fargate/exec-command: fix health check port 8000 -> 80 - fargate/enable-execute-command: fix health check port 8000 -> 80 - fargate/nlb-awsvpc-nw: allow NLB traffic to service SG, wrap in IntegTest - managedinstances-no-default: use construct defaults for IAM, remove GPU constraint - managedinstances-capacity-provider: same as above
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||
…ia Lambda CR Instead of requiring an external EBS snapshot (SNAPSHOT_ID env var), create a volume and snapshot within the stack using a Lambda-backed custom resource that waits for snapshot completion.
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Merge Queue Status
This pull request spent 42 minutes 30 seconds in the queue, including 42 minutes 17 seconds running CI. Required conditions to merge
|
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
|
Comments on closed issues and PRs are hard for our team to see. |
Issue # (if applicable)
Reason for this change
10 ECS integration tests were failing due to various issues:
IntegTestis scoped to the stackt2.microinstance type unavailability in certain AZsnetworkLoadBalancerWithSecurityGroupByDefaultfeature flagecsInstanceRoleprefix required byAmazonECSInfrastructureRolePolicyForManagedInstances) and overly restrictive instance requirements (NVIDIA GPU + Intel CPU only)Description of changes
10 tests fixed across the aws-ecs module:
fargate/integ.capacity-providers — Wrapped in
IntegTestwithdestroy.expectError: true(#19275).external/integ.daemon-service — Changed
IntegTestscope fromstacktoappto fix cross-stack export deletion ordering. When scoped to the stack, the deploy-assert stack holds a reference to the main stack exports, preventing deletion.ec2/integ.capacity-provider — Wrapped in
IntegTestwithdestroy.expectError: true(#19275).ec2/integ.pseudo-terminal — Changed instance type from
t2.microtot3.micro.t2.microis not available in all AZs, causing ASG launch failures.fargate/integ.exec-command — Fixed container health check from
curl localhost:8000tocurl localhost:80. Theamazon/amazon-ecs-sampleimage serves on port 80; port 8000 always fails, preventing service stabilization.fargate/integ.enable-execute-command — Same health check port fix (8000 → 80).
fargate/integ.nlb-awsvpc-nw — Added
service.connections.allowFrom(lb, ec2.Port.tcp(80)). With thenetworkLoadBalancerWithSecurityGroupByDefaultfeature flag, the NLB gets a security group but no ingress rules were created on the service SG, so NLB health checks always failed. Also wrapped inIntegTest.fargate/integ.ebs-volume-initialization-rate — Replaced external
SNAPSHOT_IDenv var dependency with an in-stack EBS volume + snapshot created via aNodejsFunction-backed custom resource that waits for snapshot completion before returning.integ.managedinstances-no-default-capacity-provider — Removed custom IAM roles/instance profile with hardcoded names. The
AmazonECSInfrastructureRolePolicyForManagedInstancesmanaged policy requires instance profiles prefixed withecsInstanceRole; the test usedInstanceProfilewhich does not match. Now lets the construct create defaults with the correct prefix. Removed NVIDIA accelerator and Intel CPU manufacturer constraints. Removed hardcodedregions: ['us-west-2']since FMI is available in all commercial regions. Addeddestroy.expectError: true(#36071).integ.managedinstances-capacity-provider — Same fixes as above. Added
destroy.expectError: true(#36071).Describe any new or updated permissions being added
No new IAM permissions. The NLB fix adds a security group ingress rule (port 80 TCP) to the Fargate service security group to allow traffic from the NLB — required for health checks and traffic routing to function correctly.
Description of how you validated changes
All 10 fixed tests were deployed and validated via
integ-runnerwith--update-on-failedacross multiple regions (us-east-1, us-west-2, eu-west-1, eu-central-1, ap-northeast-1):Destructive changes (expected):
integ.exec-commandandinteg.enable-execute-command:TaskDefreplaced (health check change)integ.managedinstances-*: IAM roles/instance profiles replaced (removed hardcoded names, switched to construct defaults)Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license