Test your cookbook in Chef Test Kitchen against multiple versions of the Chef Client

In large environments, during the Chef Client version change, some older servers still run the prior version of the Chef Client, the newly created servers launch with the new version of the Chef Client.

It is very important to test your cookbooks with the old and the new versions of Chef Client.

To specify the Chef Client version for the Test Kitchen “converge” run, add the highlighted three lines to the provisioner section of the .kitchen.yml file:

provisioner:
  name: chef_zero
  product_name: chef          # Install the Chef Client
  product_version: 14.0.0   # Set the Chef Client version, default=latest
  install_strategy: always    # Forces the installation of the specified Chef Client version even if another version is installed

During “converge”, test kitchen will download and install the specified version of Chef Client.

Warning:

If the server image already has Chef Client installed, and the installed Chef Client version is newer than the specified version in the kitchen.yml file, Test Kitchen downloads the specified earlier version, but executes the already installed newer version.

Leave a comment

Your email address will not be published. Required fields are marked *