Skip to content

Commit

Permalink
Add integration tests for AZ schema changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kddejong committed Sep 4, 2024
1 parent 466004b commit f4218cb
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
1 change: 1 addition & 0 deletions scripts/update_snapshot_results.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
cfn-lint test/fixtures/templates/integration/dynamic-references.yaml -e -c I --format json > test/fixtures/results/integration/dynamic-references.json
cfn-lint test/fixtures/templates/integration/resources-cloudformation-init.yaml -e -c I --format json > test/fixtures/results/integration/resources-cloudformation-init.json
cfn-lint test/fixtures/templates/integration/ref-no-value.yaml -e -c I --format json > test/fixtures/results/integration/ref-no-value.json
cfn-lint test/fixtures/templates/integration/availability-zones.yaml -e -c I --format json > test/fixtures/results/integration/availability-zones.json

# public/
cfn-lint test/fixtures/templates/public/lambda-poller.yaml -e -c I --format json > test/fixtures/results/public/lambda-poller.json
Expand Down
31 changes: 31 additions & 0 deletions test/fixtures/results/integration/availability-zones.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[
{
"Filename": "test/fixtures/templates/integration/availability-zones.yaml",
"Id": "8a77041b-02f1-a6f8-5b2d-0f586e1a3d12",
"Level": "Error",
"Location": {
"End": {
"ColumnNumber": 12,
"LineNumber": 11
},
"Path": [
"Resources",
"Subnet",
"Properties",
"VpcId"
],
"Start": {
"ColumnNumber": 7,
"LineNumber": 11
}
},
"Message": "'vpc-abc123' is not a 'AWS::EC2::VPC.Id'",
"ParentId": null,
"Rule": {
"Description": "Check that a VPC id matches a pattern",
"Id": "E1151",
"ShortDescription": "Validate VPC id format",
"Source": "https://github.com/aws-cloudformation/cfn-lint/blob/main/docs/format_keyword.md#AWS::EC2::VPC.Id"
}
}
]
12 changes: 12 additions & 0 deletions test/fixtures/templates/integration/availability-zones.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
AWSTemplateFormatVersion: '2010-09-09'
Resources:
Subnet:
Properties:
AvailabilityZoneId: use1-az1
AvailabilityZone:
Fn::Select:
- 0
- Fn::GetAZs: ""
CidrBlock: 10.0.0.0/20
VpcId: vpc-abc123
Type: "AWS::EC2::Subnet"
7 changes: 7 additions & 0 deletions test/integration/test_integration_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ class TestQuickStartTemplates(BaseCliTestCase):
"results_filename": ("test/fixtures/results/integration/metadata.json"),
"exit_code": 4,
},
{
"filename": ("test/fixtures/templates/integration/availability-zones.yaml"),
"results_filename": (
"test/fixtures/results/integration/availability-zones.json"
),
"exit_code": 2,
},
]

def test_templates(self):
Expand Down

0 comments on commit f4218cb

Please sign in to comment.