diff options
author | Vasu1105 <vasundhara.jagdale@msystechnologies.com> | 2017-12-11 11:38:27 +0000 |
---|---|---|
committer | Vasu1105 <vasundhara.jagdale@msystechnologies.com> | 2017-12-11 11:38:27 +0000 |
commit | e228bdf9fa5340dfd03c29243448c2ec5fc8d176 (patch) | |
tree | 9de30c75cf04a1c8acc930698474726f7008893b /spec | |
parent | 35eac8934a51d86bf9e12131b40148642d0b06cf (diff) | |
download | chef-e228bdf9fa5340dfd03c29243448c2ec5fc8d176.tar.gz |
[MSYS-731] Fix for [chef] windows_task resource isn't idempotent for any command
Signed-off-by: Vasu1105 <vasundhara.jagdale@msystechnologies.com>
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 d45531f3dc..04326f1b51 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) @@ -312,7 +312,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 @@ -363,7 +363,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 @@ -406,6 +406,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 |