From 3cf0eda6340e60a77cb738a52695ba49aad38e80 Mon Sep 17 00:00:00 2001 From: Yuri Rudman Date: Wed, 4 Sep 2019 09:22:42 -0400 Subject: [PATCH] test coverage for skipping backlog calculation unless subscription in replication state --- spec/models/pglogical_subscription_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spec/models/pglogical_subscription_spec.rb b/spec/models/pglogical_subscription_spec.rb index d8a47b3da6ba..b9e5ba594672 100644 --- a/spec/models/pglogical_subscription_spec.rb +++ b/spec/models/pglogical_subscription_spec.rb @@ -496,5 +496,12 @@ expect(described_class.first.backlog).to be nil end + + it 'does not attempt to calculate backlog and returns nil unless subscription status is "replicating"' do + allow(described_class).to receive(:status).and_return("down") + + expect(remote_connection).not_to receive(:xlog_location) + expect(described_class.first.backlog).to be nil + end end end