diff options
author | Brett Walker <brett@digitalmoksha.com> | 2017-12-05 19:43:47 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-12-05 19:43:47 +0300 |
commit | 02d97d46216b60568fb248f9aeb779528abd8e9c (patch) | |
tree | e8655dbc12e78e2f20e394564eb182b5eeead88f /spec/lib/gitlab/database_spec.rb | |
parent | 784edd654b8ef36535d3c1773b7a43d8f3c19b23 (diff) |
add Gitlab::Database.replication_slots_supported?
Diffstat (limited to 'spec/lib/gitlab/database_spec.rb')
-rw-r--r-- | spec/lib/gitlab/database_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/lib/gitlab/database_spec.rb b/spec/lib/gitlab/database_spec.rb index fcddfad3f9f..a5657b81952 100644 --- a/spec/lib/gitlab/database_spec.rb +++ b/spec/lib/gitlab/database_spec.rb @@ -73,6 +73,28 @@ describe Gitlab::Database do end end + describe '.replication_slots_supported?' do + it 'returns false when using MySQL' do + allow(described_class).to receive(:postgresql?).and_return(false) + + expect(described_class.replication_slots_supported?).to eq(false) + end + + it 'returns false when using PostgreSQL 9.3' do + allow(described_class).to receive(:postgresql?).and_return(true) + allow(described_class).to receive(:version).and_return('9.3.1') + + expect(described_class.replication_slots_supported?).to eq(false) + end + + it 'returns true when using PostgreSQL 9.4.0 or newer' do + allow(described_class).to receive(:postgresql?).and_return(true) + allow(described_class).to receive(:version).and_return('9.4.0') + + expect(described_class.replication_slots_supported?).to eq(true) + end + end + describe '.nulls_last_order' do context 'when using PostgreSQL' do before do |