diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-16 18:06:05 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-16 18:06:05 +0000 |
commit | 930ff68c1efc380cb7522aa9b3884842eecb2486 (patch) | |
tree | 208f21205f9c8ee90e9722c6f641169d9a1569bf /spec/lib/gitlab/ci/config/entry/job_spec.rb | |
parent | 84727c8209a4412e21111a07f99b0438b03232de (diff) | |
download | gitlab-ce-930ff68c1efc380cb7522aa9b3884842eecb2486.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/ci/config/entry/job_spec.rb')
-rw-r--r-- | spec/lib/gitlab/ci/config/entry/job_spec.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/config/entry/job_spec.rb b/spec/lib/gitlab/ci/config/entry/job_spec.rb index 1853efde350..1c4887e87c4 100644 --- a/spec/lib/gitlab/ci/config/entry/job_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/job_spec.rb @@ -417,6 +417,37 @@ describe Gitlab::Ci::Config::Entry::Job do end end end + + context 'when timeout value is not correct' do + context 'when it is higher than instance wide timeout' do + let(:config) { { timeout: '3 months' } } + + it 'returns error about value too high' do + expect(entry).not_to be_valid + expect(entry.errors) + .to include "job timeout should not exceed the limit" + end + end + + context 'when it is not a duration' do + let(:config) { { timeout: 100 } } + + it 'returns error about wrong value' do + expect(entry).not_to be_valid + expect(entry.errors).to include 'job timeout should be a duration' + end + end + end + + context 'when timeout value is correct' do + let(:config) { { script: 'echo', timeout: '1m 1s' } } + + it 'returns correct timeout' do + expect(entry).to be_valid + expect(entry.errors).to be_empty + expect(entry.timeout).to eq('1m 1s') + end + end end end |