aws / aws/aws-cdk

(ecs-patterns): Failing integration test

Open
#32,506 2 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-ecs-patterns bug effort/small p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

> **integ.multiple-application-load-balanced-ecs-service-idle-timeout**

```console
Error occurred: InvalidDomainNameException - example.com. is reserved by AWS!
```

> **integ.multiple-application-load-balanced-ecs-service**

Behaviour: target groups pointing to port 90 always unhealthy

Try running sample image locally, port 90 actually doesn't work:
docker run -d -p 80:80 -p 90:90 amazon/amazon-ecs-sample:latest > curl http://localhost:90 FAIL
docker run -d -p 80:80 -p 90:80 amazon/amazon-ecs-sample:latest > curl http://localhost:90 WORK

> **Both tests are still using Launch Configuration** > community member cannot run

### Regression Issue

- [ ] Select this option if this issue appears to be a regression.

### Last Known Working CDK Version

_No response_

### Expected Behavior

Integration tests should work seamlessly for anyone

### Current Behavior

See description

### Reproduction Steps
`yarn integ test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js --force`

### Possible Solution

> **For both tests**

- Integration test should migrate to Launch Template instead of Launch Configuration

> **integ.multiple-application-load-balanced-ecs-service-idle-timeout**

[Use your own cert pattern](https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk-testing/framework-integ/README.md#error-for-this-test-you-must-provide-your-own-hostedzoneidhostedzonenamedomainnamecertificate)

> **integ.multiple-application-load-balanced-ecs-service**

I can only think of 2 solutions. None of them are clean. Would need team advice:
- Modify nginx configuration in https://github.com/aws-samples/ecs-demo-php-simple-app to also expose port 90
- [ApplicationTargetProps](https://github.com/aws/aws-cdk/blob/1e73ac5f53809e4b5f1192e3307ba7780bc22a81/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts#L212) add support for `hostPort`/ Then we can hardcode hostPort (anti-pattern):
```txt
targetGroups: [
{
containerPort: 80,
hostPort: 8080,
},
{
containerPort: 90,
hostPort: 8090,
pathPattern: 'a/b/c',
priority: 10,
},
]
```

### Additional Information/Context

_No response_

### CDK CLI Version

main

### Framework Version

_No response_

### Node.js Version

v20.18.0

### OS

Dev container

### Language

TypeScript

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Run the listed yarn integ command and inspect the two failing ecs-patterns tests: integ.multiple-application-load-balanced-ecs-service-idle-timeout and integ.multiple-application-load-balanced-ecs-service. Read the framework-integ README guidance for custom certificates and packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts. Done means both tests run successfully without reserved-domain, unhealthy-port-90, or Launch Configuration issues.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, docker, typescript
Domain
infrastructure, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.