From 4097917d69c06bb314c271e77aa1d6314bc1cc55 Mon Sep 17 00:00:00 2001 From: Bryan McLellan Date: Wed, 27 May 2015 18:17:01 -0400 Subject: Increate the Timeout::timeout in execute timeout test Issue #2175 found that execute resource timeouts weren't working on Windows but mixlib-shellout was waiting 600 seconds for the test to fail and still raising. Timeout was added in #2686 to make sure the test failed in this case. We're currently seeing intermittant failures on a FreeBSD tester, which is likely a performance issue. But it's possible that we're seeing another issue that we don't yet understand, so I don't want to throw away the regression test yet. --- spec/functional/resource/execute_spec.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/spec/functional/resource/execute_spec.rb b/spec/functional/resource/execute_spec.rb index ffa4628cb2..692ccfb796 100644 --- a/spec/functional/resource/execute_spec.rb +++ b/spec/functional/resource/execute_spec.rb @@ -137,9 +137,16 @@ describe Chef::Resource::Execute do end end + # Ensure that CommandTimeout is raised, and is caused by resource.timeout really expiring. + # https://github.com/chef/chef/issues/2985 + # + # resource.timeout should be short, this is what we're testing + # resource.command ruby sleep timer should be longer than resource.timeout to give us something to timeout + # Timeout::timeout should be longer than resource.timeout, but less than the resource.command ruby sleep timer, + # so we fail if we finish on resource.command instead of resource.timeout, but raise CommandTimeout anyway (#2175). it "times out when a timeout is set on the resource" do - Timeout::timeout(5) do - resource.command %{ruby -e 'sleep 600'} + Timeout::timeout(30) do + resource.command %{ruby -e 'sleep 300'} resource.timeout 0.1 expect { resource.run_action(:run) }.to raise_error(Mixlib::ShellOut::CommandTimeout) end -- cgit v1.2.1