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, 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.
- 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.
- 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.
- 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. is running correctly.
- 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.
- 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 is running the infrastructure code changes. As each change is tested, it is rolled out from blue to green environment. Using monitoring tools and instrumenting your systems are key in this strategy to measure the success of the deployment.
- Monitoring business in production. This refers to defining business level KPI’s and monitoring technical KPI’s in line with business KPI’s.
In closing, we need to stop thinking about infrastructure as on 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 testing infrastructure of code skills for the test professional.
This article was written by Deepika Mamnani from Capgemini: Capping IT Off and was legally licensed through the NewsCred publisher network. Please direct all licensing questions to firstname.lastname@example.org.