Remove Geo::Fdw::GeoNode#job_artifacts method

parent 3b4eb406
...@@ -26,25 +26,6 @@ module Geo ...@@ -26,25 +26,6 @@ module Geo
projects.inner_join_project_registry projects.inner_join_project_registry
end end
def job_artifacts
return Geo::Fdw::Ci::JobArtifact.all unless selective_sync?
query = Geo::Fdw::Ci::JobArtifact.project_id_in(projects).select(:id)
cte = Gitlab::SQL::CTE.new(:restricted_job_artifacts, query)
fdw_job_artifact_table = Geo::Fdw::Ci::JobArtifact.arel_table
inner_join_restricted_job_artifacts =
cte.table
.join(fdw_job_artifact_table, Arel::Nodes::InnerJoin)
.on(cte.table[:id].eq(fdw_job_artifact_table[:id]))
.join_sources
Geo::Fdw::Ci::JobArtifact
.with(cte.to_arel)
.from(cte.table)
.joins(inner_join_restricted_job_artifacts)
end
def projects def projects
return Geo::Fdw::Project.all unless selective_sync? return Geo::Fdw::Project.all unless selective_sync?
......
...@@ -131,24 +131,4 @@ RSpec.describe Geo::Fdw::GeoNode, :geo, type: :model do ...@@ -131,24 +131,4 @@ RSpec.describe Geo::Fdw::GeoNode, :geo, type: :model do
end end
end end
end end
describe '#job_artifacts', :geo_fdw do
subject { described_class.find(node.id) }
context 'when selective sync is enabled' do
it 'applies a CTE statement' do
node.update!(selective_sync_type: 'namespaces')
expect(subject.job_artifacts.to_sql).to match(/WITH .+restricted_job_artifacts/)
end
end
context 'when selective sync is disabled' do
it 'doest not apply a CTE statement' do
node.update!(selective_sync_type: nil)
expect(subject.job_artifacts.to_sql).not_to match(/WITH .+restricted_job_artifacts/)
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