Infrastructure Testing with Serverspec

The hands-on lab is part of this learning path

DevOps Playbook - CI/CD Tools and Services
course-steps 5 certification 2 lab-steps 5

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
lock
Validate AWS Lab

Ready for the real environment experience?

DifficultyIntermediate
Max Duration45m
Students1
Ratings
4.6/5
star star star star star-half

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:

 

Updates

May 3rd, 2019 - Updated packages that caused Docker to fail to install on the Application instance

January 10th, 2019 - Added a validation Lab Step to check the work you perform in the Lab

About the Author

Students37033
Labs97
Courses11
Learning paths7

Logan has been involved in software development and research since 2007 and has been in the cloud since 2012. He is an AWS Certified DevOps Engineer - Professional, AWS Certified Solutions Architect - Professional, Microsoft Certified Azure Solutions Architect Expert, MCSE: Cloud Platform and Infrastructure, Google Cloud Certified Associate Cloud Engineer, Certified Kubernetes Administrator (CKA), Certified Kubernetes Application Developer (CKAD), Linux Foundation Certified System Administrator (LFCS), and Certified OpenStack Administrator (COA). He earned his Ph.D. studying design automation and enjoys all things tech.

Covered Topics