05.02 Write and run infrastructure tests

In this sublesson, you’re going to write and run automated infrastructure/deployment tests to verify that environments have been configured correctly. So, the same way you write automated tests for your application, you’ll write automated tests for your infrastructure and deployment. The difference is when the tests get run. With infrastructure and deployment tests, the test suite is run after the infrastructure has been instantiated. You can’t really run infrastructure tests in an atomic manner the way you might with application tests. That said, you can still apply a test-first practice to infrastructure tests. What we like to do at Stelligent is to write Cucumber features without the step definitions – in other words, without the execution. This way, we can describe how we’d like the infrastructure to behave and commit these Cucumber specifications to the version-control repository. Then, later we implement the step definitions. We tend to use Cucumber for this type of infrastructure acceptance testing, but there are many other test automation tools available including serverspec and Test Kitchen – to name a few. Also, some teams choose to use system monitoring tools and others will integrate the monitoring into the infrastructure as a way to automatically recover from system failures. You might do this CloudWatch, ELB and Auto Scaling in AWS to have a fully automated and resilient infrastructure architecture.

Resources

Prerequisites

Steps

Cucumber feature

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s