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

I can't access to my web app with kitchen instance

I using Test-Kitchen and Vagrant to do integration test on my cookbooks. But when I use kitchen login and enter into my VM to proof manually the status of apache2 service (I'm on ubuntu 12.04) there is not problems, it service is running but when I…
Robert
  • 10,403
  • 14
  • 67
  • 117
1
vote
2 answers

What is the difference between kitchen.yml and .kitchen.yml in chef?

What is the difference between kitchen.yml and .kitchen.yml? Why that extra dot in the beginning? I can only find the below statement in google and nothing else to help. As of test-kitchen 1.21.0, we now prefer kitchen.yml over .kitchen.yml. This…
Manikanta
  • 11
  • 1
1
vote
1 answer

Test Kitchen Chef Zero Use Sudo to create root_path

I'm trying to match Chef zero with what's actually used on my Chef server by setting the root_path to /etc/chef from the default /tmp/kitchen. After Chef is installed I get the following error: Setting up chef (12.22.1-1) ... Thank you for…
Ken Jenney
  • 422
  • 7
  • 15
1
vote
2 answers

Using terraform output in kitchen terraform tests

I am using Kitchen terraform to deploy/test a environment on GCP. I am struggling to get the kitchen/inspec part to use the terraform output values, so i can use them in my tests. This is what I have My inspec.yml name: default depends: - name:…
1
vote
1 answer

How to set disk size for a virtualbox vm in Chef's Test Kitchen

Pretty much what the title says: I need Kitchen to tell VirtualBox that the VM's hard drive should be 500gb. I've scoured the docs and not found anything (kitchen.ci). Am I just not looking in the right places?
Jake
  • 906
  • 10
  • 23
1
vote
1 answer

chef test-kitchen run only default recipe

I installed chef workstation on windows, I have 2 recipes, default and install_nginx, when I run kitchen converge, kitchen only executes the default recipe. For security I do kitchen verify and it gives me an error because the test script verificase…
1
vote
2 answers

Chef Policyfile.rb `include_policy` doesn't guarantee immutability of policy dependency

Let's say I have a Polcyfile.rb in a cookbook called motd: name 'motd' default_source :chef_repo, "../" include_policy "Policyfile", path: "../environment" run_list 'motd' and a recipes/default.rb: file '/etc/motd' do content…
ethan123
  • 1,084
  • 2
  • 14
  • 26
1
vote
1 answer

Cant accept license while running kitchen test

I run kitchen test, cant accept the license, answer yes does nothing kitchen.yml provisioner: name: chef_zero always_update_cookbooks: true retry_on_exit_code: - 35 # 35 is the exit code signaling that the node is rebooting max_retries:…
Hareesh
  • 29
  • 3
1
vote
2 answers

Is it possible to get platform or suite names found in .kitchen.yml inside a recipe?

.kitchen.yml: platforms: - name: win2012r2 suites: - name: example Is it possible to get the running platform or suite name from within a recipe? I've tried node['platform'] and node['suite'] but both are empty.
Reed G. Law
  • 3,897
  • 1
  • 41
  • 78
1
vote
1 answer

Chef reboot resource causes chef run to time out before Windows server is able to start back up after update and resume recipe

I am trying to create a domain on a windows 2012 R2 server and it requires a reboot before the recipe can proceed: reboot "reboot server" do reason "init::chef - continue provisioning after reboot" action :reboot_now end I receive the following…
aphexlog
  • 1,503
  • 3
  • 16
  • 43
1
vote
1 answer

How to debug an Opsworks/Chef 11.10.4 cookbook locally on Linux (Debian9) using Centos Vagrant guest (Amazon Linux like)

I searched for this for 3 weeks but didn't find any real answer. The main goal is to save time to test dev Chef cookbooks locally before deploying on production on AWS. All I found is some hints using Ubuntu with Vagrant : Chef - How to run a…
Gilles Quénot
  • 173,512
  • 41
  • 224
  • 223
1
vote
1 answer

Inspec (Kitchen) Multiple Control / Target Types

It doesn't seem as if I am able to run Inspec against multiple targets using different controls. For instance I have the following: control "aws" do describe aws_ec2_instance(name: 'Terraform Test Instance') do it { should exist } …
Brian Carpio
  • 493
  • 3
  • 9
  • 15
1
vote
1 answer

Cannot stub chef-vault data with unencrypted data bags for Kitchen Test

Chef Development Kit Version: 2.4.17 chef-client version: 13.6.4 delivery version: master (73ebb72a6c42b3d2ff5370c476be800fee7e5427) berks version: 6.3.1 kitchen version: 1.19.2 inspec version: 1.45.13 I am trying to test my chef-vault…
1
vote
1 answer

kitchen-terraform-aws testing without ssh

Is there any way to test the Kitchen-terraform with aws host availability, without ssh into the aws machine? I'm trying to bring the aws instance up by using terraform, then updating the ruby specs to verify the instance availability and security…
suresh goud
  • 367
  • 1
  • 3
  • 19
1
vote
1 answer

Chef kitchen.local.yml "attributes:" overrides sticking after removed

I have this issue with chef, namely kitchen.local.yml. It overrides kitchen.yml, that works. But when I remove the overridden attribute, it behaves like it is not removed. It looks like it is somehow cached. I can only change the value. This causes…
Ondra Žižka
  • 43,948
  • 41
  • 217
  • 277