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

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

Conversation

antonpirker
Copy link
Member

@antonpirker antonpirker commented Jan 22, 2025

For testing our AWS Lambda integration in CI we used to create actual Lambda functions and run them in actual AWS.

This PR changes this and uses AWS SAM for running a AWS Lambda like environment in a Docker container. In this local AWS Lambda we create the Lambda functions that our tests invoke.

Fixes #2795

Copy link

codecov bot commented Jan 22, 2025

❌ 27 Tests Failed:

Tests completed Failed Passed Skipped
2299 27 2272 949
View the top 3 failed tests by shortest run time
 tests.integrations.aws_lambda.test_aws_lambda
Stack Traces | 0s run time
ImportError while importing test module '.../integrations/aws_lambda/test_aws_lambda.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
.tox/py3.7-common/lib/python3.7.../site-packages/_pytest/python.py:578: in _importtestmodule
    mod = import_path(self.fspath, mode=importmode)
.tox/py3.7-common/lib/python3.7.../site-packages/_pytest/pathlib.py:524: in import_path
    importlib.import_module(module_name)
.../hostedtoolcache/Python/3.7.17.../x64/lib/python3.7/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1006: in _gcd_import
    ???
<frozen importlib._bootstrap>:983: in _find_and_load
    ???
<frozen importlib._bootstrap>:967: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:677: in _load_unlocked
    ???
.tox/py3.7-common/lib/python3.7.../_pytest/assertion/rewrite.py:170: in exec_module
    exec(co, module.__dict__)
.../integrations/aws_lambda/test_aws_lambda.py:18: in <module>
    from fastapi import FastAPI, Request
E   ModuleNotFoundError: No module named 'fastapi'
 tests.integrations.aws_lambda.test_aws_lambda
Stack Traces | 0s run time
ImportError while importing test module '.../integrations/aws_lambda/test_aws_lambda.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
.tox/py3.9-aws_lambda/lib/python3.9.../site-packages/_pytest/python.py:493: in importtestmodule
    mod = import_path(
.tox/py3.9-aws_lambda/lib/python3.9.../site-packages/_pytest/pathlib.py:587: in import_path
    importlib.import_module(module_name)
.../hostedtoolcache/Python/3.9.21.../x64/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1030: in _gcd_import
    ???
<frozen importlib._bootstrap>:1007: in _find_and_load
    ???
<frozen importlib._bootstrap>:986: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:680: in _load_unlocked
    ???
.tox/py3.9-aws_lambda/lib/python3.9.../_pytest/assertion/rewrite.py:184: in exec_module
    exec(co, module.__dict__)
.../integrations/aws_lambda/test_aws_lambda.py:18: in <module>
    from fastapi import FastAPI, Request
E   ModuleNotFoundError: No module named 'fastapi'
 tests.integrations.aws_lambda.test_aws_lambda
Stack Traces | 0s run time
ImportError while importing test module '.../integrations/aws_lambda/test_aws_lambda.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
.tox/py3.8-gevent/lib/python3.8.../site-packages/_pytest/python.py:493: in importtestmodule
    mod = import_path(
.tox/py3.8-gevent/lib/python3.8.../site-packages/_pytest/pathlib.py:587: in import_path
    importlib.import_module(module_name)
.../hostedtoolcache/Python/3.8.18.../x64/lib/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
.tox/py3.8-gevent/lib/python3.8.../_pytest/assertion/rewrite.py:184: in exec_module
    exec(co, module.__dict__)
.../integrations/aws_lambda/test_aws_lambda.py:18: in <module>
    from fastapi import FastAPI, Request
E   ModuleNotFoundError: No module named 'fastapi'

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

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
1 participant