summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2014-12-15 21:34:41 -0800
committerBryan McLellan <btm@loftninjas.org>2014-12-17 20:16:12 -0500
commit60cf0de3e368168ba0a5ed8d9d4d9f261aed6431 (patch)
tree37ce4b7ad49e4ef3916568b9b4ba8eafef15a486 /spec
parent1d5b9bf57df6812b6f6a2961d0995aa6c2d8f695 (diff)
downloadchef-60cf0de3e368168ba0a5ed8d9d4d9f261aed6431.tar.gz
Fix bug where error parser what-if output causes resource to be considered converged.
We now fall back to assuming the resource is not converged if we cannot parse information about a dsc resource.
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/util/dsc/lcm_output_parser_spec.rb19
1 files changed, 7 insertions, 12 deletions
diff --git a/spec/unit/util/dsc/lcm_output_parser_spec.rb b/spec/unit/util/dsc/lcm_output_parser_spec.rb
index ba4f40c4f7..426102caca 100644
--- a/spec/unit/util/dsc/lcm_output_parser_spec.rb
+++ b/spec/unit/util/dsc/lcm_output_parser_spec.rb
@@ -20,24 +20,19 @@ require 'chef/util/dsc/lcm_output_parser'
describe Chef::Util::DSC::LocalConfigurationManager::Parser do
context 'empty input parameter' do
- it 'returns an empty array for a 0 length string' do
- expect(Chef::Util::DSC::LocalConfigurationManager::Parser::parse('')).to be_empty
+ it 'raises an exception when there are no valid lines' do
+ str = <<-EOF
+
+ EOF
+ expect {Chef::Util::DSC::LocalConfigurationManager::Parser::parse(str)}.to raise_error(Chef::Exceptions::LCMParserException)
end
- it 'returns an empty array for a nil input' do
- expect(Chef::Util::DSC::LocalConfigurationManager::Parser::parse('')).to be_empty
+ it 'raises an exception for a nil input' do
+ expect {Chef::Util::DSC::LocalConfigurationManager::Parser::parse(nil)}.to raise_error(Chef::Exceptions::LCMParserException)
end
end
context 'correctly formatted output from lcm' do
- it 'returns an empty array for a log with no resources' do
- str = <<EOF
-logtype: [machinename]: LCM: [ Start Set ]
-logtype: [machinename]: LCM: [ End Set ]
-EOF
- expect(Chef::Util::DSC::LocalConfigurationManager::Parser::parse(str)).to be_empty
- end
-
it 'returns a single resource when only 1 logged with the correct name' do
str = <<EOF
logtype: [machinename]: LCM: [ Start Set ]