Commit d321f552 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add specs for updating project runner settings

parent 9aa02e07
...@@ -441,27 +441,43 @@ RSpec.describe Projects::UpdateService do ...@@ -441,27 +441,43 @@ RSpec.describe Projects::UpdateService do
end end
end end
context 'when updating #shared_runners', :https_pages_enabled do context 'when updating runners settings' do
let!(:pending_build) { create(:ci_pending_build, project: project, instance_runners_enabled: true) } let(:settings) do
{ instance_runners_enabled: true, namespace_traversal_ids: [] }
end
subject(:call_service) do let!(:pending_build) do
update_project(project, admin, shared_runners_enabled: shared_runners_enabled) create(:ci_pending_build, project: project, **settings)
end
it 'updates builds queue when shared runners get disabled' do
expect { update_project(shared_runners_enabled: false) }
.to change { pending_build.reload.instance_runners_enabled }.to(false)
expect(pending_build.reload.instance_runners_enabled).to be false
end end
context 'when shared runners is toggled' do it 'updates builds queue when shared runners get enabled' do
let(:shared_runners_enabled) { false } expect { update_project(shared_runners_enabled: true) }
.to not_change { pending_build.reload.instance_runners_enabled }
it 'updates ci pending builds' do expect(pending_build.reload.instance_runners_enabled).to be true
expect { call_service }.to change { pending_build.reload.instance_runners_enabled }.to(false)
end end
it 'updates builds queue when group runners get disabled' do
update_project(group_runners_enabled: false)
expect(pending_build.reload.namespace_traversal_ids).to be_empty
end end
context 'when shared runners is not toggled' do it 'updates builds queue when group runners get enabled' do
let(:shared_runners_enabled) { true } update_project(group_runners_enabled: true)
it 'updates ci pending builds' do expect(pending_build.reload.namespace_traversal_ids).not_to be_empty
expect { call_service }.to not_change { pending_build.reload.instance_runners_enabled }
end end
def update_project(**params)
update_project(project, admin, **params)
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