DEBUG: testing increase timeout for tripleo CI.

If that's working maybe do https://review.openstack.org/334011

Change-Id: Id428b112eeaa22ecef78a21032b0c1dcc0ac0592
This commit is contained in:
Sofer Athlan-Guyot 2016-06-28 14:40:02 +02:00
parent 85d8296030
commit 4890996324
2 changed files with 14 additions and 4 deletions

View File

@ -15,7 +15,9 @@ class Puppet::Provider::Openstack < Puppet::Provider
@@no_retry_actions = %w(create remove delete)
@@command_timeout = 20
@@request_timeout = 60
# Fails on the 8th retry for a max of 181s (~3min) before total
# failure.
@@request_timeout = 170
@@retry_sleep = 3
class << self
[:no_retry_actions, :request_timeout, :retry_sleep].each do |m|
@ -46,7 +48,7 @@ class Puppet::Provider::Openstack < Puppet::Provider
openstack_command *args
end
rescue Timeout::Error
raise Puppet::ExecutionFailure, "Command: 'openstack #{args.inspect}' has been running for more then #{command_timeout(action)} seconds!"
raise Puppet::ExecutionFailure, "Command: 'openstack #{args.inspect}' has been running for more then #{command_timeout(action)} seconds"
end
end
@ -74,6 +76,8 @@ class Puppet::Provider::Openstack < Puppet::Provider
Puppet::Util.withenv(env) do
rv = nil
end_time = current_time + request_timeout
start_time = current_time
retry_count = 0
loop do
begin
if action == 'list'
@ -110,10 +114,16 @@ class Puppet::Provider::Openstack < Puppet::Provider
break
rescue Puppet::ExecutionFailure => exception
raise Puppet::Error::OpenstackUnauthorizedError, 'Could not authenticate' if exception.message =~ /HTTP 40[13]/
raise exception if current_time > end_time
if current_time > end_time
error_message = exception.message
error_message += " (tried #{retry_count}, for a total of #{end_time - start_time } seconds)"
raise(Puppet::ExecutionFailure, error_message)
end
raise exception if no_retry_actions.include? action
debug "Non-fatal error: '#{exception.message}'. Retrying for #{end_time - current_time} more seconds"
sleep retry_sleep
retry_count += 1
retry
end
end

View File

@ -103,7 +103,7 @@ name="test"
.times(3)
provider.class.stubs(:sleep)
provider.class.stubs(:current_time)
.returns(0, 10, 10, 20, 20, 100, 100)
.returns(0, 10, 10, 20, 20, 180, 180)
expect do
Puppet::Provider::Openstack.request('project', 'list', ['--long'])
end.to raise_error Puppet::ExecutionFailure, /Unable to establish connection/