Commit f472e64a authored by Dylan Griffith's avatar Dylan Griffith
Browse files

Rename `runner.belonging_to_group(project.id) ->...

Rename `runner.belonging_to_group(project.id) -> runner.belonging_to_parent_group_of_project(project.id)`
parent 28d21dd3ed88
......@@ -79,7 +79,7 @@ def define_runners_variables
@shared_runners_count = @shared_runners.count(:all)
@group_runners = ::Ci::Runner.belonging_to_group(@project.id)
@group_runners = ::Ci::Runner.belonging_to_parent_group_of_project(@project.id)
end
def define_secret_variables
......
......@@ -34,7 +34,7 @@ class Runner < ActiveRecord::Base
scope :belonging_to_any_project, -> { joins(:runner_projects) }
scope :belonging_to_group, -> (project_id) {
scope :belonging_to_parent_group_of_project, -> (project_id) {
project_groups = ::Group.joins(:projects).where(projects: { id: project_id })
hierarchy_groups = Gitlab::GroupHierarchy.new(project_groups).base_and_ancestors
......@@ -42,7 +42,7 @@ class Runner < ActiveRecord::Base
}
scope :owned_or_shared, -> (project_id) do
union = Gitlab::SQL::Union.new([belonging_to_project(project_id), belonging_to_group(project_id), shared])
union = Gitlab::SQL::Union.new([belonging_to_project(project_id), belonging_to_parent_group_of_project(project_id), shared])
from("(#{union.to_sql}) ci_runners")
end
......
......@@ -1297,7 +1297,7 @@ def shared_runners
end
def group_runners
@group_runners ||= group_runners_enabled? ? Ci::Runner.belonging_to_group(self.id) : Ci::Runner.none
@group_runners ||= group_runners_enabled? ? Ci::Runner.belonging_to_parent_group_of_project(self.id) : Ci::Runner.none
end
def any_runners?(&block)
......
......@@ -4,7 +4,7 @@ def execute(build)
tick_for(build, build.project.runners)
if build.project.group_runners_enabled?
tick_for(build, Ci::Runner.belonging_to_group(build.project_id))
tick_for(build, Ci::Runner.belonging_to_parent_group_of_project(build.project_id))
end
if build.project.shared_runners_enabled?
......
......@@ -151,7 +151,7 @@
end
end
describe '.belonging_to_group' do
describe '.belonging_to_parent_group_of_project' do
it 'returns the specific group runner' do
# own
specific_group = create :group
......@@ -163,7 +163,7 @@
create :project, group: other_group
create :ci_runner, :specific, groups: [other_group]
expect(described_class.belonging_to_group(specific_project.id)).to eq [specific_runner]
expect(described_class.belonging_to_parent_group_of_project(specific_project.id)).to eq [specific_runner]
end
it 'returns the group runner from a parent group', :nested_groups do
......@@ -172,7 +172,7 @@
project = create :project, group: group
runner = create :ci_runner, :specific, groups: [parent_group]
expect(described_class.belonging_to_group(project.id)).to eq [runner]
expect(described_class.belonging_to_parent_group_of_project(project.id)).to eq [runner]
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