Class: Reagan::TestKnife
- Inherits:
-
Object
- Object
- Reagan::TestKnife
- Defined in:
- lib/reagan/test_knife.rb
Overview
tests cookbooks using knife cookbook test functionality
Instance Method Summary collapse
-
#initialize(cookbook) ⇒ TestKnife
constructor
A new instance of TestKnife.
-
#test ⇒ Object
performs knife cookbook test returns true if cookbook passed or false if it failed.
Constructor Details
#initialize(cookbook) ⇒ TestKnife
Returns a new instance of TestKnife.
22 23 24 |
# File 'lib/reagan/test_knife.rb', line 22 def initialize(cookbook) @cookbook = cookbook end |
Instance Method Details
#test ⇒ Object
performs knife cookbook test returns true if cookbook passed or false if it failed
28 29 30 31 32 33 34 35 |
# File 'lib/reagan/test_knife.rb', line 28 def test # grab the version of the cookbook in the local metadata result = system "knife cookbook test -o #{File.join(Config.settings['jenkins']['workspace_dir'], 'cookbooks')} #{@cookbook} > /dev/null 2>&1" puts 'Running knife cookbook test:' puts result ? 'PASS: Knife cookbook test was successful'.indent : 'FAIL: Knife cookbookk test was NOT successful'.indent.to_red result end |