Skip to content

Commit

Permalink
Implement new Match.serializedJson in lambda integ tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fredericbarthelet committed Dec 6, 2022
1 parent b7cace1 commit 7b7e24f
Show file tree
Hide file tree
Showing 10 changed files with 1,323 additions and 31 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"21.0.0"}
{"version":"22.0.0"}
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
{
"version": "21.0.0",
"version": "22.0.0",
"testCases": {
"integ.lambda.docker": {
"integ/DefaultTest": {
"stacks": [
"lambda-ecr-docker"
],
"diffAssets": false,
"stackUpdateWorkflow": true
"assertionStack": "integ/DefaultTest/DeployAssert",
"assertionStackName": "integDefaultTestDeployAssert946684A0"
}
},
"synthContext": {},
"enableLookups": false
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"version": "22.0.0",
"files": {
"0ac341521855ed4705d41029b27ada812d7667cb8dcd05598acd18d5cc96b5a0": {
"source": {
"path": "asset.0ac341521855ed4705d41029b27ada812d7667cb8dcd05598acd18d5cc96b5a0.bundle",
"packaging": "zip"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "0ac341521855ed4705d41029b27ada812d7667cb8dcd05598acd18d5cc96b5a0.zip",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
},
"fc2d109d84a7a233f964621c7a788047bc94abc4b27920bc393068dd34eb2079": {
"source": {
"path": "integDefaultTestDeployAssert946684A0.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "fc2d109d84a7a233f964621c7a788047bc94abc4b27920bc393068dd34eb2079.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
}
},
"dockerImages": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
{
"Resources": {
"LambdaInvoke8ca4d6356e56a59f578975a0656ecf5f": {
"Type": "Custom::DeployAssert@SdkCallLambdainvoke",
"Properties": {
"ServiceToken": {
"Fn::GetAtt": [
"SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F",
"Arn"
]
},
"service": "Lambda",
"api": "invoke",
"expected": "{\"$ObjectLike\":{\"Payload\":{\"$SerializedJson\":{\"statusCode\":200}}}}",
"parameters": {
"FunctionName": {
"Fn::ImportValue": "lambda-ecr-docker:ExportsOutputRefMyLambdaCCE802FBB974561C"
}
},
"flattenResponse": "false",
"salt": "1670351867329"
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
"LambdaInvoke8ca4d6356e56a59f578975a0656ecf5fInvokeCF29AB15": {
"Type": "AWS::Lambda::Permission",
"Properties": {
"Action": "lambda:InvokeFunction",
"FunctionName": {
"Fn::ImportValue": "lambda-ecr-docker:ExportsOutputRefMyLambdaCCE802FBB974561C"
},
"Principal": {
"Fn::GetAtt": [
"SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73",
"Arn"
]
}
}
},
"SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
}
}
]
},
"ManagedPolicyArns": [
{
"Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
}
],
"Policies": [
{
"PolicyName": "Inline",
"PolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"lambda:Invoke"
],
"Effect": "Allow",
"Resource": [
"*"
]
},
{
"Action": [
"lambda:InvokeFunction"
],
"Effect": "Allow",
"Resource": [
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":lambda:",
{
"Ref": "AWS::Region"
},
":",
{
"Ref": "AWS::AccountId"
},
":function:",
{
"Fn::ImportValue": "lambda-ecr-docker:ExportsOutputRefMyLambdaCCE802FBB974561C"
}
]
]
}
]
}
]
}
}
]
}
},
"SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Runtime": "nodejs14.x",
"Code": {
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "0ac341521855ed4705d41029b27ada812d7667cb8dcd05598acd18d5cc96b5a0.zip"
},
"Timeout": 120,
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73",
"Arn"
]
}
}
}
},
"Outputs": {
"AssertionResultsLambdaInvoke8ca4d6356e56a59f578975a0656ecf5f": {
"Value": {
"Fn::GetAtt": [
"LambdaInvoke8ca4d6356e56a59f578975a0656ecf5f",
"assertion"
]
}
}
},
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"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."
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"version": "21.0.0",
"version": "22.0.0",
"files": {
"077f5b1d65ef54f982550efd635d477a7884189645881cd41c11646212797905": {
"2c20f3551f9569b05a50288a76ab830f85c7d1482016211bf1ff4df621c7a215": {
"source": {
"path": "lambda-ecr-docker.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "077f5b1d65ef54f982550efd635d477a7884189645881cd41c11646212797905.json",
"objectKey": "2c20f3551f9569b05a50288a76ab830f85c7d1482016211bf1ff4df621c7a215.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@
]
}
},
"Outputs": {
"ExportsOutputRefMyLambdaCCE802FBB974561C": {
"Value": {
"Ref": "MyLambdaCCE802FB"
},
"Export": {
"Name": "lambda-ecr-docker:ExportsOutputRefMyLambdaCCE802FBB974561C"
}
}
},
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
Expand Down
Loading

0 comments on commit 7b7e24f

Please sign in to comment.