diff options
author | NimishaS <nimisha.sharad@msystechnologies.com> | 2016-09-23 09:59:51 +0000 |
---|---|---|
committer | NimishaS <nimisha.sharad@msystechnologies.com> | 2016-09-30 12:22:45 +0530 |
commit | 5536af82e9d6e825d988ce769bc42a61cfefcb32 (patch) | |
tree | 7749cbca5e7cc65cd59e0e7c9cb71d1f071d13a9 | |
parent | 4f738f8aaf0fb6f1ee0f24a123640d5abf57a800 (diff) | |
download | chef-5536af82e9d6e825d988ce769bc42a61cfefcb32.tar.gz |
set erroraction stop instead of continue
Signed-off-by: NimishaS <nimisha.sharad@msystechnologies.com>
-rw-r--r-- | lib/chef/util/dsc/local_configuration_manager.rb | 2 | ||||
-rw-r--r-- | spec/unit/util/dsc/local_configuration_manager_spec.rb | 14 |
2 files changed, 11 insertions, 5 deletions
diff --git a/lib/chef/util/dsc/local_configuration_manager.rb b/lib/chef/util/dsc/local_configuration_manager.rb index 741c6a5898..d837a16185 100644 --- a/lib/chef/util/dsc/local_configuration_manager.rb +++ b/lib/chef/util/dsc/local_configuration_manager.rb @@ -74,7 +74,7 @@ class Chef::Util::DSC def lcm_command_code(configuration_path, test_only_parameters) <<-EOH -$ProgressPreference = 'SilentlyContinue';start-dscconfiguration -path #{@configuration_path} -wait -erroraction 'continue' -force #{test_only_parameters} +$ProgressPreference = 'SilentlyContinue';start-dscconfiguration -path #{@configuration_path} -wait -erroraction 'stop' -force #{test_only_parameters} EOH end diff --git a/spec/unit/util/dsc/local_configuration_manager_spec.rb b/spec/unit/util/dsc/local_configuration_manager_spec.rb index 45fe8df40d..3f1210dbf1 100644 --- a/spec/unit/util/dsc/local_configuration_manager_spec.rb +++ b/spec/unit/util/dsc/local_configuration_manager_spec.rb @@ -59,10 +59,6 @@ EOH allow(lcm).to receive(:run_configuration_cmdlet).and_return(lcm_status) end context "that returns successfully" do - before(:each) do - allow(lcm).to receive(:run_configuration_cmdlet).and_return(lcm_status) - end - let(:lcm_standard_output) { normal_lcm_output } let(:lcm_standard_error) { nil } let(:lcm_cmdlet_success) { true } @@ -138,4 +134,14 @@ EOH expect(lcm.send(:dsc_module_import_failure?, dsc_resource_import_failure_output.gsub("CimException", "ArgumentException"))).to be(false) end end + + describe "#run_configuration_cmdlet" do + context "when invalid dsc script is given" do + it "raises exception" do + configuration_document = "invalid-config" + shellout_flags = { :cwd => nil, :environment => nil, :timeout => nil } + expect { lcm.send(:run_configuration_cmdlet, configuration_document, true, shellout_flags) }.to raise_error(Chef::Exceptions::PowershellCmdletException) + end + end + end end |