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

Is @requires_docker absolutely neccessary? Can we mock lambda without docker? #6987

Closed
bblommers opened this issue Nov 3, 2023 Discussed in #6985 · 3 comments
Closed

Comments

@bblommers
Copy link
Collaborator

Discussed in #6985

Originally posted by rishacha November 2, 2023

@mock_logs
@mock_lambda
@mock_sqs
@requires_docker
def test_invoke_function_from_sqs_queue():
logs_conn = boto3.client("logs", region_name="us-east-1")
sqs = boto3.resource("sqs", region_name="us-east-1")
queue_name = str(uuid.uuid4())[0:6]
queue = sqs.create_queue(QueueName=queue_name)

Hi, I was just wondering if @requires_docker as shown in the above test is absolutely required for mocking the lambda.
I am currently working on client project using an AWS Workspace (running Windows) that doesn't have docker enabled.

I needed to mock a lambda trigger from sqs and I was just wondering if it's possible to test the trigger without docker - i.e. only using sqs and the lambda_handler(event,ctx) function.

@manycoding
Copy link

Double this

@bblommers
Copy link
Collaborator Author

bblommers commented Jan 7, 2024

Hi @manycoding , this will be part of the upcoming v5 release.

All service-specific decorators will be replaced with a single @mock_aws decorator. To use the simple Lambda implementation everywhere, you can specify this in the configuration:

@mock_aws(config={"lambda": {"use_docker": False}})
def test():
    ...

We've just released an alpha version to gather some early feedback, moto==5.0.0alpha1. Are you able to verify that this version fixes your issue?

See the full release announcement here: #7198

@bblommers
Copy link
Collaborator Author

Moto V5 has now been released, so I'll close this.

Release: https://pypi.org/project/moto/5.0.0/

Documentation about this feature: http://docs.getmoto.org/en/5.0.0/docs/configuration/index.html

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

No branches or pull requests

2 participants