diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2014-08-22 14:49:53 -0700 |
---|---|---|
committer | Jay Mundrawala <jdmundrawala@gmail.com> | 2014-09-19 12:47:34 -0700 |
commit | 31f0e0a53d82d4cab7b607e367dec5ec6104847c (patch) | |
tree | 0e9125f44d2a004715261673878a055d2e8ef68a /spec/unit/util | |
parent | 7e5daa0ef8486275c82e694d1862d56b5a21f417 (diff) | |
download | chef-31f0e0a53d82d4cab7b607e367dec5ec6104847c.tar.gz |
Deal with LCM failing when a resource does not support WhatIf
Diffstat (limited to 'spec/unit/util')
-rw-r--r-- | spec/unit/util/dsc/lcm_output_parser_spec.rb | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/spec/unit/util/dsc/lcm_output_parser_spec.rb b/spec/unit/util/dsc/lcm_output_parser_spec.rb index 8ed305827c..802c0ea429 100644 --- a/spec/unit/util/dsc/lcm_output_parser_spec.rb +++ b/spec/unit/util/dsc/lcm_output_parser_spec.rb @@ -133,34 +133,46 @@ EOF Chef::Util::DSC::LocalConfigurationManager::Parser::ParseException)) end - it 'should raise an exception if a resource is found inside a test' do - str = <<EOF + it 'should allow missing a [End Resource] when its the last one and still find all the resource' do + str = <<-EOF logtype: [machinename]: LCM: [ Start Set ] -logtype: [machinename]: LCM: [ Start Resource ] [name] +logtype: [machinename]: LCM: [ Start Resource ] [name] logtype: [machinename]: LCM: [ Start Test ] -logtype: [machinename]: LCM: [ Start Resource ] -logtype: [machinename]: LCM: [ End Resource ] logtype: [machinename]: LCM: [ End Test ] -logtype: [machinename]: LCM: [ End Resource ] [name] +logtype: [machinename]: LCM: [ Skip Set ] +logtype: [machinename]: LCM: [ End Resource ] +logtype: [machinename]: LCM: [ Start Resource ] [name2] +logtype: [machinename]: LCM: [ Start Test ] +logtype: [machinename]: LCM: [ End Test ] +logtype: [machinename]: LCM: [ Start Set ] +logtype: [machinename]: LCM: [ End Set ] logtype: [machinename]: LCM: [ End Set ] EOF - expect { Chef::Util::DSC::LocalConfigurationManager::Parser::parse(str) }.to(raise_error( - Chef::Util::DSC::LocalConfigurationManager::Parser::ParseException)) + + resources = Chef::Util::DSC::LocalConfigurationManager::Parser::parse(str) + resources[0].changes_state?.should be_false + resources[1].changes_state?.should be_true end - it 'should raise an exception if a resource is found inside a resource' do - str = <<EOF + it 'should allow missing a [End Resource] when its the first one and still find all the resource' do + str = <<-EOF logtype: [machinename]: LCM: [ Start Set ] -logtype: [machinename]: LCM: [ Start Resource ] [name] -logtype: [machinename]: LCM: [ Start Resource ] -logtype: [machinename]: LCM: [ End Resource ] -logtype: [machinename]: LCM: [ End Resource ] [name] +logtype: [machinename]: LCM: [ Start Resource ] [name] +logtype: [machinename]: LCM: [ Start Test ] +logtype: [machinename]: LCM: [ End Test ] +logtype: [machinename]: LCM: [ Skip Set ] +logtype: [machinename]: LCM: [ Start Resource ] [name2] +logtype: [machinename]: LCM: [ Start Test ] +logtype: [machinename]: LCM: [ End Test ] +logtype: [machinename]: LCM: [ Start Set ] +logtype: [machinename]: LCM: [ End Set ] +logtype: [machinename]: LCM: [ End Resource ] logtype: [machinename]: LCM: [ End Set ] EOF - expect { Chef::Util::DSC::LocalConfigurationManager::Parser::parse(str) }.to(raise_error( - Chef::Util::DSC::LocalConfigurationManager::Parser::ParseException)) - end + resources = Chef::Util::DSC::LocalConfigurationManager::Parser::parse(str) + resources[0].changes_state?.should be_false + resources[1].changes_state?.should be_true + end end - end |