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 solo can't find cookbook during kitchen test run

I'm trying to add a Test Kitchen for a bunch of cookbooks that we use to provision a Jenkins CI instance. We use Berkshelf to manage dependencies. The file structure is as follows: | .gitignore | .kitchen.yml | Berksfile | Berksfile.lock | …
PiX06
  • 431
  • 4
  • 17
0
votes
2 answers

"Kitchen list" command fails with "Could not load the 'ssh' transport from the load path"

I'm trying to add a Test Kitchen to a Chef cookbook but am getting the error "Could not load the 'ssh' transport from the load path". I have previously set up a Test Kitchen following the exact same steps without issue, but that was on a different…
PiX06
  • 431
  • 4
  • 17
0
votes
0 answers

Can't transfer cookbook to Windows node using Chef Kitchen

I've been stuck trying to converge my test cookbook with Chef Kitchen. I've tried tinkering with the settings and using different vagrant boxes as well as "packing" my own. But each time I still get this error: >>>>>> ------Exception------- >>>>>>…
Zhao Li
  • 4,936
  • 8
  • 33
  • 51
0
votes
1 answer

How do I set up a Test-Kitchen networked cluster

I'm trying to set up a cluster of local VMs with test-kitchen so that they can communicate with each other. I don't care if they can talk to the world outside of their little cluster. Tech in use: Test-kitchen on windows 7 chef-zero…
JackChance
  • 520
  • 3
  • 11
0
votes
2 answers

chefspec NoMethodError for cron_d

I have a successful resource: (converged, worked as expected) cron_d 'zk_metric' do minute '*' command “something something" end But after adding spec it 'add cron_d' do expect(chef_run).to create_cron_d('zk_metric') end chefspec got the…
digit plumber
  • 1,140
  • 2
  • 14
  • 27
0
votes
0 answers

Searching with chef-zero non working as with chefserver

I have a problem when using search inside a chef recipe: When my cookbook runs using chefserver, the next search is successfull: search(:node, %Q{nginx_vhosts_#{name}:*}) When my cookbook runs using chef-zero (with kitchen) it is not successful,…
albs
  • 13
  • 4
0
votes
1 answer

Chef - create test data bags at Compile Time

In my chef recipe, I am basically decrypting a couple of data bags: 1. test.json 2. sample.json The data obtained after decryption will next be used to create files on my kitchen node. Basically, test.json and sample.json are encrypted using a…
Sasanka Panguluri
  • 3,058
  • 4
  • 32
  • 54
0
votes
1 answer

Chef execute fails for the first time

I have a weird problem with a Chef Recipe. Let me tell you that I'm new to Chef so pardon me if something looks awfully wrong. I have my war file, which is built by Spring Boot. I just need to run java -jar .war -config=config/ to run my…
Sasanka Panguluri
  • 3,058
  • 4
  • 32
  • 54
0
votes
1 answer

Kitchen-EC2 SSH prompting password for an instance inside VPC

I am trying to spin up an ec2 instance inside a VPC on a private subnet. Every time I run kitchen test, I am able to spin up the instance with the right security groups and in the right subnet range. When test-kitchen is trying to SSH on to the…
jssnirmal
  • 78
  • 4
0
votes
1 answer

How to 'kitchen login' with user different from root

our main cookbook disables root login via ssh, but we want to be able to execute kitchen login to play with the test machine (yes, we can do it with ssh machine, but I want to know if it is possible to configure test-kitchen to use a custom…
meddle
  • 159
  • 2
  • 9
0
votes
1 answer

Bad parameter combination with ec2 & test-kitchen

I'm trying to run test kitchen using the ec2 plugin in our VPC and getting the following message: Message: InvalidParameterCombination => The parameter groupName cannot be used with the parameter subnet As soon as I set the subnet_id to denote it's…
Dan Webb
  • 64
  • 4
0
votes
1 answer

How to define custom attributes for nginx cookbook?

For my current problem I'm using the nginxcookbook. What I want to do is to install it from source (no problem to do that using nginx::source) and prefix it to /opt/nginx//, but it will always be prefixed (by default) to…
0
votes
1 answer

Determining if a test-kitchen test passed or failed

We have a script that looks something like this: #!/bin/bash for cookbook in $cookbooks; do cd /path/to/$cookbook kitchen test; # Log whether the test failed or passed done; # Print number of tests passed and number of tests failed How…
Jacklynn
  • 1,503
  • 1
  • 13
  • 23
0
votes
1 answer

How to dynamically get IP address from already executed recipe in Chef

I am a new to Chef and I am trying to test AWS cluster configuration for 2 db serves + 2 application servers using kitchen-ec2 and facing the following problem: I cannot dynamically pass ip_address_1 from recipe#1 (recipe#1 for server1 is…
Dmitry S
  • 4,990
  • 2
  • 24
  • 32
0
votes
1 answer

Test Kitchen (chefdk), Vagrant and Amazon VPC

I'm trying to get KitchenCI to build test instances inside my Amazon VPC. I have this working, however when Vagrant goes to attempt to connect to the ec2 instance, it uses the instance's external (public) IP vs it's internal (VPC) IP. Is there any…
danieljimenez
  • 1,390
  • 4
  • 17
  • 26