Commit 8662b9a9 authored by Brett Walker's avatar Brett Walker Committed by Stan Hu

add PostgreSQL 10 to Geo CI build

parent 887b3f1a
...@@ -90,6 +90,11 @@ stages: ...@@ -90,6 +90,11 @@ stages:
- postgres:9.6 - postgres:9.6
- redis:alpine - redis:alpine
.use-pg-10-2: &use-pg-10-2
services:
- postgres:10.2
- redis:alpine
.use-pg-with-elasticsearch: &use-pg-with-elasticsearch .use-pg-with-elasticsearch: &use-pg-with-elasticsearch
services: services:
- postgres:9.2 - postgres:9.2
...@@ -219,7 +224,7 @@ stages: ...@@ -219,7 +224,7 @@ stages:
<<: *rspec-metadata-ee <<: *rspec-metadata-ee
<<: *use-mysql-with-elasticsearch <<: *use-mysql-with-elasticsearch
.rspec-geo-pg-9-6: &rspec-metadata-pg-geo .rspec-geo-pg-9-6: &rspec-metadata-pg-geo-9-6
<<: *rspec-metadata <<: *rspec-metadata
<<: *use-pg-9-6 <<: *use-pg-9-6
stage: test stage: test
...@@ -230,6 +235,17 @@ stages: ...@@ -230,6 +235,17 @@ stages:
- scripts/gitaly-test-spawn - scripts/gitaly-test-spawn
- bundle exec rspec --color --format documentation --tag geo ee/spec/ - bundle exec rspec --color --format documentation --tag geo ee/spec/
.rspec-geo-pg-10-2: &rspec-metadata-pg-geo-10-2
<<: *rspec-metadata
<<: *use-pg-10-2
stage: test
script:
- export NO_KNAPSACK=1
- export CACHE_CLASSES=true
- source scripts/prepare_postgres_fdw.sh
- scripts/gitaly-test-spawn
- bundle exec rspec --color --format documentation --tag geo ee/spec/
.rspec-ee-pg-rails5: &rspec-ee-pg-rails5 .rspec-ee-pg-rails5: &rspec-ee-pg-rails5
<<: *rspec-ee-pg <<: *rspec-ee-pg
<<: *rails5 <<: *rails5
...@@ -238,8 +254,12 @@ stages: ...@@ -238,8 +254,12 @@ stages:
<<: *rspec-ee-mysql <<: *rspec-ee-mysql
<<: *rails5 <<: *rails5
.rspec-geo-pg-9-6-rails5: &rspec-metadata-pg-geo-rails5 .rspec-geo-pg-9-6-rails5: &rspec-metadata-pg-geo-9-6-rails5
<<: *rspec-metadata-pg-geo <<: *rspec-metadata-pg-geo-9-6
<<: *rails5
.rspec-geo-pg-10-2-rails5: &rspec-metadata-pg-geo-10-2-rails5
<<: *rspec-metadata-pg-geo-10-2
<<: *rails5 <<: *rails5
.spinach-metadata: &spinach-metadata .spinach-metadata: &spinach-metadata
...@@ -525,13 +545,15 @@ rspec-pg-ee 0 2: *rspec-ee-pg ...@@ -525,13 +545,15 @@ rspec-pg-ee 0 2: *rspec-ee-pg
rspec-pg-ee 1 2: *rspec-ee-pg rspec-pg-ee 1 2: *rspec-ee-pg
rspec-mysql-ee 0 2: *rspec-ee-mysql rspec-mysql-ee 0 2: *rspec-ee-mysql
rspec-mysql-ee 1 2: *rspec-ee-mysql rspec-mysql-ee 1 2: *rspec-ee-mysql
rspec-pg geo: *rspec-metadata-pg-geo rspec-pg geo 0 2: *rspec-metadata-pg-geo-9-6
rspec-pg geo 1 2: *rspec-metadata-pg-geo-10-2
rspec-pg-ee-rails5 0 2: *rspec-ee-pg-rails5 rspec-pg-ee-rails5 0 2: *rspec-ee-pg-rails5
rspec-pg-ee-rails5 1 2: *rspec-ee-pg-rails5 rspec-pg-ee-rails5 1 2: *rspec-ee-pg-rails5
rspec-mysql-ee-rails5 0 2: *rspec-ee-mysql-rails5 rspec-mysql-ee-rails5 0 2: *rspec-ee-mysql-rails5
rspec-mysql-ee-rails5 1 2: *rspec-ee-mysql-rails5 rspec-mysql-ee-rails5 1 2: *rspec-ee-mysql-rails5
rspec-pg-geo-rails5: *rspec-metadata-pg-geo-rails5 rspec-pg-geo-rails5 0 2: *rspec-metadata-pg-geo-9-6-rails5
rspec-pg-geo-rails5 1 2: *rspec-metadata-pg-geo-10-2-rails5
## EE jobs ## EE jobs
rspec-pg 0 28: *rspec-metadata-pg rspec-pg 0 28: *rspec-metadata-pg
......
...@@ -90,7 +90,7 @@ module Geo ...@@ -90,7 +90,7 @@ module Geo
if use_legacy_queries? if use_legacy_queries?
legacy_find_failed_job_artifacts legacy_find_failed_job_artifacts
else else
fdw_find_job_artifacts.merge(find_synced_job_artifacts_registries) fdw_find_job_artifacts.merge(find_failed_job_artifacts_registries)
end end
end end
......
...@@ -22,52 +22,36 @@ describe Geo::LfsObjectRegistryFinder, :geo do ...@@ -22,52 +22,36 @@ describe Geo::LfsObjectRegistryFinder, :geo do
stub_lfs_object_storage stub_lfs_object_storage
end end
describe '#count_synced_lfs_objects' do context 'aggregate pushdown not supported' do
it 'delegates to #legacy_find_synced_lfs_objects' do before do
expect(subject).to receive(:legacy_find_synced_lfs_objects).and_call_original allow(subject).to receive(:aggregate_pushdown_supported?).and_return(false)
subject.count_synced_lfs_objects
end
it 'counts LFS objects that has been synced' do
create(:geo_file_registry, :lfs, file_id: lfs_object_1.id, success: false)
create(:geo_file_registry, :lfs, file_id: lfs_object_2.id)
create(:geo_file_registry, :lfs, file_id: lfs_object_3.id)
expect(subject.count_synced_lfs_objects).to eq 2
end
it 'ignores remote LFS objects' do
create(:geo_file_registry, :lfs, file_id: lfs_object_remote_1.id)
create(:geo_file_registry, :lfs, file_id: lfs_object_2.id)
create(:geo_file_registry, :lfs, file_id: lfs_object_3.id)
expect(subject.count_synced_lfs_objects).to eq 2
end end
context 'with selective sync' do describe '#count_synced_lfs_objects' do
before do
allow_any_instance_of(LfsObjectsProject).to receive(:update_project_statistics).and_return(nil)
create(:lfs_objects_project, project: synced_project, lfs_object: lfs_object_1)
create(:lfs_objects_project, project: synced_project, lfs_object: lfs_object_2)
create(:lfs_objects_project, project: unsynced_project, lfs_object: lfs_object_3)
secondary.update!(selective_sync_type: 'namespaces', namespaces: [synced_group])
end
it 'delegates to #legacy_find_synced_lfs_objects' do it 'delegates to #legacy_find_synced_lfs_objects' do
expect(subject).to receive(:legacy_find_synced_lfs_objects).and_call_original expect(subject).to receive(:legacy_find_synced_lfs_objects).and_call_original
subject.count_synced_lfs_objects subject.count_synced_lfs_objects
end end
end
describe '#count_failed_lfs_objects' do
it 'delegates to #legacy_find_failed_lfs_objects' do
expect(subject).to receive(:legacy_find_failed_lfs_objects).and_call_original
subject.count_failed_lfs_objects
end
end
end
shared_examples 'counts all the things' do
describe '#count_synced_lfs_objects' do
it 'counts LFS objects that has been synced' do it 'counts LFS objects that has been synced' do
create(:geo_file_registry, :lfs, file_id: lfs_object_1.id, success: false) create(:geo_file_registry, :lfs, file_id: lfs_object_1.id, success: false)
create(:geo_file_registry, :lfs, file_id: lfs_object_2.id) create(:geo_file_registry, :lfs, file_id: lfs_object_2.id)
create(:geo_file_registry, :lfs, file_id: lfs_object_3.id) create(:geo_file_registry, :lfs, file_id: lfs_object_3.id)
expect(subject.count_synced_lfs_objects).to eq 1 expect(subject.count_synced_lfs_objects).to eq 2
end end
it 'ignores remote LFS objects' do it 'ignores remote LFS objects' do
...@@ -75,57 +59,51 @@ describe Geo::LfsObjectRegistryFinder, :geo do ...@@ -75,57 +59,51 @@ describe Geo::LfsObjectRegistryFinder, :geo do
create(:geo_file_registry, :lfs, file_id: lfs_object_2.id) create(:geo_file_registry, :lfs, file_id: lfs_object_2.id)
create(:geo_file_registry, :lfs, file_id: lfs_object_3.id) create(:geo_file_registry, :lfs, file_id: lfs_object_3.id)
expect(subject.count_synced_lfs_objects).to eq 1 expect(subject.count_synced_lfs_objects).to eq 2
end end
end
end
describe '#count_failed_lfs_objects' do context 'with selective sync' do
it 'delegates to #legacy_find_failed_lfs_objects' do before do
expect(subject).to receive(:legacy_find_failed_lfs_objects).and_call_original allow_any_instance_of(LfsObjectsProject).to receive(:update_project_statistics).and_return(nil)
subject.count_failed_lfs_objects create(:lfs_objects_project, project: synced_project, lfs_object: lfs_object_1)
end create(:lfs_objects_project, project: synced_project, lfs_object: lfs_object_2)
create(:lfs_objects_project, project: unsynced_project, lfs_object: lfs_object_3)
it 'counts LFS objects that sync has failed' do secondary.update!(selective_sync_type: 'namespaces', namespaces: [synced_group])
create(:geo_file_registry, :lfs, file_id: lfs_object_1.id, success: false) end
create(:geo_file_registry, :lfs, file_id: lfs_object_2.id)
create(:geo_file_registry, :lfs, file_id: lfs_object_3.id, success: false)
expect(subject.count_failed_lfs_objects).to eq 2 it 'delegates to #legacy_find_synced_lfs_objects' do
end expect(subject).to receive(:legacy_find_synced_lfs_objects).and_call_original
it 'ignores remote LFS objects' do subject.count_synced_lfs_objects
create(:geo_file_registry, :lfs, file_id: lfs_object_remote_1.id, success: false) end
create(:geo_file_registry, :lfs, file_id: lfs_object_2.id, success: false)
create(:geo_file_registry, :lfs, file_id: lfs_object_3.id, success: false)
expect(subject.count_failed_lfs_objects).to eq 2 it 'counts LFS objects that has been synced' do
end create(:geo_file_registry, :lfs, file_id: lfs_object_1.id, success: false)
create(:geo_file_registry, :lfs, file_id: lfs_object_2.id)
create(:geo_file_registry, :lfs, file_id: lfs_object_3.id)
context 'with selective sync' do expect(subject.count_synced_lfs_objects).to eq 1
before do end
allow_any_instance_of(LfsObjectsProject).to receive(:update_project_statistics).and_return(nil)
create(:lfs_objects_project, project: synced_project, lfs_object: lfs_object_1) it 'ignores remote LFS objects' do
create(:lfs_objects_project, project: synced_project, lfs_object: lfs_object_2) create(:geo_file_registry, :lfs, file_id: lfs_object_remote_1.id)
create(:lfs_objects_project, project: unsynced_project, lfs_object: lfs_object_3) create(:geo_file_registry, :lfs, file_id: lfs_object_2.id)
create(:geo_file_registry, :lfs, file_id: lfs_object_3.id)
secondary.update!(selective_sync_type: 'namespaces', namespaces: [synced_group]) expect(subject.count_synced_lfs_objects).to eq 1
end end
it 'delegates to #legacy_find_failed_lfs_objects' do
expect(subject).to receive(:legacy_find_failed_lfs_objects).and_call_original
subject.count_failed_lfs_objects
end end
end
describe '#count_failed_lfs_objects' do
it 'counts LFS objects that sync has failed' do it 'counts LFS objects that sync has failed' do
create(:geo_file_registry, :lfs, file_id: lfs_object_1.id, success: false) create(:geo_file_registry, :lfs, file_id: lfs_object_1.id, success: false)
create(:geo_file_registry, :lfs, file_id: lfs_object_2.id) create(:geo_file_registry, :lfs, file_id: lfs_object_2.id)
create(:geo_file_registry, :lfs, file_id: lfs_object_3.id, success: false) create(:geo_file_registry, :lfs, file_id: lfs_object_3.id, success: false)
expect(subject.count_failed_lfs_objects).to eq 1 expect(subject.count_failed_lfs_objects).to eq 2
end end
it 'ignores remote LFS objects' do it 'ignores remote LFS objects' do
...@@ -133,7 +111,41 @@ describe Geo::LfsObjectRegistryFinder, :geo do ...@@ -133,7 +111,41 @@ describe Geo::LfsObjectRegistryFinder, :geo do
create(:geo_file_registry, :lfs, file_id: lfs_object_2.id, success: false) create(:geo_file_registry, :lfs, file_id: lfs_object_2.id, success: false)
create(:geo_file_registry, :lfs, file_id: lfs_object_3.id, success: false) create(:geo_file_registry, :lfs, file_id: lfs_object_3.id, success: false)
expect(subject.count_failed_lfs_objects).to eq 1 expect(subject.count_failed_lfs_objects).to eq 2
end
context 'with selective sync' do
before do
allow_any_instance_of(LfsObjectsProject).to receive(:update_project_statistics).and_return(nil)
create(:lfs_objects_project, project: synced_project, lfs_object: lfs_object_1)
create(:lfs_objects_project, project: synced_project, lfs_object: lfs_object_2)
create(:lfs_objects_project, project: unsynced_project, lfs_object: lfs_object_3)
secondary.update!(selective_sync_type: 'namespaces', namespaces: [synced_group])
end
it 'delegates to #legacy_find_failed_lfs_objects' do
expect(subject).to receive(:legacy_find_failed_lfs_objects).and_call_original
subject.count_failed_lfs_objects
end
it 'counts LFS objects that sync has failed' do
create(:geo_file_registry, :lfs, file_id: lfs_object_1.id, success: false)
create(:geo_file_registry, :lfs, file_id: lfs_object_2.id)
create(:geo_file_registry, :lfs, file_id: lfs_object_3.id, success: false)
expect(subject.count_failed_lfs_objects).to eq 1
end
it 'ignores remote LFS objects' do
create(:geo_file_registry, :lfs, file_id: lfs_object_remote_1.id, success: false)
create(:geo_file_registry, :lfs, file_id: lfs_object_2.id, success: false)
create(:geo_file_registry, :lfs, file_id: lfs_object_3.id, success: false)
expect(subject.count_failed_lfs_objects).to eq 1
end
end end
end end
end end
...@@ -214,6 +226,8 @@ describe Geo::LfsObjectRegistryFinder, :geo do ...@@ -214,6 +226,8 @@ describe Geo::LfsObjectRegistryFinder, :geo do
skip('FDW is not configured') if Gitlab::Database.postgresql? && !Gitlab::Geo::Fdw.enabled? skip('FDW is not configured') if Gitlab::Database.postgresql? && !Gitlab::Geo::Fdw.enabled?
end end
include_examples 'counts all the things'
include_examples 'finds all the things' do include_examples 'finds all the things' do
let(:method_prefix) { 'fdw' } let(:method_prefix) { 'fdw' }
end end
...@@ -224,6 +238,8 @@ describe Geo::LfsObjectRegistryFinder, :geo do ...@@ -224,6 +238,8 @@ describe Geo::LfsObjectRegistryFinder, :geo do
allow(Gitlab::Geo::Fdw).to receive(:enabled?).and_return(false) allow(Gitlab::Geo::Fdw).to receive(:enabled?).and_return(false)
end end
include_examples 'counts all the things'
include_examples 'finds all the things' do include_examples 'finds all the things' do
let(:method_prefix) { 'legacy' } let(:method_prefix) { 'legacy' }
end end
......
...@@ -156,7 +156,9 @@ describe GeoNodeStatus, :geo do ...@@ -156,7 +156,9 @@ describe GeoNodeStatus, :geo do
end end
end end
describe '#lfs_objects_failed' do # Disable transactions via :delete method because a foreign table
# can't see changes inside a transaction of a different connection.
describe '#lfs_objects_failed', :delete do
it 'counts failed LFS objects' do it 'counts failed LFS objects' do
# These four should be ignored # These four should be ignored
create(:geo_file_registry, success: false) create(:geo_file_registry, success: false)
...@@ -170,7 +172,9 @@ describe GeoNodeStatus, :geo do ...@@ -170,7 +172,9 @@ describe GeoNodeStatus, :geo do
end end
end end
describe '#lfs_objects_synced_in_percentage' do # Disable transactions via :delete method because a foreign table
# can't see changes inside a transaction of a different connection.
describe '#lfs_objects_synced_in_percentage', :delete do
let(:lfs_object_project) { create(:lfs_objects_project, project: project_1) } let(:lfs_object_project) { create(:lfs_objects_project, project: project_1) }
before do before do
...@@ -198,7 +202,9 @@ describe GeoNodeStatus, :geo do ...@@ -198,7 +202,9 @@ describe GeoNodeStatus, :geo do
end end
end end
describe '#job_artifacts_synced_count' do # Disable transactions via :delete method because a foreign table
# can't see changes inside a transaction of a different connection.
describe '#job_artifacts_synced_count', :delete do
it 'counts synced job artifacts' do it 'counts synced job artifacts' do
# These should be ignored # These should be ignored
create(:geo_file_registry, success: false) create(:geo_file_registry, success: false)
...@@ -212,7 +218,9 @@ describe GeoNodeStatus, :geo do ...@@ -212,7 +218,9 @@ describe GeoNodeStatus, :geo do
end end
end end
describe '#job_artifacts_failed_count' do # Disable transactions via :delete method because a foreign table
# can't see changes inside a transaction of a different connection.
describe '#job_artifacts_failed_count', :delete do
it 'counts failed job artifacts' do it 'counts failed job artifacts' do
# These should be ignored # These should be ignored
create(:geo_file_registry, success: false) create(:geo_file_registry, success: false)
...@@ -226,7 +234,9 @@ describe GeoNodeStatus, :geo do ...@@ -226,7 +234,9 @@ describe GeoNodeStatus, :geo do
end end
describe '#job_artifacts_synced_in_percentage' do describe '#job_artifacts_synced_in_percentage' do
context 'when artifacts are available' do # Disable transactions via :delete method because a foreign table
# can't see changes inside a transaction of a different connection.
context 'when artifacts are available', :delete do
before do before do
[project_1, project_2, project_3, project_4].each_with_index do |project, index| [project_1, project_2, project_3, project_4].each_with_index do |project, index|
build = create(:ci_build, project: project) build = create(:ci_build, project: project)
......
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