Skip to content

Commit 6b6d93b

Browse files
committed
test(golden): regenerate sentinel pins to match real BuildContext output
Five sentinel pins now reflect what real ``sam build`` and ``sam package`` write to disk: - ``sam_resources/serverless_function_zip/expected.build.yaml`` now contains ``AWS::Serverless::Function`` (no SAM transform), with ``CodeUri: <<BUILT_ARTIFACT>>`` and a SAM-CLI-added ``Metadata.SamResourceId``. The pre-existing auto-generated ``HelloFunctionRole`` is gone (the SAM transform runs server-side at deploy time, not at build time). - ``sam_resources/serverless_function_zip/expected.package.yaml`` preserves the same shape, with ``CodeUri`` rewritten to ``s3://golden-bucket/<sha>``. - ``packageable_resources/lambda_function_zip/expected.build.yaml`` now carries ``Metadata.SamResourceId`` (added by SAM CLI's stack provider for raw CFN Lambdas, too). - ``packageable_resources/lambda_function_zip/expected.package.yaml`` carries the same metadata; ``Code`` becomes the ``{S3Bucket, S3Key}`` dict shape that real ``sam package`` emits. - ``language_extensions/foreach_static_zip/expected.package.yaml`` digest changes because the package URI is now content-addressed over the harness's sentinel placeholder file (whose content is the resource full path) rather than a synthesized hash. ``Fn::ForEach`` preservation is unchanged.
1 parent 24b32b2 commit 6b6d93b

5 files changed

Lines changed: 16 additions & 56 deletions

File tree

tests/golden/templates/language_extensions/foreach_static_zip/expected.package.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Resources:
66
- Beta
77
- ${WorkerName}Function:
88
Properties:
9-
CodeUri: s3://golden-bucket/a199f4d73e5f32885341a8e279ab4d1ece42eebb187c5cde13ecbb95bcf49481
9+
CodeUri: s3://golden-bucket/dd2bf2d87ad97f55f64a8691a0e0c55ec010e7791d6815e0c0f0037348b8d5db
1010
Handler: app.handler
1111
Runtime: python3.11
1212
Type: AWS::Serverless::Function

tests/golden/templates/packageable_resources/lambda_function_zip/expected.build.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
AWSTemplateFormatVersion: '2010-09-09'
22
Resources:
33
HelloFunction:
4+
Metadata:
5+
SamResourceId: HelloFunction
46
Properties:
57
Code: <<BUILT_ARTIFACT>>
68
FunctionName: hello

tests/golden/templates/packageable_resources/lambda_function_zip/expected.package.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
AWSTemplateFormatVersion: '2010-09-09'
22
Resources:
33
HelloFunction:
4+
Metadata:
5+
SamResourceId: HelloFunction
46
Properties:
57
Code:
68
S3Bucket: golden-bucket
7-
S3Key: 17c3a49c87d6d228b7f4e7b016472d9da14ad548c986f67d3cc3c42365dabcf4
9+
S3Key: 7187d20310f5514ad6d32ad02c3f6a8200a0b82949bcb4c63a751bc4ce730095
810
FunctionName: hello
911
Handler: app.handler
1012
MemorySize: 128
Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,12 @@
11
AWSTemplateFormatVersion: '2010-09-09'
22
Resources:
33
HelloFunction:
4+
Metadata:
5+
SamResourceId: HelloFunction
46
Properties:
5-
Code: <<BUILT_ARTIFACT>>
7+
CodeUri: <<BUILT_ARTIFACT>>
68
Handler: app.handler
79
MemorySize: 128
8-
Role:
9-
Fn::GetAtt:
10-
- HelloFunctionRole
11-
- Arn
1210
Runtime: python3.11
13-
Tags:
14-
- Key: lambda:createdBy
15-
Value: SAM
16-
Type: AWS::Lambda::Function
17-
HelloFunctionRole:
18-
Properties:
19-
AssumeRolePolicyDocument:
20-
Statement:
21-
- Action:
22-
- sts:AssumeRole
23-
Effect: Allow
24-
Principal:
25-
Service:
26-
- lambda.amazonaws.com
27-
Version: '2012-10-17'
28-
ManagedPolicyArns:
29-
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
30-
Tags:
31-
- Key: lambda:createdBy
32-
Value: SAM
33-
Type: AWS::IAM::Role
11+
Type: AWS::Serverless::Function
12+
Transform: AWS::Serverless-2016-10-31
Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,12 @@
11
AWSTemplateFormatVersion: '2010-09-09'
22
Resources:
33
HelloFunction:
4+
Metadata:
5+
SamResourceId: HelloFunction
46
Properties:
5-
Code:
6-
S3Bucket: golden-bucket
7-
S3Key: 17c3a49c87d6d228b7f4e7b016472d9da14ad548c986f67d3cc3c42365dabcf4
7+
CodeUri: s3://golden-bucket/7187d20310f5514ad6d32ad02c3f6a8200a0b82949bcb4c63a751bc4ce730095
88
Handler: app.handler
99
MemorySize: 128
10-
Role:
11-
Fn::GetAtt:
12-
- HelloFunctionRole
13-
- Arn
1410
Runtime: python3.11
15-
Tags:
16-
- Key: lambda:createdBy
17-
Value: SAM
18-
Type: AWS::Lambda::Function
19-
HelloFunctionRole:
20-
Properties:
21-
AssumeRolePolicyDocument:
22-
Statement:
23-
- Action:
24-
- sts:AssumeRole
25-
Effect: Allow
26-
Principal:
27-
Service:
28-
- lambda.amazonaws.com
29-
Version: '2012-10-17'
30-
ManagedPolicyArns:
31-
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
32-
Tags:
33-
- Key: lambda:createdBy
34-
Value: SAM
35-
Type: AWS::IAM::Role
11+
Type: AWS::Serverless::Function
12+
Transform: AWS::Serverless-2016-10-31

0 commit comments

Comments
 (0)