summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanielsdeleo <dan@getchef.com>2015-05-19 15:40:17 -0700
committerdanielsdeleo <dan@getchef.com>2015-05-20 10:42:28 -0700
commita0fad76df616ccc662f3eb660f8d74a96f2a72a4 (patch)
treec37710efbeec1f7cd5fcd107960227e98e2e58e5
parent2fce76b2fa8bd56b56d12618ab3677a2d88f4188 (diff)
downloadchef-a0fad76df616ccc662f3eb660f8d74a96f2a72a4.tar.gz
Add regression test for failures not originating from cookbook code
-rw-r--r--spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb b/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb
index c28c9bdca3..d957a97284 100644
--- a/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb
+++ b/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb
@@ -106,6 +106,39 @@ describe Chef::Formatters::ErrorInspectors::CompileErrorInspector do
end
end
+ context "when the error does not contain any lines from cookbooks" do
+
+ let(:trace) do
+ [
+ "/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/lib/chef/run_context.rb:144:in `rescue in block in load_libraries'",
+ "/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/lib/chef/run_context.rb:138:in `block in load_libraries'",
+ "/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/lib/chef/run_context.rb:230:in `call'",
+ "/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/lib/chef/run_context.rb:230:in `block (2 levels) in foreach_cookbook_load_segment'",
+ "/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/lib/chef/run_context.rb:229:in `each'",
+ "/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/lib/chef/run_context.rb:229:in `block in foreach_cookbook_load_segment'",
+ "/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/lib/chef/run_context.rb:227:in `each'",
+ "/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/lib/chef/run_context.rb:227:in `foreach_cookbook_load_segment'",
+ "/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/lib/chef/run_context.rb:137:in `load_libraries'"
+ ]
+ end
+
+ let(:exception) do
+ e = Chef::Exceptions::RecipeNotFound.new("recipe nope:nope not found")
+ e.set_backtrace(trace)
+ e
+ end
+
+ let(:path_to_failed_file) { nil }
+
+ it "gives a full, non-filtered trace" do
+ expect(inspector.filtered_bt).to eq(trace)
+ end
+
+ it "does not error when displaying the error" do
+ expect { description.display(outputter) }.to_not raise_error
+ end
+
+ end
end
describe "when explaining an error on windows" do