Commit bbf5bb70 authored by Tomasz Maczukin's avatar Tomasz Maczukin

Fix rubocop offenses

parent 3eafffce
...@@ -36,7 +36,7 @@ module API ...@@ -36,7 +36,7 @@ module API
contacted_at_max_age = UPDATE_RUNNER_EVERY + Random.rand(UPDATE_RUNNER_EVERY) contacted_at_max_age = UPDATE_RUNNER_EVERY + Random.rand(UPDATE_RUNNER_EVERY)
current_runner.contacted_at.nil? || current_runner.contacted_at.nil? ||
(Time.now - current_runner.contacted_at) >= contacted_at_max_age (Time.now - current_runner.contacted_at) >= contacted_at_max_age
end end
def build_not_found! def build_not_found!
......
...@@ -17,4 +17,4 @@ module Gitlab ...@@ -17,4 +17,4 @@ module Gitlab
end end
end end
end end
end end
\ No newline at end of file
...@@ -43,4 +43,4 @@ module Gitlab ...@@ -43,4 +43,4 @@ module Gitlab
end end
end end
end end
end end
\ No newline at end of file
...@@ -236,7 +236,6 @@ describe API::Runner do ...@@ -236,7 +236,6 @@ describe API::Runner do
end end
context 'when valid token is provided' do context 'when valid token is provided' do
context 'when Runner is not active' do context 'when Runner is not active' do
let(:runner) { create(:ci_runner, :inactive) } let(:runner) { create(:ci_runner, :inactive) }
...@@ -267,7 +266,7 @@ describe API::Runner do ...@@ -267,7 +266,7 @@ describe API::Runner do
context 'when there is a pending job' do context 'when there is a pending job' do
it 'starts a job' do it 'starts a job' do
request_job info: {platform: :darwin} request_job info: { platform: :darwin }
expect(response).to have_http_status(201) expect(response).to have_http_status(201)
expect(response.headers).not_to have_key('X-GitLab-Last-Update') expect(response.headers).not_to have_key('X-GitLab-Last-Update')
...@@ -320,7 +319,7 @@ describe API::Runner do ...@@ -320,7 +319,7 @@ describe API::Runner do
let(:value) { "#{param}_value" } let(:value) { "#{param}_value" }
it %q(updates provided Runner's parameter) do it %q(updates provided Runner's parameter) do
request_job info: {param => value} request_job info: { param => value }
expect(response).to have_http_status(201) expect(response).to have_http_status(201)
runner.reload runner.reload
...@@ -386,24 +385,22 @@ describe API::Runner do ...@@ -386,24 +385,22 @@ describe API::Runner do
request_job request_job
expect(response).to have_http_status(201) expect(response).to have_http_status(201)
expect(json_response['variables']).to include( expect(json_response['variables']).to include({ 'key' => 'CI_BUILD_NAME', 'value' => 'spinach', 'public' => true },
{'key' => 'CI_BUILD_NAME', 'value' => 'spinach', 'public' => true}, { 'key' => 'CI_BUILD_STAGE', 'value' => 'test', 'public' => true },
{'key' => 'CI_BUILD_STAGE', 'value' => 'test', 'public' => true}, { 'key' => 'CI_BUILD_TRIGGERED', 'value' => 'true', 'public' => true },
{'key' => 'CI_BUILD_TRIGGERED', 'value' => 'true', 'public' => true}, { 'key' => 'DB_NAME', 'value' => 'postgres', 'public' => true },
{'key' => 'DB_NAME', 'value' => 'postgres', 'public' => true}, { 'key' => 'SECRET_KEY', 'value' => 'secret_value', 'public' => false },
{'key' => 'SECRET_KEY', 'value' => 'secret_value', 'public' => false}, { 'key' => 'TRIGGER_KEY_1', 'value' => 'TRIGGER_VALUE_1', 'public' => false })
{'key' => 'TRIGGER_KEY_1', 'value' => 'TRIGGER_VALUE_1', 'public' => false},
)
end end
end end
describe 'registry credentials support' do describe 'registry credentials support' do
let(:registry_url) { 'registry.example.com:5005' } let(:registry_url) { 'registry.example.com:5005' }
let(:registry_credentials) do let(:registry_credentials) do
{'type' => 'registry', { 'type' => 'registry',
'url' => registry_url, 'url' => registry_url,
'username' => 'gitlab-ci-token', 'username' => 'gitlab-ci-token',
'password' => job.token} 'password' => job.token }
end end
context 'when registry is enabled' do context 'when registry is enabled' do
...@@ -431,7 +428,7 @@ describe API::Runner do ...@@ -431,7 +428,7 @@ describe API::Runner do
def request_job(token = runner.token, **params) def request_job(token = runner.token, **params)
new_params = params.merge(token: token, last_update: last_update) new_params = params.merge(token: token, last_update: last_update)
post api('/jobs/request'), new_params, {'User-Agent' => user_agent} post api('/jobs/request'), new_params, { 'User-Agent' => user_agent }
end end
end end
end end
......
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