Slide 1

Slide 1 text

Cloud Integration Testing Made easy with LocalStack and Testcontainers localstack.cloud

Slide 2

Slide 2 text

Anca Ghenade - Developer Advocate - anca.ghenade@localstack.cloud @tinyg210

Slide 3

Slide 3 text

1. The Software Ninjas are tasked with developing a new web application on AWS Cloud 2. Developing on a local machine, they soon find out that there are lots of dependencies with resources in the cloud How it goes…

Slide 4

Slide 4 text

3. They realize that the dev & test loop is extremely slow and tedious. Every local change needs to be packaged and uploaded to the cloud for testing. 4. Now the Software Ninja has a red build on their feature branch, but can’t efficiently test and debug their code in the CI/CD pipeline.

Slide 5

Slide 5 text

5. The whole team is using Git flow for development - one CI build per feature branch. There is an explosion of different environments required for development (branches x developers). 6. The Ninja manager approaches the team and complains that AWS dev/test resources are not being cleaned up properly causing cost spikes.

Slide 6

Slide 6 text

How much of your system you can test Cloud emulation Full cloud emulation with service integration 3 Staging environments Highest fidelity because it actually runs in the cloud 4 Mocking Mock out cloud APIs 1 Service emulation Replace individual services with local versions 2 What about all the important testing?

Slide 7

Slide 7 text

WE INTERRUPT THE REGULAR SCHEDULED PRESENTATION TO BRING YOU THIS IMPORTANT STORY TIME

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

So how can we bring the ease and speed of unit tests into these integration tests?

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

https://github.com/tinyg210/localstack-testcontainers-meetup-demo

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

Test successful POST Test successful GET Test fails validation on incorrect values Test 404 on wrong param

Slide 15

Slide 15 text

Tips and Tricks

Slide 16

Slide 16 text

Use a waiter to make sure your Lambdas are in state ACTIVE and not just created.

Slide 17

Slide 17 text

Source: https://aws.amazon.com/blogs/compute/coming-soon-expansion-of-aws-lambda-states-to-all-functions/

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

Use this nifty configuration to scan the LocalStack logs and make sure your instance is in the right state before the tests are allowed to start:

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

Streaming container output to an SLF4J logger

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

Thank You

Slide 24

Slide 24 text

PSAs

Slide 25

Slide 25 text

&

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

Q&A