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
1
vote
1 answer

Test Kitchen, store credentials

With Test Kitchen, in the yaml configs... where is the best place to store globally used attributes that apply to multiple platforms and multiple suites? To use my .kitchen.yml as an example: --- provisioner: name: chef_solo platforms: - name:…
danieljimenez
  • 1,390
  • 4
  • 17
  • 26
1
vote
1 answer

How to set delay between converge and verify on kitchen test?

I'm running Serverspec integration smoke tests with Test Kitchen on a system built with Vagrant+Chef Solo. When i run kitchen test then the tests are started right after successful converge, and some of my tests fail because it takes time for the…
k6ps
  • 359
  • 4
  • 11
1
vote
1 answer

`search` not finding nodes by role on dev

I'm working on spinning up a cluster of nodes. In myrepo/cookbooks/mycookbook/.kitchen.yml I have driver: name: vagrant provisioner: name: chef_zero roles_path: '../../roles' environments_path: '../../environments' data_bags_path:…
KeatsKelleher
  • 10,015
  • 4
  • 45
  • 52
1
vote
1 answer

Test Kitchen - How can I pass the local user login in as a Chef attribute?

Our development environment includes local VMs running queries to larger, shared resources in the cloud. It was set up in such a way that the local user's login would be passed into a Chef role as an attribute, which is used to define SSH and DB…
invict_us
  • 103
  • 3
  • 8
1
vote
2 answers

chef test-kitchen configuration for Vagrant ssh connect timeout

My google-fu is failing me. what do I need to put into my .kitchen.yml in order to get it to increase the config.vm.boot_timeout or number of attempts in my Vagrantfile. My kitchen converge almost always hits: STDERR: Timed out while waiting for…
Bill Warner
  • 639
  • 6
  • 18
1
vote
1 answer

Development using Vagrant with Chef Test Kitchen

First would like to apologise if this is blatantly obvious, have only just started working with Chef and still getting to grips with the details. Have some experience using Vagrant and Puppet but haven't done any infrastructure testing…
Nick
  • 1,219
  • 1
  • 13
  • 24
1
vote
1 answer

Class: Kitchen::ActionFailed - Test Kitchen + Docker + Remote API

I am trying to create a docker instance on a remote server using test kitchen (That came with ChefDK and with docker-api driver installed) on my Mac (OS X Mavericks) and I seem to failing almost at the last step: stardust:test_kitchen rilindo$…
Rilindo
  • 1,756
  • 1
  • 11
  • 20
1
vote
0 answers

Using chef-zero + docker + kitchen with multiple nodes recipe

I'm using Docker + chef-zero + Test Kitchen to test my cookbooks, As part of my recipe I am searching for other nodes: nodes = search(:node, "*:*") It seems that when converging my kitchen, It raises chef-zero on each container, and therefor the…
odedpr
  • 147
  • 1
  • 9
1
vote
1 answer

chef_zero provisioner won't work in test-kitchen

When testing out the chef_zero provisioner in the OpsCode test-kitchen tool, I am seeing the following error: $ bundle exec kitchen test -----> Starting Kitchen (v1.1.1) -----> Cleaning up any prior instances of ----->…
TrinitronX
  • 4,959
  • 3
  • 39
  • 66
1
vote
3 answers

Chef solo how to install postgresql 9.3 and minitest

I am trying to install postgresql 9.3 with chef solo from opcode recipes but I get the following error: Chef::Exceptions::Package: No version specified, and no candidate version available for postgresql93-devel here is my code in…
markhorrocks
  • 1,199
  • 19
  • 82
  • 151
1
vote
2 answers

Test kitchen stopped working suddenly

I wanted to use test-kitchen to deploy ubuntu with java and hadoop cookbook. I had installed 1 suite up with the test-kitchen. I put in another suite in the kitchen config file and now kitchen is broken. I put undid the changes to my kitchen config…
anu
  • 1,017
  • 1
  • 19
  • 36
1
vote
1 answer

Unable to search on node's role in chef cookbook recipe

I have to access ip address of a node with role pg_client in a cookbook recipe named hc-pg. For testing purpose I am using a single node which has both role[pg_client] and recipe[hc-pg] in the runlist. hc-pg has a recipe which tries to search on a…
Vaibhav
  • 569
  • 6
  • 31
1
vote
1 answer

What means the opts attribute in Test-Kitchen commands?

I am using Test-Kitchen for my integration test and I have a few doubts about the Kitchen command specificaly about the opts attribute It is the kitchen commands. Commands: kitchen console # Kitchen Console! kitchen…
Robert
  • 10,403
  • 14
  • 67
  • 117
1
vote
1 answer

How can I test if redis service is running using serverspec service resource?

I am using Test-Kitchen with the serverspec busser. I am trying to test the redis service is running into my kitchen instance. It is my serverspec test. describe "myapp::redis" do describe service ('redis6379') do it { should be_enabled } …
Robert
  • 10,403
  • 14
  • 67
  • 117
1
vote
1 answer

require ruby library in serverspec

I am a newbie in ruby and trying to get my hands dirty in chef. I have written a wrapper cookbook on postgresql community cookbook and wish to test it using test kitchen. Following is the spec.rb file I have written: require 'serverspec' require…
Vaibhav
  • 569
  • 6
  • 31