diff options
author | Ho-Sheng Hsiao <hosh@opscode.com> | 2013-02-11 15:57:27 -0800 |
---|---|---|
committer | John Keiser <jkeiser@opscode.com> | 2013-06-07 13:12:25 -0700 |
commit | 54ca886d8bfdfbcfea7bd3ed9f5f3e3e6054cbb3 (patch) | |
tree | 351c40c2bf14192bb545fd0cefb9880c9f867dbe /spec | |
parent | bba5ac00224cf3cffabfe39e51366778d6a3e8e1 (diff) | |
download | chef-54ca886d8bfdfbcfea7bd3ed9f5f3e3e6054cbb3.tar.gz |
[COOKBOOKS] Fixed regressions when versioned_cookbooks is false
Diffstat (limited to 'spec')
-rw-r--r-- | spec/support/shared/integration/knife_support.rb | 6 | ||||
-rw-r--r-- | spec/unit/chef_fs/file_system/cookbooks_dir_spec.rb | 22 |
2 files changed, 20 insertions, 8 deletions
diff --git a/spec/support/shared/integration/knife_support.rb b/spec/support/shared/integration/knife_support.rb index cd479ba6ab..7c695280ec 100644 --- a/spec/support/shared/integration/knife_support.rb +++ b/spec/support/shared/integration/knife_support.rb @@ -4,6 +4,7 @@ require 'logger' require 'chef/log' module KnifeSupport + DEBUG = ENV['DEBUG'] def knife(*args, &block) # Allow knife('role from file roles/blah.json') rather than requiring the # arguments to be split like knife('role', 'from', 'file', 'roles/blah.json') @@ -21,6 +22,7 @@ module KnifeSupport old_loggers = Chef::Log.loggers old_log_level = Chef::Log.level begin + puts "knife: #{args.join(' ')}" if DEBUG subcommand_class = Chef::Knife.subcommand_class_from(args) subcommand_class.options = Chef::Application::Knife.options.merge(subcommand_class.options) instance = subcommand_class.new(args) @@ -29,12 +31,12 @@ module KnifeSupport instance.ui = Chef::Knife::UI.new(stdout, stderr, STDIN, {}) # Don't print stuff - Chef::Config[:verbosity] = 0 + Chef::Config[:verbosity] = ( DEBUG ? 2 : 0 ) instance.configure_chef logger = Logger.new(stderr) logger.formatter = proc { |severity, datetime, progname, msg| "#{severity}: #{msg}\n" } Chef::Log.use_log_devices([logger]) - Chef::Log.level = :warn + Chef::Log.level = ( DEBUG ? :debug : :warn ) Chef::Log::Formatter.show_time = false instance.run diff --git a/spec/unit/chef_fs/file_system/cookbooks_dir_spec.rb b/spec/unit/chef_fs/file_system/cookbooks_dir_spec.rb index 559ca91516..723b348da2 100644 --- a/spec/unit/chef_fs/file_system/cookbooks_dir_spec.rb +++ b/spec/unit/chef_fs/file_system/cookbooks_dir_spec.rb @@ -30,14 +30,24 @@ describe Chef::ChefFS::FileSystem::CookbooksDir do }, 'everything') } - let(:cookbooks_dir) { root_dir.child('cookbooks') } - let(:should_list_cookbooks) do - @rest.should_receive(:get_rest).with('cookbooks').once.and_return( + + let(:cookbook_response) do { - "achild" => "http://opscode.com/achild", - "bchild" => "http://opscode.com/bchild" - }) + "achild" => { + "url" => "http://example.com/cookbooks/achild", + 'versions' => [ + { "version" => '2.0.0', 'url' => 'http://example.com/cookbooks/achild/2.0.0' }, + { "version" => '1.0.0', 'url' => 'http://example.com/cookbooks/achild/2.0.0' }, ] }, + "bchild" => { + "url" => "http://example.com/cookbokks/bchild", + 'versions' => [ { "version" => '1.0.0', 'url' => 'http://example.com/cookbooks/achild/2.0.0' }, ] }, + + } end + + let(:cookbooks_dir) { root_dir.child('cookbooks') } + let(:should_list_cookbooks) { @rest.should_receive(:get_rest).with('cookbooks').once.and_return(cookbook_response) } + before(:each) do @rest = double("rest") Chef::REST.stub(:new).with('url','username','key') { @rest } |