diff options
author | Ahmad Hassan <ahmad.hassan612@gmail.com> | 2018-11-15 16:19:09 +0200 |
---|---|---|
committer | Ahmad Hassan <ahmad.hassan612@gmail.com> | 2018-11-15 16:19:09 +0200 |
commit | 73b3da73d62b3b18b6552f2a99f86458d03d628a (patch) | |
tree | ad65dac4757615ddb813f6152d4eb76ac14ebee4 /spec/models/postgresql/replication_slot_spec.rb | |
parent | ebc174e968ece65110aa722a18cdf437cfa75eeb (diff) | |
parent | bf31bd0d82affc29963d7d15c850ae0a0cc362a3 (diff) | |
download | gitlab-ce-73b3da73d62b3b18b6552f2a99f86458d03d628a.tar.gz |
Merge remote-tracking branch 'origin/master' into support-gitaly-tls
Diffstat (limited to 'spec/models/postgresql/replication_slot_spec.rb')
-rw-r--r-- | spec/models/postgresql/replication_slot_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/models/postgresql/replication_slot_spec.rb b/spec/models/postgresql/replication_slot_spec.rb index 919a7526803..e100af7ddc7 100644 --- a/spec/models/postgresql/replication_slot_spec.rb +++ b/spec/models/postgresql/replication_slot_spec.rb @@ -3,7 +3,27 @@ require 'spec_helper' describe Postgresql::ReplicationSlot, :postgresql do + describe '.in_use?' do + it 'returns true when replication slots are present' do + expect(described_class).to receive(:exists?).and_return(true) + expect(described_class.in_use?).to be_truthy + end + + it 'returns false when replication slots are not present' do + expect(described_class.in_use?).to be_falsey + end + + it 'returns false if the existence check is invalid' do + expect(described_class).to receive(:exists?).and_raise(ActiveRecord::StatementInvalid.new('PG::FeatureNotSupported')) + expect(described_class.in_use?).to be_falsey + end + end + describe '.lag_too_great?' do + before do + expect(described_class).to receive(:in_use?).and_return(true) + end + it 'returns true when replication lag is too great' do expect(described_class) .to receive(:pluck) |