Skip to content

Commit

Permalink
Allow for empty strings in the execution_ttl field
Browse files Browse the repository at this point in the history
https://bugzilla.redhat.com/show_bug.cgi?id=1601538

An empty string yields a 0 timeout value causing jobs to be
terminated right away.
  • Loading branch information
mkanoor committed Jul 16, 2018
1 parent f07d954 commit 40abd08
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def minimize_indirect

def current_job_timeout(_timeout_adjustment = 1)
@execution_ttl ||=
(options[:execution_ttl].try(:to_i) || DEFAULT_EXECUTION_TTL) * 60
(options[:execution_ttl].present? ? options[:execution_ttl].try(:to_i) : DEFAULT_EXECUTION_TTL) * 60
end

def start
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@
expect(subject.current_job_timeout).to eq(described_class::DEFAULT_EXECUTION_TTL * 60)
end
end

context 'timeout is blank in options' do
let(:options) { {:execution_ttl => ""} }

it 'uses default timeout value' do
expect(subject.current_job_timeout).to eq(described_class::DEFAULT_EXECUTION_TTL * 60)
end
end
end

describe '#create_inventory' do
Expand Down

0 comments on commit 40abd08

Please sign in to comment.