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

ruby/chef: what is the purpose of the 'node' stanza?

Here is a example snipit of code: mwh_dir = "#{node['fmw']['middleware_home_dir']}" I have just been using this syntax without being able to find details online of why I need to use the node stanza. If someone could explain what the purpose of node…
aphexlog
  • 1,503
  • 3
  • 16
  • 43
1
vote
1 answer

Vagrant ubuntu/trusty64 contains old version of Ruby which causes test-kitchen to fail

I'm trying to learn Ansible with Vagrant (Ubuntu/trusty64) and I'm trying to use test-kitchen to assert my setup. The problem I am having is the Vagrant machine has an old version of Ruby (1.9.1) and therefore one of the dependencies (busser) fails…
Ilyas Patel
  • 400
  • 2
  • 11
  • 27
1
vote
2 answers

chef kitchen not working from Windows 10 integrated bash

I am receiving the following error when trying to run any command in 'kitchen': bash: /mnt/c/opscode/chefdk/bin/kitchen: C:/opscode/chefdk/embedded/bin/ruby.exe: bad interpreter: No such file or directory It works from outside integrated bash when…
aphexlog
  • 1,503
  • 3
  • 16
  • 43
1
vote
1 answer

Unable to configure my Docker container using intermediate_instructions and pid_one_command in Test Kitchen

The following .kitchen.yml file fails to configure my docker container with the required tools mentioned in intermediate_instructions. The pid_one_command also does not work as the container still loads with the bash shell Any ideas what is wrong…
1
vote
1 answer

Disable Virtualbox guest additions for Testkitchen

For tests in Testkitchen I use Vagrant base box with an older version of VirtualBox guest additions. So every time I run tests it updates guest additions first ==> default: Machine booted and ready! …
Kirill
  • 6,762
  • 4
  • 51
  • 81
1
vote
1 answer

Disable Chef/Berks SSL verification inside test kitchen

When running test kitchen, the Chef client inside VirtualBox VM isn't accepting my Chef server's self-signed certificate. $ bundle exec kitchen converge default-windows-2008r2 -----> Starting Kitchen (v1.17.0) -----> Converging…
spiffytech
  • 6,161
  • 7
  • 41
  • 57
1
vote
1 answer

How to run test kitchen in docker and use a local driver

I have a development environment set up inside a docker container with chef and all the dependencies installed (including kitchen gems, bundler, etc). If I wanted to run kitchen from my host and converge / test within a docker container, I could…
Brett
  • 5,690
  • 6
  • 36
  • 63
1
vote
2 answers

How to test a chef recipe with encrypted data bags

So in my recipe I have the following: secret = Chef::EncryptedDataBagItem.load_secret("/root/.chef/encrypted_data_bag_secret") # Decrypt the data bag creds = Chef::EncryptedDataBagItem.load("passwords", "mysql-root", secret) How can I override…
sdot257
  • 10,046
  • 26
  • 88
  • 122
1
vote
1 answer

Testing Chef cookbook failure

I'm writing a cookbook with custom resource that (among other things) validates SSH keys through ssh-keygen. I need to test scenario in which user feeds in invalid input and resource should raise according exception, so i'm searching for a way to…
Etki
  • 2,042
  • 2
  • 17
  • 40
1
vote
1 answer

Chef - Search within test kitchen context

I'm managing some scripts that can only be run on one server. I've decided the best way to single out one host that is assigned to a given role is by doing a search and then choosing the first element in the array returned. Like this: q =…
Brando__
  • 365
  • 6
  • 24
1
vote
1 answer

Users cookbook failing in Test Kitchen but working in bootstrap

I have a simple recipe that added users to a Centos 7.3 machine: users_manage 'sales' do group_id 5000 action [:create] data_bag 'sales_users' end users_manage 'mechanics' do group_id 6000 action [:create] data_bag 'shop_users' end The…
TyMac
  • 783
  • 2
  • 9
  • 32
1
vote
2 answers

How to properly change the Chef::Config[:file_cache_path] in .kitchen.yml?

I'm stumped. I want to change the cache location. The default is in the user profile temp folder; it makes for a VERY long path on Windows. I have looked over all the docs; and I can't seem to figure this out. Here I see that I can specify…
Pezius
  • 117
  • 3
  • 12
1
vote
1 answer

How to search the .kitchen.yml attributes

I want to search the hostname with searchnode = search(:node, "zookeeper:true") Want to get output Hostname.fqdn.com as node but i am not getting it. Maybe I don't know how to access the attribute. --- driver: name: vagrant provisioner: name:…
Udhay
  • 7
  • 7
1
vote
2 answers

How to install python 3.5 in chef

I am trying to install python 3.5 in a chef recipe. I tried using the poise-python cookbook. After reading the documentation. I tried the following command, but it doesn't install python 3.5. It installs python2.7 python_runtime 'python3' do version…
Jeetendra Pujari
  • 1,286
  • 2
  • 17
  • 31
1
vote
1 answer

The requested URL /awstats/awstats.pl was not found on this server on centos 7.2

I need help for my awstats problem I got 404 when I'm going to access awstats/awstats.pl. below is the current awstats.conf file. Alias /awstatsclasses "/usr/share/awstats/wwwroot/classes/" Alias /awstatscss "/usr/share/awstats/wwwroot/css/" Alias…