Skip to content

Commit

Permalink
integ test added
Browse files Browse the repository at this point in the history
  • Loading branch information
polothy committed Jun 21, 2023
1 parent e7ac730 commit 75b214b
Show file tree
Hide file tree
Showing 11 changed files with 2,206 additions and 27 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"32.0.0"}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"version": "32.0.0",
"files": {
"e71b8987058d4a328559b0787d0f7cde4a36293ad6f2e690dc824de581af7d19": {
"source": {
"path": "asset.e71b8987058d4a328559b0787d0f7cde4a36293ad6f2e690dc824de581af7d19",
"packaging": "zip"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "e71b8987058d4a328559b0787d0f7cde4a36293ad6f2e690dc824de581af7d19.zip",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
},
"8a2c3e66f4dc2738f9db28c229551543c5f8b5ef8dcf3745069c60a8edfd9db3": {
"source": {
"path": "integ-lambda-python-function-local.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "8a2c3e66f4dc2738f9db28c229551543c5f8b5ef8dcf3745069c60a8edfd9db3.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,101 @@
{
"Resources": {
"myhandlerServiceRole77891068": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
}
}
],
"Version": "2012-10-17"
},
"ManagedPolicyArns": [
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
]
]
}
]
}
},
"myhandlerD202FA8E": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Code": {
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "e71b8987058d4a328559b0787d0f7cde4a36293ad6f2e690dc824de581af7d19.zip"
},
"Role": {
"Fn::GetAtt": [
"myhandlerServiceRole77891068",
"Arn"
]
},
"Handler": "index.handler",
"Runtime": "python3.9"
},
"DependsOn": [
"myhandlerServiceRole77891068"
]
}
},
"Outputs": {
"ExportsOutputRefmyhandlerD202FA8E369E8804": {
"Value": {
"Ref": "myhandlerD202FA8E"
},
"Export": {
"Name": "integ-lambda-python-function-local:ExportsOutputRefmyhandlerD202FA8E369E8804"
}
}
},
"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
@@ -0,0 +1,13 @@
{
"version": "32.0.0",
"testCases": {
"lambda-python-function-local/DefaultTest": {
"stacks": [
"integ-lambda-python-function-local"
],
"stackUpdateWorkflow": false,
"assertionStack": "lambda-python-function-local/DefaultTest/DeployAssert",
"assertionStackName": "lambdapythonfunctionlocalDefaultTestDeployAssert45D2A34B"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"version": "32.0.0",
"files": {
"36618132bd37b6b15f9987b57ad1fbf613f1ad937aec72381232b163ed9c44c4": {
"source": {
"path": "asset.36618132bd37b6b15f9987b57ad1fbf613f1ad937aec72381232b163ed9c44c4.bundle",
"packaging": "zip"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "36618132bd37b6b15f9987b57ad1fbf613f1ad937aec72381232b163ed9c44c4.zip",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
},
"0fc29a96ca934762eac0be96d25847e90fcbd025c1e58b14a95607277ffa3b0d": {
"source": {
"path": "lambdapythonfunctionlocalDefaultTestDeployAssert45D2A34B.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "0fc29a96ca934762eac0be96d25847e90fcbd025c1e58b14a95607277ffa3b0d.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": {
"LambdaInvoke431773224924ebf10c8a31d363a6bf16": {
"Type": "Custom::DeployAssert@SdkCallLambdainvoke",
"Properties": {
"ServiceToken": {
"Fn::GetAtt": [
"SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F",
"Arn"
]
},
"service": "Lambda",
"api": "invoke",
"expected": "{\"$ObjectLike\":{\"Payload\":\"{\\\"helloFrom\\\": \\\"LocalBundle\\\"}\"}}",
"parameters": {
"FunctionName": {
"Fn::ImportValue": "integ-lambda-python-function-local:ExportsOutputRefmyhandlerD202FA8E369E8804"
}
},
"flattenResponse": "false",
"salt": "1687374066141"
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
"LambdaInvoke431773224924ebf10c8a31d363a6bf16Invoke9BC0E67F": {
"Type": "AWS::Lambda::Permission",
"Properties": {
"Action": "lambda:InvokeFunction",
"FunctionName": {
"Fn::ImportValue": "integ-lambda-python-function-local:ExportsOutputRefmyhandlerD202FA8E369E8804"
},
"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": "integ-lambda-python-function-local:ExportsOutputRefmyhandlerD202FA8E369E8804"
}
]
]
}
]
}
]
}
}
]
}
},
"SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Runtime": "nodejs14.x",
"Code": {
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "36618132bd37b6b15f9987b57ad1fbf613f1ad937aec72381232b163ed9c44c4.zip"
},
"Timeout": 120,
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73",
"Arn"
]
}
}
}
},
"Outputs": {
"AssertionResultsLambdaInvoke431773224924ebf10c8a31d363a6bf16": {
"Value": {
"Fn::GetAtt": [
"LambdaInvoke431773224924ebf10c8a31d363a6bf16",
"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."
}
]
}
}
}

0 comments on commit 75b214b

Please sign in to comment.