Automated deploys and tests

Hi there,

Apologies if this is the wrong place to ask.

I’m trying to work out the best way to automate deploys and tests for changes to my application.

I’m looking at AWS, with lambda, dynamodb, API gateway and so on. That bits easy enough.

The bit that I’m trying to work out is how to deploy changes, but asserting they work first.

With a monolith application, I’d build the app, start it up with mocked out dependencies (eg with Docker), run a suite of tests against it, and only if they all pass does it get deployed.

With serverless stuff this is all different. In order to start up the app I’d need to deploy the full stack to AWS. Which means you can’t test it before deploying it.

Instead what seems sensible is:

  • deploy the full stack to an ephemeral environment
  • run the suite of tests against this environment
  • tear down the environment
  • if the tests all passed, deploy to the real environment

That way you get a fully representative test suite. But there are problems with this:

  • it’s expensive. Both in terms of money and time.
  • it’s difficult to set up test data. You need to access every individual data store from the tests
  • being an ephemeral environment, there’s no well-known base URL. It’ll be different every time.

This seems like it must be a solved problem, surely? But if so, what do other people do for this?