Commit 03ff1da2 authored by Kamil Trzciński's avatar Kamil Trzciński Committed by Dylan Griffith

Fix some failures

parent 1fcc9ad7
...@@ -43,7 +43,7 @@ module Clusters ...@@ -43,7 +43,7 @@ module Clusters
def create_and_assign_runner def create_and_assign_runner
transaction do transaction do
project.runners.create!(runner_create_params).tap do |runner| Ci::Runner.create!(runner_create_params).tap do |runner|
update!(runner_id: runner.id) update!(runner_id: runner.id)
end end
end end
...@@ -53,7 +53,8 @@ module Clusters ...@@ -53,7 +53,8 @@ module Clusters
{ {
name: 'kubernetes-cluster', name: 'kubernetes-cluster',
runner_type: :project_type, runner_type: :project_type,
tag_list: %w(kubernetes cluster) tag_list: %w(kubernetes cluster),
projects: [project]
} }
end end
......
...@@ -9,6 +9,10 @@ FactoryBot.define do ...@@ -9,6 +9,10 @@ FactoryBot.define do
is_shared true is_shared true
runner_type :instance_type runner_type :instance_type
trait :online do
contacted_at Time.now
end
trait :instance do trait :instance do
is_shared true is_shared true
runner_type :instance_type runner_type :instance_type
......
...@@ -12,21 +12,8 @@ describe API::Runners do ...@@ -12,21 +12,8 @@ describe API::Runners do
let(:group2) { create(:group).tap { |group| group.add_owner(user) } } let(:group2) { create(:group).tap { |group| group.add_owner(user) } }
let!(:shared_runner) { create(:ci_runner, :instance, description: 'Shared runner') } let!(:shared_runner) { create(:ci_runner, :instance, description: 'Shared runner') }
let!(:unused_project_runner) { create(:ci_runner) } let!(:project_runner) { create(:ci_runner, :project, description: 'Project runner', projects: [project]) }
let!(:two_projects_runner) { create(:ci_runner, :project, description: 'Two projects runner', projects: [project, project2])
let!(:project_runner) do
create(:ci_runner, description: 'Project runner').tap do |runner|
create(:ci_runner_project, runner: runner, project: project)
end
end
let!(:two_projects_runner) do
create(:ci_runner, description: 'Two projects runner').tap do |runner|
create(:ci_runner_project, runner: runner, project: project)
create(:ci_runner_project, runner: runner, project: project2)
end
end
let!(:group_runner) { create(:ci_runner, :group, description: 'Group runner', groups: [group]) } let!(:group_runner) { create(:ci_runner, :group, description: 'Group runner', groups: [group]) }
before do before do
...@@ -310,14 +297,6 @@ describe API::Runners do ...@@ -310,14 +297,6 @@ describe API::Runners do
end end
context 'when runner is not shared' do context 'when runner is not shared' do
it 'deletes unused runner' do
expect do
delete api("/runners/#{unused_project_runner.id}", admin)
expect(response).to have_gitlab_http_status(204)
end.to change { Ci::Runner.specific.count }.by(-1)
end
it 'deletes used project runner' do it 'deletes used project runner' do
expect do expect do
delete api("/runners/#{project_runner.id}", admin) delete api("/runners/#{project_runner.id}", admin)
...@@ -586,13 +565,6 @@ describe API::Runners do ...@@ -586,13 +565,6 @@ describe API::Runners do
end end
context 'user is admin' do context 'user is admin' do
it 'enables any specific runner' do
expect do
post api("/projects/#{project.id}/runners", admin), runner_id: unused_project_runner.id
end.to change { project.runners.count }.by(+1)
expect(response).to have_gitlab_http_status(201)
end
it 'enables a shared runner' do it 'enables a shared runner' do
expect do expect do
post api("/projects/#{project.id}/runners", admin), runner_id: shared_runner.id post api("/projects/#{project.id}/runners", admin), runner_id: shared_runner.id
...@@ -603,14 +575,6 @@ describe API::Runners do ...@@ -603,14 +575,6 @@ describe API::Runners do
end end
end end
context 'user is not admin' do
it 'does not enable runner without access to' do
post api("/projects/#{project.id}/runners", user), runner_id: unused_project_runner.id
expect(response).to have_gitlab_http_status(403)
end
end
it 'raises an error when no runner_id param is provided' do it 'raises an error when no runner_id param is provided' do
post api("/projects/#{project.id}/runners", admin) post api("/projects/#{project.id}/runners", admin)
......
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