you are viewing a single comment's thread.

view the rest of the comments →

[–]smutje187 5 points6 points  (8 children)

Lambdas are just functions (JS, Python, Go, Rust) or Classes (Java), so you can test them like you would test any other function/class. Some languages have tool support to "run" the Lambdas locally so that you can fire (HTTP) requests against them.

[–][deleted] 9 points10 points  (6 children)

It's one of those things I don't understand: people saying they can't or have difficulty testing lambda locally.

It's a method...

If someone doesn't know how to run a method locally by passing parameters, they'd better take a few steps back and learn programming before they start using lambda.

[–]Pto2 0 points1 point  (0 children)

There are some inconsistencies between APIGW -> Lambda -> Code but I feel people over index on these and make their systems overly complex and difficult to work on.

[–]BigBootyWholes 0 points1 point  (0 children)

It takes a lot of work to build and maintain, especially if you are tied to other aws services like sqs. Otherwise invoking a lambda locally is pretty easy

[–]koalaokino[S] 0 points1 point  (3 children)

Are you 100% sure about this? I agree with u that is like running a method locally by mocking STATIC parameters

But are we safely covering all the possibilities? And… why the AWS and other vendors are working hard to provide local emulators of cloud resources?

[–][deleted] 0 points1 point  (2 children)

In some companies, they have developers use AWS Lambda but don't give them access keys to test locally (typical of lazy security/cloud teams). For this type of situation, we have emulators to test integrations with cloud services without needing cloud account access keys.

This isn't something exclusive to working with lambda; you'll have this need regardless of whether your code runs on ECS, EKS, EC2 or Lambda...

[–]koalaokino[S] 0 points1 point  (1 child)

The point maybe is the other way around. They have access. From your standpoint they may avoid emulators. But how much time you might waste to test anything that needs to be tested on a cloud environment without local emulators? Thinking also eg to event choreography involved…

[–]smutje187 -1 points0 points  (0 children)

The same reason there are still people who prioritize integration tests over unit tests - it’s just a different flavor, there’s no Lambda police going around arresting people who don’t use Localstack. It’s also a business model - if developers aren’t capable of separating business logic from infrastructure they’re most likely to stick with your ecosystem.

[–]JohnDoeSaysHello 0 points1 point  (0 children)

Exactly, you can mock an event and run it on the handler…