Skip to content
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

Add test for setting SQS DLQ MessageRetentionPeriod #1772

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions tests/test_aws_sns_sqs_service_dead_letter_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import pytest

from run_test_service_helper import start_service
from tomodachi.transport.aws_sns_sqs import connector


@pytest.mark.skipif(
Expand All @@ -32,6 +33,24 @@ async def _async(loop: Any) -> None:
assert instance.test_topic_data_received_count == 3
assert instance.test_dlq_data_received_after_count == 3

async with connector("tomodachi.sqs", service_name="sqs") as sqs_client:
dlq_name = "test-queue-dlq-{}".format(instance.data_uuid)
response = await sqs_client.get_queue_url(QueueName=dlq_name)
dlq_url = response.get("QueueUrl")
response = await sqs_client.get_queue_attributes(
QueueUrl=dlq_url,
AttributeNames=[
"VisibilityTimeout",
"MessageRetentionPeriod",
],
)
dlq_attributes = response.get("Attributes", {})

assert dlq_attributes == {
"VisibilityTimeout": "30",
"MessageRetentionPeriod": "1209600", # 14 days
}

loop.run_until_complete(_async(loop))
instance.stop_service()
loop.run_until_complete(future)