diff options
author | Tim Smith <tsmith@chef.io> | 2017-12-11 10:05:01 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-11 10:05:01 -0800 |
commit | 19eb180aace2aedb9bbd60093bfb286c8d781128 (patch) | |
tree | 7ad8238430ed749a4ea0be92ef84bb3df0805aa3 /spec | |
parent | b40007342ba57eaf49cba75b6f134429bdfa68b6 (diff) | |
parent | 8802455211fbdcd91ff51357303321c46f98322e (diff) | |
download | chef-19eb180aace2aedb9bbd60093bfb286c8d781128.tar.gz |
Merge pull request #6654 from MsysTechnologiesllc/vasundhara/chef_windows_task_resource_not_idempotent_for_any_command
windows_task: Fix resource isn't fully idempotent due to command property
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/provider/windows_task_spec.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/spec/unit/provider/windows_task_spec.rb b/spec/unit/provider/windows_task_spec.rb index 9a73f4f07f..ce0fe9e50e 100644 --- a/spec/unit/provider/windows_task_spec.rb +++ b/spec/unit/provider/windows_task_spec.rb @@ -40,7 +40,7 @@ describe Chef::Provider::WindowsTask do :LastRunTime => "3/30/2017 2:27:00 PM", :LastResult => "1", :Author => "Administrator", - :TaskToRun => "chef-client", + :TaskToRun => "chef-client -L C:\\tmp\\", :StartIn => "N/A", :Comment => "N/A", :ScheduledTaskState => "Enabled", @@ -91,7 +91,7 @@ describe Chef::Provider::WindowsTask do allow(provider).to receive(:load_task_hash).and_return(task_hash) current_resource = provider.load_current_resource expect(current_resource.exists).to be(true) - expect(current_resource.command).to eq("chef-client") + expect(current_resource.command).to eq("chef-client -L C:\\tmp\\") expect(current_resource.user).to eq("SYSTEM") expect(current_resource.run_level).to eq(:highest) expect(current_resource.frequency).to eq(:minute) @@ -328,7 +328,7 @@ describe Chef::Provider::WindowsTask do before do @task_action = "CREATE" @options = { "F" => "", "SC" => :minute, "MO" => 15, "TR" => "chef-client", "RU" => "SYSTEM", "RL" => "HIGHEST" } - @cmd = "schtasks /CREATE /TN \"sample_task\" /F /SC \"minute\" /MO \"15\" /TR \"chef-client\" /RU \"SYSTEM\" /RL \"HIGHEST\" " + @cmd = "schtasks /CREATE /TN \"sample_task\" /F /SC \"minute\" /MO \"15\" /RU \"SYSTEM\" /RL \"HIGHEST\" /TR \"chef-client \" " end it "forms the command properly from the given options" do @@ -379,7 +379,7 @@ describe Chef::Provider::WindowsTask do allow(provider).to receive(:get_system_short_date_format).and_return("MM/dd/yyyy") provider.load_current_resource - new_resource.command "chef-client" + new_resource.command "chef-client -L C:\\tmp\\" new_resource.run_level :highest new_resource.frequency :minute new_resource.frequency_modifier 15 @@ -422,6 +422,13 @@ describe Chef::Provider::WindowsTask do expect(provider.send(:task_need_update?)).to be(true) end end + + context "when command updated" do + it "return true" do + new_resource.command "chef-client" + expect(provider.send(:task_need_update?)).to be(true) + end + end end end |