Skip to content
Snippets Groups Projects
Commit 273374f8 authored by Ian Baum's avatar Ian Baum
Browse files

Merge branch 'wait-timeout-measure' into 'master'

Add wait timeout to docker exec measurement job

See merge request gitlab-org/omnibus-gitlab!3588
parents a38fc550 e4f48ddf
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -157,11 +157,11 @@ module Gitlab
[pid_command_hash_array, smem_result_hash_array]
end
 
def container_exec_command(container, command, log_file)
def container_exec_command(container, command, log_file, timeout = 120)
# make sure the folder exists
FileUtils.mkdir_p debug_output_dir unless debug_output_dir.nil?
 
stdout, stderr, code = container.exec(command)
stdout, stderr, code = container.exec(command, wait: timeout)
stdout = stdout.join('')
stderr = stderr.join('')
 
Loading
Loading
Loading
Loading
@@ -159,16 +159,16 @@ describe Gitlab::DockerImageMemoryMeasurer do
 
context 'command succeed' do
it 'return the stdout result' do
expect(container).to receive(:exec).with(command).and_return([%w[success message], [], 0])
command_ret = measurer.container_exec_command(container, command, log_file)
expect(container).to receive(:exec).with(command, wait: 120).and_return([%w[success message], [], 0])
command_ret = measurer.container_exec_command(container, command, log_file, 120)
expect(command_ret).to eq('successmessage')
end
end
 
context 'command fail' do
it 'should raise error' do
expect(container).to receive(:exec).with(command).and_return([[], %w[error message], 1])
expect { measurer.container_exec_command(container, command, log_file) }.to raise_error(SystemExit, 'errormessage')
expect(container).to receive(:exec).with(command, wait: 120).and_return([[], %w[error message], 1])
expect { measurer.container_exec_command(container, command, log_file, 120) }.to raise_error(SystemExit, 'errormessage')
end
end
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment