@@ -549,6 +549,45 @@ describe('tests', () => {
549
549
} ) . toThrow ( 'Healthcheck interval 1 minute must be greater than the timeout 2 minute' ) ;
550
550
} ) ;
551
551
552
+ test ( 'Throws error for health check interval less than timeout' , ( ) => {
553
+ const app = new cdk . App ( ) ;
554
+ const stack = new cdk . Stack ( app , 'Stack' ) ;
555
+ const vpc = new ec2 . Vpc ( stack , 'Vpc' ) ;
556
+
557
+ new elbv2 . ApplicationTargetGroup ( stack , 'TargetGroup' , {
558
+ vpc,
559
+ port : 80 ,
560
+ healthCheck : {
561
+ interval : cdk . Duration . seconds ( 10 ) ,
562
+ timeout : cdk . Duration . seconds ( 20 ) ,
563
+ } ,
564
+ } ) ;
565
+
566
+ expect ( ( ) => {
567
+ app . synth ( ) ;
568
+ } ) . toThrow ( 'Health check interval must be greater than or equal to the timeout; received interval 10, timeout 20.' ) ;
569
+ } ) ;
570
+
571
+ // for backwards compatibility these can be equal, see discussion in https://github.com/aws/aws-cdk/pull/26031
572
+ test ( 'Throws error for health check interval less than timeout' , ( ) => {
573
+ const app = new cdk . App ( ) ;
574
+ const stack = new cdk . Stack ( app , 'Stack' ) ;
575
+ const vpc = new ec2 . Vpc ( stack , 'Vpc' ) ;
576
+
577
+ new elbv2 . ApplicationTargetGroup ( stack , 'TargetGroup' , {
578
+ vpc,
579
+ port : 80 ,
580
+ healthCheck : {
581
+ interval : cdk . Duration . seconds ( 10 ) ,
582
+ timeout : cdk . Duration . seconds ( 20 ) ,
583
+ } ,
584
+ } ) ;
585
+
586
+ expect ( ( ) => {
587
+ app . synth ( ) ;
588
+ } ) . toThrow ( 'Health check interval must be greater than or equal to the timeout; received interval 10, timeout 20.' ) ;
589
+ } ) ;
590
+
552
591
test ( 'imported targetGroup has targetGroupName' , ( ) => {
553
592
// GIVEN
554
593
const app = new cdk . App ( ) ;
0 commit comments