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

How do I run roles in test kitchen without putting everything in the berksfile?

Asked a similar question on this, but realized my problem is more with conceptualizing how this can work. I've read a bunch of articles, but I'm still super confused. Here is what I am doing now: I apply a set of base roles to all my nodes…
red888
  • 27,709
  • 55
  • 204
  • 392
0
votes
2 answers

how to get information about chef provisioner (chef-zero or not) inside a chef recipe?

In my recipe I want to find out the the mode in which chef is running and load from data bag based on that. If it is running chef-zero then I will load the data bag in a specific way and if not in a different way . if Chef::Config[:zero] == 'true' …
Shamik
  • 1,591
  • 2
  • 16
  • 36
0
votes
1 answer

Chef Kitchen (kitchen-ec2) serverspec spec failing and causing error

I am learning Chef and the testing process using Kitchen with the ec2 driver and have the following serverspec file: require "serverspec" set :backend, :exec describe "rbenv" do describe file("/home/ec2-user/.rbenv") do it { should…
sixty4bit
  • 7,422
  • 7
  • 33
  • 57
0
votes
1 answer

Test-Kitchen sync files to remote servers

I've been using test-kitchen locally with Vagrant to run serverspec tests and haven't had any major problems. I'm now setting up my CI process with test-kitchen, and using kitchen-google Gem to provision servers and run my serverspec test suite. I…
user387049
  • 6,647
  • 8
  • 53
  • 55
0
votes
1 answer

kitchen converge on chef_roles using chef_zero doesn't expand run_list

Issue: I was trying to use chef_zero to test my cookbook roles specified in ruby DSL format, but when I tried to do kitchen converge. It looks like it's not able to expand the role specified in kitchen.yml. How to Resolve: Is it not possible to use…
bablu
  • 75
  • 4
  • 11
0
votes
1 answer

Ansible + Test Kitchen: passing Array data into dependent module

I am trying to set up Ansible + Test Kitchen to test a Galaxy module for Sonatype Nexus. In order to do this, I want a dependency on geerlingguy.java and I'd like to override the default Java version by passing an array java_packages:…
Alex Harvey
  • 14,494
  • 5
  • 61
  • 97
0
votes
0 answers

chef local kitchen apt-get update stuck

I am trying to configure Ubuntu 14.04 locally on Mac. I have: apt_update "update apt sources" do action :update end in the receipt and overtime I run it using kitchen converge, the program stuck at the following: * execute[apt-get -q update]…
dami.max
  • 377
  • 3
  • 17
0
votes
0 answers

WinRM:: HTTPNegotiate::WinRMWebService Error while trying kitchen create to launch instance

I was trying to launch windows-2012 instance using kitchen-ec2 and test-kitchen. I was using the below kitchen.yml file for launching instance.I observe the instance to be created but it eventually leads to this error. can any one guide me on what's…
bablu
  • 75
  • 4
  • 11
0
votes
2 answers

include_recipe does not work with test-kitchen

I have two cookbooks "users" and "nginx". First cookbook creates users and folders for system and second cookbook installs nginx for created directories' configuration. In kitchen.yml file I added "users:default" to run list: --- driver: name:…
Mehmet Davut
  • 667
  • 10
  • 30
0
votes
1 answer

Message: Failed to complete converge action

PS C:\App\cookbooks\windows_settings> kitchen verify ---> Starting Kitchen (v1.4.2) C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/httpclient-2.6.0.1/lib/httpclient/webagent-cookie.rb:458: warning: a lready initialized constant…
pavan kumar
  • 102
  • 1
  • 2
  • 11
0
votes
0 answers

Cookbooks are not being executed in order

I am trying to install resource before I execute my own recipe. .kitchen.yaml: run_list: - recipe[ets_base_filesystems::default] - recipe[nexpose::default] - recipe[ets_nexpose_bootstrap::default] Execution log: Synchronizing Cookbooks: …
Snehit Gajjar
  • 38
  • 1
  • 6
0
votes
1 answer

Kitchen doesn't recognise docker

The problem is quite simple: $ kitchen converge -----> Starting Kitchen (v1.6.0) >>>>>> ------Exception------- >>>>>> Class: Kitchen::UserError >>>>>> Message: You must first install the Docker CLI tool http://www.docker.io/gettingstarted/ >>>>>>…
AsTeR
  • 7,247
  • 14
  • 60
  • 99
0
votes
2 answers

Chef: How to set a user's password from an encrypted data bag

I am using Chef with kitchen (1.5.0) and vagrant (1.8.1) to manage a user consistently with a new server. My user recipe looks like this: include_recipe "users" group 'sudo' password_secret =…
Jay Godse
  • 15,163
  • 16
  • 84
  • 131
0
votes
1 answer

Cannot use test-kitchen with lxc

I am trying to setup my test-kitchen setup with lxc. Lxc is working fine on my machine and i have tested it. When i try to do kitchen create i am getting following error. -----> Starting Kitchen (v1.6.0) >>>>>> ------Exception------- >>>>>> Class:…
shivams
  • 2,597
  • 6
  • 25
  • 47
0
votes
1 answer

Chef purpose of cwd attribute on script resource

What is the purpose of cwd attribute in script resource? For some reason the running the first block works but the second one doesn't work as intended (i.e. cloning the git repo under /var/apps) script 'clone_repo' do interpreter "bash" code…
denniss
  • 17,229
  • 26
  • 92
  • 141