Fix : SQS Create Queue with attributes (#3345)
* Considering only new attributes while queue creation * Linting Co-authored-by: usmankb <usman@krazybee.com> Co-authored-by: Bert Blommers <info@bertblommers.nl>
This commit is contained in:
parent
1dd5cf08a8
commit
1c3ba83fc2
@ -545,22 +545,10 @@ class SQSBackend(BaseBackend):
|
|||||||
|
|
||||||
queue_attributes = queue.attributes
|
queue_attributes = queue.attributes
|
||||||
new_queue_attributes = new_queue.attributes
|
new_queue_attributes = new_queue.attributes
|
||||||
static_attributes = (
|
|
||||||
"DelaySeconds",
|
|
||||||
"MaximumMessageSize",
|
|
||||||
"MessageRetentionPeriod",
|
|
||||||
"Policy",
|
|
||||||
"QueueArn",
|
|
||||||
"ReceiveMessageWaitTimeSeconds",
|
|
||||||
"RedrivePolicy",
|
|
||||||
"VisibilityTimeout",
|
|
||||||
"KmsMasterKeyId",
|
|
||||||
"KmsDataKeyReusePeriodSeconds",
|
|
||||||
"FifoQueue",
|
|
||||||
"ContentBasedDeduplication",
|
|
||||||
)
|
|
||||||
|
|
||||||
for key in static_attributes:
|
# only the attributes which are being sent for the queue
|
||||||
|
# creation have to be compared if the queue is existing.
|
||||||
|
for key in kwargs:
|
||||||
if queue_attributes.get(key) != new_queue_attributes.get(key):
|
if queue_attributes.get(key) != new_queue_attributes.get(key):
|
||||||
raise QueueAlreadyExists("The specified queue already exists.")
|
raise QueueAlreadyExists("The specified queue already exists.")
|
||||||
else:
|
else:
|
||||||
|
@ -89,6 +89,18 @@ def test_create_queue_with_different_attributes_fail():
|
|||||||
else:
|
else:
|
||||||
raise RuntimeError("Should of raised QueueAlreadyExists Exception")
|
raise RuntimeError("Should of raised QueueAlreadyExists Exception")
|
||||||
|
|
||||||
|
response = sqs.create_queue(
|
||||||
|
QueueName="test-queue1", Attributes={"FifoQueue": "True"}
|
||||||
|
)
|
||||||
|
|
||||||
|
attributes = {"VisibilityTimeout": "60"}
|
||||||
|
sqs.set_queue_attributes(QueueUrl=response.get("QueueUrl"), Attributes=attributes)
|
||||||
|
|
||||||
|
new_response = sqs.create_queue(
|
||||||
|
QueueName="test-queue1", Attributes={"FifoQueue": "True"}
|
||||||
|
)
|
||||||
|
new_response["QueueUrl"].should.equal(response.get("QueueUrl"))
|
||||||
|
|
||||||
|
|
||||||
@mock_sqs
|
@mock_sqs
|
||||||
def test_create_fifo_queue():
|
def test_create_fifo_queue():
|
||||||
|
Loading…
Reference in New Issue
Block a user