summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan McLellan <btm@loftninjas.org>2015-05-27 18:17:01 -0400
committerBryan McLellan <btm@loftninjas.org>2015-05-28 13:32:36 -0400
commit4097917d69c06bb314c271e77aa1d6314bc1cc55 (patch)
tree0928e4e40287c0f4a221cbceb3322097bcb3c214
parentd8172e646d9fbf43e57bca5e20d0ac352ba9a66a (diff)
downloadchef-btm/execute-timeout-timeout.tar.gz
Increate the Timeout::timeout in execute timeout testbtm/execute-timeout-timeout
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.
-rw-r--r--spec/functional/resource/execute_spec.rb11
1 files 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