Skip to content

Commit 6925b81

Browse files
committed
Fix SQS list queues with empty response
1 parent da9b863 commit 6925b81

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

localstack/services/sqs/provider.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,9 @@ def list_queues(
771771
# NextToken response element directly outside of the AWS CLI.
772772
urls = urls[:max_results]
773773

774+
if len(urls) == 0:
775+
return ListQueuesResult()
776+
774777
return ListQueuesResult(QueueUrls=urls)
775778

776779
def change_message_visibility(

tests/aws/services/sqs/test_sqs.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ def test_list_queues(self, sqs_create_queue, aws_client):
130130
for url in queue_urls:
131131
assert url in result["QueueUrls"]
132132

133+
# list queues with empty result
134+
result = aws_client.sqs.list_queues(QueueNamePrefix="nonexisting-queue-")
135+
assert "QueueUrls" not in result
136+
133137
@markers.aws.validated
134138
def test_create_queue_and_get_attributes(self, sqs_queue, aws_client):
135139
result = aws_client.sqs.get_queue_attributes(

tests/aws/services/sqs/test_sqs.snapshot.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@
850850
"recorded-content": {}
851851
},
852852
"tests/aws/services/sqs/test_sqs.py::TestSqsProvider::test_list_queues": {
853-
"recorded-date": "14-11-2023, 11:57:28",
853+
"recorded-date": "08-12-2023, 17:13:26",
854854
"recorded-content": {}
855855
},
856856
"tests/aws/services/sqs/test_sqs.py::TestSqsProvider::test_fifo_set_content_based_deduplication_strategy": {

0 commit comments

Comments
 (0)