diff --git a/packages/@aws-cdk/aws-ecs/lib/container-definition.ts b/packages/@aws-cdk/aws-ecs/lib/container-definition.ts index 8c112a18a3a38..4eda8f884b813 100644 --- a/packages/@aws-cdk/aws-ecs/lib/container-definition.ts +++ b/packages/@aws-cdk/aws-ecs/lib/container-definition.ts @@ -858,6 +858,23 @@ function renderEnvironmentFiles(partition: string, environmentFiles: Environment } function renderHealthCheck(hc: HealthCheck): CfnTaskDefinition.HealthCheckProperty { + if (hc.interval?.toSeconds() !== undefined) { + if (5 > hc.interval?.toSeconds() || hc.interval?.toSeconds() > 300) { + throw new Error('Interval must be between 5 seconds and 300 seconds.'); + } + } + + if (hc.timeout?.toSeconds() !== undefined) { + if (2 > hc.timeout?.toSeconds() || hc.timeout?.toSeconds() > 120) { + throw new Error('Timeout must be between 2 seconds and 120 seconds.'); + } + } + if (hc.interval?.toSeconds() !== undefined && hc.timeout?.toSeconds() !== undefined) { + if (hc.interval?.toSeconds() < hc.timeout?.toSeconds()) { + throw new Error('Health check interval should be longer than timeout.'); + } + } + return { command: getHealthCheckCommand(hc), interval: hc.interval?.toSeconds() ?? 30, diff --git a/packages/@aws-cdk/aws-ecs/test/container-definition.test.ts b/packages/@aws-cdk/aws-ecs/test/container-definition.test.ts index a0bfbf217ed2b..1db0b3e8815d0 100644 --- a/packages/@aws-cdk/aws-ecs/test/container-definition.test.ts +++ b/packages/@aws-cdk/aws-ecs/test/container-definition.test.ts @@ -7,6 +7,7 @@ import * as cdk from '@aws-cdk/core'; import * as cxapi from '@aws-cdk/cx-api'; import * as ecs from '../lib'; import { AppProtocol } from '../lib'; +import { Duration } from '@aws-cdk/core'; describe('container definition', () => { describe('When creating a Task Definition', () => { @@ -1691,6 +1692,161 @@ describe('container definition', () => { }).toThrow(/At least one argument must be supplied for health check command./); }); + test('throws when setting Health Check with invalid interval because of too short', () => { + // GIVEN + const stack = new cdk.Stack(); + const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef'); + + // WHEN + taskDefinition.addContainer('cont', { + image: ecs.ContainerImage.fromRegistry('test'), + memoryLimitMiB: 1024, + healthCheck: { + command: ['CMD-SHELL', 'curl localhost:8000'], + interval: Duration.seconds(4), + timeout: Duration.seconds(30), + }, + }); + + // THEN + expect(() => { + Template.fromStack(stack).hasResourceProperties('AWS::ECS::TaskDefinition', { + ContainerDefinitions: [ + { + HealthCheck: { + Command: ['CMD-SHELL', 'curl localhost:8000'], + Interval: 4, + }, + }, + ], + }); + }).toThrow(/Interval must be between 5 seconds and 300 seconds./); + }); + + test('throws when setting Health Check with invalid interval because of too long', () => { + // GIVEN + const stack = new cdk.Stack(); + const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef'); + + // WHEN + taskDefinition.addContainer('cont', { + image: ecs.ContainerImage.fromRegistry('test'), + memoryLimitMiB: 1024, + healthCheck: { + command: ['CMD-SHELL', 'curl localhost:8000'], + interval: Duration.seconds(301), + timeout: Duration.seconds(30), + }, + }); + + // THEN + expect(() => { + Template.fromStack(stack).hasResourceProperties('AWS::ECS::TaskDefinition', { + ContainerDefinitions: [ + { + HealthCheck: { + Command: ['CMD-SHELL', 'curl localhost:8000'], + Interval: 4, + }, + }, + ], + }); + }).toThrow(/Interval must be between 5 seconds and 300 seconds./); + }); + + test('throws when setting Health Check with invalid timeout because of too short', () => { + // GIVEN + const stack = new cdk.Stack(); + const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef'); + + // WHEN + taskDefinition.addContainer('cont', { + image: ecs.ContainerImage.fromRegistry('test'), + memoryLimitMiB: 1024, + healthCheck: { + command: ['CMD-SHELL', 'curl localhost:8000'], + interval: Duration.seconds(40), + timeout: Duration.seconds(1), + }, + }); + + // THEN + expect(() => { + Template.fromStack(stack).hasResourceProperties('AWS::ECS::TaskDefinition', { + ContainerDefinitions: [ + { + HealthCheck: { + Command: ['CMD-SHELL', 'curl localhost:8000'], + Interval: 4, + }, + }, + ], + }); + }).toThrow(/Timeout must be between 2 seconds and 120 seconds./); + }); + + test('throws when setting Health Check with invalid timeout because of too long', () => { + // GIVEN + const stack = new cdk.Stack(); + const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef'); + + // WHEN + taskDefinition.addContainer('cont', { + image: ecs.ContainerImage.fromRegistry('test'), + memoryLimitMiB: 1024, + healthCheck: { + command: ['CMD-SHELL', 'curl localhost:8000'], + interval: Duration.seconds(150), + timeout: Duration.seconds(130), + }, + }); + + // THEN + expect(() => { + Template.fromStack(stack).hasResourceProperties('AWS::ECS::TaskDefinition', { + ContainerDefinitions: [ + { + HealthCheck: { + Command: ['CMD-SHELL', 'curl localhost:8000'], + Interval: 4, + }, + }, + ], + }); + }).toThrow(/Timeout must be between 2 seconds and 120 seconds./); + }); + + test('throws when setting Health Check with invalid interval and timeout because timeout is longer than interval', () => { + // GIVEN + const stack = new cdk.Stack(); + const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef'); + + // WHEN + taskDefinition.addContainer('cont', { + image: ecs.ContainerImage.fromRegistry('test'), + memoryLimitMiB: 1024, + healthCheck: { + command: ['CMD-SHELL', 'curl localhost:8000'], + interval: Duration.seconds(10), + timeout: Duration.seconds(30), + }, + }); + + // THEN + expect(() => { + Template.fromStack(stack).hasResourceProperties('AWS::ECS::TaskDefinition', { + ContainerDefinitions: [ + { + HealthCheck: { + Command: ['CMD-SHELL', 'curl localhost:8000'], + Interval: 4, + }, + }, + ], + }); + }).toThrow(/Health check interval should be longer than timeout./); + }); + test('can specify Health Check values in shell form', () => { // GIVEN const stack = new cdk.Stack(); diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/aws-ecs-integ-exec-command.assets.json b/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/aws-ecs-integ-exec-command.assets.json index a926baf83f30c..69056d07d817d 100644 --- a/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/aws-ecs-integ-exec-command.assets.json +++ b/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/aws-ecs-integ-exec-command.assets.json @@ -1,7 +1,7 @@ { - "version": "20.0.0", + "version": "30.0.0", "files": { - "4dba456b46dc53b954d12cf55bad7b455371f307d7b5df57b5fb2e6cafe4e9ba": { + "1a5bcacf8adc1fb93503daec527cf36ecf57f189012726acf8ad69d9f993d3cb": { "source": { "path": "aws-ecs-integ-exec-command.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "4dba456b46dc53b954d12cf55bad7b455371f307d7b5df57b5fb2e6cafe4e9ba.json", + "objectKey": "1a5bcacf8adc1fb93503daec527cf36ecf57f189012726acf8ad69d9f993d3cb.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/aws-ecs-integ-exec-command.template.json b/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/aws-ecs-integ-exec-command.template.json index a6e57f5b88db6..377a73d413b6d 100644 --- a/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/aws-ecs-integ-exec-command.template.json +++ b/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/aws-ecs-integ-exec-command.template.json @@ -673,6 +673,15 @@ "ContainerDefinitions": [ { "Essential": true, + "HealthCheck": { + "Command": [ + "CMD-SHELL", + "curl localhost:8000" + ], + "Interval": 60, + "Retries": 3, + "Timeout": 40 + }, "Image": "amazon/amazon-ecs-sample", "Name": "web" } diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/cdk.out b/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/cdk.out index 588d7b269d34f..ae4b03c54e770 100644 --- a/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"20.0.0"} \ No newline at end of file +{"version":"30.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/execcommandintegtestDefaultTestDeployAssert4F7706FE.assets.json b/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/execcommandintegtestDefaultTestDeployAssert4F7706FE.assets.json new file mode 100644 index 0000000000000..d3e14dafbed7e --- /dev/null +++ b/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/execcommandintegtestDefaultTestDeployAssert4F7706FE.assets.json @@ -0,0 +1,19 @@ +{ + "version": "30.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "execcommandintegtestDefaultTestDeployAssert4F7706FE.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/execcommandintegtestDefaultTestDeployAssert4F7706FE.template.json b/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/execcommandintegtestDefaultTestDeployAssert4F7706FE.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/execcommandintegtestDefaultTestDeployAssert4F7706FE.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/integ.json b/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/integ.json index 54e1790dd2707..c11a247f3a29b 100644 --- a/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/integ.json +++ b/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/integ.json @@ -1,14 +1,20 @@ { - "version": "20.0.0", + "version": "30.0.0", "testCases": { - "integ.exec-command": { + "exec-command-integ-test/DefaultTest": { "stacks": [ "aws-ecs-integ-exec-command" ], - "diffAssets": false, - "stackUpdateWorkflow": true + "diffAssets": true, + "cdkCommandOptions": { + "deploy": { + "args": { + "rollback": true + } + } + }, + "assertionStack": "exec-command-integ-test/DefaultTest/DeployAssert", + "assertionStackName": "execcommandintegtestDefaultTestDeployAssert4F7706FE" } - }, - "synthContext": {}, - "enableLookups": false + } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/manifest.json b/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/manifest.json index f2551e7cdb262..e45fd352cef32 100644 --- a/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/manifest.json @@ -1,12 +1,6 @@ { - "version": "20.0.0", + "version": "30.0.0", "artifacts": { - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - }, "aws-ecs-integ-exec-command.assets": { "type": "cdk:asset-manifest", "properties": { @@ -23,7 +17,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/4dba456b46dc53b954d12cf55bad7b455371f307d7b5df57b5fb2e6cafe4e9ba.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/1a5bcacf8adc1fb93503daec527cf36ecf57f189012726acf8ad69d9f993d3cb.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -216,7 +210,10 @@ "/aws-ecs-integ-exec-command/TaskDef/Resource": [ { "type": "aws:cdk:logicalId", - "data": "TaskDef54694570" + "data": "TaskDef54694570", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_REPLACE" + ] } ], "/aws-ecs-integ-exec-command/FargateService/Service": [ @@ -245,6 +242,59 @@ ] }, "displayName": "aws-ecs-integ-exec-command" + }, + "execcommandintegtestDefaultTestDeployAssert4F7706FE.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "execcommandintegtestDefaultTestDeployAssert4F7706FE.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "execcommandintegtestDefaultTestDeployAssert4F7706FE": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "execcommandintegtestDefaultTestDeployAssert4F7706FE.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "execcommandintegtestDefaultTestDeployAssert4F7706FE.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "execcommandintegtestDefaultTestDeployAssert4F7706FE.assets" + ], + "metadata": { + "/exec-command-integ-test/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/exec-command-integ-test/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "exec-command-integ-test/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/tree.json b/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/tree.json index 0da31318a2e10..ccc7204857046 100644 --- a/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/tree.json +++ b/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/tree.json @@ -4,14 +4,6 @@ "id": "App", "path": "", "children": { - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" - } - }, "aws-ecs-integ-exec-command": { "id": "aws-ecs-integ-exec-command", "path": "aws-ecs-integ-exec-command", @@ -91,8 +83,8 @@ "id": "Acl", "path": "aws-ecs-integ-exec-command/Vpc/PublicSubnet1/Acl", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.Resource", + "version": "0.0.0" } }, "RouteTable": { @@ -258,8 +250,8 @@ "id": "Acl", "path": "aws-ecs-integ-exec-command/Vpc/PublicSubnet2/Acl", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.Resource", + "version": "0.0.0" } }, "RouteTable": { @@ -425,8 +417,8 @@ "id": "Acl", "path": "aws-ecs-integ-exec-command/Vpc/PrivateSubnet1/Acl", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.Resource", + "version": "0.0.0" } }, "RouteTable": { @@ -544,8 +536,8 @@ "id": "Acl", "path": "aws-ecs-integ-exec-command/Vpc/PrivateSubnet2/Acl", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.Resource", + "version": "0.0.0" } }, "RouteTable": { @@ -880,6 +872,14 @@ "id": "TaskRole", "path": "aws-ecs-integ-exec-command/TaskDef/TaskRole", "children": { + "ImportTaskRole": { + "id": "ImportTaskRole", + "path": "aws-ecs-integ-exec-command/TaskDef/TaskRole/ImportTaskRole", + "constructInfo": { + "fqn": "@aws-cdk/core.Resource", + "version": "0.0.0" + } + }, "Resource": { "id": "Resource", "path": "aws-ecs-integ-exec-command/TaskDef/TaskRole/Resource", @@ -1051,7 +1051,16 @@ { "essential": true, "image": "amazon/amazon-ecs-sample", - "name": "web" + "name": "web", + "healthCheck": { + "command": [ + "CMD-SHELL", + "curl localhost:8000" + ], + "interval": 60, + "retries": 3, + "timeout": 40 + } } ], "cpu": "256", @@ -1178,17 +1187,95 @@ "fqn": "@aws-cdk/aws-ecs.FargateService", "version": "0.0.0" } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "aws-ecs-integ-exec-command/BootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "aws-ecs-integ-exec-command/CheckBootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnRule", + "version": "0.0.0" + } } }, + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + }, + "exec-command-integ-test": { + "id": "exec-command-integ-test", + "path": "exec-command-integ-test", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "exec-command-integ-test/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "exec-command-integ-test/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.249" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "exec-command-integ-test/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "exec-command-integ-test/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "exec-command-integ-test/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.85" + "version": "10.1.249" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.App", + "version": "0.0.0" } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.ts b/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.ts index 5bc89fb2432b7..0af518dfa6b11 100644 --- a/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.ts +++ b/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.ts @@ -3,6 +3,8 @@ import * as kms from '@aws-cdk/aws-kms'; import * as logs from '@aws-cdk/aws-logs'; import * as s3 from '@aws-cdk/aws-s3'; import * as cdk from '@aws-cdk/core'; +import { Duration } from '@aws-cdk/core'; +import * as integ from '@aws-cdk/integ-tests'; import * as ecs from '../../lib'; const app = new cdk.App(); @@ -39,6 +41,11 @@ const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDef'); taskDefinition.addContainer('web', { image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + healthCheck: { + command: ['CMD-SHELL', 'curl localhost:8000'], + interval: Duration.seconds(60), + timeout: Duration.seconds(40), + }, }); new ecs.FargateService(stack, 'FargateService', { @@ -47,4 +54,14 @@ new ecs.FargateService(stack, 'FargateService', { enableExecuteCommand: true, }); -app.synth(); \ No newline at end of file +new integ.IntegTest(app, 'exec-command-integ-test', { + testCases: [stack], + diffAssets: true, + cdkCommandOptions: { + deploy: { + args: { + rollback: true, + }, + }, + }, +});