Skip to content

Commit

Permalink
chore: add integ testing
Browse files Browse the repository at this point in the history
  • Loading branch information
neilkuan committed Jan 1, 2024
1 parent a347097 commit 0fefaed
Show file tree
Hide file tree
Showing 9 changed files with 1,116 additions and 0 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,288 @@
{
"Resources": {
"inAlarmLambdaServiceRole970DE64C": {
"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"
]
]
}
]
}
},
"inAlarmLambda0920D101": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Code": {
"ZipFile": "\ndef handler(event, context):\n make this fn fail\n prinr22(''hello)"
},
"FunctionName": "inAlarmLambda",
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"inAlarmLambdaServiceRole970DE64C",
"Arn"
]
},
"Runtime": "python3.12"
},
"DependsOn": [
"inAlarmLambdaServiceRole970DE64C"
]
},
"Alarm7103F465": {
"Type": "AWS::CloudWatch::Alarm",
"Properties": {
"ActionsEnabled": true,
"AlarmActions": [
{
"Ref": "alarmLambdaCurrentVersionBDCE825Ced84cae8d64e7eaa69f8105fc0363a2a"
},
{
"Ref": "alarmLambdaAliasaliasName41B27313"
},
{
"Fn::GetAtt": [
"alarmLambda131DB691",
"Arn"
]
}
],
"ComparisonOperator": "GreaterThanThreshold",
"Dimensions": [
{
"Name": "FunctionName",
"Value": {
"Ref": "inAlarmLambda0920D101"
}
}
],
"EvaluationPeriods": 1,
"MetricName": "Errors",
"Namespace": "AWS/Lambda",
"Period": 60,
"Statistic": "Sum",
"Threshold": 1,
"TreatMissingData": "notBreaching"
}
},
"AlarmCurrentVersionAlarmPermission22DB4772": {
"Type": "AWS::Lambda::Permission",
"Properties": {
"Action": "lambda:InvokeFunction",
"FunctionName": {
"Fn::Join": [
"",
[
{
"Ref": "alarmLambda131DB691"
},
":",
{
"Fn::GetAtt": [
"alarmLambdaCurrentVersionBDCE825Ced84cae8d64e7eaa69f8105fc0363a2a",
"Version"
]
}
]
]
},
"Principal": "lambda.alarms.cloudwatch.amazonaws.com",
"SourceAccount": {
"Ref": "AWS::AccountId"
},
"SourceArn": {
"Fn::GetAtt": [
"Alarm7103F465",
"Arn"
]
}
}
},
"AlarmAliasaliasNameAlarmPermission3887D390": {
"Type": "AWS::Lambda::Permission",
"Properties": {
"Action": "lambda:InvokeFunction",
"FunctionName": {
"Fn::Join": [
"",
[
{
"Fn::Select": [
6,
{
"Fn::Split": [
":",
{
"Ref": "alarmLambdaAliasaliasName41B27313"
}
]
}
]
},
":aliasName"
]
]
},
"Principal": "lambda.alarms.cloudwatch.amazonaws.com",
"SourceAccount": {
"Ref": "AWS::AccountId"
},
"SourceArn": {
"Fn::GetAtt": [
"Alarm7103F465",
"Arn"
]
}
}
},
"AlarmalarmLambdaAlarmPermission5CAF3DE7": {
"Type": "AWS::Lambda::Permission",
"Properties": {
"Action": "lambda:InvokeFunction",
"FunctionName": {
"Ref": "alarmLambda131DB691"
},
"Principal": "lambda.alarms.cloudwatch.amazonaws.com",
"SourceAccount": {
"Ref": "AWS::AccountId"
},
"SourceArn": {
"Fn::GetAtt": [
"Alarm7103F465",
"Arn"
]
}
}
},
"alarmLambdaServiceRoleCDAABB9D": {
"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"
]
]
}
]
}
},
"alarmLambda131DB691": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Code": {
"ZipFile": "\ndef handler(event, context):\n print('event:', event)\n print('.............................................')\n print('context:', context)"
},
"FunctionName": "alarmLambda",
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"alarmLambdaServiceRoleCDAABB9D",
"Arn"
]
},
"Runtime": "python3.12"
},
"DependsOn": [
"alarmLambdaServiceRoleCDAABB9D"
]
},
"alarmLambdaCurrentVersionBDCE825Ced84cae8d64e7eaa69f8105fc0363a2a": {
"Type": "AWS::Lambda::Version",
"Properties": {
"FunctionName": {
"Ref": "alarmLambda131DB691"
}
}
},
"alarmLambdaAliasaliasName41B27313": {
"Type": "AWS::Lambda::Alias",
"Properties": {
"FunctionName": {
"Ref": "alarmLambda131DB691"
},
"FunctionVersion": {
"Fn::GetAtt": [
"alarmLambdaCurrentVersionBDCE825Ced84cae8d64e7eaa69f8105fc0363a2a",
"Version"
]
},
"Name": "aliasName"
}
}
},
"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."
}
]
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0fefaed

Please sign in to comment.