diff options
author | Bryan McLellan <btm@loftninjas.org> | 2015-05-27 18:17:01 -0400 |
---|---|---|
committer | Bryan McLellan <btm@loftninjas.org> | 2015-05-28 14:49:19 -0400 |
commit | 678d696b169d6fbcf5966124f41847bfc3282c13 (patch) | |
tree | dc016d0220abeedfc5d33ddb561eab78ed8c6dd7 | |
parent | 05351f833eb20328b8959ac12437f8a541f596a2 (diff) | |
download | chef-678d696b169d6fbcf5966124f41847bfc3282c13.tar.gz |
Increase 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.
-rw-r--r-- | spec/functional/resource/execute_spec.rb | 11 |
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 |