diff options
author | Claire McQuin <mcquin@users.noreply.github.com> | 2014-06-18 17:02:56 -0700 |
---|---|---|
committer | Claire McQuin <mcquin@users.noreply.github.com> | 2014-06-18 17:02:56 -0700 |
commit | 9c0fb4bede5c30a175b658bef34300539dc22f2c (patch) | |
tree | 45eeaa731fd2abc6b780bd876a23d9f1a9354af4 /spec/unit | |
parent | cbe69c74eada5957d409f5d47694bd961951226e (diff) | |
parent | 27bfcc144afb48b40ab04aaded05744cab456bbe (diff) | |
download | chef-9c0fb4bede5c30a175b658bef34300539dc22f2c.tar.gz |
Merge pull request #1483 from opscode/CHEF-4600
Chef 4600
Diffstat (limited to 'spec/unit')
-rw-r--r-- | spec/unit/provider/service/windows_spec.rb | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/spec/unit/provider/service/windows_spec.rb b/spec/unit/provider/service/windows_spec.rb index a007e7b984..33d3cde8fd 100644 --- a/spec/unit/provider/service/windows_spec.rb +++ b/spec/unit/provider/service/windows_spec.rb @@ -92,7 +92,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do @provider.start_service @new_resource.updated_by_last_action?.should be_false end - + it "should raise an error if the service is paused" do Win32::Service.stub(:status).with(@new_resource.service_name).and_return( double("StatusStruct", :current_state => "paused")) @@ -112,7 +112,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do @provider.start_service @new_resource.updated_by_last_action?.should be_false end - + it "should fail if the service is in stop_pending" do Win32::Service.stub(:status).with(@new_resource.service_name).and_return( double("StatusStruct", :current_state => "stop pending")) @@ -161,7 +161,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do @provider.stop_service @new_resource.updated_by_last_action?.should be_false end - + it "should raise an error if the service is paused" do Win32::Service.stub(:status).with(@new_resource.service_name).and_return( double("StatusStruct", :current_state => "paused")) @@ -170,7 +170,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do expect { @provider.stop_service }.to raise_error( Chef::Exceptions::Service ) @new_resource.updated_by_last_action?.should be_false end - + it "should wait and continue if the service is in stop_pending" do Win32::Service.stub(:status).with(@new_resource.service_name).and_return( double("StatusStruct", :current_state => "stop pending"), @@ -191,6 +191,17 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do @new_resource.updated_by_last_action?.should be_false end + it "should pass custom timeout to the stop command if provided" do + Win32::Service.stub!(:status).with(@new_resource.service_name).and_return( + mock("StatusStruct", :current_state => "running")) + @new_resource.timeout 1 + Win32::Service.should_receive(:stop).with(@new_resource.service_name) + Timeout.timeout(2) do + expect { @provider.stop_service }.to raise_error(Timeout::Error) + end + @new_resource.updated_by_last_action?.should be_false + end + end describe Chef::Provider::Service::Windows, "restart_service" do |