Chef Testing Cookbook with Test Kitchen - Chef (software)

What is Chef Testing Cookbook with Test Kitchen?

Test kitchen is Chef's mix testing syntax. It empowers writing tests, which pursue VM is instantiated and combined utilizing the cookbook. The tests keep running on VM and can check that everything fills in of course.

This is node contract to ChefSpec, which just recreates a Chef run. Test Kitchen boots up a genuine node and runs Chef on it.

Setting Up

So as to do this, we need Vagrant installed on the machine which helps in dealing with a virtual machine. At that point we need bookshelf installed and snared with Vagrant so as to oversee cookbook conditions

Step 1 − Edit default recipe in the cookbook.

Step 2 – After that edit cookbook attributes.

Step 3 – Let’s edit gem file to install the necessary Ruby gems.

Step 4 – Then install the necessary Ruby gem.

Step 5 – Let’s create .kitchen.yml file in the cookbook.

Step 6 – Now create a test directory inside the cookbook.

Step 7 – Generate a test cookbook for integration testing.

Step 8 – At this step edit test cookbooks default recipe.

Step 9 – Go to the cookbook and create Minitest Spec.

Step 10 – Now edit your main cookbook's Berksfile.

Testing the Setup

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

Chef (software) Topics