Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Remove direct imports of lambda provider #6737

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

Merged
merged 10 commits into from
Sep 1, 2022
Merged

Conversation

dfangl
Copy link
Member

@dfangl dfangl commented Aug 23, 2022

Goal

When moving to the new lambda provider, we want to avoid all imports which rely on the logic of the old provider, to make seamless switching possible

Main changes

  • Introduced a new environment variable, MAIN_DOCKER_NETWORK in order to replace the usage of LAMBDA_DOCKER_NETWORK for other services as well (as it is a misnomer, and to avoid tight coupling of lambda with other services). For now, until a major/minor version release, this variable falls back to LAMBDA_DOCKER_NETWORK to simulate current behavior. /cc @thrau

Splitting other services from lambda modules

  • SNS: Move process_sns_notification_to_lambda to sns module (it belongs there thematically, since SNS is responsible for the payload) and invoke using boto client /cc @bentsku
  • DynamoDB: Use botocall to list event source mappings instead of accessing the data directly /cc @giograno
  • ApiGateway: Move invocation logic (payload etc.) to apigateway module, use boto client to invoke. Also some changes regarding base64 encoded data (which should be present in the json as string, otherwise json.dumps will not work), and removal of processing of everything not a boto response (flaskresponses, lambda invocation results etc). Also moved a test (for the apigw event payload) from lambda unit tests to apigatway unit tests (also belongs there thematically) /cc @calvernaz
  • snapshots: Move account_id fixture to fixtures.py, since it is universally applicable /cc @dominikschubert
  • docker_utils: Move get_host_path_for_path_in_docker into docker utils, since other services need this as well. Also change some comments insinuating strictly lambda usage /cc @thrau
  • stepfunctions: Remove direct module access to lambda api internals for asserting stepfunctions invoking lambdas. The existing assertions already assert the results, so the lambda invocation in the middle is asserted with it as well. /cc @dominikschubert

@dfangl dfangl temporarily deployed to localstack-ext-tests August 23, 2022 21:32 Inactive
@dfangl dfangl temporarily deployed to localstack-ext-tests August 23, 2022 21:42 Inactive
@coveralls
Copy link

coveralls commented Aug 23, 2022

Coverage Status

Coverage decreased (-0.005%) to 91.393% when pulling 08aed23 on lambda-provider-import-rework into 719c674 on master.

@github-actions
Copy link

github-actions bot commented Aug 23, 2022

LocalStack integration with Pro

       3 files  ±0         3 suites  ±0   1h 13m 20s ⏱️ - 1m 10s
1 247 tests ±0  1 206 ✔️ +1  41 💤  - 1  0 ±0 
1 672 runs  ±0  1 600 ✔️ +1  72 💤  - 1  0 ±0 

Results for commit 08aed23. ± Comparison against base commit 719c674.

♻️ This comment has been updated with latest results.

@dfangl dfangl force-pushed the lambda-provider-import-rework branch from fced3a8 to 365692b Compare August 25, 2022 16:06
@dfangl dfangl temporarily deployed to localstack-ext-tests August 25, 2022 16:06 Inactive
@dfangl dfangl temporarily deployed to localstack-ext-tests August 25, 2022 16:34 Inactive
@dfangl dfangl force-pushed the lambda-provider-import-rework branch from dc8e437 to 961fe21 Compare August 30, 2022 08:21
@dfangl dfangl temporarily deployed to localstack-ext-tests August 30, 2022 08:21 Inactive
@dfangl dfangl force-pushed the lambda-provider-import-rework branch from 961fe21 to 485cb60 Compare August 30, 2022 18:13
@dfangl dfangl temporarily deployed to localstack-ext-tests August 30, 2022 18:13 Inactive
@dfangl dfangl temporarily deployed to localstack-ext-tests August 30, 2022 18:22 Inactive
@dfangl dfangl temporarily deployed to localstack-ext-tests August 30, 2022 18:25 Inactive
@dfangl dfangl temporarily deployed to localstack-ext-tests August 31, 2022 08:08 Inactive
@dfangl dfangl temporarily deployed to localstack-ext-tests August 31, 2022 09:55 Inactive
@dfangl dfangl marked this pull request as ready for review August 31, 2022 11:43
Copy link
Member

@dominikschubert dominikschubert left a comment

Choose a reason for hiding this comment

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

Haven't looked too much over the apigateway,dynamodb parts but the rest seems fine to me 🚀

Hope we can merge this soon, so we have some proper boundaries between Lambda and the other services again 🙏

Copy link
Contributor

@bentsku bentsku left a comment

Choose a reason for hiding this comment

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

I had only a quick glance over the things not SNS related, but LGTM, thanks for moving it, it makes more sense for it to be in the SNS provider! I'm glad to see us use the external client between services and API! 🎉

Copy link
Contributor

@calvernaz calvernaz left a comment

Choose a reason for hiding this comment

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

Thanks for doing this @dfangl, I can speak for API GW, is not always easy to understand the code. I only have one comment regarding the response coming from the lambda that used to be dependent on the lambda runtime, otherwise LGTM!

Copy link
Member

@thrau thrau left a comment

Choose a reason for hiding this comment

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

this is great, thanks for churning through the changes 💯

@dfangl dfangl force-pushed the lambda-provider-import-rework branch from 6cc113c to 08aed23 Compare September 1, 2022 12:41
@dfangl dfangl temporarily deployed to localstack-ext-tests September 1, 2022 12:41 Inactive
@dfangl dfangl merged commit c50b1d4 into master Sep 1, 2022
@dfangl dfangl deleted the lambda-provider-import-rework branch September 1, 2022 14:35
macnev2013 pushed a commit to macnev2013/localstack that referenced this pull request Sep 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants