diff options
author | adamedx <adamed@getchef.com> | 2015-06-03 17:31:50 -0700 |
---|---|---|
committer | adamedx <adamed@getchef.com> | 2015-06-06 08:36:31 -0700 |
commit | a93cdc6e526735912eae6f921f1da2af8b0ef5b0 (patch) | |
tree | 572b289a770cc740cf82e6a023aa7fa5c3e6230b /spec/unit/guard_interpreter | |
parent | fd18d4bdfd79a269a3220936efd2ec8f69353c29 (diff) | |
download | chef-a93cdc6e526735912eae6f921f1da2af8b0ef5b0.tar.gz |
Issue#3485: Fix corruption of run_context when guard interpreters are executedadamedx/3485-run_context_corruption
Diffstat (limited to 'spec/unit/guard_interpreter')
-rw-r--r-- | spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb b/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb index 02e4eb2fae..acf1b15fd8 100644 --- a/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb +++ b/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb @@ -84,6 +84,14 @@ describe Chef::GuardInterpreter::ResourceGuardInterpreter do expect(guard_interpreter.evaluate).to eq(true) end + it "does not corrupt the run_context of the node" do + node_run_context_before_guard_execution = parent_resource.run_context + expect(node_run_context_before_guard_execution.object_id).to eq(parent_resource.node.run_context.object_id) + guard_interpreter.evaluate + node_run_context_after_guard_execution = parent_resource.run_context + expect(node_run_context_after_guard_execution.object_id).to eq(parent_resource.node.run_context.object_id) + end + describe "script command opts switch" do let(:command_opts) { {} } let(:guard_interpreter) { Chef::GuardInterpreter::ResourceGuardInterpreter.new(parent_resource, "exit 0", command_opts) } |