8000 Apply suggestions from code review · localstack/localstack@818d70d · GitHub
[go: up one dir, main page]

Skip to content

Commit 818d70d

Browse files
Apply suggestions from code review
Co-authored-by: Dominik Schubert <dominik.schubert91@gmail.com>
1 parent be4914e commit 818d70d

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

tests/integration/awslambda/functions/lambda_sqs_integration.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
def handler(event, context):
2020
# this lambda expects inputs from an SQS event source mapping
21-
if not event.get("Records"):
22-
raise ValueError("no records passed to event")
21+
if len(event.get("Records", [])) != 1:
22+
raise ValueError("the payload must consist of exactly one record")
2323

2424
# it expects exactly one record where the message body is '{"destination": "<queue_url>"}' that mimics a
2525
# DestinationConfig (which is not possible with SQS event source mappings).
@@ -49,7 +49,4 @@ def create_external_boto_client(service):
4949
endpoint_url = (
5050
f"http://{os.environ['LOCALSTACK_HOSTNAME']}:{os.environ.get('EDGE_PORT', 4566)}"
5151
)
52-
region_name = (
53-
os.environ.get("AWS_DEFAULT_REGION") or os.environ.get("AWS_REGION") or "us-east-1"
54-
)
55-
return boto3.client(service, endpoint_url=endpoint_url, region_name=region_name)
52+
return boto3.client(service, endpoint_url=endpoint_url)

tests/integration/awslambda/test_lambda_sqs_integration.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ def test_failing_lambda_retries_after_visibility_timeout(
137137

138138
@pytest.mark.skip_snapshot_verify(
139139
paths=[
140-
# FIXME: this is most of the event source mapping unfortunately
141140
"$..ParallelizationFactor",
142141
"$..LastProcessingResult",
143142
"$..Topics",
@@ -158,9 +157,9 @@ def test_redrive_policy_with_failing_lambda(
158157
snapshot,
159158
cleanups,
160159
):
161-
"""This test verifies a that SQS moves a message that is passed to a failing lambda to a DLQ according to the
160+
"""This test verifies that SQS moves a message that is passed to a failing lambda to a DLQ according to the
162161
redrive policy, and the lambda is invoked the correct number of times. The test retries twice and the event
163-
source mapping should then automatically move the message to the DQL, but not earlier (see
162+
source mapping should then automatically move the message to the DLQ, but not earlier (see
164163
https://github.com/localstack/localstack/issues/5283)"""
165164

166165
# create queue used in the lambda to send events to (to verify lambda was invoked)

0 commit comments

Comments
 (0)
0