File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
packages/@aws-cdk/aws-ecs Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,7 @@ export abstract class BaseService extends cdk.Construct
111
111
maximumPercent : props . maximumPercent || 200 ,
112
112
minimumHealthyPercent : props . minimumHealthyPercent || 50
113
113
} ,
114
+ healthCheckGracePeriodSeconds : props . healthCheckGracePeriodSeconds ,
114
115
/* role: never specified, supplanted by Service Linked Role */
115
116
networkConfiguration : new cdk . Token ( ( ) => this . networkConfiguration ) ,
116
117
...additionalProps
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import ec2 = require('@aws-cdk/aws-ec2');
3
3
import cdk = require( '@aws-cdk/cdk' ) ;
4
4
import { Test } from 'nodeunit' ;
5
5
import ecs = require( '../../lib' ) ;
6
+ import { ContainerImage } from '../../lib' ;
6
7
7
8
export = {
8
9
"When creating a Fargate Service" : {
@@ -127,5 +128,32 @@ export = {
127
128
128
129
test . done ( ) ;
129
130
} ,
130
- }
131
+ } ,
132
+
133
+ "When setting up a health check" : {
134
+ 'grace period is respected' ( test : Test ) {
135
+ // GIVEN
136
+ const stack = new cdk . Stack ( ) ;
137
+ const vpc = new ec2 . VpcNetwork ( stack , 'MyVpc' , { } ) ;
138
+ const cluster = new ecs . Cluster ( stack , 'EcsCluster' , { vpc } ) ;
139
+ const taskDefinition = new ecs . FargateTaskDefinition ( stack , 'FargateTaskDef' ) ;
140
+ taskDefinition . addContainer ( 'MainContainer' , {
141
+ image : ContainerImage . fromDockerHub ( 'hello' ) ,
142
+ } ) ;
143
+
144
+ // WHEN
145
+ new ecs . FargateService ( stack , 'Svc' , {
146
+ cluster,
147
+ taskDefinition,
148
+ healthCheckGracePeriodSeconds : 10
149
+ } ) ;
150
+
151
+ // THEN
152
+ expect ( stack ) . to ( haveResource ( 'AWS::ECS::Service' , {
153
+ HealthCheckGracePeriodSeconds : 10
154
+ } ) ) ;
155
+
156
+ test . done ( ) ;
157
+ } ,
158
+ } ,
131
159
} ;
You can’t perform that action at this time.
0 commit comments