Skip to content

Commit d0687a9

Browse files
committed
Base for tests with embedded SDK.
1 parent e64b7b9 commit d0687a9

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Need to add some ignore rules in this directory, because the unit tests will add the Sentry SDK and its dependencies
2+
# into this directory to create a Lambda function package that contains everything needed to instrument a Lambda function using Sentry.
3+
4+
# Ignore everything
5+
*
6+
7+
# But not index.py
8+
!index.py
9+
10+
# And not .gitignore itself
11+
!.gitignore

tests/integrations/aws_lambda/test_aws_lambda.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -453,18 +453,12 @@ def test_span_origin(lambda_client, test_environment):
453453

454454

455455
def test_traces_sampler_has_correct_sampling_context(lambda_client, test_environment):
456-
print("111")
457-
bla = lambda_client.invoke(
456+
lambda_client.invoke(
458457
FunctionName="TracesSampler",
459458
Payload=json.dumps({}),
460459
)
461-
print(bla)
462-
print("222")
463460
envelopes = test_environment["server"].envelopes
464-
print(envelopes)
465-
print("333")
466461
(transaction_event,) = envelopes
467-
print("444")
468462
assert (
469463
transaction_event["contexts"]["trace"]["origin"] == "auto.function.aws_lambda"
470464
)

tests/integrations/aws_lambda/utils.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
153153
]
154154
for lambda_dir in lambda_dirs:
155155
# Copy the Sentry SDK into the function directory
156-
import ipdb; ipdb.set_trace()
157156
sdk_path = os.path.join(LAMBDA_FUNCTION_WITH_EMBEDDED_SDK_DIR, lambda_dir, "sentry_sdk")
158157
if not os.path.exists(sdk_path):
159158
# Find the Sentry SDK in the current environment
@@ -170,20 +169,20 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
170169
"-m",
171170
"pip",
172171
"install",
172+
"--upgrade",
173173
"--target",
174174
os.path.join(LAMBDA_FUNCTION_WITH_EMBEDDED_SDK_DIR, lambda_dir),
175175
"-r",
176176
requirements_file,
177177
])
178178

179-
180179
CfnResource(
181180
self,
182181
lambda_dir,
183182
type="AWS::Serverless::Function",
184183
properties={
185184
"CodeUri": os.path.join(LAMBDA_FUNCTION_WITH_EMBEDDED_SDK_DIR, lambda_dir),
186-
"Handler": "sentry_sdk.integrations.init_serverless_sdk.sentry_lambda_handler",
185+
"Handler": "index.handler",
187186
"Runtime": PYTHON_VERSION,
188187
"Timeout": LAMBDA_FUNCTION_TIMEOUT,
189188
"Environment": {

0 commit comments

Comments
 (0)