Testing Recipes and Roles Using Test Kitchen - nshenry03/chef-repo GitHub Wiki
Your chef repo should come with Test Kitchen pre-configured in .kitchen.yml
with Ubuntu 12.04 (precise64), Ubuntu 10.04 (lucid64), CentOS 6 (centos6), and CentOS 5 (centos5); however, you can add additional boxes if you would like (or remove ones that you company doesn't support).
The default
suite that comes pre-configured isn't very useful since it doesn't do anything; therefore, you should create your own role. For example, I got rid of the default suite and instead, created the 'base_system' test suite:
- name: base_system
run_list:
- role[base]
attributes: {}
Since I only have one role at the moment, I could test my base role on all platforms using the following command:
kitchen test --parallel
If I had multiple test suites, I could test just the 'base_system' suite with the following command:
kitchen test "base-system-*" --parallel
Or I could test a specific platform:
kitchen test "base-system-precise64"
To list all of the possible instances, use the following command:
kitchen list
NOTE: As far as I can tell, test kitchen does not support environments at this time; therefore, everything will be created using the "_default" environment. This means that the way we defined our 'base' role earlier will make it so that we are not testing the postfix cookbook with Test Kitchen.