diff options
author | vasu1105 <vasundhara.jagdale@msystechnologies.com> | 2018-05-25 17:10:47 +0530 |
---|---|---|
committer | vasu1105 <vasundhara.jagdale@msystechnologies.com> | 2018-06-14 12:05:51 +0530 |
commit | 0357969833fd6a1de59dc969e1b06b9fc006fa81 (patch) | |
tree | 7cbc30988be16f52f3b1b563ac857e11ca840d6b /spec/functional/resource | |
parent | 0a2f9d6b693b8d31e500f20b03710261b348917e (diff) | |
download | chef-0357969833fd6a1de59dc969e1b06b9fc006fa81.tar.gz |
fix for task is not idempotent when task name includes parent folder
Signed-off-by: vasu1105 <vasundhara.jagdale@msystechnologies.com>
Diffstat (limited to 'spec/functional/resource')
-rw-r--r-- | spec/functional/resource/windows_task_spec.rb | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/spec/functional/resource/windows_task_spec.rb b/spec/functional/resource/windows_task_spec.rb index 65a396cf56..46fbfe2e82 100644 --- a/spec/functional/resource/windows_task_spec.rb +++ b/spec/functional/resource/windows_task_spec.rb @@ -1109,6 +1109,60 @@ describe Chef::Resource::WindowsTask, :windows_only do end end + context "task_name with parent folder" do + describe "task_name with path '\\foo\\chef-client-functional-test' " do + let(:task_name) { "\\foo\\chef-client-functional-test" } + after { delete_task } + subject do + new_resource = Chef::Resource::WindowsTask.new(task_name, run_context) + new_resource.command task_name + new_resource.run_level :highest + new_resource.frequency :once + new_resource.execution_time_limit = 259200 / 60 # converting "PT72H" into minutes and passing here since win32-taskscheduler accespts this + new_resource + end + + it "creates the scheduled task with task name 'chef-client-functional-test' inside path '\\foo'" do + call_for_create_action + current_resource = call_for_load_current_resource + expect(current_resource.exists).to eq(true) + expect(current_resource.task.application_name).to eq(task_name) + end + + it "does not converge the resource if it is already converged" do + subject.run_action(:create) + subject.run_action(:create) + expect(subject).not_to be_updated_by_last_action + end + end + + describe "task_name with path '\\foo\\bar\\chef-client-functional-test' " do + let(:task_name) { "\\foo\\bar\\chef-client-functional-test" } + after { delete_task } + subject do + new_resource = Chef::Resource::WindowsTask.new(task_name, run_context) + new_resource.command task_name + new_resource.run_level :highest + new_resource.frequency :once + new_resource.execution_time_limit = 259200 / 60 # converting "PT72H" into minutes and passing here since win32-taskscheduler accespts this + new_resource + end + + it "creates the scheduled task with task with name 'chef-client-functional-test' inside path '\\foo\\bar' " do + call_for_create_action + current_resource = call_for_load_current_resource + expect(current_resource.exists).to eq(true) + expect(current_resource.task.application_name).to eq(task_name) + end + + it "does not converge the resource if it is already converged" do + subject.run_action(:create) + subject.run_action(:create) + expect(subject).not_to be_updated_by_last_action + end + end + end + describe "Examples of idempotent checks for each frequency" do after { delete_task } context "For frequency :once" do |