-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
validate attributes when creating SQS queues #10820
Conversation
LocalStack Community integration with Pro 2 files ± 0 2 suites ±0 1h 38m 11s ⏱️ + 1m 38s Results for commit d1d34d1. ± Comparison against base commit 3c4c463. This pull request removes 12 and adds 25 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will let the service owner(s) comment on the SQS changes, but the CFn changes look good to me. Just a non-critical suggestion for the future
Conditions: | ||
IsFifo: !Equals [ {{ is_fifo }}, "true"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: this could be a CloudFormation parameter, rather than relying on our string interpolation:
Conditions: | |
IsFifo: !Equals [ {{ is_fifo }}, "true"] | |
Parameters: | |
IsFifo: | |
Type: String | |
Conditions: | |
IsFifo: !Equals [ !Ref IsFifo, "true"] |
then deploy with
result = deploy_cfn_template(
template_path=os.path.join(
os.path.dirname(__file__), "../../../templates/sqs_fifo_autogenerate_name.yaml"
),
parameters={"IsFifo": "false"},
max_wait=240,
)
Annoyingly CFn parameters cannot be booleans 🤦
@@ -33,8 +33,7 @@ def test_sqs_fifo_queue_generates_valid_name(deploy_cfn_template): | |||
assert ".fifo" in result.outputs["FooQueueName"] | |||
|
|||
|
|||
# FIXME: doesn't work on AWS. (known bug in cloudformation: https://github.com/aws-cloudformation/cloudformation-coverage-roadmap/issues/165) | |||
@markers.aws.unknown | |||
@markers.aws.validated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woo! 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 thanks for tackling this :)
valid = [ | ||
k[1] | ||
for k in inspect.getmembers( | ||
QueueAttributeName, lambda x: isinstance(x, str) and not x.startswith("__") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
purely curious, what's the reasoning behind the startswith clause, which attributes are weeded out here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_members
returns all of the members and dunder methods, after filtering for str
, I believe it is __name__
that was left.
Motivation
Looking into issue #10812, I realised that the attributes were not being validated at queue creation.
While the documentation does mention
false
as an appropriate value for this attribute, reports are dating back 2017 that providing it results inAttributeNameError
.Changes
The method
validate_queue_attributes
was already enforcing this behaviour but it wasn't called when originally creating the queue.A test for fifo queue attributes is also now fixed. 😄
fix #10812