Merge pull request #2387 from oman36/issues-2386-queues-with-different-ApproximateNumberOfMessages

issues-2386 make comparing exists and new queues only by static attrs
This commit is contained in:
Steve Pulec 2019-09-11 21:42:12 -05:00 committed by GitHub
commit b2fddf8469
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -424,13 +424,26 @@ class SQSBackend(BaseBackend):
queue_attributes = 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 ['CreatedTimestamp', 'LastModifiedTimestamp']:
queue_attributes.pop(key)
new_queue_attributes.pop(key)
if queue_attributes != new_queue_attributes:
raise QueueAlreadyExists("The specified queue already exists.")
for key in static_attributes:
if queue_attributes.get(key) != new_queue_attributes.get(key):
raise QueueAlreadyExists(
"The specified queue already exists.",
)
else:
try:
kwargs.pop('region')