Commit 7bb1227f authored by Brett Walker's avatar Brett Walker Committed by Nick Thomas

fix spelling of fdw table name that caused 500 error

parent 87f19344
......@@ -76,7 +76,7 @@ module Geo
#
def fdw_find_job_artifacts
fdw_job_artifacts.joins("INNER JOIN file_registry ON file_registry.file_id = #{fdw_jobs_artifacts_table}.id")
fdw_job_artifacts.joins("INNER JOIN file_registry ON file_registry.file_id = #{fdw_job_artifacts_table}.id")
.with_files_stored_locally
.merge(Geo::FileRegistry.job_artifacts)
end
......
......@@ -21,12 +21,71 @@ describe Geo::JobArtifactRegistryFinder, :geo do
describe '#count_synced_job_artifacts' do
it 'delegates to #legacy_find_synced_job_artifacts' do
allow(subject).to receive(:aggregate_pushdown_supported?).and_return(false)
expect(subject).to receive(:legacy_find_synced_job_artifacts).and_call_original
subject.count_synced_job_artifacts
end
it 'counts job artifacts that has been synced' do
it 'delegates to #find_synced_job_artifacts for PostgreSQL 10' do
allow(subject).to receive(:aggregate_pushdown_supported?).and_return(true)
expect(subject).to receive(:find_synced_job_artifacts).and_call_original
subject.count_synced_job_artifacts
end
end
describe '#count_failed_job_artifacts' do
it 'delegates to #legacy_find_failed_job_artifacts' do
allow(subject).to receive(:aggregate_pushdown_supported?).and_return(false)
expect(subject).to receive(:legacy_find_failed_job_artifacts).and_call_original
subject.count_failed_job_artifacts
end
it 'delegates to #find_failed_job_artifacts' do
allow(subject).to receive(:aggregate_pushdown_supported?).and_return(true)
expect(subject).to receive(:find_failed_job_artifacts).and_call_original
subject.count_failed_job_artifacts
end
end
shared_examples 'counts all the things' do
describe '#count_job_artifacts' do
it 'counts job artifacts' do
expect(subject.count_job_artifacts).to eq 4
end
it 'ignores remote job artifacts' do
job_artifact_1.update!(file_store: ObjectStorage::Store::REMOTE)
expect(subject.count_job_artifacts).to eq 3
end
context 'with selective sync' do
before do
secondary.update!(selective_sync_type: 'namespaces', namespaces: [synced_group])
end
it 'counts job artifacts' do
expect(subject.count_job_artifacts).to eq 2
end
it 'ignores remote job artifacts' do
job_artifact_1.update!(file_store: ObjectStorage::Store::REMOTE)
expect(subject.count_job_artifacts).to eq 1
end
end
end
describe '#count_synced_job_artifacts' do
it 'counts job artifacts that have been synced' do
create(:geo_file_registry, :job_artifact, file_id: job_artifact_1.id, success: false)
create(:geo_file_registry, :job_artifact, file_id: job_artifact_2.id)
create(:geo_file_registry, :job_artifact, file_id: job_artifact_3.id)
......@@ -74,12 +133,6 @@ describe Geo::JobArtifactRegistryFinder, :geo do
end
describe '#count_failed_job_artifacts' do
it 'delegates to #legacy_find_failed_job_artifacts' do
expect(subject).to receive(:legacy_find_failed_job_artifacts).and_call_original
subject.count_failed_job_artifacts
end
it 'counts job artifacts that sync has failed' do
create(:geo_file_registry, :job_artifact, file_id: job_artifact_1.id, success: false)
create(:geo_file_registry, :job_artifact, file_id: job_artifact_2.id)
......@@ -131,6 +184,7 @@ describe Geo::JobArtifactRegistryFinder, :geo do
end
end
end
end
shared_examples 'finds all the things' do
describe '#find_unsynced_job_artifacts' do
......@@ -167,6 +221,8 @@ describe Geo::JobArtifactRegistryFinder, :geo do
skip('FDW is not configured') if Gitlab::Database.postgresql? && !Gitlab::Geo::Fdw.enabled?
end
include_examples 'counts all the things'
include_examples 'finds all the things' do
let(:method_prefix) { 'fdw' }
end
......@@ -177,6 +233,8 @@ describe Geo::JobArtifactRegistryFinder, :geo do
allow(Gitlab::Geo::Fdw).to receive(:enabled?).and_return(false)
end
include_examples 'counts all the things'
include_examples 'finds all the things' do
let(:method_prefix) { 'legacy' }
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