Commit c50c0325 authored by Allison Browne's avatar Allison Browne Committed by Bob Van Landuyt

Move API::Runner and API::Runners to the Ci namespace

API::Runners => API::Ci::Runners
parent e15045dd
...@@ -49,7 +49,7 @@ module API ...@@ -49,7 +49,7 @@ module API
end end
def process_pull_request def process_pull_request
external_pull_request = Ci::ExternalPullRequests::ProcessGithubEventService.new(project, mirror_user).execute(params) external_pull_request = ::Ci::ExternalPullRequests::ProcessGithubEventService.new(project, mirror_user).execute(params)
if external_pull_request if external_pull_request
render_validation_error!(external_pull_request) render_validation_error!(external_pull_request)
......
...@@ -131,6 +131,8 @@ module API ...@@ -131,6 +131,8 @@ module API
mount ::API::Boards mount ::API::Boards
mount ::API::Branches mount ::API::Branches
mount ::API::BroadcastMessages mount ::API::BroadcastMessages
mount ::API::Ci::Runner
mount ::API::Ci::Runners
mount ::API::Commits mount ::API::Commits
mount ::API::CommitStatuses mount ::API::CommitStatuses
mount ::API::ContainerRegistryEvent mount ::API::ContainerRegistryEvent
...@@ -195,8 +197,6 @@ module API ...@@ -195,8 +197,6 @@ module API
mount ::API::Release::Links mount ::API::Release::Links
mount ::API::RemoteMirrors mount ::API::RemoteMirrors
mount ::API::Repositories mount ::API::Repositories
mount ::API::Runner
mount ::API::Runners
mount ::API::Search mount ::API::Search
mount ::API::Services mount ::API::Services
mount ::API::Settings mount ::API::Settings
......
This diff is collapsed.
This diff is collapsed.
...@@ -60,7 +60,7 @@ module API ...@@ -60,7 +60,7 @@ module API
not_found! 'Commit' unless commit not_found! 'Commit' unless commit
# Since the CommitStatus is attached to Ci::Pipeline (in the future Pipeline) # Since the CommitStatus is attached to ::Ci::Pipeline (in the future Pipeline)
# We need to always have the pipeline object # We need to always have the pipeline object
# To have a valid pipeline object that can be attached to specific MR # To have a valid pipeline object that can be attached to specific MR
# Other CI service needs to send `ref` # Other CI service needs to send `ref`
......
...@@ -48,7 +48,7 @@ module API ...@@ -48,7 +48,7 @@ module API
requires :value, type: String, desc: 'The value of the variable' requires :value, type: String, desc: 'The value of the variable'
optional :protected, type: String, desc: 'Whether the variable is protected' optional :protected, type: String, desc: 'Whether the variable is protected'
optional :masked, type: String, desc: 'Whether the variable is masked' optional :masked, type: String, desc: 'Whether the variable is masked'
optional :variable_type, type: String, values: Ci::GroupVariable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file. Defaults to env_var' optional :variable_type, type: String, values: ::Ci::GroupVariable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file. Defaults to env_var'
end end
post ':id/variables' do post ':id/variables' do
variable_params = declared_params(include_missing: false) variable_params = declared_params(include_missing: false)
...@@ -70,7 +70,7 @@ module API ...@@ -70,7 +70,7 @@ module API
optional :value, type: String, desc: 'The value of the variable' optional :value, type: String, desc: 'The value of the variable'
optional :protected, type: String, desc: 'Whether the variable is protected' optional :protected, type: String, desc: 'Whether the variable is protected'
optional :masked, type: String, desc: 'Whether the variable is masked' optional :masked, type: String, desc: 'Whether the variable is masked'
optional :variable_type, type: String, values: Ci::GroupVariable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file' optional :variable_type, type: String, values: ::Ci::GroupVariable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file'
end end
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
put ':id/variables/:key' do put ':id/variables/:key' do
......
...@@ -60,7 +60,7 @@ module API ...@@ -60,7 +60,7 @@ module API
def current_job def current_job
strong_memoize(:current_job) do strong_memoize(:current_job) do
Ci::Build.find_by_id(params[:id]) ::Ci::Build.find_by_id(params[:id])
end end
end end
......
...@@ -160,7 +160,7 @@ module API ...@@ -160,7 +160,7 @@ module API
authorize!(:update_build, build) authorize!(:update_build, build)
break forbidden!('Job is not retryable') unless build.retryable? break forbidden!('Job is not retryable') unless build.retryable?
build = Ci::Build.retry(build, current_user) build = ::Ci::Build.retry(build, current_user)
present build, with: Entities::Job present build, with: Entities::Job
end end
......
...@@ -22,7 +22,7 @@ module API ...@@ -22,7 +22,7 @@ module API
get ':id/pipeline_schedules' do get ':id/pipeline_schedules' do
authorize! :read_pipeline_schedule, user_project authorize! :read_pipeline_schedule, user_project
schedules = Ci::PipelineSchedulesFinder.new(user_project).execute(scope: params[:scope]) schedules = ::Ci::PipelineSchedulesFinder.new(user_project).execute(scope: params[:scope])
.preload([:owner, :last_pipeline]) .preload([:owner, :last_pipeline])
present paginate(schedules), with: Entities::PipelineSchedule present paginate(schedules), with: Entities::PipelineSchedule
end end
...@@ -51,7 +51,7 @@ module API ...@@ -51,7 +51,7 @@ module API
post ':id/pipeline_schedules' do post ':id/pipeline_schedules' do
authorize! :create_pipeline_schedule, user_project authorize! :create_pipeline_schedule, user_project
pipeline_schedule = Ci::CreatePipelineScheduleService pipeline_schedule = ::Ci::CreatePipelineScheduleService
.new(user_project, current_user, declared_params(include_missing: false)) .new(user_project, current_user, declared_params(include_missing: false))
.execute .execute
...@@ -137,7 +137,7 @@ module API ...@@ -137,7 +137,7 @@ module API
requires :pipeline_schedule_id, type: Integer, desc: 'The pipeline schedule id' requires :pipeline_schedule_id, type: Integer, desc: 'The pipeline schedule id'
requires :key, type: String, desc: 'The key of the variable' requires :key, type: String, desc: 'The key of the variable'
requires :value, type: String, desc: 'The value of the variable' requires :value, type: String, desc: 'The value of the variable'
optional :variable_type, type: String, values: Ci::PipelineScheduleVariable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file. Defaults to env_var' optional :variable_type, type: String, values: ::Ci::PipelineScheduleVariable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file. Defaults to env_var'
end end
post ':id/pipeline_schedules/:pipeline_schedule_id/variables' do post ':id/pipeline_schedules/:pipeline_schedule_id/variables' do
authorize! :update_pipeline_schedule, pipeline_schedule authorize! :update_pipeline_schedule, pipeline_schedule
...@@ -158,7 +158,7 @@ module API ...@@ -158,7 +158,7 @@ module API
requires :pipeline_schedule_id, type: Integer, desc: 'The pipeline schedule id' requires :pipeline_schedule_id, type: Integer, desc: 'The pipeline schedule id'
requires :key, type: String, desc: 'The key of the variable' requires :key, type: String, desc: 'The key of the variable'
optional :value, type: String, desc: 'The value of the variable' optional :value, type: String, desc: 'The value of the variable'
optional :variable_type, type: String, values: Ci::PipelineScheduleVariable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file' optional :variable_type, type: String, values: ::Ci::PipelineScheduleVariable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file'
end end
put ':id/pipeline_schedules/:pipeline_schedule_id/variables/:key' do put ':id/pipeline_schedules/:pipeline_schedule_id/variables/:key' do
authorize! :update_pipeline_schedule, pipeline_schedule authorize! :update_pipeline_schedule, pipeline_schedule
......
...@@ -18,7 +18,7 @@ module API ...@@ -18,7 +18,7 @@ module API
use :pagination use :pagination
optional :scope, type: String, values: %w[running pending finished branches tags], optional :scope, type: String, values: %w[running pending finished branches tags],
desc: 'The scope of pipelines' desc: 'The scope of pipelines'
optional :status, type: String, values: Ci::HasStatus::AVAILABLE_STATUSES, optional :status, type: String, values: ::Ci::HasStatus::AVAILABLE_STATUSES,
desc: 'The status of pipelines' desc: 'The status of pipelines'
optional :ref, type: String, desc: 'The ref of pipelines' optional :ref, type: String, desc: 'The ref of pipelines'
optional :sha, type: String, desc: 'The sha of pipelines' optional :sha, type: String, desc: 'The sha of pipelines'
...@@ -27,7 +27,7 @@ module API ...@@ -27,7 +27,7 @@ module API
optional :username, type: String, desc: 'The username of the user who triggered pipelines' optional :username, type: String, desc: 'The username of the user who triggered pipelines'
optional :updated_before, type: DateTime, desc: 'Return pipelines updated before the specified datetime. Format: ISO 8601 YYYY-MM-DDTHH:MM:SSZ' optional :updated_before, type: DateTime, desc: 'Return pipelines updated before the specified datetime. Format: ISO 8601 YYYY-MM-DDTHH:MM:SSZ'
optional :updated_after, type: DateTime, desc: 'Return pipelines updated after the specified datetime. Format: ISO 8601 YYYY-MM-DDTHH:MM:SSZ' optional :updated_after, type: DateTime, desc: 'Return pipelines updated after the specified datetime. Format: ISO 8601 YYYY-MM-DDTHH:MM:SSZ'
optional :order_by, type: String, values: Ci::PipelinesFinder::ALLOWED_INDEXED_COLUMNS, default: 'id', optional :order_by, type: String, values: ::Ci::PipelinesFinder::ALLOWED_INDEXED_COLUMNS, default: 'id',
desc: 'Order pipelines' desc: 'Order pipelines'
optional :sort, type: String, values: %w[asc desc], default: 'desc', optional :sort, type: String, values: %w[asc desc], default: 'desc',
desc: 'Sort pipelines' desc: 'Sort pipelines'
...@@ -36,7 +36,7 @@ module API ...@@ -36,7 +36,7 @@ module API
authorize! :read_pipeline, user_project authorize! :read_pipeline, user_project
authorize! :read_build, user_project authorize! :read_build, user_project
pipelines = Ci::PipelinesFinder.new(user_project, current_user, params).execute pipelines = ::Ci::PipelinesFinder.new(user_project, current_user, params).execute
present paginate(pipelines), with: Entities::PipelineBasic present paginate(pipelines), with: Entities::PipelineBasic
end end
...@@ -57,9 +57,9 @@ module API ...@@ -57,9 +57,9 @@ module API
.merge(variables_attributes: params[:variables]) .merge(variables_attributes: params[:variables])
.except(:variables) .except(:variables)
new_pipeline = Ci::CreatePipelineService.new(user_project, new_pipeline = ::Ci::CreatePipelineService.new(user_project,
current_user, current_user,
pipeline_params) pipeline_params)
.execute(:api, ignore_skip_ci: true, save_on_errors: false) .execute(:api, ignore_skip_ci: true, save_on_errors: false)
if new_pipeline.persisted? if new_pipeline.persisted?
......
This diff is collapsed.
This diff is collapsed.
...@@ -32,7 +32,7 @@ module API ...@@ -32,7 +32,7 @@ module API
project = find_project(params[:id]) project = find_project(params[:id])
not_found! unless project not_found! unless project
result = Ci::PipelineTriggerService.new(project, nil, params).execute result = ::Ci::PipelineTriggerService.new(project, nil, params).execute
not_found! unless result not_found! unless result
if result[:http_status] if result[:http_status]
......
...@@ -56,7 +56,7 @@ module API ...@@ -56,7 +56,7 @@ module API
requires :value, type: String, desc: 'The value of the variable' requires :value, type: String, desc: 'The value of the variable'
optional :protected, type: Boolean, desc: 'Whether the variable is protected' optional :protected, type: Boolean, desc: 'Whether the variable is protected'
optional :masked, type: Boolean, desc: 'Whether the variable is masked' optional :masked, type: Boolean, desc: 'Whether the variable is masked'
optional :variable_type, type: String, values: Ci::Variable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file. Defaults to env_var' optional :variable_type, type: String, values: ::Ci::Variable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file. Defaults to env_var'
optional :environment_scope, type: String, desc: 'The environment_scope of the variable' optional :environment_scope, type: String, desc: 'The environment_scope of the variable'
end end
post ':id/variables' do post ':id/variables' do
...@@ -80,7 +80,7 @@ module API ...@@ -80,7 +80,7 @@ module API
optional :value, type: String, desc: 'The value of the variable' optional :value, type: String, desc: 'The value of the variable'
optional :protected, type: Boolean, desc: 'Whether the variable is protected' optional :protected, type: Boolean, desc: 'Whether the variable is protected'
optional :masked, type: Boolean, desc: 'Whether the variable is masked' optional :masked, type: Boolean, desc: 'Whether the variable is masked'
optional :variable_type, type: String, values: Ci::Variable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file' optional :variable_type, type: String, values: ::Ci::Variable.variable_types.keys, desc: 'The type of variable, must be one of env_var or file'
optional :environment_scope, type: String, desc: 'The environment_scope of the variable' optional :environment_scope, type: String, desc: 'The environment_scope of the variable'
end end
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do
include StubGitlabCalls include StubGitlabCalls
include RedisHelpers include RedisHelpers
include WorkhorseHelpers include WorkhorseHelpers
...@@ -13,7 +13,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -13,7 +13,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
stub_feature_flags(ci_enable_live_trace: true) stub_feature_flags(ci_enable_live_trace: true)
stub_gitlab_calls stub_gitlab_calls
stub_application_setting(runners_registration_token: registration_token) stub_application_setting(runners_registration_token: registration_token)
allow_any_instance_of(Ci::Runner).to receive(:cache_attributes) allow_any_instance_of(::Ci::Runner).to receive(:cache_attributes)
end end
describe '/api/v4/runners' do describe '/api/v4/runners' do
...@@ -38,7 +38,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -38,7 +38,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
it 'creates runner with default values' do it 'creates runner with default values' do
post api('/runners'), params: { token: registration_token } post api('/runners'), params: { token: registration_token }
runner = Ci::Runner.first runner = ::Ci::Runner.first
expect(response).to have_gitlab_http_status(:created) expect(response).to have_gitlab_http_status(:created)
expect(json_response['id']).to eq(runner.id) expect(json_response['id']).to eq(runner.id)
...@@ -57,7 +57,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -57,7 +57,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
expect(response).to have_gitlab_http_status(:created) expect(response).to have_gitlab_http_status(:created)
expect(project.runners.size).to eq(1) expect(project.runners.size).to eq(1)
runner = Ci::Runner.first runner = ::Ci::Runner.first
expect(runner.token).not_to eq(registration_token) expect(runner.token).not_to eq(registration_token)
expect(runner.token).not_to eq(project.runners_token) expect(runner.token).not_to eq(project.runners_token)
expect(runner).to be_project_type expect(runner).to be_project_type
...@@ -72,7 +72,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -72,7 +72,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
expect(response).to have_gitlab_http_status(:created) expect(response).to have_gitlab_http_status(:created)
expect(group.runners.reload.size).to eq(1) expect(group.runners.reload.size).to eq(1)
runner = Ci::Runner.first runner = ::Ci::Runner.first
expect(runner.token).not_to eq(registration_token) expect(runner.token).not_to eq(registration_token)
expect(runner.token).not_to eq(group.runners_token) expect(runner.token).not_to eq(group.runners_token)
expect(runner).to be_group_type expect(runner).to be_group_type
...@@ -88,7 +88,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -88,7 +88,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
} }
expect(response).to have_gitlab_http_status(:created) expect(response).to have_gitlab_http_status(:created)
expect(Ci::Runner.first.description).to eq('server.hostname') expect(::Ci::Runner.first.description).to eq('server.hostname')
end end
end end
...@@ -100,7 +100,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -100,7 +100,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
} }
expect(response).to have_gitlab_http_status(:created) expect(response).to have_gitlab_http_status(:created)
expect(Ci::Runner.first.tag_list.sort).to eq(%w(tag1 tag2)) expect(::Ci::Runner.first.tag_list.sort).to eq(%w(tag1 tag2))
end end
end end
...@@ -114,8 +114,8 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -114,8 +114,8 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
} }
expect(response).to have_gitlab_http_status(:created) expect(response).to have_gitlab_http_status(:created)
expect(Ci::Runner.first.run_untagged).to be false expect(::Ci::Runner.first.run_untagged).to be false
expect(Ci::Runner.first.tag_list.sort).to eq(['tag']) expect(::Ci::Runner.first.tag_list.sort).to eq(['tag'])
end end
end end
...@@ -141,7 +141,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -141,7 +141,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
} }
expect(response).to have_gitlab_http_status(:created) expect(response).to have_gitlab_http_status(:created)
expect(Ci::Runner.first.locked).to be true expect(::Ci::Runner.first.locked).to be true
end end
end end
...@@ -154,7 +154,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -154,7 +154,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
} }
expect(response).to have_gitlab_http_status(:created) expect(response).to have_gitlab_http_status(:created)
expect(Ci::Runner.first.active).to be true expect(::Ci::Runner.first.active).to be true
end end
end end
...@@ -166,7 +166,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -166,7 +166,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
} }
expect(response).to have_gitlab_http_status(:created) expect(response).to have_gitlab_http_status(:created)
expect(Ci::Runner.first.active).to be false expect(::Ci::Runner.first.active).to be false
end end
end end
end end
...@@ -180,7 +180,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -180,7 +180,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
} }
expect(response).to have_gitlab_http_status(:created) expect(response).to have_gitlab_http_status(:created)
expect(Ci::Runner.first.ref_protected?).to be true expect(::Ci::Runner.first.ref_protected?).to be true
end end
end end
...@@ -192,7 +192,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -192,7 +192,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
} }
expect(response).to have_gitlab_http_status(:created) expect(response).to have_gitlab_http_status(:created)
expect(Ci::Runner.first.ref_protected?).to be false expect(::Ci::Runner.first.ref_protected?).to be false
end end
end end
end end
...@@ -205,7 +205,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -205,7 +205,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
} }
expect(response).to have_gitlab_http_status(:created) expect(response).to have_gitlab_http_status(:created)
expect(Ci::Runner.first.maximum_timeout).to eq(9000) expect(::Ci::Runner.first.maximum_timeout).to eq(9000)
end end
context 'when maximum job timeout is empty' do context 'when maximum job timeout is empty' do
...@@ -216,7 +216,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -216,7 +216,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
} }
expect(response).to have_gitlab_http_status(:created) expect(response).to have_gitlab_http_status(:created)
expect(Ci::Runner.first.maximum_timeout).to be_nil expect(::Ci::Runner.first.maximum_timeout).to be_nil
end end
end end
end end
...@@ -232,7 +232,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -232,7 +232,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
} }
expect(response).to have_gitlab_http_status(:created) expect(response).to have_gitlab_http_status(:created)
expect(Ci::Runner.first.read_attribute(param.to_sym)).to eq(value) expect(::Ci::Runner.first.read_attribute(param.to_sym)).to eq(value)
end end
end end
end end
...@@ -243,7 +243,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -243,7 +243,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
headers: { 'X-Forwarded-For' => '123.111.123.111' } headers: { 'X-Forwarded-For' => '123.111.123.111' }
expect(response).to have_gitlab_http_status(:created) expect(response).to have_gitlab_http_status(:created)
expect(Ci::Runner.first.ip_address).to eq('123.111.123.111') expect(::Ci::Runner.first.ip_address).to eq('123.111.123.111')
end end
end end
...@@ -271,7 +271,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -271,7 +271,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
delete api('/runners'), params: { token: runner.token } delete api('/runners'), params: { token: runner.token }
expect(response).to have_gitlab_http_status(:no_content) expect(response).to have_gitlab_http_status(:no_content)
expect(Ci::Runner.count).to eq(0) expect(::Ci::Runner.count).to eq(0)
end end
it_behaves_like '412 response' do it_behaves_like '412 response' do
...@@ -537,7 +537,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -537,7 +537,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
end end
it 'creates persistent ref' do it 'creates persistent ref' do
expect_any_instance_of(Ci::PersistentRef).to receive(:create_ref) expect_any_instance_of(::Ci::PersistentRef).to receive(:create_ref)
.with(job.sha, "refs/#{Repository::REF_PIPELINES}/#{job.commit_id}") .with(job.sha, "refs/#{Repository::REF_PIPELINES}/#{job.commit_id}")
request_job info: { platform: :darwin } request_job info: { platform: :darwin }
...@@ -749,7 +749,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -749,7 +749,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
context 'when concurrently updating a job' do context 'when concurrently updating a job' do
before do before do
expect_any_instance_of(Ci::Build).to receive(:run!) expect_any_instance_of(::Ci::Build).to receive(:run!)
.and_raise(ActiveRecord::StaleObjectError.new(nil, nil)) .and_raise(ActiveRecord::StaleObjectError.new(nil, nil))
end end
...@@ -890,7 +890,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -890,7 +890,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
let!(:trigger_request) { create(:ci_trigger_request, pipeline: pipeline, builds: [job], trigger: trigger) } let!(:trigger_request) { create(:ci_trigger_request, pipeline: pipeline, builds: [job], trigger: trigger) }
before do before do
project.variables << Ci::Variable.new(key: 'SECRET_KEY', value: 'secret_value') project.variables << ::Ci::Variable.new(key: 'SECRET_KEY', value: 'secret_value')
end end
shared_examples 'expected variables behavior' do shared_examples 'expected variables behavior' do
...@@ -1099,7 +1099,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -1099,7 +1099,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
let_it_be(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
let(:runner) { create(:ci_runner, :project, projects: [project]) } let(:runner) { create(:ci_runner, :project, projects: [project]) }
let(:service) { Ci::CreateWebIdeTerminalService.new(project, user, ref: 'master').execute } let(:service) { ::Ci::CreateWebIdeTerminalService.new(project, user, ref: 'master').execute }
let(:pipeline) { service[:pipeline] } let(:pipeline) { service[:pipeline] }
let(:build) { pipeline.builds.first } let(:build) { pipeline.builds.first }
let(:job) { {} } let(:job) { {} }
...@@ -2258,7 +2258,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do ...@@ -2258,7 +2258,7 @@ RSpec.describe API::Runner, :clean_gitlab_redis_shared_state do
FileUtils.remove_entry(new_tmpdir) FileUtils.remove_entry(new_tmpdir)
end end
it' "fails to post artifacts for outside of tmp path"' do it 'fails to post artifacts for outside of tmp path' do
upload_artifacts(file_upload, headers_with_token) upload_artifacts(file_upload, headers_with_token)
expect(response).to have_gitlab_http_status(:bad_request) expect(response).to have_gitlab_http_status(:bad_request)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe API::Runners do RSpec.describe API::Ci::Runners do
let_it_be(:admin) { create(:user, :admin) } let_it_be(:admin) { create(:user, :admin) }
let_it_be(:user) { create(:user) } let_it_be(:user) { create(:user) }
let_it_be(:user2) { create(:user) } let_it_be(:user2) { create(:user) }
...@@ -266,7 +266,7 @@ RSpec.describe API::Runners do ...@@ -266,7 +266,7 @@ RSpec.describe API::Runners do
delete api("/runners/#{unused_project_runner.id}", admin) delete api("/runners/#{unused_project_runner.id}", admin)
expect(response).to have_gitlab_http_status(:no_content) expect(response).to have_gitlab_http_status(:no_content)
end.to change { Ci::Runner.project_type.count }.by(-1) end.to change { ::Ci::Runner.project_type.count }.by(-1)
end end
end end
...@@ -493,7 +493,7 @@ RSpec.describe API::Runners do ...@@ -493,7 +493,7 @@ RSpec.describe API::Runners do
delete api("/runners/#{shared_runner.id}", admin) delete api("/runners/#{shared_runner.id}", admin)
expect(response).to have_gitlab_http_status(:no_content) expect(response).to have_gitlab_http_status(:no_content)
end.to change { Ci::Runner.instance_type.count }.by(-1) end.to change { ::Ci::Runner.instance_type.count }.by(-1)
end end
it_behaves_like '412 response' do it_behaves_like '412 response' do
...@@ -507,7 +507,7 @@ RSpec.describe API::Runners do ...@@ -507,7 +507,7 @@ RSpec.describe API::Runners do
delete api("/runners/#{project_runner.id}", admin) delete api("/runners/#{project_runner.id}", admin)
expect(response).to have_gitlab_http_status(:no_content) expect(response).to have_gitlab_http_status(:no_content)
end.to change { Ci::Runner.project_type.count }.by(-1) end.to change { ::Ci::Runner.project_type.count }.by(-1)
end end
end end
...@@ -542,7 +542,7 @@ RSpec.describe API::Runners do ...@@ -542,7 +542,7 @@ RSpec.describe API::Runners do
delete api("/runners/#{project_runner.id}", user) delete api("/runners/#{project_runner.id}", user)
expect(response).to have_gitlab_http_status(:no_content) expect(response).to have_gitlab_http_status(:no_content)
end.to change { Ci::Runner.project_type.count }.by(-1) end.to change { ::Ci::Runner.project_type.count }.by(-1)
end end
it 'does not delete group runner with guest access' do it 'does not delete group runner with guest access' do
...@@ -574,7 +574,7 @@ RSpec.describe API::Runners do ...@@ -574,7 +574,7 @@ RSpec.describe API::Runners do
delete api("/runners/#{group_runner_a.id}", user) delete api("/runners/#{group_runner_a.id}", user)
expect(response).to have_gitlab_http_status(:no_content) expect(response).to have_gitlab_http_status(:no_content)
end.to change { Ci::Runner.group_type.count }.by(-1) end.to change { ::Ci::Runner.group_type.count }.by(-1)
end end
it 'deletes inherited group runner with owner access' do it 'deletes inherited group runner with owner access' do
...@@ -582,7 +582,7 @@ RSpec.describe API::Runners do ...@@ -582,7 +582,7 @@ RSpec.describe API::Runners do
delete api("/runners/#{group_runner_b.id}", user) delete api("/runners/#{group_runner_b.id}", user)
expect(response).to have_gitlab_http_status(:no_content) expect(response).to have_gitlab_http_status(:no_content)
end.to change { Ci::Runner.group_type.count }.by(-1) end.to change { ::Ci::Runner.group_type.count }.by(-1)
end end
it_behaves_like '412 response' do it_behaves_like '412 response' do
...@@ -968,7 +968,7 @@ RSpec.describe API::Runners do ...@@ -968,7 +968,7 @@ RSpec.describe API::Runners do
end end
it 'does not enable locked runner' do it 'does not enable locked runner' do
project_runner2.update(locked: true) project_runner2.update!(locked: true)
expect do expect do
post api("/projects/#{project.id}/runners", user), params: { runner_id: project_runner2.id } post api("/projects/#{project.id}/runners", user), params: { runner_id: project_runner2.id }
......
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