Cloud & Infrastructure

Part I: Does DevOps Need Dedicated Testers?

A software testing strategy to ensure infrastructure changes do not break the development environment.

As a DevOps/Cloud Engineering professional, and human being, I will make eight mistakes for every 100 words typed. This means I make hundreds, if not thousands, of mistakes each week. 

So how do I catch my mistakes? I would like to say I write good unit and integration tests for my infrastructure-related code and have over 90 percent code coverage, but this would be a lie. 

In fact, if you’re like most DevOps and cloud engineering professionals, you are not expected to write unit and integration tests and will rely on external tools to test the infrastructure-related errors. So, why aren’t the same unit and integration testing procedures, which are applied to application code, being applied to infrastructure code?

So, why aren’t the same unit and integration testing procedures, which are applied to application code, being applied to infrastructure code?

While the infrastructure team can utilize resources like Terraform, localstack and Terraform-compliance to mock and test resources, they can not mock the platform and services which will live within the infrastructure. Thus, infrastructure teams will do actual deployments to the development environment, in order to test their infrastructure.

Unfortunately, from a developer-perspective, the development environment is ‘production’, and is expected to be stable, and always available. Developers do not want downtime because the infrastructure team is deploying and testing an infrastructure change – and breaks something.

So, how do we resolve this conflict, in the simplest way possible (assuming the development environment is used 24 hours per day)?

I’ve had good results utilizing the same software testing strategy utilized for applications,  for the infrastructure code-base.

By having infrastructure-related unit and integration tests written and tested against the infrastructure code prior to deployment to a development environment, you can ensure infrastructure changes will not break the development environment.

Infrastructure Unit tests might include:

  • Testing the resource is created and has the proper parameters
  • Testing pipeline logic to handle exceptions

Infrastructure Integration tests might include:

  • Testing connectivity
  • Testing security
  • Testing permissions

Application/Platform/Service integration tests might include:

  • Testing Network Access Control Lists
  • Testing Security Groups
  • Testing Route Tables
  • Testing Permissions
  • Testing for infrastructure controlled keys
  • Testing for shared resources, and access to shared resources

Writing Good Tests Requires Infrastructure, Architectural Knowledge 

While development software testers could write Application/Platform/Service tests, they may not have the infrastructure and architectural knowledge to understand how to write good tests. Instead, a DevOps Software Tester team should be responsible for coordinating with all development software testers for infrastructure-related integration tests.

The infrastructure-related integration tests would then become part of the infrastructure deployment pipeline.

For example, before any infrastructure-related changes are deployed to the ‘development’ environment, the infrastructure should be deployed to a new environment and validated. Once all tests are passing, then the infrastructure is deployed. In addition, like with application code, infrastructure code should have at least 90 percent code coverage for all infrastructure resources, contain good infrastructure-related integration tests, and have  90 percent coverage for application-related integration tests.

While this solution does not guarantee an outage to your development environment, it applies a consistent, organizational-wide testing strategy for all code, and should help to catch many of the infrastructure-related coding mistakes.

It also provides an additional career path for software testers to enhance their knowledge and skills, and teach DevOps and cloud engineers how to do proper testing.

Or, you can continue to deploy infrastructure-as-code and not write any unit or integration tests.

Read the Entire DevOps Testing Series

To further support this growing need, I will publish three more articles in the coming days.

Join the Team

We are always looking for people who love problems and welcome the hard work required to solve them.

“The best work environment I've ever had. People are honest, trustworthy, respectful, professional. I'm never leaving! I truly appreciate that our leadership has years of hands-on experience developing and implementing solutions for customers, and can easily discuss technical details with customers and developers. The owners of Trility are truly unique. They set the atmosphere, tone, pace, and ethos, and have built an organization that is unique from other organizations.”

 – Will Rubel 

By Will Rubel

As a DevOps/Cloud Engineer at Trility Consulting, Will brings extensive experience in the integration, automation, and DevOps space. He has engineered top-to-bottom automation solutions for build pipes that leverage all things AWS married with Cloud Formation, Lambda, Opswork/Chef, Jenkins, and more. Will enjoys working with peers where he can continually learn and grow his skills while expanding what can be done technically for his customer.