Skip to content

Commit a1b9920

Browse files
committed
add unit tests
1 parent 52d2584 commit a1b9920

9 files changed

+654
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Resources:
2+
MinimalFunction:
3+
Type: AWS::Serverless::Function
4+
Properties:
5+
CodeUri: s3://sam-demo-bucket/hello.zip
6+
Handler: hello.handler
7+
Runtime: python3.10
8+
AutoPublishAlias: live
9+
AutoPublishAliasAllProperties: true
10+
VersionDescription: sam-testing
11+
Layers:
12+
- !Ref TestEnvLayer
13+
14+
TestEnvLayer:
15+
Type: AWS::Serverless::LayerVersion
16+
Properties:
17+
LayerName: test-env-dependencies
18+
Description: Dependencies for test env implementation
19+
ContentUri: s3://bucket/key
20+
PublishLambdaVersion: true
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Resources:
2+
MinimalFunction:
3+
Type: AWS::Serverless::Function
4+
Properties:
5+
CodeUri: s3://sam-demo-bucket/hello.zip
6+
Handler: hello.handler
7+
Runtime: python3.10
8+
AutoPublishAlias: live
9+
AutoPublishAliasAllProperties: true
10+
VersionDescription: sam-testing
11+
Layers:
12+
- !Ref TestEnvLayer
13+
14+
TestEnvLayer:
15+
Type: AWS::Serverless::LayerVersion
16+
Properties:
17+
LayerName: test-env-dependencies
18+
Description: Dependencies for test env implementation
19+
ContentUri: s3://bucket/key
20+
PublishLambdaVersion: false
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Resources:
2+
MinimalFunction:
3+
Type: AWS::Serverless::Function
4+
Properties:
5+
CodeUri: s3://sam-demo-bucket/hello.zip
6+
Handler: hello.handler
7+
Runtime: python3.10
8+
AutoPublishAlias: live
9+
AutoPublishAliasAllProperties: true
10+
VersionDescription: sam-testing
11+
Layers:
12+
- !Ref TestEnvLayer
13+
14+
TestEnvLayer:
15+
Type: AWS::Serverless::LayerVersion
16+
Properties:
17+
LayerName: test-env-dependencies
18+
Description: Dependencies for test env implementation
19+
ContentUri: s3://bucket/key
20+
PublishLambdaVersion: true
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
{
2+
"Resources": {
3+
"MinimalFunction": {
4+
"Properties": {
5+
"Code": {
6+
"S3Bucket": "sam-demo-bucket",
7+
"S3Key": "hello.zip"
8+
},
9+
"Handler": "hello.handler",
10+
"Layers": [
11+
{
12+
"Ref": "TestEnvLayerd122689ed9"
13+
}
14+
],
15+
"Role": {
16+
"Fn::GetAtt": [
17+
"MinimalFunctionRole",
18+
"Arn"
19+
]
20+
},
21+
"Runtime": "python3.10",
22+
"Tags": [
23+
{
24+
"Key": "lambda:createdBy",
25+
"Value": "SAM"
26+
}
27+
]
28+
},
29+
"Type": "AWS::Lambda::Function"
30+
},
31+
"MinimalFunctionAliaslive": {
32+
"Properties": {
33+
"FunctionName": {
34+
"Ref": "MinimalFunction"
35+
},
36+
"FunctionVersion": {
37+
"Fn::GetAtt": [
38+
"MinimalFunctionVersion5346b7b9b0",
39+
"Version"
40+
]
41+
},
42+
"Name": "live"
43+
},
44+
"Type": "AWS::Lambda::Alias"
45+
},
46+
"MinimalFunctionRole": {
47+
"Properties": {
48+
"AssumeRolePolicyDocument": {
49+
"Statement": [
50+
{
51+
"Action": [
52+
"sts:AssumeRole"
53+
],
54+
"Effect": "Allow",
55+
"Principal": {
56+
"Service": [
57+
"lambda.amazonaws.com"
58+
]
59+
}
60+
}
61+
],
62+
"Version": "2012-10-17"
63+
},
64+
"ManagedPolicyArns": [
65+
"arn:aws-cn:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
66+
],
67+
"Tags": [
68+
{
69+
"Key": "lambda:createdBy",
70+
"Value": "SAM"
71+
}
72+
]
73+
},
74+
"Type": "AWS::IAM::Role"
75+
},
76+
"MinimalFunctionVersion5346b7b9b0": {
77+
"DeletionPolicy": "Retain",
78+
"Properties": {
79+
"Description": "sam-testing",
80+
"FunctionName": {
81+
"Ref": "MinimalFunction"
82+
}
83+
},
84+
"Type": "AWS::Lambda::Version"
85+
},
86+
"TestEnvLayerd122689ed9": {
87+
"DeletionPolicy": "Retain",
88+
"Properties": {
89+
"Content": {
90+
"S3Bucket": "bucket",
91+
"S3Key": "key"
92+
},
93+
"Description": "Dependencies for test env implementation",
94+
"LayerName": "test-env-dependencies"
95+
},
96+
"Type": "AWS::Lambda::LayerVersion"
97+
}
98+
}
99+
}
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
{
2+
"Resources": {
3+
"MinimalFunction": {
4+
"Properties": {
5+
"Code": {
6+
"S3Bucket": "sam-demo-bucket",
7+
"S3Key": "hello.zip"
8+
},
9+
"Handler": "hello.handler",
10+
"Layers": [
11+
{
12+
"Ref": "TestEnvLayer856c65a2ec"
13+
}
14+
],
15+
"Role": {
16+
"Fn::GetAtt": [
17+
"MinimalFunctionRole",
18+
"Arn"
19+
]
20+
},
21+
"Runtime": "python3.10",
22+
"Tags": [
23+
{
24+
"Key": "lambda:createdBy",
25+
"Value": "SAM"
26+
}
27+
]
28+
},
29+
"Type": "AWS::Lambda::Function"
30+
},
31+
"MinimalFunctionAliaslive": {
32+
"Properties": {
33+
"FunctionName": {
34+
"Ref": "MinimalFunction"
35+
},
36+
"FunctionVersion": {
37+
"Fn::GetAtt": [
38+
"MinimalFunctionVersion046dad86da",
39+
"Version"
40+
]
41+
},
42+
"Name": "live"
43+
},
44+
"Type": "AWS::Lambda::Alias"
45+
},
46+
"MinimalFunctionRole": {
47+
"Properties": {
48+
"AssumeRolePolicyDocument": {
49+
"Statement": [
50+
{
51+
"Action": [
52+
"sts:AssumeRole"
53+
],
54+
"Effect": "Allow",
55+
"Principal": {
56+
"Service": [
57+
"lambda.amazonaws.com"
58+
]
59+
}
60+
}
61+
],
62+
"Version": "2012-10-17"
63+
},
64+
"ManagedPolicyArns": [
65+
"arn:aws-cn:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
66+
],
67+
"Tags": [
68+
{
69+
"Key": "lambda:createdBy",
70+
"Value": "SAM"
71+
}
72+
]
73+
},
74+
"Type": "AWS::IAM::Role"
75+
},
76+
"MinimalFunctionVersion046dad86da": {
77+
"DeletionPolicy": "Retain",
78+
"Properties": {
79+
"Description": "sam-testing",
80+
"FunctionName": {
81+
"Ref": "MinimalFunction"
82+
}
83+
},
84+
"Type": "AWS::Lambda::Version"
85+
},
86+
"TestEnvLayer856c65a2ec": {
87+
"DeletionPolicy": "Retain",
88+
"Properties": {
89+
"Content": {
90+
"S3Bucket": "bucket",
91+
"S3Key": "key"
92+
},
93+
"Description": "Dependencies for test env implementation",
94+
"LayerName": "test-env-dependencies"
95+
},
96+
"Type": "AWS::Lambda::LayerVersion"
97+
}
98+
}
99+
}
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
{
2+
"Resources": {
3+
"MinimalFunction": {
4+
"Properties": {
5+
"Code": {
6+
"S3Bucket": "sam-demo-bucket",
7+
"S3Key": "hello.zip"
8+
},
9+
"Handler": "hello.handler",
10+
"Layers": [
11+
{
12+
"Ref": "TestEnvLayerd122689ed9"
13+
}
14+
],
15+
"Role": {
16+
"Fn::GetAtt": [
17+
"MinimalFunctionRole",
18+
"Arn"
19+
]
20+
},
21+
"Runtime": "python3.10",
22+
"Tags": [
23+
{
24+
"Key": "lambda:createdBy",
25+
"Value": "SAM"
26+
}
27+
]
28+
},
29+
"Type": "AWS::Lambda::Function"
30+
},
31+
"MinimalFunctionAliaslive": {
32+
"Properties": {
33+
"FunctionName": {
34+
"Ref": "MinimalFunction"
35+
},
36+
"FunctionVersion": {
37+
"Fn::GetAtt": [
38+
"MinimalFunctionVersion5346b7b9b0",
39+
"Version"
40+
]
41+
},
42+
"Name": "live"
43+
},
44+
"Type": "AWS::Lambda::Alias"
45+
},
46+
"MinimalFunctionRole": {
47+
"Properties": {
48+
"AssumeRolePolicyDocument": {
49+
"Statement": [
50+
{
51+
"Action": [
52+
"sts:AssumeRole"
53+
],
54+
"Effect": "Allow",
55+
"Principal": {
56+
"Service": [
57+
"lambda.amazonaws.com"
58+
]
59+
}
60+
}
61+
],
62+
"Version": "2012-10-17"
63+
},
64+
"ManagedPolicyArns": [
65+
"arn:aws-us-gov:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
66+
],
67+
"Tags": [
68+
{
69+
"Key": "lambda:createdBy",
70+
"Value": "SAM"
71+
}
72+
]
73+
},
74+
"Type": "AWS::IAM::Role"
75+
},
76+
"MinimalFunctionVersion5346b7b9b0": {
77+
"DeletionPolicy": "Retain",
78+
"Properties": {
79+
"Description": "sam-testing",
80+
"FunctionName": {
81+
"Ref": "MinimalFunction"
82+
}
83+
},
84+
"Type": "AWS::Lambda::Version"
85+
},
86+
"TestEnvLayerd122689ed9": {
87+
"DeletionPolicy": "Retain",
88+
"Properties": {
89+
"Content": {
90+
"S3Bucket": "bucket",
91+
"S3Key": "key"
92+
},
93+
"Description": "Dependencies for test env implementation",
94+
"LayerName": "test-env-dependencies"
95+
},
96+
"Type": "AWS::Lambda::LayerVersion"
97+
}
98+
}
99+
}

0 commit comments

Comments
 (0)