summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/health_checks/probes/collection_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/health_checks/probes/collection_spec.rb')
-rw-r--r--spec/lib/gitlab/health_checks/probes/collection_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/lib/gitlab/health_checks/probes/collection_spec.rb b/spec/lib/gitlab/health_checks/probes/collection_spec.rb
index 03138e936aa..69828c143db 100644
--- a/spec/lib/gitlab/health_checks/probes/collection_spec.rb
+++ b/spec/lib/gitlab/health_checks/probes/collection_spec.rb
@@ -61,6 +61,35 @@ RSpec.describe Gitlab::HealthChecks::Probes::Collection do
expect(subject.json[:message]).to eq('Redis::CannotConnectError : Redis down')
end
end
+
+ context 'when some checks are not available' do
+ before do
+ allow(Gitlab::Runtime).to receive(:puma_in_clustered_mode?).and_return(false)
+ end
+
+ let(:checks) do
+ [
+ Gitlab::HealthChecks::MasterCheck
+ ]
+ end
+
+ it 'asks for check availability' do
+ expect(Gitlab::HealthChecks::MasterCheck).to receive(:available?)
+
+ subject
+ end
+
+ it 'does not call `readiness` on checks that are not available' do
+ expect(Gitlab::HealthChecks::MasterCheck).not_to receive(:readiness)
+
+ subject
+ end
+
+ it 'does not fail collection check' do
+ expect(subject.http_status).to eq(200)
+ expect(subject.json[:status]).to eq('ok')
+ end
+ end
end
context 'without checks' do