fix: broad catch statement for failedInvalidDelay (#6721)
Co-authored-by: Adrian Mlodzianowski <amlodzianowski@logicworks.net>
This commit is contained in:
parent
3cf4f6315b
commit
873bc9cf1a
@ -912,8 +912,11 @@ class SQSBackend(BaseBackend):
|
|||||||
)
|
)
|
||||||
message.user_id = entry["Id"] # type: ignore[attr-defined]
|
message.user_id = entry["Id"] # type: ignore[attr-defined]
|
||||||
messages.append(message)
|
messages.append(message)
|
||||||
except InvalidParameterValue:
|
except InvalidParameterValue as err:
|
||||||
|
if "DelaySeconds is invalid" in str(err):
|
||||||
failedInvalidDelay.append(entry)
|
failedInvalidDelay.append(entry)
|
||||||
|
else:
|
||||||
|
raise err
|
||||||
|
|
||||||
return messages, failedInvalidDelay
|
return messages, failedInvalidDelay
|
||||||
|
|
||||||
|
@ -3273,3 +3273,37 @@ def test_fifo_dedupe_error_no_message_dedupe_id():
|
|||||||
"The queue should either have ContentBasedDeduplication enabled "
|
"The queue should either have ContentBasedDeduplication enabled "
|
||||||
"or MessageDeduplicationId provided explicitly"
|
"or MessageDeduplicationId provided explicitly"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@mock_sqs
|
||||||
|
def test_fifo_dedupe_error_no_message_dedupe_id_batch():
|
||||||
|
client = boto3.client("sqs", region_name="us-east-1")
|
||||||
|
response = client.create_queue(
|
||||||
|
QueueName=f"{str(uuid4())[0:6]}.fifo", Attributes={"FifoQueue": "true"}
|
||||||
|
)
|
||||||
|
queue_url = response["QueueUrl"]
|
||||||
|
with pytest.raises(ClientError) as exc:
|
||||||
|
client.send_message_batch(
|
||||||
|
QueueUrl=queue_url,
|
||||||
|
Entries=[
|
||||||
|
{
|
||||||
|
"Id": "id_1",
|
||||||
|
"MessageBody": "body_1",
|
||||||
|
"DelaySeconds": 0,
|
||||||
|
"MessageGroupId": "message_group_id_1",
|
||||||
|
"MessageDeduplicationId": "message_deduplication_id_1",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Id": "id_2",
|
||||||
|
"MessageBody": "body_2",
|
||||||
|
"DelaySeconds": 0,
|
||||||
|
"MessageGroupId": "message_group_id_2",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
assert exc.value.response["Error"]["Code"] == "InvalidParameterValue"
|
||||||
|
assert exc.value.response["Error"]["Message"] == (
|
||||||
|
"The queue should either have ContentBasedDeduplication enabled "
|
||||||
|
"or MessageDeduplicationId provided explicitly"
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user