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

Test kitchen doesn't retry when using reboot in Server 2012R2

My cookbook requires the guest to restart after installing WMF5 on Windows Server 2012R2. reboot 'Reboot Windows' do action :nothing end chocolatey 'DotNet4.5.1' do version '4.5.1.20140606' action :install end chocolatey 'Powershell' do …
Lloyd Smith
  • 1,187
  • 12
  • 21
0
votes
1 answer

No resource found when using berks cookbook in test kitchen

I'm trying to test a recipe that uses the sudo community cookbook. I have installed berks locally, I have created a Berksfile and added the following to it: source "https://supermarket.getchef.com" metadata cookbook 'sudo' and issued the commands…
Tom Klino
  • 2,358
  • 5
  • 35
  • 60
0
votes
0 answers

Error converging ubuntu1604 on a mac

I am trying to create and after that converge a kitchen-dokken ubuntu-1604 image on a mac but I can't seem to get it working. I have searched for three hours and that I know now is that it is because of systemd, that is only or mainly available for…
Horsty
  • 321
  • 6
  • 18
0
votes
1 answer

How do I test things in test kitchen that are only externally accessible?

I have a recipe that uses the file resource to grant an active directory group access to a local folder. I don't have access to AD from my Chef workstation where I am running test kitchen. I want to be able to converge the kitchen vm (not just spec…
red888
  • 27,709
  • 55
  • 204
  • 392
0
votes
1 answer

Test Kitchen says php-mysql is not installed

I'm new to Chef. I [think I] am installing php-mysql using package 'php-mysql' do action :install notifies :restart, 'httpd_service[apps]' end However, when I run the test describe package 'php-mysql' do it { should be_installed…
Christopher Francisco
  • 15,672
  • 28
  • 94
  • 206
0
votes
1 answer

Chef tutorial errors on node configuration [cannot load such file -- mysql2]

So here is the weird part. I'm using the ubuntu-14.04 platform for my test kitchen setup, and I'm also using bento/ubuntu-14.04 for my vagrant node. They should be the same right? I'm basically following the Chef tutorial Manage a Web App, and…
Christopher Francisco
  • 15,672
  • 28
  • 94
  • 206
0
votes
1 answer

Chef test kitchen: How to get the path of plugin scripts?

I'm learning chef and working with test kitchen. I have written a plugin script that checks if any *.core files in /var/tmp/ in my test instances were altered less than 5 min ago. In my cookbook this file is…
Alex Cohen
  • 5,596
  • 16
  • 54
  • 104
0
votes
1 answer

Chef: Test Kitchen with Vagrant Appears to ignore rdp_port

I'm working through some of the basic Chef tutorials, and trying to get my test kitchen set up for my cookbook using vagrant hosted on my local machine. I know that I need to port-forward my RDP connection to this box from port 3389 to 33389. Based…
kjb4
  • 141
  • 1
  • 6
0
votes
1 answer

Stuck on create symlink at /etc/service/kibana to /etc/sv/kibana when running kitchen test on CentOS 6.7

my problem here is I got stuck on the kibana create symlink instead of continue running on the the code below which is elasticsearch recipe and logstash recipe. Can anybody know why this is happening cause I don't have any idea whats going on about…
redwolfgang20
  • 368
  • 1
  • 5
  • 15
0
votes
1 answer

chef: cant use depends 'httpd' in metadata.rb

I cannot get my chef cookbook to use depends 'httpd', heres my metadata.rb: name 'awesome_customers_rhel' maintainer 'The Authors' maintainer_email 'you@example.com' license 'all_rights' description 'Installs/Configures…
Alex Cohen
  • 5,596
  • 16
  • 54
  • 104
0
votes
1 answer

Chef kitchen converge instance requires ssh password

To run kitchen converge and set up my test kitchen vagrant instance, such as in this guide, I have noticed that I must first create a $COOKBOOK_ROOT_DIR/.kitchen/default-centos-72.yml file. After the file has been created with kitchen converge I…
Alex Cohen
  • 5,596
  • 16
  • 54
  • 104
0
votes
0 answers

chef integrations tests are not identified by kitchen

I'm trying to write integration tests for chef cookbook using serverspec verifier-name in kitchen using kitchen-ssh driver. below is the directory structure how the files are arranged in my cookbook. |-- recipes | …
0
votes
0 answers

Vagrant-winrm not recognized when running kitchen list

I have a very simple serverspec test that I'm trying to run for platform windows-2012r2. When I run kitchen list I get the following: exception: "#
devlife
  • 15,275
  • 27
  • 77
  • 131
0
votes
1 answer

chef-provisioning chef-zero testing with test-kitchen convenience

We are currently using the following approach: Test and develop Cookbooks with test-kitchen, bootstrap a node with knife bootstrap At the moment I am switching our bootstrap part over to chef-provisioning because we also want to automatically clone…
Stefan Marbury
  • 187
  • 1
  • 13
0
votes
1 answer

How to get value of the ipaddress specified in TestKitchen using OHAI?

I am providing the ipaddress of the machine within my kitchen.yml: - name: node_abc driver: network: - ['private_network', {ip: '193.169.33.84'}] When I try to retrieve the value of ipaddress using ohai node[ipaddres] I get…
meallhour
  • 13,921
  • 21
  • 60
  • 117