Skip to content

Commit

Permalink
Add integration tests for AZ schema changes (#3655)
Browse files Browse the repository at this point in the history
  • Loading branch information
kddejong authored Sep 4, 2024
1 parent e6eb757 commit 31d4036
Show file tree
Hide file tree
Showing 4 changed files with 80 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
60 changes: 60 additions & 0 deletions test/fixtures/results/integration/availability-zones.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
[
{
"Filename": "test/fixtures/templates/integration/availability-zones.yaml",
"Id": "5ed67959-64ec-2c99-379b-b9c9cc0afea2",
"Level": "Error",
"Location": {
"End": {
"ColumnNumber": 25,
"LineNumber": 5
},
"Path": [
"Resources",
"Subnet",
"Properties",
"AvailabilityZoneId"
],
"Start": {
"ColumnNumber": 7,
"LineNumber": 5
}
},
"Message": "'AvailabilityZoneId' should not be included with 'AvailabilityZone'",
"ParentId": null,
"Rule": {
"Description": "When certain properties are specified other properties should not be included",
"Id": "E3020",
"ShortDescription": "Validate that when a property is specified another property should be excluded",
"Source": "https://github.com/aws-cloudformation/cfn-lint/blob/main/docs/cfn-schema-specification.md#dependentexcluded"
}
},
{
"Filename": "test/fixtures/templates/integration/availability-zones.yaml",
"Id": "de15b593-58fc-a138-446a-c62c4803d10e",
"Level": "Error",
"Location": {
"End": {
"ColumnNumber": 23,
"LineNumber": 6
},
"Path": [
"Resources",
"Subnet",
"Properties",
"AvailabilityZone"
],
"Start": {
"ColumnNumber": 7,
"LineNumber": 6
}
},
"Message": "'AvailabilityZone' should not be included with 'AvailabilityZoneId'",
"ParentId": null,
"Rule": {
"Description": "When certain properties are specified other properties should not be included",
"Id": "E3020",
"ShortDescription": "Validate that when a property is specified another property should be excluded",
"Source": "https://github.com/aws-cloudformation/cfn-lint/blob/main/docs/cfn-schema-specification.md#dependentexcluded"
}
}
]
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-abc12345
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 31d4036

Please sign in to comment.