Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run AWS Lambda tests locally #3988

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open

Conversation

antonpirker
Copy link
Member

@antonpirker antonpirker commented Jan 22, 2025

Test Sentry AWS Lambda integration locally instead of creating actual Lambda function in AWS:

  • Create a local AWS Lambda environment using AWS SAM and AWS CDK. (Docker based)
  • Start a local Sentry server that accepts envelopes.
  • Run the tests in the local AWS Lambda environment configured with a DSN that tells the SDK to send data to the local Sentry server.
  • Read the captured envelopes from the local Sentry server to assert their correctness.
  • Update CI configuration, so AWS tests are now handled the same as test suite matrices of other integrations.

There is also a follow-up PR that removes obsolete code handling AWS authentication data: #4076 (This PR will also fix the one failing test)

Fixes #2795

Copy link

codecov bot commented Jan 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.49%. Comparing base (189e4a9) to head (bfa0312).

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3988      +/-   ##
==========================================
- Coverage   79.55%   79.49%   -0.06%     
==========================================
  Files         140      140              
  Lines       15521    15521              
  Branches     2631     2631              
==========================================
- Hits        12347    12338       -9     
- Misses       2338     2351      +13     
+ Partials      836      832       -4     

see 3 files with indirect coverage changes

@antonpirker antonpirker reopened this Feb 18, 2025
@antonpirker antonpirker force-pushed the antonpirker/better-aws-tests branch from ffe9693 to d12abf5 Compare February 19, 2025 12:29
@antonpirker antonpirker force-pushed the antonpirker/better-aws-tests branch from 2cde31a to a89b3c4 Compare February 19, 2025 13:48
@antonpirker antonpirker marked this pull request as ready for review February 24, 2025 09:32
Because we changed our AWS Lambda test suite to not create real Lambda
functions but rather run a Lambda environment locally, we do not need
all the code necessary for handling the authentication to AWS in the
test suite.

This PR removes all the AWS auth related code and als moves the AWS
Lambda testsuite again into the "Cloud" group of test suites, because it
is a "normal" test suite again.

The PR that includes the change to have a local Lambda environment is
here: #3988
Copy link
Contributor

@sentrivana sentrivana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looking great. I tried comparing the old tests to the new ones and it seems to me like we might not be testing the following anymore:

  • sampling context being correct (old test name was test_traces_sampler_gets_correct_values_in_sampling_context)
  • different behavior if perf is enabled/disabled (tests ending in ..._performance_enabled/disabled)

Maybe this is included in the new tests, it's just hard to diff 😇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix AWS Lambda tests
2 participants