From testing code to testing infrastructure as code—the new must-have testing skill

Publish date:

The proliferation for infrastructure as a code strategies, goes hand in hand with Agile and DevOps adoption.

Technology is a useful servant but a dangerous master—Christian Lous Lange.

So is infrastructure. Infrastructure as a code, is a step forward.

Simplistically, it is an approach to manage IT infrastructure, be it test environment or production infrastructure, for the age of cloud, micro services and continuous delivery.

The underlying basic principal is to treat IT infrastructure as code through machine-readable definition files, to rapidly set up and deploy environments using tools such as Chef and Puppet.

The proliferation for infrastructure as a code strategies, goes hand in hand with Agile and DevOps adoption. One of the key factors, and why it is so important for testers, is that development typically can be done very fast, however to release a product it needs to be tested and integrated with several other systems.
In this case, infrastructure as a code, is very effective in spinning up test environments.

Let us consider a use case where I am a tester and my infrastructure team has used Chef to automate the test and production infrastructure. As a result, I can provision all my test environments in a minute. It is tempting to think that my job is done. In reality, what my infrastructure team has done, is automated the provisioning and the deployment. However just like in code, the infrastructure code is not defect free and needs to be tested.

Mentioned below are six strategies that could be leveraged to test infrastructure as code:

1. Static testing of infrastructure as a code: Just like static testing of code, this means writing tests to validate the quality of the infrastructure configuration code. This can be done using compilers or style checkers to follow pre-defined standards around the configuration management framework.

2. Unit testing of infrastructure as code: The focus of unit tests is to validate each piece of infrastructure code and make sure that specific environments that each component is responsible for are running. For example validating all the executable configuration definition files such as shell scripts, Ansible playbooks, Chef recipes or Puppet manifests to test every component of the infrastructure.

3. System testing: This refers to running all the configuration files to set up the environment and test whether the application responds to the integrated configurations as a whole. In a real-time environment, it would mean testing if my server is running and the services that the server relies on such as OS, web server, database server, etc. are running correctly.

4. System integration testing: This involves testing the deployment, of an end-to-end, real-time distributed system into a production-like environment and running real-time tests for performance, availability, and failover.

5. Blue/Green deployment: In this scenario, the production environment is divided in two parts; green, which is leveraged for normal use, and the blue part, which runs the infrastructure code changes. As each change is tested, it is rolled out from the blue to the green environment. Using monitoring tools and instrumenting your systems are key in this strategy to measure the success of the deployment.

6. Monitoring business in production: This refers to defining business-level KPIs and monitoring technical KPIs in line with business KPIs.

In closing, we need to stop thinking about infrastructure as an operations-only responsibility and start thinking about it as part of our testing strategy. This will be the essence for speed to market and will necessitate building of new skills for the test professional.

Related Posts

devops

DevGovOps – Key factors for IT governance for enterprises in a DevOps world

Chuks Anochie
Date icon September 27, 2019

IT governance structures need to be better aligned to the idea economy

devops

DevOps for legacy services – it’ll never happen!

Jonathan Vince
Date icon September 25, 2019

It is not possible to run your legacy services with DevOps teams, but with a bit of care you...

devops

EvoQE (Evolution of Quality Engineering) – Next-generation quality engineering services

Vivek Jaykrishnan
Date icon September 11, 2019

With new digital era, the need for quality and agility is a top priority across all...