Author Archives: Kristian Van Der Vliet
Author Archives: Kristian Van Der Vliet
One of the key tenets of DevOps is automation, or more specifically, “Infrastructure as Code.” That means your system configuration is expressed as a series of scripts that can be executed by your configuration management software, repeatedly, across multiple machines.
Treating infrastructure as code has many benefits, including the abilities to control when and how changes are applied, to apply changes quickly and to manage your changes with version control. Most importantly, because it’s code, you can test it.
If you’ve been maintaining computer systems for any amount of time, you’ve probably accidentally broken something important when you were making a configuration change; either the change didn’t work as you expected or you typed the wrong command. What if you had been able to write your changes ahead of time and test them before you applied them to production? Infrastructure as Code enables you to do just that.
Software developers have been testing their code for a long time, and we can leverage their experience and knowledge and apply it to Infrastructure as Code. So, just as there are a series of testing tools available for software engineers, automation engineers can also draw from a collection of tools and build themselves a complete end-to-end Continue reading
One of these tools is Serverspec, which is an RSpec testing framework for checking that servers are configured correctly by testing their actual state.
Serverspec can execute its tests on a remote host (such as a Cumulus Linux switch) via. SSH. The tests express how the system should be configured and Serverspec will test that the current system configuration meets those expectations.
Using Serverspec to validate your switch configuration means that you can make changes to your configuration management scripts and be confident that the changes have been applied correctly and worked as intended.
Because Serverspec natively supports Cumulus Linux, all you have to do is install Serverspec and create your tests. If you’ve never used Serverspec before, the serverspec-init
command will create an example called sample_spec.rb
. Adding your own files is very simple; just make sure the filename ends in _spec.rb
and the first line of the file is require 'spec_helper'
Individual Serverspec tests are Continue reading