diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2018-11-05 12:50:31 +0000 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2018-11-05 12:50:31 +0000 |
commit | 3eb57ceccd3b75c34993c77e329f7f08000f118f (patch) | |
tree | 1bf81ff4e3c18c317e56899b5cd3509d607a3960 /spec/models | |
parent | a5fa8228f6d1c79431396a58ea289dc7a9a4b6d6 (diff) | |
parent | fd7f95ee7421f297e71f8fe81159b6d9df381e4c (diff) | |
download | gitlab-ce-3eb57ceccd3b75c34993c77e329f7f08000f118f.tar.gz |
Merge branch 'sh-fix-issue-52176' into 'master'
Disable replication lag check for Aurora PostgreSQL databases
Closes #52176
See merge request gitlab-org/gitlab-ce!22786
Diffstat (limited to 'spec/models')
-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) |