Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

RSS

example_resources (13) Versions 1.0.3

Provider cookbook that defines an example Chef resource. Integration tests in InSpec.

Berkshelf/Librarian
Policyfile
Knife
cookbook 'example_resources', '= 1.0.3'
cookbook 'example_resources', '= 1.0.3', :supermarket
knife cookbook site install example_resources
knife cookbook site download example_resources
README
Dependencies
Changelog
Quality

example_resources

Build Status

This is a resource cookbook that demonstrates how to use InSpec for integration testing.

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.

This is a simple resource cookbook that defines a Chef resource. I wrote another cookbook called example, which consumes the resource defined here.

To test

  1. Install bundled gems using Bundler in context of ChefDK
  2. Converge in context of Bundler and ChefDK
  3. 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)

Changelog

This file tracks and describes changes to example_resources.

This project adheres to semantic versioning 2.0.

v1.0.2 (2016-03-19)

  • Improve metadata for Supermarket
  • Increase detail in readme
  • Add license
  • Point to Supermarket instead of GitHub

v1.0.1 (2016-03-18)

  • Correct spelling of InSpec

v1.0.0 (2016-03-17)

  • Refactor name from example_resource_cookbook to example_resources

v0.1.0 (2016-03-16)

  • Creates example_resource
  • Creates test cookbook
  • Supports Centos

Foodcritic Metric
            

1.0.3 passed this metric