Skip to content

Instantly share code, notes, and snippets.

@johnbellone
Created August 27, 2015 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnbellone/1d0c2745d8100ab771b1 to your computer and use it in GitHub Desktop.
Save johnbellone/1d0c2745d8100ab771b1 to your computer and use it in GitHub Desktop.
poise breaking cookbook name
~/Projects/rc-cookbook % bin/rspec test/spec/libraries/rc_file_spec.rb
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
Randomized with seed 22193
================================================================================
Error executing action `create` on resource 'rc_file[/etc/skel/bashrc]'
================================================================================
Poise::Error
------------
Unable to find cookbook for file "/Users/jbellone/Projects/rc-cookbook/libraries/rc_file.rb"
Resource Declaration:
---------------------
# In /Users/jbellone/Projects/rc-cookbook/test/spec/libraries/rc_file_spec.rb
8: rc_file '/etc/skel/bashrc' do
9: options(
10: 'http_proxy' => 'http://proxy.corporate.com:80',
11: 'https_proxy' => 'http://proxy.corporate.com:443',
12: 'ftp_proxy' => 'http://proxy.corporate.com:80',
13: 'no_proxy' => 'localhost,127.0.0.1'
14: )
15: end
16: end
Compiled Resource:
------------------
# Declared in /Users/jbellone/Projects/rc-cookbook/test/spec/libraries/rc_file_spec.rb:8:in `block (3 levels) in <top (required)>'
rc_file("/etc/skel/bashrc") do
provider #<Class:0x007f9bc2a6d1b8>
action [:create]
retries 0
retry_delay 2
default_guard_interpreter :default
declared_type :rc_file
options {"http_proxy"=>"http://proxy.corporate.com:80", "https_proxy"=>"http://proxy.corporate.com:443", "ftp_proxy"=>"http://proxy.corporate.com:80", "no_proxy"=>"localhost,127.0.0.1"}
path "/etc/skel/bashrc"
mode "0640"
type "bash"
end
F
Failures:
1) RcCookbook::Resource::RcFile runtime configuration for bashrc
Failure/Error: it { is_expected.to render_file('/etc/skel/bashrc').with_content(<<-EOH.chomp) }
Poise::Error:
rc_file[/etc/skel/bashrc] (/Users/jbellone/Projects/rc-cookbook/test/spec/libraries/rc_file_spec.rb line 8) had an error: Poise::Error: Unable to find cookbook for file "/Users/jbellone/Projects/rc-cookbook/libraries/rc_file.rb"
# /Users/jbellone/.gem/ruby/2.2.2/gems/poise-2.3.1/lib/poise/utils.rb:64:in `find_cookbook_name'
# /Users/jbellone/.gem/ruby/2.2.2/gems/poise-2.3.1/lib/poise/helpers/template_content.rb:64:in `block in attribute'
# /Users/jbellone/.gem/ruby/2.2.2/gems/poise-2.3.1/lib/poise/helpers/lazy_default.rb:50:in `instance_eval'
# /Users/jbellone/.gem/ruby/2.2.2/gems/poise-2.3.1/lib/poise/helpers/lazy_default.rb:50:in `set_or_return'
# /Users/jbellone/.gem/ruby/2.2.2/gems/poise-2.3.1/lib/poise/helpers/lwrp_polyfill.rb:114:in `block in attribute'
# /Users/jbellone/.gem/ruby/2.2.2/gems/poise-2.3.1/lib/poise/helpers/template_content.rb:114:in `block in attribute'
# /Users/jbellone/.gem/ruby/2.2.2/gems/poise-2.3.1/lib/poise/helpers/template_content.rb:76:in `block in attribute'
# ./libraries/rc_file.rb:32:in `block (3 levels) in <class:RcFile>'
# /Users/jbellone/.gem/ruby/2.2.2/gems/chef-12.4.1/lib/chef/resource_builder.rb:77:in `instance_eval'
# /Users/jbellone/.gem/ruby/2.2.2/gems/chef-12.4.1/lib/chef/resource_builder.rb:77:in `build'
# /Users/jbellone/.gem/ruby/2.2.2/gems/chef-12.4.1/lib/chef/dsl/recipe.rb:110:in `build_resource'
# /Users/jbellone/.gem/ruby/2.2.2/gems/chef-12.4.1/lib/chef/dsl/recipe.rb:71:in `declare_resource'
# /Users/jbellone/.gem/ruby/2.2.2/gems/chef-12.4.1/lib/chef/dsl/resources.rb:15:in `file'
# ./libraries/rc_file.rb:28:in `block (2 levels) in <class:RcFile>'
# ./libraries/rc_file.rb:27:in `block in <class:RcFile>'
# /Users/jbellone/.gem/ruby/2.2.2/gems/chef-12.4.1/lib/chef/provider.rb:144:in `run_action'
# /Users/jbellone/.gem/ruby/2.2.2/gems/chef-12.4.1/lib/chef/resource.rb:584:in `run_action'
# /Users/jbellone/.gem/ruby/2.2.2/gems/chefspec-4.3.0/lib/chefspec/extensions/chef/resource.rb:22:in `run_action'
# /Users/jbellone/.gem/ruby/2.2.2/gems/chef-12.4.1/lib/chef/runner.rb:49:in `run_action'
# /Users/jbellone/.gem/ruby/2.2.2/gems/chef-12.4.1/lib/chef/runner.rb:81:in `block (2 levels) in converge'
# /Users/jbellone/.gem/ruby/2.2.2/gems/chef-12.4.1/lib/chef/runner.rb:81:in `each'
# /Users/jbellone/.gem/ruby/2.2.2/gems/chef-12.4.1/lib/chef/runner.rb:81:in `block in converge'
# /Users/jbellone/.gem/ruby/2.2.2/gems/chef-12.4.1/lib/chef/resource_collection/resource_list.rb:83:in `block in execute_each_resource'
# /Users/jbellone/.gem/ruby/2.2.2/gems/chef-12.4.1/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
# /Users/jbellone/.gem/ruby/2.2.2/gems/chef-12.4.1/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
# /Users/jbellone/.gem/ruby/2.2.2/gems/chef-12.4.1/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
# /Users/jbellone/.gem/ruby/2.2.2/gems/chef-12.4.1/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
# /Users/jbellone/.gem/ruby/2.2.2/gems/chef-12.4.1/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
# /Users/jbellone/.gem/ruby/2.2.2/gems/chef-12.4.1/lib/chef/resource_collection/resource_list.rb:81:in `execute_each_resource'
# /Users/jbellone/.gem/ruby/2.2.2/gems/chef-12.4.1/lib/chef/runner.rb:80:in `converge'
# /Users/jbellone/.gem/ruby/2.2.2/gems/chef-12.4.1/lib/chef/client.rb:654:in `block in converge'
# /Users/jbellone/.gem/ruby/2.2.2/gems/chef-12.4.1/lib/chef/client.rb:649:in `catch'
# /Users/jbellone/.gem/ruby/2.2.2/gems/chef-12.4.1/lib/chef/client.rb:649:in `converge'
# /Users/jbellone/.gem/ruby/2.2.2/gems/chefspec-4.3.0/lib/chefspec/solo_runner.rb:121:in `converge'
# ./test/spec/libraries/rc_file_spec.rb:18:in `block (3 levels) in <top (required)>'
Finished in 0.0117 seconds (files took 0.92321 seconds to load)
1 example, 1 failure
Failed examples:
rspec ./test/spec/libraries/rc_file_spec.rb:18 # RcCookbook::Resource::RcFile runtime configuration for bashrc
Randomized with seed 22193
Coverage report generated for Unit Tests to /Users/jbellone/Projects/rc-cookbook/coverage. 21 / 24 LOC (87.5%) covered.
require 'poise_boiler/spec_helper'
require_relative '../../../libraries/rc_file'
describe RcCookbook::Resource::RcFile do
step_into(:rc_file)
context 'runtime configuration for bashrc' do
recipe do
rc_file '/etc/skel/bashrc' do
options(
'http_proxy' => 'http://proxy.corporate.com:80',
'https_proxy' => 'http://proxy.corporate.com:443',
'ftp_proxy' => 'http://proxy.corporate.com:80',
'no_proxy' => 'localhost,127.0.0.1'
)
end
end
it { is_expected.to render_file('/etc/skel/bashrc').with_content(<<-EOH.chomp) }
# This file is managed by Chef; all manual changes will be lost!
http_proxy="http://proxy.corporate.com:80"
https_proxy="http://proxy.corporate.com:443"
ftp_proxy="http://proxy.corporate.com:80"
no_proxy="localhost,127.0.0.1"
EOH
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment