Commit cbc010ad authored by Pedro Pombeiro's avatar Pedro Pombeiro

Fix specs

parent 4f12dcf7
......@@ -265,10 +265,10 @@ RSpec.describe Ci::Runner do
it_behaves_like '.belonging_to_parent_group_of_project'
end
context 'with existing system wide, group and project runners' do
context 'with instance runners sharing enabled' do
# group specific
let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, group: group) }
let_it_be(:group) { create(:group, shared_runners_enabled: true) }
let_it_be(:project) { create(:project, group: group, shared_runners_enabled: true) }
let_it_be(:group_runner) { create(:ci_runner, :group, groups: [group]) }
# project specific
......@@ -280,20 +280,8 @@ RSpec.describe Ci::Runner do
describe '.owned_or_instance_wide' do
subject { described_class.owned_or_instance_wide(project.id) }
context 'with instance runners sharing enabled' do
let(:shared_runners_enabled) { true }
it 'returns a globally shared, a project specific and a group specific runner' do
is_expected.to contain_exactly(group_runner, project_runner, shared_runner)
end
end
context 'with instance runners sharing disabled' do
let(:shared_runners_enabled) { false }
it 'returns a project specific and a group specific runner' do
is_expected.to contain_exactly(group_runner, project_runner)
end
it 'returns a globally shared, a project specific and a group specific runner' do
is_expected.to contain_exactly(group_runner, project_runner, shared_runner)
end
end
......@@ -305,20 +293,42 @@ RSpec.describe Ci::Runner do
project_runner
end
context 'with instance runners sharing enabled' do
let(:shared_runners_enabled) { true }
it 'returns a globally shared and a group specific runner' do
is_expected.to contain_exactly(group_runner, shared_runner)
end
end
end
context 'with instance runners sharing disabled' do
# group specific
let_it_be(:group) { create(:group, shared_runners_enabled: false) }
let_it_be(:project) { create(:project, group: group, shared_runners_enabled: false) }
let_it_be(:group_runner) { create(:ci_runner, :group, groups: [group]) }
# project specific
let_it_be(:project_runner) { create(:ci_runner, :project, projects: [project]) }
it 'returns a globally shared and a group specific runner' do
is_expected.to contain_exactly(group_runner, shared_runner)
end
# globally shared
let_it_be(:shared_runner) { create(:ci_runner, :instance) }
describe '.owned_or_instance_wide' do
subject { described_class.owned_or_instance_wide(project.id) }
it 'returns a project specific and a group specific runner' do
is_expected.to contain_exactly(group_runner, project_runner)
end
end
context 'with instance runners sharing disabled' do
let(:shared_runners_enabled) { false }
describe '.group_or_instance_wide' do
subject { described_class.group_or_instance_wide(group) }
it 'returns a group specific runner' do
is_expected.to contain_exactly(group_runner)
end
before do
# Ensure the project runner is instantiated
project_runner
end
it 'returns a group specific runner' do
is_expected.to contain_exactly(group_runner)
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