Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: duration doesn't get accurately compared in multi alb service base #27664

Merged
merged 6 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@
},
{
"Key": "idle_timeout.timeout_seconds",
"Value": "400"
"Value": "5"
}
],
"Scheme": "internet-facing",
Expand Down Expand Up @@ -1101,7 +1101,7 @@
},
{
"Key": "idle_timeout.timeout_seconds",
"Value": "400"
"Value": "500"
}
],
"Scheme": "internet-facing",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ new ApplicationMultipleTargetGroupsEc2Service(stack, 'myService', {
loadBalancers: [
{
name: 'lb',
idleTimeout: Duration.seconds(400),
idleTimeout: Duration.seconds(5),
domainName: 'api.example.com',
domainZone: zone,
listeners: [
Expand All @@ -41,7 +41,7 @@ new ApplicationMultipleTargetGroupsEc2Service(stack, 'myService', {
},
{
name: 'lb2',
idleTimeout: Duration.seconds(400),
idleTimeout: Duration.seconds(500),
domainName: 'frontend.example.com',
domainZone: zone,
listeners: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ export interface ApplicationLoadBalancerProps {
readonly domainZone?: IHostedZone;

/**
* The load balancer idle timeout, in seconds
* The load balancer idle timeout, in seconds. Can be between 1 and 4000 seconds.
*
* @default - CloudFormation sets idle timeout to 60 seconds
*/
Expand Down Expand Up @@ -585,7 +585,8 @@ export abstract class ApplicationMultipleTargetGroupsServiceBase extends Constru
private validateLbProps(props: ApplicationLoadBalancerProps[]) {
for (let prop of props) {
if (prop.idleTimeout) {
if (prop.idleTimeout > Duration.seconds(4000) || prop.idleTimeout < Duration.seconds(1)) {
const idleTimeout = prop.idleTimeout.toSeconds();
if (idleTimeout > Duration.seconds(4000).toSeconds() || idleTimeout < Duration.seconds(1).toSeconds()) {
throw new Error('Load balancer idle timeout must be between 1 and 4000 seconds.');
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/l3s.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ test('passes when idleTimeout is between 1 and 4000 seconds for multiAlbService'
loadBalancers: [
{
name: 'lb',
idleTimeout: Duration.seconds(400),
idleTimeout: Duration.seconds(5),
domainName: 'api.example.com',
domainZone: new PublicHostedZone(stack, 'HostedZone', { zoneName: 'example.com' }),
listeners: [
Expand All @@ -997,7 +997,7 @@ test('passes when idleTimeout is between 1 and 4000 seconds for multiAlbService'
},
{
name: 'lb2',
idleTimeout: Duration.seconds(120),
idleTimeout: Duration.seconds(500),
domainName: 'frontend.com',
domainZone: new PublicHostedZone(stack, 'HostedZone2', { zoneName: 'frontend.com' }),
listeners: [
Expand Down