diff options
author | Bryan McLellan <btm@opscode.com> | 2011-02-07 16:07:40 -0800 |
---|---|---|
committer | Bryan McLellan <btm@opscode.com> | 2011-02-07 16:07:40 -0800 |
commit | b1b7b6d8f1f2a8207edd80c177186f60a468b2fe (patch) | |
tree | a7c1897c5a59b5780caf8f05968918821252be01 | |
parent | c2d6250e8a01edfc901b0b6b6de63ea2d31fc22c (diff) | |
download | chef-b1b7b6d8f1f2a8207edd80c177186f60a468b2fe.tar.gz |
merge in debian_service_spec from master
-rw-r--r-- | chef/spec/unit/provider/service/debian_service_spec.rb | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/chef/spec/unit/provider/service/debian_service_spec.rb b/chef/spec/unit/provider/service/debian_service_spec.rb index 7379d0314e..d0cee9ec23 100644 --- a/chef/spec/unit/provider/service/debian_service_spec.rb +++ b/chef/spec/unit/provider/service/debian_service_spec.rb @@ -57,6 +57,7 @@ Removing any system startup links for /etc/init.d/chef ... /etc/rc6.d/K20chef UPDATE_RC_D_SUCCESS @stdout = StringIO.new(result) + @stderr = StringIO.new @provider.stub!(:popen4).and_yield(@pid, @stdin, @stdout, @stderr).and_return(@status) end @@ -69,6 +70,7 @@ Removing any system startup links for /etc/init.d/chef ... @provider.load_current_resource.should equal(@current_resource) @current_resource.enabled.should be_true end + end {"Debian/Lenny and older" => { "linked" => { @@ -158,18 +160,28 @@ insserv: dryrun, not creating .depend.boot, .depend.start, and .depend.stop" @provider.load_current_resource.should equal(@current_resource) @current_resource.enabled.should be_false end - it "stores the start/stop priorities of the service" do - @provider.load_current_resource - expected_priorities = {"6"=>[:stop, "20"], - "0"=>[:stop, "20"], - "1"=>[:stop, "20"], - "2"=>[:start, "20"], - "3"=>[:start, "20"], - "4"=>[:start, "20"], - "5"=>[:start, "20"]} - @provider.current_resource.priority.should == expected_priorities + end + end + + describe "when update-rc.d shows the init script isn't linked to rc*.d" do + before do + @provider.stub!(:run_command) + @provider.stub!(:assert_update_rcd_available) + @status = mock("Status", :exitstatus => 0) + @stdout = StringIO.new(" Removing any system startup links for /etc/init.d/chef ...") + @stderr = StringIO.new + @provider.stub!(:popen4).and_yield(@pid, @stdin, @stdout, @stderr).and_return(@status) + end + + it "says the service is disabled" do + @provider.service_currently_enabled?(@provider.get_priority).should be_false end + it "stores the 'disabled' state" do + Chef::Resource::Service.stub!(:new).and_return(@current_resource) + @provider.load_current_resource.should equal(@current_resource) + @current_resource.enabled.should be_false + end end describe "when update-rc.d fails" do |