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

Chef::remote_file unable to download while doing a kitchen converge

I have the following piece of code to download an installer remote_file '/tmp/apache-tomcat-8.0.23.tar.gz' do source 'http://mirror.sdunix.com/apache/tomcat/tomcat-8/v8.0.23/bin/apache-tomcat-8.0.23.tar.gz' end which when executed using kitchen…
codec
  • 7,978
  • 26
  • 71
  • 127
0
votes
2 answers

Can we add a role in kitchen.yml?

Here is my kitchen.yml --- driver: name: vagrant network: - ["private_network", {ip: "192.168.35.35"}] provisioner: name: chef_zero # You may wish to disable always updating cookbooks in CI or other testing environments. # For…
codec
  • 7,978
  • 26
  • 71
  • 127
0
votes
2 answers

Test Kitchen Vagrant Berkshelf

With the following software versions installed: Berkshelf - 2.0.18 Ruby - 2.2.2 Vagrant - 1.9.3 test-kitchen - 1.15.0 kitchen-vagrant - 1.1.0 Chef Server API version - 11.0.2 I am attempting to run test kitchen on my local system. In doing so, I…
user2932053
0
votes
1 answer

chef file cache not where expected

While trying the following example on chef leaning: https://learn.chef.io/manage-a-web-app/ubuntu/configure-the-database/ I ran in to an issue with this piece of code # Create a path to the SQL file in the Chef cache. create_tables_script_path =…
TyMac
  • 783
  • 2
  • 9
  • 32
0
votes
1 answer

InSpec should_be_listening Test Fails When Port is Open

Environment chefdk 1.3.40 berks 5.6.4 kitchen 1.16.0 vagrant 1.9.3 After a 'kitchen login', we can see that port 80 has been opened sudo iptables-save | grep 80 -A IN_public_allow -p tcp -m tcp --dport 80 -m conntrack --ctstate NEW -j…
Paul Croarkin
  • 14,496
  • 14
  • 79
  • 118
0
votes
1 answer

How can I add a second nic in Test Kitchen with the ec2 driver?

Looking at the readme I see lots of options for adding extra storage but nothing for a second nic. Is it possible?
TyMac
  • 783
  • 2
  • 9
  • 32
0
votes
1 answer

Test Kitchen: Chef don't restart after reboot

I have a problem during testing my chef cookbooks using Kitchen. I use Vagrant as a driver and Virtual Box as virtualization system. They running on Linux platform. I have create a test recipe to reboot my machine. This is the code: # # Author::…
AleZucchelli
  • 55
  • 1
  • 12
0
votes
0 answers

gem_package fails with Illformed requirement [""] in test kitchen

Getting error 'Illformed requirement [""]' during the gem installation in test kitchen on windows platform: I, [2017-03-24T15:17:54.108999 #2848] INFO -- enable-windows: ---- Begin output of C:\opscode\chef\embedded\bin\gem install…
ReshmaA
  • 85
  • 1
  • 3
  • 12
0
votes
3 answers

Set aws tags and instance name with ec2 driver in test kitchen?

Is there a way to set aws tags and an instance name with ec2 driver in test kitchen?
TyMac
  • 783
  • 2
  • 9
  • 32
0
votes
1 answer

Print vars with Test Kitchen - Chef

I'm working with Chef and Test Kitchen, I have some problems installing Apache 2.2 and I was reading the cookbook with my recipe (https://github.com/sous-chefs/apache2/blob/master/recipes/default.rb), I would like to know how this recipe is working…
BigBugCreator
  • 1,009
  • 4
  • 17
  • 34
0
votes
2 answers

how to add same cookbook recipe in other and how to access variables from included recipe

How to add same cook book recipe in other recipe include_recipe "localcookbook::test" where i have included there test recipe variables are not passing
Udhay
  • 7
  • 7
0
votes
0 answers

When i am running recipe second time i dont want to start the service second time

when i have added this recipe first time i want to run the service but whenever i am trying to deploy other recipe, I don't want to run this service again I have tried to add condition as creation of new file for guard service 'mapr-zookeeper' do …
Udhay
  • 7
  • 7
0
votes
2 answers

Same hosts 2nd time run lists are not running from test kitchen which are declared in 2nd time

Hi Same hosts i want to run other recipes 2nd time but only first declared run list only running but second time declared run list for same nodes are not running from .kitchen.yml and test kitchen. Please suggest me how can accomplish 2nd time…
Udhay
  • 7
  • 7
0
votes
1 answer

Kitchen and Kitchen-docker

I am trying to use kitchen-docker driver on a GNU/Linux machine. I have installed the kitchen-docker gem using chef gem install command. This is an extract of my .kitchen.yml file: --- driver: name: docker provisioner: name:…
Navarro
  • 1,284
  • 2
  • 17
  • 40
0
votes
0 answers

ec2 driver Test Kitchen config error

I cannot figure out why I keep getting this error with a custom AMI in test kitchen: "Failed to complete #create action: [undefined method `username' for nil:NilClass] on image5.0_new" Here is the plaforms stanza in the .kitchen.yml: platforms: -…
TyMac
  • 783
  • 2
  • 9
  • 32