Commit 62f053e4 authored by Tomasz Maczukin's avatar Tomasz Maczukin

Update runner registration API

parent d02694c5
...@@ -14,11 +14,12 @@ module API ...@@ -14,11 +14,12 @@ module API
optional :locked, type: Boolean, desc: 'Should Runner be locked for current project' optional :locked, type: Boolean, desc: 'Should Runner be locked for current project'
optional :run_untagged, type: Boolean, desc: 'Should Runner handle untagged jobs' optional :run_untagged, type: Boolean, desc: 'Should Runner handle untagged jobs'
optional :tag_list, type: Array[String], desc: %q(List of Runner's tags) optional :tag_list, type: Array[String], desc: %q(List of Runner's tags)
optional :maximum_job_timeout_human_readable, type: String, desc: 'Maximum timeout set when this Runner will handle the job' optional :maximum_job_timeout, type: String, desc: 'Maximum timeout set when this Runner will handle the job'
end end
post '/' do post '/' do
attributes = attributes_for_keys([:description, :locked, :run_untagged, :tag_list, :maximum_job_timeout_human_readable]) attributes = attributes_for_keys([:description, :locked, :run_untagged, :tag_list])
.merge(get_runner_details_from_request) .merge(get_runner_details_from_request)
.merge(maximum_job_timeout_human_readable: params[:maximum_job_timeout])
runner = runner =
if runner_registration_token_valid? if runner_registration_token_valid?
......
...@@ -112,7 +112,7 @@ describe API::Runner do ...@@ -112,7 +112,7 @@ describe API::Runner do
context 'when maximum job timeout is specified' do context 'when maximum job timeout is specified' do
it 'creates runner' do it 'creates runner' do
post api('/runners'), token: registration_token, post api('/runners'), token: registration_token,
maximum_job_timeout_human_readable: '2h 30m' maximum_job_timeout: '2h 30m'
expect(response).to have_gitlab_http_status 201 expect(response).to have_gitlab_http_status 201
expect(Ci::Runner.first.maximum_job_timeout).to eq(9000) expect(Ci::Runner.first.maximum_job_timeout).to eq(9000)
...@@ -121,7 +121,7 @@ describe API::Runner do ...@@ -121,7 +121,7 @@ describe API::Runner do
context 'when maximum job timeout is empty' do context 'when maximum job timeout is empty' do
it 'creates runner' do it 'creates runner' do
post api('/runners'), token: registration_token, post api('/runners'), token: registration_token,
maximum_job_timeout_human_readable: '' maximum_job_timeout: ''
expect(response).to have_gitlab_http_status 201 expect(response).to have_gitlab_http_status 201
expect(Ci::Runner.first.maximum_job_timeout).to be_nil expect(Ci::Runner.first.maximum_job_timeout).to be_nil
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment