Allow to provide timeout for snapshot generation
removed automatic retries, they can cause duplication of tarballs even when snapshot can not be generated in given timeout Change-Id: I4c5fec5d72d2ed76528d1b03d878ca0572e012f2 Closes-Bug: 1414059
This commit is contained in:
parent
5cdd4ae403
commit
fa3aa37547
|
@ -5,9 +5,14 @@
|
|||
coverage
|
||||
coverage.data
|
||||
|
||||
# Need only on local machine for gem
|
||||
# Need only on local machine for gem
|
||||
Gemfile.lock
|
||||
docs/_build
|
||||
|
||||
|
||||
#Vim swap files
|
||||
*.swp
|
||||
|
||||
# Local raemon copy
|
||||
raemon/
|
||||
|
||||
|
|
|
@ -17,8 +17,10 @@ module Astute
|
|||
module Dump
|
||||
def self.dump_environment(ctx, settings)
|
||||
lastdump = settings['lastdump']
|
||||
timeout = Astute.config.dump_timeout
|
||||
shell = MClient.new(ctx, 'execute_shell_command', ['master'], check_result=true, timeout=timeout, retries=1)
|
||||
|
||||
timeout = settings['timeout'] || Astute.config.dump_timeout
|
||||
shell = MClient.new(ctx, 'execute_shell_command', ['master'], check_result=true, timeout=timeout, retries=0)
|
||||
|
||||
upload_file = MClient.new(ctx, 'uploadfile', ['master'])
|
||||
begin
|
||||
config_path = '/tmp/dump_config'
|
||||
|
|
|
@ -21,7 +21,8 @@ describe 'dump_environment' do
|
|||
let(:ctx) { mock_ctx }
|
||||
let(:settings) do
|
||||
{
|
||||
'lastdump' => '/last/dump/path'
|
||||
'lastdump' => '/last/dump/path',
|
||||
'timeout' => 300,
|
||||
}
|
||||
end
|
||||
let(:rpc_mock) { mock_rpcclient }
|
||||
|
@ -64,6 +65,12 @@ describe 'dump_environment' do
|
|||
Astute::Dump.dump_environment(ctx, settings)
|
||||
end
|
||||
|
||||
it "non default timeout should be used" do
|
||||
Astute::MClient.stubs(:new).with(ctx, 'uploadfile', ['master'])
|
||||
Astute::MClient.stubs(:new).with(ctx, 'execute_shell_command', ['master'], true, 300, 0)
|
||||
Astute::Dump.dump_environment(ctx, settings)
|
||||
end
|
||||
|
||||
it "should report error if shell agent times out" do
|
||||
agent = mock do
|
||||
stubs(:upload)
|
||||
|
|
Loading…
Reference in New Issue