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
3
votes
1 answer

How to require cookbook libraries in kitchen serverspec tests

On a cookbook I defined a class Rds::Checks that shares methods for building unix commands for bash/execute resources and Guards. A sample of the file libraries/checks.rb is: module Rds class Checks class << self def…
sekipaolo
  • 135
  • 2
  • 7
2
votes
1 answer

Error installing chef-client on ubuntu 18.04

I am performing the convergence of a recipe but the convergence fails not because of the recipe but because of the installation of chef-client. This is error Preparing to unpack .../cache/chef_16.2.44-1_amd64.deb ... Unpacking chef…
2
votes
3 answers

How to enable specific Ohai plugin on a node in Test Kitchen

I wanted to enable Passwd ohai plugin in my node in test kitchen. On a regular node, I've done it by adding: ohai.optional_plugins = [ :Passwd ] to /etc/chef/client.rb. I wanted to achieve the same in a test node, so I added to my…
Learner
  • 162
  • 11
2
votes
2 answers

Kitchen-Docker specify image name for Dockerfile

I am currently using kitchen-docker driver for testing my cookbooks. Wondering how to specify a image name:tag for the image that is build by the kitchen create command. Here is my .kitchen.yml : --- driver: name: docker use_sudo: false …
Dinesh
  • 1,711
  • 2
  • 20
  • 41
2
votes
3 answers

systemctl error in docker 'Failed to connect to bus: No such file or directory'

I am using Ubuntu-16.04 image with docker to test my cookbook in local. While doing kitchen converge, I am getting the following error. I figured out systemctl is not working properly. Can someone please help me to fix this problem OR any other way…
Jai Prak
  • 2,855
  • 4
  • 29
  • 37
2
votes
1 answer

Puppet, cp: cannot stat `/tmp/kitchen/hiera/*': No such file or directory

I am trying to create a puppet deployment using kitchen-puppet. Here is what my kitchen file looks like: --- driver: name: vagrant provisioner: name: puppet_apply manifests_path: /repository/puppet_repo/manifests modules_path:…
Alex Cohen
  • 5,596
  • 16
  • 54
  • 104
2
votes
0 answers

kitchen create with vagrant-libvirt plugin

I tried to do kitchen create with this kitchen.yml: --- driver_plugin: vagrant transport: name: ssh ssh_key: /home/aida/Documents/chef-repo/.chef/aida.pem provisioner: name: chef_solo driver_config: provider: libvirt platforms: -…
Aira
  • 179
  • 2
  • 3
  • 13
2
votes
1 answer

Kitchen-Docker and Systemd

I am currently using kitchen-docker driver for my test kitchen runs in order to speed up our automated cookbook tests. However after playing for a while with this I found that every kitchen run fails if there is involved in any recipe a service…
Navarro
  • 1,284
  • 2
  • 17
  • 40
2
votes
1 answer

Does test-kitchen support running multiple specific suites?

For example if my kitchen.yml contains these three suites (example is abbreviated): suites: - name: dogs - name: cats - name: horse I would like to be able to run: kitchen converge -c 2 dogs cats Is this possible?
thun
  • 478
  • 3
  • 12
2
votes
1 answer

kitchen synced_folders owner and group

I am trying to spin a chef cookbook with kitchen converge. I have synced_folders set up which are created correctly, however I can not assign the desired USER:GROUP. There is no kitchen documentation on how to do it and I have tried different ways…
al gh
  • 508
  • 2
  • 15
2
votes
3 answers

Is it possible to run kitchen tests against a server without using any drivers?

I just want to see if it's possible to run kitchen tests against a server that's always on. I know that testing cookbooks against VMs that you can create and destroy at will would be ideal, but I would expect there to be some stripped down way of…
arjabbar
  • 6,044
  • 4
  • 30
  • 46
2
votes
3 answers

Could not load the 'vagrant' driver from the load path: Kitchen cannot find kitchen-vagrant's plugin

I've installed the latest ChefDK and running through one of the kitchen tutorials on the Chef site. When I run kitchen list, this is the error message I see: >>>>>> ------Exception------- >>>>>> Class: Kitchen::ClientError >>>>>> Message: Could not…
EmeraldAegis
  • 99
  • 3
  • 10
2
votes
2 answers

Chef Vault with Test-Kitchen, Vagrant and Chef-Zero provisioner

I have an environment setup with Test-Kitchen v1.5.0, Vagrant v1.8.1. I have a recipe that uses chef vault to decrypt our encrypted passwords that our in our data_bags_path/passwords/pilot.json file. I am using the solution here…
tjmair
  • 77
  • 7
2
votes
2 answers

How to change box name in Chef kitchen.yml?

I have created my kitchen.yml in the following way: --- driver: name: vagrant customize: memory: 2048 driver_config: require_chef_omnibus: true use_vagrant_berkshelf_plugin: true provisioner: name: chef_zero chef_omnibus_url:…
meallhour
  • 13,921
  • 21
  • 60
  • 117
2
votes
1 answer

How do I use roles in test kitchen?

I can't figure out how to run roles in a run list in test kitchen. I did a knife download roles to my chef repo (C:\.chef\roles). I also did a knife download cookbooks to c:\.chef\cookbooks Here is the .kitchen.yml for a cookbook I want to test…
red888
  • 27,709
  • 55
  • 204
  • 392
1 2
3
23 24