Project

cpspec

0.0
No commit activity in last 3 years
No release in over 3 years
lets to run your chef cookbooks or puppet manifest again local vm and runs test on it
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6.4

Runtime

= 1.1.rc.6
= 0.9.2.2
= 0.8.7
 Project Readme

cpspec¶ ↑

Cpspec is a framework which allows behaviour driven development for chef cookbooks/Puppet Manifests. It enables testing of the cookbooks on the local box. The same test then can be executed on Target machine. It is a vagrant extension. Use vagrant to apply cookbook on the local environment and then run test to assert if desired changes are applied.

Installation¶ ↑

gem install cpsec

Usage¶ ↑

  • Write test for the cook books

require 'test/unit'
class TestJavaCookbook
  def test_java_installed_in_correct_path
    assert_true File.exists?("/usr/bin/java")
  end
end
  • Specify the test directory path (Absolute or relative)

Vagrant::Config.run do |config|
 config.test.directory = "env-test"
 config.vm.define :dev do |conf|
  conf.vm.box = "lucid32"
  conf.vm.provision :chef_solo do |chef|
   chef.cookbooks_path = "chef-repo/cookbooks"
   chef.add_recipe "java"
  end
 end
end
  • Run tests

vagrant run_test

Copyright © 2011 Shishir Das. See LICENSE.txt for further details.