From a7f7bca284ec9d99ed074950a18a62aeb41d3f70 Mon Sep 17 00:00:00 2001 From: Jay Mundrawala Date: Thu, 18 Dec 2014 13:44:47 -0800 Subject: Execute spec should actually check to make sure it did not wait for 600 seconds --- spec/functional/resource/execute_spec.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/spec/functional/resource/execute_spec.rb b/spec/functional/resource/execute_spec.rb index cebcc52fcf..020814fcd6 100644 --- a/spec/functional/resource/execute_spec.rb +++ b/spec/functional/resource/execute_spec.rb @@ -18,6 +18,7 @@ require 'spec_helper' require 'functional/resource/base' +require 'timeout' describe Chef::Resource::Execute do let(:resource) { @@ -111,8 +112,10 @@ describe Chef::Resource::Execute do end it "times out when a timeout is set on the resource" do - resource.command %{ruby -e 'sleep 600'} - resource.timeout 0.1 - expect { resource.run_action(:run) }.to raise_error(Mixlib::ShellOut::CommandTimeout) + Timeout::timeout(5) do + resource.command %{ruby -e 'sleep 600'} + resource.timeout 0.1 + expect { resource.run_action(:run) }.to raise_error(Mixlib::ShellOut::CommandTimeout) + end end end -- cgit v1.2.1