CloudAcademy

Infrastructure Testing with Serverspec

Lab Steps

keyboard_tab
lock
Logging in to the Amazon Web Services Console
lock
Opening the AWS Cloud9 IDE
lock
Running a Local Serverspec Test Suite
lock
Testing Remote Infrastructure with Serverspec
lock
Testing Docker Infrastructure With Serverspec
lock
Running Serverspec in a Docker Container

Ready for the real environment experience?

DifficultyIntermediate
Duration45m
Students12

Description

Lab Overview

An important principle in DevOps is to test your infrastructure. The tests should run as part of your continuous delivery pipeline giving you agility and confidence in your infrastructure changes. Serverspec is one example of an infrastructure testing framework. Serverspec can be used to test local and remote target machines by connecting over SSH or WinRM.

This Lab illustrates how to perform Infrastructure Testing with Serverspec. You will write Serverspec tests to specify the expected behavior of machines running in the reverse-proxy, load-balancing tier and the application tier of a sample application. The tests illustrate how to describe the expected behavior of servers and Docker containers. You will run the tests using Serverspec at the command-line and in a Docker container.

Lab Objectives

Upon completion of this Lab, you will be able to:

  • Understand where automated infrastructure testing fits into DevOps
  • Initialize Serverspec infrastructure test suites
  • Write Serverspec tests for a variety of Serverspec resources including packages, services, ports, and Docker infrastructure
  • Run Serverspec from the command line and in a Docker container

Lab Prerequisites

You should be familiar with:

  • A programming language. Ruby familiarity is most beneficial, but not required.
  • Basic Docker concepts, such as images and containers
  • Basic Linux concepts, such as the command line, processes, packages, and services

Lab Environment

Before completing the Lab instructions, the environment will look as follows:

After completing the Lab instructions, the environment should look similar to:

About the Author

Students6161
Labs57
Courses3
Learning paths2

Logan has been involved in software development and research for over eleven years, including six years in the cloud. He is an AWS Certified DevOps Engineer - Professional, MCSE: Cloud Platform and Infrastructure, and Certified Kubernetes Administrator (CKA). He earned his Ph.D. studying design automation and enjoys all things tech.

Covered Topics