Commit cbc010ad authored by Pedro Pombeiro's avatar Pedro Pombeiro

Fix specs

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