summaryrefslogtreecommitdiffstats
path: root/spec/unit/interface
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@puppetlabs.com>2011-05-02 15:14:25 -0700
committerDaniel Pittman <daniel@puppetlabs.com>2011-05-02 15:34:22 -0700
commit1b42725b5caab6f8e457e11fec2488fbe94e8e43 (patch)
tree4feb8e200b2c4fb69e18cb6a19d3d58432583038 /spec/unit/interface
parent86c6ec24f387fc70abc333fc4ac974b06b3ec80a (diff)
downloadpuppet-1b42725b5caab6f8e457e11fec2488fbe94e8e43.tar.gz
puppet-1b42725b5caab6f8e457e11fec2488fbe94e8e43.tar.xz
puppet-1b42725b5caab6f8e457e11fec2488fbe94e8e43.zip
(#7314) Faces fail horribly when one has a syntax error.
When we hit a syntax error in any face, a whole bunch of unrelated face things would blow up in horrible ways. Stack traces for all... Now, instead, we catch that fault but specifically only in the face file and report it through our error logs, then quietly ignore the face. Reviewed-By: Nick Lewis <nick@puppetlabs.com>
Diffstat (limited to 'spec/unit/interface')
-rwxr-xr-xspec/unit/interface/face_collection_spec.rb19
1 files changed, 18 insertions, 1 deletions
diff --git a/spec/unit/interface/face_collection_spec.rb b/spec/unit/interface/face_collection_spec.rb
index 4358ef4b6..4ad8787c5 100755
--- a/spec/unit/interface/face_collection_spec.rb
+++ b/spec/unit/interface/face_collection_spec.rb
@@ -22,7 +22,7 @@ describe Puppet::Interface::FaceCollection do
after :each do
subject.instance_variable_set(:@faces, @original_faces)
- $".clear ; @original_required.each do |item| $" << item end
+ @original_required.each {|f| $".push f unless $".include? f }
end
describe "::prefix_match?" do
@@ -160,4 +160,21 @@ describe Puppet::Interface::FaceCollection do
end
end
end
+
+ context "faulty faces" do
+ before :each do
+ $:.unshift "#{PuppetSpec::FIXTURE_DIR}/faulty_face"
+ end
+
+ after :each do
+ $:.delete_if {|x| x == "#{PuppetSpec::FIXTURE_DIR}/faulty_face"}
+ end
+
+ it "should not die if a face has a syntax error" do
+ subject.faces.should be_include :help
+ subject.faces.should_not be_include :syntax
+ @logs.should_not be_empty
+ @logs.first.message.should =~ /syntax error/
+ end
+ end
end