Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/database/load_balancing_spec.rb')
-rw-r--r--spec/lib/gitlab/database/load_balancing_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/lib/gitlab/database/load_balancing_spec.rb b/spec/lib/gitlab/database/load_balancing_spec.rb
index 65ffe539910..45878b2e266 100644
--- a/spec/lib/gitlab/database/load_balancing_spec.rb
+++ b/spec/lib/gitlab/database/load_balancing_spec.rb
@@ -38,6 +38,24 @@ RSpec.describe Gitlab::Database::LoadBalancing do
end
end
+ describe '.primary_only?' do
+ it 'returns true if all load balancers have no replicas' do
+ described_class.each_load_balancer do |lb|
+ allow(lb).to receive(:primary_only?).and_return(true)
+ end
+
+ expect(described_class.primary_only?).to eq(true)
+ end
+
+ it 'returns false if at least one has replicas' do
+ described_class.each_load_balancer.with_index do |lb, index|
+ allow(lb).to receive(:primary_only?).and_return(index != 0)
+ end
+
+ expect(described_class.primary_only?).to eq(false)
+ end
+ end
+
describe '.release_hosts' do
it 'releases the host of every load balancer' do
described_class.each_load_balancer do |lb|