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

Test Kitchen Fails Almost Every Time on Transferring Files

Almost every time I run kitchen converge with ec2 driver it is able to create the server and establish an ssh connection but then after detecting the chef omnibus installation it tries to transfer files but fails with an unhelpful error. I've tried…
Alex
  • 1,161
  • 1
  • 7
  • 7
2
votes
2 answers

How can set dynamic attribute value in .kitchen.yml

I am using kitchen with ec2 driver. I would like to add Name tag to ec2 instances based on the instance name kitchen creates. If I had a 'default' suite and was using centos7.2, kitchen list would name the instance 'default-centos-72'. I could hard…
loafdog
  • 101
  • 7
2
votes
2 answers

Including dependencies in Ansible + Test Kitchen

I am trying to get Ansible + Test Kitchen to work and my code is available at Github. When running kitchen test it errors out with: ERROR! the role 'geerlingguy.java' was not found in…
Alex Harvey
  • 14,494
  • 5
  • 61
  • 97
2
votes
2 answers

How to specify cookbook_path in .kitchen.yml with chef_zero provisioner without Berkshelf

My project is structured with our company cookbooks in a directory separate from 3rd-party cookbooks. cookbooks | |- CompanyCookbooks | | | |-MyCookbook | |- 3rdPartyCookbooks | | | |-ark While working from the "MyCookbook" directory, I'm…
TreverW
  • 440
  • 7
  • 16
2
votes
0 answers

running service elasticsearch start fails, but running the command manually succeeds

Context: I'm testing an elasticsearch 1.7.1 configuration that's set up by chef, and testing in kitchen The chef script and configuration works because it's running in production somehow running service elasticsearch start as the elasticsearch user…
BrDaHa
  • 5,138
  • 5
  • 32
  • 47
2
votes
2 answers

How to run multiple kitchen-ansible role tests

I'm using kitchen and ansible to test-drive server configurations. Every example I can find has a .kitchen.yml file in the same folder as the ansible role. I would like to execute multiple tests but there doesn't seem to be an in-built way of doing…
blank
  • 17,852
  • 20
  • 105
  • 159
2
votes
1 answer

Test Kitchen 1.4.2 initial setup Message: Could not load the 'ssh' driver from the load path

Working on evaluating Chef. Working with Test-Kitchen. **** note -- Linux and Chef novice **** I am utilizing CentOS 7. Installed chefdk 0.7.0. Due to some Websense limitations in my sandbox, I was simply going to stand up 2 VM's and use the…
pcguy88
  • 51
  • 4
2
votes
1 answer

How to multi-provision in kitchen.yml?

I have a Vagrantfile in which I am provisioning different Vm's by looping through a json file. eg. cluster_config.each do |cluster| cluster_name = cluster[0] # name of node nodes_config =…
MikeW
  • 4,749
  • 9
  • 42
  • 83
2
votes
1 answer

Use test-kitchen with Vagrant and Parallels?

Is it possible to use test-kitchen with Vagrant and Parallels? I have a working kitchen using Virtualbox, but I wanted to try with Parallels. I've installed the Vagrant Parallels plugin and confirmed that is working. But when I run kitchen converge,…
wisbucky
  • 33,218
  • 10
  • 150
  • 101
2
votes
1 answer

How can I capture chef-client log output to a file in a kitchen run?

I am trying to configure chef-client to output logs to a file in a test kitchen run, but my configuration in .kitchen.yml doesn't appear to be being reflected in the client.rb prepared and injected into the test node. I'm using ChefDK 0.3.6, the…
Allan Lang
  • 130
  • 2
  • 7
2
votes
3 answers

kitchen create new_box command not working

I'm running the command kitchen create default-centos65 but I am not able to pull in the box and provision. For whatever reason it keeps saying the URL path is…
Petesta
  • 1,623
  • 3
  • 19
  • 29
2
votes
1 answer

How to write platform specific tests in test-kitchen?

What is the best way to write tests that react differently depending on the platform they are running on? My use case is the following: I want to ensure my system is protected against the heartbleed bug in open ssl. This means verifying that the…
Alex Ethier
  • 497
  • 2
  • 7
  • 18
2
votes
2 answers

Testing library Chef cookbooks

Summary: How can I best test a library cookbook meant for inclusion from another cookbook? Details: I am writing a cookbook that contains an LWRP and a minimal default recipe that sets some attributes based on where it is run. However the new…
Friedrich 'Fred' Clausen
  • 3,321
  • 8
  • 39
  • 70
2
votes
1 answer

vagrant-lxc fails to start when run from test-kitchen

I'm trying to use LXC to run test-kitchen. When I use following .kitchen.yml driver: name: vagrant provisioner: name: chef_solo platforms: - name: ubuntu-12.04 driver: box: precise-lxc provider: lxc kitchen-converge fails…
AlexD
  • 914
  • 7
  • 15
2
votes
1 answer

Kitchen lxc not finding container

I'm trying to run kitchen with my actual test suite using LXC, I have tried kitchen delegating to vagrant-lxc and kitchen-lxc both without any luck. Using kitchen-lxc my kitchen.yml looks this way: driver_plugin: lxc driver_config: …
Carlos Castellanos
  • 2,358
  • 4
  • 25
  • 43