File tree 2 files changed +27
-2
lines changed
packages/@aws-cdk/aws-elasticloadbalancingv2
2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -205,7 +205,7 @@ export abstract class TargetGroupBase extends cdk.Construct implements ITargetGr
205
205
super ( scope , id ) ;
206
206
207
207
if ( baseProps . deregistrationDelay !== undefined ) {
208
- this . setAttribute ( 'deregistration_delay.timeout_seconds' , baseProps . deregistrationDelay . toString ( ) ) ;
208
+ this . setAttribute ( 'deregistration_delay.timeout_seconds' , baseProps . deregistrationDelay . toSeconds ( ) . toString ( ) ) ;
209
209
}
210
210
211
211
this . healthCheck = baseProps . healthCheck || { } ;
Original file line number Diff line number Diff line change 1
1
import { expect , haveResource , MatchStyle } from '@aws-cdk/assert' ;
2
2
import ec2 = require( '@aws-cdk/aws-ec2' ) ;
3
3
import cdk = require( '@aws-cdk/core' ) ;
4
- import { ConstructNode } from '@aws-cdk/core' ;
4
+ import { ConstructNode , Duration } from '@aws-cdk/core' ;
5
5
import { Test } from 'nodeunit' ;
6
6
import elbv2 = require( '../../lib' ) ;
7
7
import { FakeSelfRegisteringTarget } from '../helpers' ;
@@ -534,6 +534,31 @@ export = {
534
534
test . done ( ) ;
535
535
} ,
536
536
537
+ 'Can configure deregistration_delay for targets' ( test : Test ) {
538
+ // GIVEN
539
+ const stack = new cdk . Stack ( ) ;
540
+ const vpc = new ec2 . Vpc ( stack , 'Stack' ) ;
541
+
542
+ // WHEN
543
+ new elbv2 . ApplicationTargetGroup ( stack , 'TargetGroup' , {
544
+ vpc,
545
+ port : 80 ,
546
+ deregistrationDelay : Duration . seconds ( 30 )
547
+ } ) ;
548
+
549
+ // THEN
550
+ expect ( stack ) . to ( haveResource ( 'AWS::ElasticLoadBalancingV2::TargetGroup' , {
551
+ TargetGroupAttributes : [
552
+ {
553
+ Key : "deregistration_delay.timeout_seconds" ,
554
+ Value : "30"
555
+ }
556
+ ]
557
+ } ) ) ;
558
+
559
+ test . done ( ) ;
560
+ } ,
561
+
537
562
'Throws with bad fixed responses' : {
538
563
539
564
'status code' ( test : Test ) {
You can’t perform that action at this time.
0 commit comments