summaryrefslogtreecommitdiff
path: root/spec/unit/util
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/util')
-rw-r--r--spec/unit/util/dsc/lcm_output_parser_spec.rb45
1 files changed, 18 insertions, 27 deletions
diff --git a/spec/unit/util/dsc/lcm_output_parser_spec.rb b/spec/unit/util/dsc/lcm_output_parser_spec.rb
index 05aa072a94..23a3dbd3ec 100644
--- a/spec/unit/util/dsc/lcm_output_parser_spec.rb
+++ b/spec/unit/util/dsc/lcm_output_parser_spec.rb
@@ -103,49 +103,40 @@ EOF
end
context 'Incorrectly formatted output from LCM' do
- it 'should raise an exception if a set 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 Set ]
-logtype: [machinename]: LCM: [ End Set ]
logtype: [machinename]: LCM: [ End Test ]
-logtype: [machinename]: LCM: [ End Resource ] [name]
-logtype: [machinename]: LCM: [ End Set ]
-EOF
- expect { Chef::Util::DSC::LocalConfigurationManager::Parser::parse(str) }.to(raise_error(
- Chef::Util::DSC::LocalConfigurationManager::Parser::ParseException))
- end
-
- it 'should raise an exception if a test is found inside a test' do
- str = <<EOF
-logtype: [machinename]: LCM: [ Start Set ]
-logtype: [machinename]: LCM: [ Start Resource ] [name]
-logtype: [machinename]: LCM: [ Start Test ]
+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: [ End Test ]
-logtype: [machinename]: LCM: [ End Resource ] [name]
+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 allow missing a [End Resource] when its the last one and still find all the resource' do
+ 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 Test ]
logtype: [machinename]: LCM: [ End Test ]
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 Resource ]
logtype: [machinename]: LCM: [ End Set ]
EOF
@@ -154,13 +145,12 @@ EOF
resources[1].changes_state?.should be_true
end
- it 'should allow missing a [End Resource] when its the first one and still find all the resource' do
+ it 'should allow missing set and end resource and assume an unconverged resource in this case' do
str = <<-EOF
logtype: [machinename]: LCM: [ Start Set ]
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 ]
@@ -169,10 +159,11 @@ logtype: [machinename]: LCM: [ End Set ]
logtype: [machinename]: LCM: [ End Resource ]
logtype: [machinename]: LCM: [ End Set ]
EOF
-
resources = Chef::Util::DSC::LocalConfigurationManager::Parser::parse(str)
- resources[0].changes_state?.should be_false
+ resources[0].changes_state?.should be_true
+ resources[0].name.should eql('[name]')
resources[1].changes_state?.should be_true
+ resources[1].name.should eql('[name2]')
end
end
end