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

How to preserve existing host file when running chef template resource

I'm trying to add new set of FQDN and IPs into the existing Windows hosts file by using the Chef template resources. What I found out is when I ran the chef recipe it will erase the existing hosts file and then add the new updates. I only want to…
Fang
  • 151
  • 1
  • 11
0
votes
0 answers

why my gem is not found although it exists in the forge?

During a kitchen verify : $ cat test/integration/advanced/serverspec/Gemfile source 'https://rubygems.org' gem 'net-ssh', '3.2.0'
Minstrel
  • 369
  • 1
  • 2
  • 14
0
votes
2 answers

Error executing action `install` on resource 'windows_feature[AD-Domain-Services]' - on Windows server 2016 chef run with windows_feature resource

error: Error executing action `install` on resource 'windows_feature[AD-Domain-Services]' ^ this happens on all windows features when installing them via windows_feature resource on windows server 2016. Chef version: Chef Development Kit Version:…
aphexlog
  • 1,503
  • 3
  • 16
  • 43
0
votes
2 answers

Ruby returns uninitialized constant error when trying to include a module within a chef recipe

I have a java/recipes/windows recipe that uses a method called win_friendly_path and it doesn't work because win_friendly_path is not yet defined. win_friendly_path is however defined in the ../windows/libraries/windows_helper.rb as follows: module…
aphexlog
  • 1,503
  • 3
  • 16
  • 43
0
votes
2 answers

Can't figure out the complete path of JSON environment for Kitchen/Chef

I don't know how to set the full path of environement JSON file. I guess the path is composed of multiple level, but it's not described in doc The path is now environment/dev.json, what is a correct path/name ? My tests on hash in cookbooks…
0
votes
1 answer

Test Kitchen with existing chef node

If I already have a node provisioned using $ knife bootstrap... and in my list of servers $ knife list, can I just point kitchen to that node and have it converge so I can then run verify on it?
Greg
  • 382
  • 1
  • 5
  • 14
0
votes
0 answers

Running specific puppet tests using kitchen

I am using kitchen to run inspec tests for the puppet repository. I am able to apply the entire puppet catalogue ina vagrant box and then run tests for it. But what if I want to run a specific module in the puppet code base alone? I don't want to…
leoOrion
  • 1,833
  • 2
  • 26
  • 52
0
votes
1 answer

Chef's Kitchen tests fail but local examination prove otherwise

I'm testing two platforms, cento-7 & ubuntu-1604. Both converge successfully. But fail during verify. Ubuntu: System Package apache2 ✔ should be installed Service apache2 × should be running expected that `Service apache2` is…
KingAndrew
  • 1,164
  • 4
  • 21
  • 41
0
votes
2 answers

Chef Kitchen CI Verify without converge. Existing Server test

I have a situation where I want to test AWS EC2 sever using the Kitchen test framework. We are using cloudformation for our infrastructure creation and not the Chef. I want to use Kitchen Verify functionality by writing the test cases, but can't use…
Atul
  • 125
  • 1
  • 2
  • 6
0
votes
1 answer

Kitchen EC2 on Windows - Eventual WinRM::WinRMAuthorizationError

I am using the Kitchen EC2 driver for testing some Windows "base" cookbooks on Windows Server 2012R2, 2016, and 1803 AMIs from Amazon. I'm encountering what seems like a problem that happens after a specific duration of time while executing a recipe…
Jason Capriotti
  • 1,836
  • 2
  • 17
  • 33
0
votes
1 answer

Kitchen unable to load Vagrant

When I try to tun kitchen converge I keep getting the following error: -----> Starting Kitchen (v1.20.0) >>>>>> ------Exception------- >>>>>> Class: Kitchen::ClientError >>>>>> Message: Could not load the 'vagrant' driver from the load path. Please…
codec
  • 7,978
  • 26
  • 71
  • 127
0
votes
1 answer

test-kitchen: unable to use ENV variable in .kitchen.yml on Windows

It appears I'm unable to use erb in the .kitchen.yml when using the ENV var on Windows platforms. $ kitchen list >>>>>> ------Exception------- >>>>>> Class: Kitchen::UserError >>>>>> Message: Error parsing C:/Users/anonymous/.kitchen.yml as…
mdo123
  • 1,757
  • 3
  • 16
  • 34
0
votes
2 answers

Chef Kitchen Vagrant box will not start when adding additional disks

Development is happening on Mac OSX Writing a cookbook to partition, format, mount drives dynamically based on drives that are not partitioned, mounted, or formatted, May have been taken out of single drive raid-0 configuration, or may not have been…
0
votes
1 answer

Testkitchen in chef

I created a vagrant box out of windows 8.1 embedded OS that I have which includes winrm access. However when I try to create an instance using "Kitchen create", it's pulling the box and everything but kitchen's attempting to connect to Instance over…
Krishna
  • 13
  • 3
0
votes
1 answer

How to write test for chef make install

I am trying to write some tests for a chef Nginx cookbook. I have come to a block. I need to write a test for the code below. I can test for the core_lock released. I am unsure how to test for the make install as well as ./autogen.sh and ./configure…
user9753902