Questions tagged [test-kitchen]

Test Kitchen is an integration tool for developing and testing infrastructure code and software on isolated target platforms.

What is Test Kitchen?

Test Kitchen is a test harness tool to execute your configured code on one or more platforms in isolation. A driver plugin architecture is used which lets you run your code on various cloud providers and virtualization technologies such as Amazon EC2, Blue Box, CloudStack, Digital Ocean, Rackspace, OpenStack, Vagrant, Docker, LXC containers, and more. Many testing frameworks are already supported out of the box including Bats, shUnit2, RSpec, Serverspec, with others being created weekly.

For Chef workflows, cookbook dependency resolver tools such as Berkshelf and Librarian-Chef are supported or you can simply have a cookbooks/ directory and Test Kitchen will know what to do. Support for Test Kitchen is already included in many Chef community cookbooks such as the MySQL, nginx, Chef Server, and runit cookbooks.

What does it give me?

Test Kitchen has a simple workflow that stresses speed but optimizes for the freshness of your code executing on the remote systems between tests. It has a static, declarative configuration in a .kitchen.yml file at the root of your project. It is designed to execute isolated code run in pristine environments ensuring that no prior state exists. A plugin architecture gives you the freedom to run your code on any cloud, virtualization, or bare metal resources and allows you to write acceptance criteria in whatever framework you desire.

How do I get started?

Adding testing support to your Chef cookbook or project is easy. Assuming you have Ruby 1.9 or higher and Vagrant installed, open a terminal session and type:

$ gem install test-kitchen
$ kitchen init
$ kitchen test

For more comprehensive instructions, check out the Getting Started guide.

358 questions
0
votes
2 answers

Chef Kitchen converge is generating [No space left on device - write] error

On a Windows 10 host, vagrant, and a local virtual box VM (Windows Server 2012 R2), I suddenly began seeing the following error when performing a kitchen converge: -----> Starting Kitchen (v2.2.5) $$$$$$ Deprecated configuration…
0
votes
1 answer

Could not load the 'vagrant' driver from the load path Test Kitchen, downloading new versions doesn't work

When I try to run kitchen test on terminal I'm greeted with >>>>>> ------Exception------- >>>>>> Class: Kitchen::ClientError >>>>>> Message: Could not load the 'vagrant' driver from the load path. Did you mean: dummy, exec, proxy ? Please ensure…
Cdhippen
  • 615
  • 1
  • 10
  • 32
0
votes
0 answers

Test Kitchen is Broken on Ubuntu 18.04 Because of Rspec Mismatch

I've run tests in the same environment for weeks now without issues. Just today I started getting errors: /opt/chef/embedded/bin/ruby -I/tmp/verifier/suites/serverspec…
Ken Jenney
  • 422
  • 7
  • 15
0
votes
3 answers

Coerce command('stdout') to integer for math comparison

Given a checker script deployed to my server at path /tmp/foo with the following content... #!/bin/bash a=`cat /tmp/a` b=`cat /tmp/b` echo -n $( expr $a - $b ) ...I have an InSpec test to evaluate if the difference between a and b are within an…
Peter Vandivier
  • 606
  • 1
  • 9
  • 31
0
votes
1 answer

After updating ChefDK, I get the error "undefined local variable or method `credentials_file'" in Test Kitchen or an error in credentials.rb in knife

This issue was discovered after upgrading from ChefDK 3.2.30 to 4.2.0, and everything worked fine before the upgrade (Including these two commands). The full error from "knife node…
Taegost
  • 1,208
  • 1
  • 17
  • 26
0
votes
1 answer

Is there a way to share attributes in test kitchen suites?

Is there a way we can share attributes between test kitchen suites for eg: Current setup suite1: att1: "foo" suite2: attr1: "foo" New Setup suites: attr1: "foo"
Jeetendra Pujari
  • 1,286
  • 2
  • 17
  • 31
0
votes
1 answer

How would I import my id_rsa ssh key in test-kitchen (kitchen.yml) so I may use it to log into all kitchen managed VMs?

from my kitchen.yml I am using the vagrant driver and trying to get my id_rsa key to import so that I may use it to ssh into these hosts. Here is my kitchen.yml: #kitchen.yml --- driver: name: vagrant # Ansible configuration provisioner: name:…
aphexlog
  • 1,503
  • 3
  • 16
  • 43
0
votes
1 answer

Error: Connection refused connecting to locahost - Berkshelf - Test Kitchen

I having an issue when running kitchen converge on Test Kitchen with Dokken driver and Inspec as verifier. The error occurred when the starting to resolving the cookbook dependencies 7.0.6 Resolving cookbook dependencies with Berkshelf…
Edmhar
  • 642
  • 1
  • 7
  • 24
0
votes
1 answer

Chef Nessus Agent Install

I am trying to write a cookbook to download and install Nessus Agent found here: https://www.tenable.com/downloads/nessus-agents But am having trouble due to an explicit download url not being provided, and the requirement of accepting the license…
okstef
  • 11
  • 4
0
votes
1 answer

puppet/hiera : the module class cannot be found durins a puppet apply

During a kitchen converge, calling a puppet apply, i got this error : Error: Evaluation Error: Error while evaluating a Function Call, Could not find class ::alibi for ... at .. entry.pp alibi is the module name, and : /tmp/kitchen>ll total…
Minstrel
  • 369
  • 1
  • 2
  • 14
0
votes
0 answers

Writing chef test-kitchen integration tests for logstash filters

There is a lot of ways to test logstash pipelines including: 1) Using logstash command line using config file 2) https://github.com/magnusbaeck/logstash-filter-verifier The question is whether it's possible to integrate testing logstash filters…
Andrei
  • 175
  • 1
  • 9
0
votes
1 answer

Chef firewall cookbook not working with custom JSON objects

I am playing around with the firewall cookbook: cookbook 'firewall', '~> 2.7.0' Not sure if it's just me but the instructions are not very clear but I gave it the old college try... What I am trying to do is build a recipe that allows me to use…
Jeremy
  • 1,878
  • 2
  • 30
  • 54
0
votes
1 answer

My Vagrant machine from chef kitchen cannot access the internet

I am trying to learn how to do local development of chef recipes. I am following this guide https://gist.github.com/smford22/f00f46471047422bd8a7 I am prefixing all the kitchen commands with chef exec because if I try to run kitchen directly, I get…
swagrov
  • 1,510
  • 3
  • 22
  • 38
0
votes
1 answer

kitchen create error: Failed to complete #create action: [work_image build failed: The command '/bin/sh -c yum install -y hostname iproute less lsof

I am getting an error while running $ kitchen create Does anyone know what am I doing wrong? INFO -- Kitchen: -----> Starting Kitchen (v1.21.2) INFO -- Kitchen: -----> Creating ... ERROR -- Kitchen: ------Exception------- ERROR…
user674669
  • 10,681
  • 15
  • 72
  • 105
0
votes
1 answer

How to get image from a docker repo for test kitchen

I need to test my application with Docker Image httpd and when i add it to the current .kitchen.yaml file it fails with the error: root@ip-172-31-1-22:~/test1# kitchen test -----> Starting Kitchen (v1.23.2) -----> Cleaning up any prior instances of…
anish anil
  • 2,299
  • 7
  • 21
  • 41