Skip to content

Commit 31d4036

Browse files
authored
Add integration tests for AZ schema changes (#3655)
1 parent e6eb757 commit 31d4036

File tree

4 files changed

+80
-0
lines changed

4 files changed

+80
-0
lines changed

scripts/update_snapshot_results.sh

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
cfn-lint test/fixtures/templates/integration/dynamic-references.yaml -e -c I --format json > test/fixtures/results/integration/dynamic-references.json
55
cfn-lint test/fixtures/templates/integration/resources-cloudformation-init.yaml -e -c I --format json > test/fixtures/results/integration/resources-cloudformation-init.json
66
cfn-lint test/fixtures/templates/integration/ref-no-value.yaml -e -c I --format json > test/fixtures/results/integration/ref-no-value.json
7+
cfn-lint test/fixtures/templates/integration/availability-zones.yaml -e -c I --format json > test/fixtures/results/integration/availability-zones.json
78

89
# public/
910
cfn-lint test/fixtures/templates/public/lambda-poller.yaml -e -c I --format json > test/fixtures/results/public/lambda-poller.json
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
[
2+
{
3+
"Filename": "test/fixtures/templates/integration/availability-zones.yaml",
4+
"Id": "5ed67959-64ec-2c99-379b-b9c9cc0afea2",
5+
"Level": "Error",
6+
"Location": {
7+
"End": {
8+
"ColumnNumber": 25,
9+
"LineNumber": 5
10+
},
11+
"Path": [
12+
"Resources",
13+
"Subnet",
14+
"Properties",
15+
"AvailabilityZoneId"
16+
],
17+
"Start": {
18+
"ColumnNumber": 7,
19+
"LineNumber": 5
20+
}
21+
},
22+
"Message": "'AvailabilityZoneId' should not be included with 'AvailabilityZone'",
23+
"ParentId": null,
24+
"Rule": {
25+
"Description": "When certain properties are specified other properties should not be included",
26+
"Id": "E3020",
27+
"ShortDescription": "Validate that when a property is specified another property should be excluded",
28+
"Source": "https://github.com/aws-cloudformation/cfn-lint/blob/main/docs/cfn-schema-specification.md#dependentexcluded"
29+
}
30+
},
31+
{
32+
"Filename": "test/fixtures/templates/integration/availability-zones.yaml",
33+
"Id": "de15b593-58fc-a138-446a-c62c4803d10e",
34+
"Level": "Error",
35+
"Location": {
36+
"End": {
37+
"ColumnNumber": 23,
38+
"LineNumber": 6
39+
},
40+
"Path": [
41+
"Resources",
42+
"Subnet",
43+
"Properties",
44+
"AvailabilityZone"
45+
],
46+
"Start": {
47+
"ColumnNumber": 7,
48+
"LineNumber": 6
49+
}
50+
},
51+
"Message": "'AvailabilityZone' should not be included with 'AvailabilityZoneId'",
52+
"ParentId": null,
53+
"Rule": {
54+
"Description": "When certain properties are specified other properties should not be included",
55+
"Id": "E3020",
56+
"ShortDescription": "Validate that when a property is specified another property should be excluded",
57+
"Source": "https://github.com/aws-cloudformation/cfn-lint/blob/main/docs/cfn-schema-specification.md#dependentexcluded"
58+
}
59+
}
60+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
AWSTemplateFormatVersion: '2010-09-09'
2+
Resources:
3+
Subnet:
4+
Properties:
5+
AvailabilityZoneId: use1-az1
6+
AvailabilityZone:
7+
Fn::Select:
8+
- 0
9+
- Fn::GetAZs: ""
10+
CidrBlock: 10.0.0.0/20
11+
VpcId: vpc-abc12345
12+
Type: "AWS::EC2::Subnet"

test/integration/test_integration_templates.py

+7
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ class TestQuickStartTemplates(BaseCliTestCase):
4040
"results_filename": ("test/fixtures/results/integration/metadata.json"),
4141
"exit_code": 4,
4242
},
43+
{
44+
"filename": ("test/fixtures/templates/integration/availability-zones.yaml"),
45+
"results_filename": (
46+
"test/fixtures/results/integration/availability-zones.json"
47+
),
48+
"exit_code": 2,
49+
},
4350
]
4451

4552
def test_templates(self):

0 commit comments

Comments
 (0)