MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

Chef Tutorials: What is Test Kitchen?

Use Test Kitchen to automatically test cookbooks across any combination of platforms and test suites:

  • Test suites are defined in a kitchen.yml file.
  • Supports cookbook testing across many cloud providers and virtualization technologies.
  • Uses a comprehensive set of operating system base images from Chefโ€™s Bento project.

Bento

Bento is a Chef Software project that produces base testing VirtualBox, Parallels, and VMware boxes for multiple operating systems for use with Test Kitchen. By default, Test Kitchen uses the base images provided by Bento although custom images may also be built using HashiCorp Packer.

The key concepts in Test Kitchen are:

  • A platform is the operating system or target environment on which a cookbook is to be tested
  • A suite is the Chef Infra Client configuration, a Policyfile or run-list, and (optionally) node attributes
  • An instance is the combination of a specific platform and a specific suite, with each instance being assigned an auto-generated name
  • A driver is the lifecycle that implements the actions associated with a specific instanceโ€”create the instance, do what is needed to converge on that instance (such as installing Chef Infra Client, uploading – cookbooks, starting a Chef Infra Client run, and so on), setup anything else needed for testing, verify one (or more) suites post-converge, and then destroy that instance
  • A provisioner is the component on which the Chef Infra Client code will be run, either using chef-zero or chef-solo via the chef_zero and chef_solo provisioners, respectively

Test Kitchen driver

Test Kitchen uses a driver plugin architecture to enable Test Kitchen to test instances on cloud providers such as Amazon EC2, Google Compute Engine, and Microsoft Azure. You can also test on multiple local hypervisors, such as VMware, Hyper-V, or VirtualBox.

A Test Kitchen driver is what supports configuring the compute instance that is used for isolated testing. This is typically a local hypervisor (Hyper-V), hypervisor abstraction layer (Vagrant), or cloud service (AWS EC2).

Test Kitchen driver layers: kitchen-vagrant, kitchen-ec2, kitchen-docker and kitchen-ssh, plus their backends

Chef Workstation includes Test Kitchen along with the following drivers:

  • Amazon EC2 (AWS) via the kitchen-ec2 project
  • DigitalOcean via the kitchen-digitalocean project
  • Dokken (Chef Infra specific Docker driver) via the kitchen-dokken project
  • Google Cloud Platform via the kitchen-google project
  • HashiCorp Vagrant via the kitchen-vagrant project
  • Microsoft Azure via the kitchen-azurerm project
  • Microsoft Hyper-V via the kitchen-hyperv project
  • Openstack via the kitchen-openstack project
  • VMware vCenter via the kitchen-vcenter project
  • VMware vRealize Automation via the kitchen-vra project

The Test Kitchen community also maintains several additional plugins not bundled directly in Chef Workstation:

  • kitchen-docker
  • kitchen-rackspace
  • kitchen-terraform
  • kitchen-vcair
  • kitchen-vro

Driver Plugin Description

Driver PluginDescription
kitchen-azurermA driver for Microsoft Azure.
kitchen-cloudstackA driver for CloudStack.
kitchen-digitaloceanA driver for DigitalOcean. This driver ships in Chef Workstation.
kitchen-dokkenA driver for Docker. This driver ships in Chef Workstation.
kitchen-dscA driver for Windows PowerShell Desired State Configuration (DSC).
kitchen-ec2A driver for Amazon EC2. This driver ships in Chef Workstation.
kitchen-googleA driver for Google Compute Engine. This driver ships in Chef Workstation
kitchen-hypervA driver for Microsoft Hyper-V Server. This driver ships in Chef Workstation.
kitchen-openstackA driver for OpenStack. This driver ships in Chef Workstation.
kitchen-rackspaceA driver for Rackspace.
kitchen-vagrantA driver for HashiCorp Vagrant. This driver ships in Chef Workstation.

Validation with InSpec

Test Kitchen will create a VM or cloud instance, install Chef Infra Client to that system, and converge Chef Infra Client with your local cookbook. Once this is complete, you will want to perform automated validation against the infrastructure you have built to validate its configuration. Test Kitchen allows you to run InSpec tests against your converged cookbook for easy local validation of your infrastructure.

kitchen (executable)

kitchen is the command-line tool for Test Kitchen, an integration testing tool maintained by Chef Software. Test Kitchen runs tests against any combination of platforms using any combination of test suites.

kitchen.yml

Use a kitchen.yml file to define what is required to run Test Kitchen, including drivers, provisioners, platforms, and test suites.


Test Kitchen with Vagrant & Virtualbox


Diagram of Test Kitchen creating a Vagrant VirtualBox instance and Chef connecting to the sandbox
Flowchart of Vagrant: download basebox if missing, import box, configure VM, boot VM instance

Test Kitchen with AWS


Diagram of Test Kitchen creating an AWS instance through the provider API, with Chef connecting over SSH

Test Kitchen with Docker


Diagram of Test Kitchen creating a Docker instance and Chef linking to the sandbox environment

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services โ€” all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

Chef Training Roadmap for DevOps Engineers: Course Tracks, Lab Workflow, and Practical Commands

This guide turns a promotional Chef training post into a practical roadmap for engineers. Compare course levels, understand the learning workflow, and use hands-on commands you can run in a lab.

Read More

Chef Interview Q&A (Part 2): Resources, Run-Lists, Bootstrap, and Test Kitchen

A practical rewrite of classic Chef interview questions, focused on how Chef resources converge, how run-lists drive node configuration, and how to test cookbooks safely. Includes command examples, workflow diagrams, and comparison tables.

Read More

Chef Interview Questions, Explained: Resources, Run-Lists, Bootstrapping, and Test Kitchen

This updated guide converts classic Chef interview Q&A into a practical reference for real infrastructure work. It covers core concepts, execution order, bootstrap flow, key knife commands, and Test Kitchen testing patterns.

Read More

Chef Configuration Management Training: 3-Day Hands-On Curriculum for DevOps Teams

This revised guide turns a legacy Chef course post into a clear 3-day learning roadmap for DevOps teams. It covers the agenda, toolchain, workflow, and practical commands learners should expect.

Read More

Chef Tutorials: Test Kitchen – Example of kitchen.yml with VAGRANT and VirtualBox

How to test Chef recipes/cookbooks on your workstation with VAGRANT and VirtualBox using Test Kitchen Install Test Kitchen, VAGRANT and VirtualBox: Chef Test Kitchen: Test Kitchen is…

Read More

Provision an AWS EC2 Instance with Chef (Legacy ChefDK Workflow)

A practical, step-by-step walkthrough for provisioning an AWS EC2 VM using the classic ChefDK and chef-provisioning approach. Includes workflow, commands, recipe examples, and validation checks for legacy environments.

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x