DevOps Classroom Series – 02/Nov/2021

Test Kitchen

  • We can use test kitchen to test cookbook across any combination of platforms
  • When we create a cookbook, we have a file with in cookbook kitchen.yaml
    • Drivers:
      • Drivers help test kitchen to create test instances.
      • Chef supports Creating test instances on cloud providers and also on virtual box
        • AWS
        • Azure
        • GCP
        • Virtual Box (Vagrant)
      • Refer Here for the documentation
    • Key Concepts
      • A platform reprsents the operating system where the cookbook will be tested
      • A suite which will have a run_list
      • A provisioner chef_zero or chef_solo
  • Lets start working on a cookbook apache_phpinfo and set up the ec2 driver Refer Here
  • Also Refer Here for the kitchen ec2 driver documentation
  • Install aws cli Refer Here
  • Refer Here for the changes done in kitchen.yaml
  • Kitchen has commands, execute them as mentioned below Preview Preview Preview *
  • To check syntax install ruby Refer Here and then execute the command ruby -c <path to recipe> Preview
  • In chef we have a generic package resource Refer Here. Refer Here for the changes done to use a generic package.
  • Lets converge using test kitchen kitchen converge Preview
  • Lets use array for installing packages Refer Here
  • Lets try to check if our changes works on a fresh ubuntu instance.
  • Lets delete the ec2 created by kitchen Preview
  • Now lets do kitchen converge to simulate fresh installation
    • converge

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin