Commit 5c918a58 authored by Stan Hu's avatar Stan Hu

Merge branch 'bw-geo-add-postgresql-10-to-ci' into 'master'

add PostgreSQL 10 to Geo CI build

See merge request gitlab-org/gitlab-ee!5220
parents 887b3f1a 8662b9a9
...@@ -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,13 +22,30 @@ describe Geo::LfsObjectRegistryFinder, :geo do ...@@ -22,13 +22,30 @@ describe Geo::LfsObjectRegistryFinder, :geo do
stub_lfs_object_storage stub_lfs_object_storage
end end
context 'aggregate pushdown not supported' do
before do
allow(subject).to receive(:aggregate_pushdown_supported?).and_return(false)
end
describe '#count_synced_lfs_objects' do describe '#count_synced_lfs_objects' do
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)
...@@ -81,12 +98,6 @@ describe Geo::LfsObjectRegistryFinder, :geo do ...@@ -81,12 +98,6 @@ describe Geo::LfsObjectRegistryFinder, :geo do
end end
describe '#count_failed_lfs_objects' do 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
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)
...@@ -137,6 +148,7 @@ describe Geo::LfsObjectRegistryFinder, :geo do ...@@ -137,6 +148,7 @@ describe Geo::LfsObjectRegistryFinder, :geo do
end end
end end
end end
end
shared_examples 'finds all the things' do shared_examples 'finds all the things' do
describe '#find_unsynced_lfs_objects' do describe '#find_unsynced_lfs_objects' do
...@@ -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