cookbook 'example', '= 0.1.3'
example (15) Versions 0.1.3 Follow0
Recipe cookbook that calls Chef resources defined in a separate resource cookbook dependency. Integration tests are in InSpec.
cookbook 'example', '= 0.1.3', :supermarket
knife supermarket install example
knife supermarket download example
example
This is a simple cookbook that depends on a resource cookbook called example_resources, which defines a simple Chef resource.
The purpose of this cookbook is to illustrate the relationship between a cookbook that defines a new Chef resource, and another cookbook that consumes it.
Integration tests are in InSpec. Unit tests are in ChefSpec.
To test
- Install bundled gems using Bundler in context of ChefDK
- Converge in context of Bundler and ChefDK
- Verify in context of Bundler and ChefDK
$ chef exec bundle install $ chef exec bundle exec kitchen converge $ chef exec bundle exec kitchen verify
Gemfile
Currently ChefDK provides Test Kitchen 1.5.0 which doesn't play nice with InSpec.
Note how I lock gem versions using the Gemfile. Run your tests in the context of these Gemfile
locks, otherwise you will likely see problems [at the time of this writing].
This is because ChefDK does a shim thing and locks Test Kitchen to 1.5.0, so I use a Gemfile to lock to Test Kitchen 1.6.0.
The ChefDK shim looks like this for ChefDK 0.15.2 on OS X:
$ cat /opt/chefdk/bin/kitchen #!/opt/chefdk/embedded/bin/ruby #--APP_BUNDLER_BINSTUB_FORMAT_VERSION=1-- ENV["GEM_HOME"] = ENV["GEM_PATH"] = nil unless ENV["APPBUNDLER_ALLOW_RVM"] == "true" gem "chef-config", "= 12.7.2" gem "mixlib-config", "= 2.2.1" gem "mixlib-shellout", "= 2.2.6" gem "mixlib-install", "= 0.7.1" gem "net-scp", "= 1.2.1" gem "net-ssh", "= 3.0.2" gem "safe_yaml", "= 1.0.4" gem "thor", "= 0.19.1" gem "test-kitchen", "= 1.5.0" spec = Gem::Specification.find_by_name("test-kitchen", "= 1.5.0") bin_file = spec.bin_file("kitchen") Kernel.load(bin_file)
Dependent cookbooks
example_resources >= 0.0.0 |
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
Changelog
This file tracks and describes changes to example_resources
.
This project adheres to [semantic versioning 2.0][semver].
v0.1.2 (2016-03-19)
- Correct spelling of InSpec
- Improve metadata for Supermarket
- Fix Travis CI config
- Correct my email address
- Remove group from Berksfile
v0.1.1 (2016-03-18)
- Minor changes, refer to public supermarket
v0.1.0 (2016-03-18)
- Initial version, a simple cookbook that depends on
example_resources
Foodcritic Metric
0.1.3 passed this metric
0.1.3 passed this metric