Skip to content

Commit

Permalink
V1 cleanup tests (#3165)
Browse files Browse the repository at this point in the history
* Fix resource type error message syntax
* Update tests for alphabetic ordering
  • Loading branch information
kddejong committed Apr 25, 2024
1 parent 8c45a89 commit 848e448
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/cfnlint/rules/resources/Type.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def cfnresourcetype(
("Custom::", "AWS::Serverless::")
) and not resource_type.endswith("::MODULE"):
yield ValidationError(
f"Resource type `{resource_type}` does not exist in '{region}'",
f"Resource type {resource_type!r} does not exist in {region!r}",
path=deque(["Type"]),
rule=self,
)
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def validator():
(
{
"Engine": "mysql",
"EngineVersion": "5.7.37",
"EngineVersion": "5.7.44",
},
[],
),
Expand Down Expand Up @@ -74,8 +74,7 @@ def validator():
[
ValidationError(
(
"'foo' is not one of ['5.7.37', '5.7.38', '5.7.39', '5.7.40', "
"'5.7.41', '5.7.42', '5.7.43', '5.7.44', '8.0.28', '8.0.31', "
"'foo' is not one of ['5.7.44', '8.0.28', '8.0.31', "
"'8.0.32', '8.0.33', '8.0.34', '8.0.35', '8.0.36']"
),
rule=DbClusterEngineVersion(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def validator():
"'custom-sqlserver-web', 'db2-ae', 'db2-se', 'mariadb', "
"'mysql', 'oracle-ee', 'oracle-ee-cdb', 'oracle-se2', "
"'oracle-se2-cdb', 'postgres', 'sqlserver-ee', "
"'sqlserver-se', 'sqlserver-ex', 'sqlserver-web']"
"'sqlserver-ex', 'sqlserver-se', 'sqlserver-web']"
),
rule=DbInstanceEngineVersion(),
path=deque(["Engine"]),
Expand All @@ -79,8 +79,7 @@ def validator():
[
ValidationError(
(
"'foo' is not one of ['5.7.37', '5.7.38', '5.7.39', '5.7.40', "
"'5.7.41', '5.7.42', '5.7.43', '5.7.44', '8.0.28', '8.0.31', "
"'foo' is not one of ['5.7.44', '8.0.28', '8.0.31', "
"'8.0.32', '8.0.33', '8.0.34', '8.0.35', '8.0.36']"
),
rule=DbInstanceEngineVersion(),
Expand Down
2 changes: 1 addition & 1 deletion test/unit/rules/resources/test_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_types_with_conditions(self, cfn):
errors,
[
ValidationError(
"Resource type `Foo::Bar::Type` does not exist in 'us-east-1'",
"Resource type 'Foo::Bar::Type' does not exist in 'us-east-1'",
path=deque(["Type"]),
schema_path=deque([]),
rule=Type(),
Expand Down

0 comments on commit 848e448

Please sign in to comment.