From 375b379ab55c668999ba5e391577e339a99c5a2c Mon Sep 17 00:00:00 2001 From: Sannya Singal <32308435+sannya-singal@users.noreply.github.com> Date: Sat, 21 Oct 2023 00:13:53 +0530 Subject: [PATCH] add multi account support to failing tests in apigateway-sqs integration (#9416) --- localstack/utils/aws/resources.py | 4 ---- tests/aws/services/apigateway/test_apigateway_sqs.py | 8 ++++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/localstack/utils/aws/resources.py b/localstack/utils/aws/resources.py index c0ed8028fff7a..3923cce6ca725 100644 --- a/localstack/utils/aws/resources.py +++ b/localstack/utils/aws/resources.py @@ -7,10 +7,6 @@ from localstack.utils.sync import poll_condition -def create_sqs_queue(queue_name): - return connect_to().sqs.create_queue(QueueName=queue_name) - - # TODO: make s3_client mandatory def get_or_create_bucket(bucket_name: str, s3_client=None): s3_client = s3_client or connect_to().s3 diff --git a/tests/aws/services/apigateway/test_apigateway_sqs.py b/tests/aws/services/apigateway/test_apigateway_sqs.py index 148b6e1ce6ffb..36d7038ffd9db 100644 --- a/tests/aws/services/apigateway/test_apigateway_sqs.py +++ b/tests/aws/services/apigateway/test_apigateway_sqs.py @@ -8,7 +8,6 @@ from localstack.services.apigateway.helpers import connect_api_gateway_to_sqs, path_based_url from localstack.testing.pytest import markers from localstack.utils.aws import queries -from localstack.utils.aws import resources as resource_util from localstack.utils.strings import short_uid, to_str from localstack.utils.sync import retry from localstack.utils.xml import is_valid_xml @@ -18,10 +17,10 @@ @markers.aws.unknown -def test_api_gateway_sqs_integration(aws_client): +def test_api_gateway_sqs_integration(aws_client, sqs_create_queue, sqs_get_queue_arn): # create target SQS stream queue_name = f"queue-{short_uid()}" - resource_util.create_sqs_queue(queue_name) + sqs_create_queue(QueueName=queue_name) # create API Gateway and connect it to the target queue result = connect_api_gateway_to_sqs( @@ -44,7 +43,8 @@ def test_api_gateway_sqs_integration(aws_client): result = requests.post(url, data=json.dumps(test_data)) assert 200 == result.status_code - messages = queries.sqs_receive_message(queue_name)["Messages"] + queue_arn = sqs_get_queue_arn(queue_name) + messages = queries.sqs_receive_message(queue_arn)["Messages"] assert 1 == len(messages) assert test_data == json.loads(base64.b64decode(messages[0]["Body"]))