diff options
author | Ash McKenzie <amckenzie@gitlab.com> | 2019-03-14 18:25:05 +0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-03-14 18:25:05 +0300 |
commit | 26134eeeceff1bcbaee9fe4c3fc3cb08da2b84b2 (patch) | |
tree | 95cb6a7fb72672987e6891f76f95079b3d0eecd1 /spec | |
parent | 80eaed2aeb3f0544151de15fed7969b34ef2f7a8 (diff) |
Rename pg_stat_wal_receiver_supported? DB helper
From pg_stat_wal_receiver_supported? to
postgresql_minimum_supported_version?
Also add test coverage
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/database_spec.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/lib/gitlab/database_spec.rb b/spec/lib/gitlab/database_spec.rb index 60106ee3c0b..ae50abd0e7a 100644 --- a/spec/lib/gitlab/database_spec.rb +++ b/spec/lib/gitlab/database_spec.rb @@ -87,6 +87,38 @@ describe Gitlab::Database do end end + describe '.postgresql_minimum_supported_version?' do + it 'returns false when not using PostgreSQL' do + allow(described_class).to receive(:postgresql?).and_return(false) + + expect(described_class.postgresql_minimum_supported_version?).to eq(false) + end + + context 'when using PostgreSQL' do + before do + allow(described_class).to receive(:postgresql?).and_return(true) + end + + it 'returns false when using PostgreSQL 9.5' do + allow(described_class).to receive(:version).and_return('9.5') + + expect(described_class.postgresql_minimum_supported_version?).to eq(false) + end + + it 'returns true when using PostgreSQL 9.6' do + allow(described_class).to receive(:version).and_return('9.6') + + expect(described_class.postgresql_minimum_supported_version?).to eq(true) + end + + it 'returns true when using PostgreSQL 10 or newer' do + allow(described_class).to receive(:version).and_return('10') + + expect(described_class.postgresql_minimum_supported_version?).to eq(true) + end + end + end + describe '.join_lateral_supported?' do it 'returns false when using MySQL' do allow(described_class).to receive(:postgresql?).and_return(false) @@ -195,6 +227,12 @@ describe Gitlab::Database do end end + describe '.pg_last_xact_replay_timestamp' do + it 'returns pg_last_xact_replay_timestamp' do + expect(described_class.pg_last_xact_replay_timestamp).to eq('pg_last_xact_replay_timestamp') + end + end + describe '.nulls_last_order' do context 'when using PostgreSQL' do before do |