diff options
author | Dmitry Chepurovskiy <dm3ch@dm3ch.net> | 2019-05-20 18:03:34 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-05-20 18:03:34 +0300 |
commit | 7017889d0b92dd8bd215770a9d4f823b5dc1f2eb (patch) | |
tree | 0cbce8dda9e38e89632f7d59a0b774873ec8bae5 /spec/requests | |
parent | 7115bd811f4bc87c0706fc2b876729878ad8fc5b (diff) |
Added filtering jobs by age to jobs/request API endpoint
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/runner_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/requests/api/runner_spec.rb b/spec/requests/api/runner_spec.rb index b331da1acba..4006e697a41 100644 --- a/spec/requests/api/runner_spec.rb +++ b/spec/requests/api/runner_spec.rb @@ -542,6 +542,30 @@ describe API::Runner, :clean_gitlab_redis_shared_state do end end + context 'when job filtered by job_age' do + let!(:job) { create(:ci_build, :tag, pipeline: pipeline, name: 'spinach', stage: 'test', stage_idx: 0, queued_at: 60.seconds.ago) } + + context 'job is queued less than job_age parameter' do + let(:job_age) { 120 } + + it 'gives 204' do + request_job(job_age: job_age) + + expect(response).to have_gitlab_http_status(204) + end + end + + context 'job is queued more than job_age parameter' do + let(:job_age) { 30 } + + it 'picks a job' do + request_job(job_age: job_age) + + expect(response).to have_gitlab_http_status(201) + end + end + end + context 'when job is made for branch' do it 'sets tag as ref_type' do request_job |