Skip to content

Commit 4e2d32e

Browse files
Merge branch 'junior/aws-lambda-trigger' into junior/aws-lambda-queue-process
# Conflicts: # tests/integrations/aws_lambda/test_aws_lambda.py
2 parents 4aad837 + 61c3b58 commit 4e2d32e

1 file changed

Lines changed: 36 additions & 27 deletions

File tree

‎tests/integrations/aws_lambda/test_aws_lambda.py‎

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,32 @@
2828
SPANDATA.SENTRY_LINK_TYPE: {"value": "message_origin", "type": "string"}
2929
}
3030

31+
SQS_RECORD = {
32+
"messageId": "059f36b4-87a3-44ab-83d2-661975830a7d",
33+
"body": "{}",
34+
"eventSource": "aws:sqs",
35+
"eventSourceARN": "arn:aws:sqs:us-east-1:012345678912:orders",
36+
}
37+
SNS_RECORD = {
38+
"EventSource": "aws:sns",
39+
"Sns": {"TopicArn": "arn:aws:sns:us-east-1:012345678912:alerts"},
40+
}
41+
APPSYNC_EVENT = {
42+
"arguments": {"id": "1"},
43+
"info": {"fieldName": "getOrder", "parentTypeName": "Query"},
44+
}
45+
EVENTBRIDGE_EVENT = {
46+
"version": "0",
47+
"id": "53dc4d37-cffa-4f76-80c9-8b7d4a4d2eaa",
48+
"detail-type": "Object Created",
49+
"source": "aws.s3",
50+
"account": "012345678912",
51+
"time": "2026-10-26T12:00:00Z",
52+
"region": "us-east-1",
53+
"resources": [],
54+
"detail": {},
55+
}
56+
3157

3258
@pytest.fixture(scope="session", autouse=True)
3359
def test_environment():
@@ -864,27 +890,6 @@ def _sns_record(sentry_trace=None):
864890
return record
865891

866892

867-
def _appsync_event():
868-
return {
869-
"arguments": {"id": "1"},
870-
"info": {"fieldName": "getOrder", "parentTypeName": "Query"},
871-
}
872-
873-
874-
def _eventbridge_event(source, detail_type):
875-
return {
876-
"version": "0",
877-
"id": "53dc4d37-cffa-4f76-80c9-8b7d4a4d2eaa",
878-
"detail-type": detail_type,
879-
"source": source,
880-
"account": "012345678912",
881-
"time": "2026-10-26T12:00:00Z",
882-
"region": "us-east-1",
883-
"resources": [],
884-
"detail": {},
885-
}
886-
887-
888893
@pytest.mark.parametrize(
889894
"aws_event,trigger",
890895
[
@@ -907,22 +912,26 @@ def _eventbridge_event(source, detail_type):
907912
"http",
908913
id="cloudfront",
909914
),
910-
pytest.param(_appsync_event(), "http", id="appsync"),
911-
pytest.param([_appsync_event(), _appsync_event()], "http", id="appsync-batch"),
912-
pytest.param({"Records": [_sqs_record(), _sqs_record()]}, "pubsub", id="sqs"),
913-
pytest.param({"Records": [_sns_record()]}, "pubsub", id="sns"),
915+
pytest.param(APPSYNC_EVENT, "http", id="appsync"),
916+
pytest.param([APPSYNC_EVENT, APPSYNC_EVENT], "http", id="appsync-batch"),
917+
pytest.param({"Records": [SQS_RECORD, SQS_RECORD]}, "pubsub", id="sqs"),
918+
pytest.param({"Records": [SNS_RECORD]}, "pubsub", id="sns"),
914919
pytest.param(
915920
{"eventSource": "aws:kafka", "records": {"orders-0": [{}]}},
916921
"pubsub",
917922
id="msk",
918923
),
919924
pytest.param(
920-
_eventbridge_event("aws.s3", "Object Created"),
925+
EVENTBRIDGE_EVENT,
921926
"pubsub",
922927
id="eventbridge",
923928
),
924929
pytest.param(
925-
_eventbridge_event("aws.events", "Scheduled Event"),
930+
{
931+
**EVENTBRIDGE_EVENT,
932+
"source": "aws.events",
933+
"detail-type": "Scheduled Event",
934+
},
926935
"timer",
927936
id="eventbridge-schedule",
928937
),

0 commit comments

Comments
 (0)