diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2015-06-02 16:36:46 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2015-06-02 18:52:12 -0700 |
commit | 23e3c799803ac1800149e27271c6168539cea25e (patch) | |
tree | c6394473fc32f9b30b50a309de765940a21d2c8c /spec/unit/provider/package/aix_spec.rb | |
parent | 025cabb7158fb02a89250ef91cc94ce3b3c38648 (diff) | |
download | chef-23e3c799803ac1800149e27271c6168539cea25e.tar.gz |
fix package timeout attribute
updates all the shell_out calls to respect the timeout which is passed
on the new_resource.
the old `Chef::Config` yum timeout values are still respected and will
override the default.
the default of 900 seconds is preserved.
Diffstat (limited to 'spec/unit/provider/package/aix_spec.rb')
-rw-r--r-- | spec/unit/provider/package/aix_spec.rb | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/spec/unit/provider/package/aix_spec.rb b/spec/unit/provider/package/aix_spec.rb index bdcc9dc1c3..13992cb8d1 100644 --- a/spec/unit/provider/package/aix_spec.rb +++ b/spec/unit/provider/package/aix_spec.rb @@ -41,16 +41,16 @@ describe Chef::Provider::Package::Aix do it "should create a current resource with the name of new_resource" do status = double("Status", :stdout => @bffinfo, :exitstatus => 0) - expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base").and_return(status) - expect(@provider).to receive(:shell_out).with("lslpp -lcq samba.base").and_return(@empty_status) + expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base", timeout: 900).and_return(status) + expect(@provider).to receive(:shell_out).with("lslpp -lcq samba.base", timeout: 900).and_return(@empty_status) @provider.load_current_resource expect(@provider.current_resource.name).to eq("samba.base") end it "should set the current resource bff package name to the new resource bff package name" do status = double("Status", :stdout => @bffinfo, :exitstatus => 0) - expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base").and_return(status) - expect(@provider).to receive(:shell_out).with("lslpp -lcq samba.base").and_return(@empty_status) + expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base", timeout: 900).and_return(status) + expect(@provider).to receive(:shell_out).with("lslpp -lcq samba.base", timeout: 900).and_return(@empty_status) @provider.load_current_resource expect(@provider.current_resource.package_name).to eq("samba.base") end @@ -65,8 +65,8 @@ describe Chef::Provider::Package::Aix do it "should get the source package version from lslpp if provided" do status = double("Status", :stdout => @bffinfo, :exitstatus => 0) - expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base").and_return(status) - expect(@provider).to receive(:shell_out).with("lslpp -lcq samba.base").and_return(@empty_status) + expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base", timeout: 900).and_return(status) + expect(@provider).to receive(:shell_out).with("lslpp -lcq samba.base", timeout: 900).and_return(@empty_status) @provider.load_current_resource expect(@provider.current_resource.package_name).to eq("samba.base") @@ -77,8 +77,8 @@ describe Chef::Provider::Package::Aix do status = double("Status", :stdout => @bffinfo, :exitstatus => 0) @stdout = StringIO.new(@bffinfo) @stdin, @stderr = StringIO.new, StringIO.new - expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base").and_return(status) - expect(@provider).to receive(:shell_out).with("lslpp -lcq samba.base").and_return(status) + expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base", timeout: 900).and_return(status) + expect(@provider).to receive(:shell_out).with("lslpp -lcq samba.base", timeout: 900).and_return(status) @provider.load_current_resource expect(@provider.current_resource.version).to eq("3.3.12.0") end @@ -99,8 +99,8 @@ describe Chef::Provider::Package::Aix do it "should return a current resource with a nil version if the package is not found" do status = double("Status", :stdout => @bffinfo, :exitstatus => 0) - expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base").and_return(status) - expect(@provider).to receive(:shell_out).with("lslpp -lcq samba.base").and_return(@empty_status) + expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base", timeout: 900).and_return(status) + expect(@provider).to receive(:shell_out).with("lslpp -lcq samba.base", timeout: 900).and_return(@empty_status) @provider.load_current_resource expect(@provider.current_resource.version).to be_nil end @@ -109,7 +109,7 @@ describe Chef::Provider::Package::Aix do wrongbffinfo = "/usr/lib/objrepos:openssl.base:0.9.8.2400::COMMITTED:I:Open Secure Socket Layer: /etc/objrepos:openssl.base:0.9.8.2400::COMMITTED:I:Open Secure Socket Layer:" status = double("Status", :stdout => wrongbffinfo, :exitstatus => 0) - expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base").and_return(status) + expect(@provider).to receive(:shell_out).with("installp -L -d /tmp/samba.base", timeout: 900).and_return(status) expect { @provider.load_current_resource }.to raise_error(Chef::Exceptions::Package) end end @@ -137,7 +137,7 @@ describe Chef::Provider::Package::Aix do describe "install and upgrade" do it "should run installp -aYF -d with the package source to install" do - expect(@provider).to receive(:shell_out!).with("installp -aYF -d /tmp/samba.base samba.base") + expect(@provider).to receive(:shell_out!).with("installp -aYF -d /tmp/samba.base samba.base", timeout: 900) @provider.install_package("samba.base", "3.3.12.0") end @@ -145,26 +145,26 @@ describe Chef::Provider::Package::Aix do @new_resource = Chef::Resource::Package.new("/tmp/samba.base") @provider = Chef::Provider::Package::Aix.new(@new_resource, @run_context) expect(@new_resource.source).to eq("/tmp/samba.base") - expect(@provider).to receive(:shell_out!).with("installp -aYF -d /tmp/samba.base /tmp/samba.base") + expect(@provider).to receive(:shell_out!).with("installp -aYF -d /tmp/samba.base /tmp/samba.base", timeout: 900) @provider.install_package("/tmp/samba.base", "3.3.12.0") end it "should run installp with -eLogfile option." do allow(@new_resource).to receive(:options).and_return("-e/tmp/installp.log") - expect(@provider).to receive(:shell_out!).with("installp -aYF -e/tmp/installp.log -d /tmp/samba.base samba.base") + expect(@provider).to receive(:shell_out!).with("installp -aYF -e/tmp/installp.log -d /tmp/samba.base samba.base", timeout: 900) @provider.install_package("samba.base", "3.3.12.0") end end describe "remove" do it "should run installp -u samba.base to remove the package" do - expect(@provider).to receive(:shell_out!).with("installp -u samba.base") + expect(@provider).to receive(:shell_out!).with("installp -u samba.base", timeout: 900) @provider.remove_package("samba.base", "3.3.12.0") end it "should run installp -u -e/tmp/installp.log with options -e/tmp/installp.log" do allow(@new_resource).to receive(:options).and_return("-e/tmp/installp.log") - expect(@provider).to receive(:shell_out!).with("installp -u -e/tmp/installp.log samba.base") + expect(@provider).to receive(:shell_out!).with("installp -u -e/tmp/installp.log samba.base", timeout: 900) @provider.remove_package("samba.base", "3.3.12.0") end |