summaryrefslogtreecommitdiff
path: root/spec/controllers/health_controller_spec.rb
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-12-11 18:56:53 +0000
committerFilipa Lacerda <filipa@gitlab.com>2017-12-11 18:56:53 +0000
commitfcd44484cd427fc75f05e1c8363e9def4b4bf64f (patch)
treee3181efad22ad409ef98a89592c1911d43f7bdad /spec/controllers/health_controller_spec.rb
parent7c68be16a6d364cd40d9fbb6e0878b9f2947bb88 (diff)
parent4ccbd556d98e002b1c521fd3dd7748fe1d9c4044 (diff)
downloadgitlab-ce-28869-es6-modules.tar.gz
Merge branch 'master' into 28869-es6-modules28869-es6-modules
* master: (117 commits) small change to make less conflict with EE version Add cop for use of remove_column Resolve merge conflicts with dev.gitlab.org/master after security release add index for doc/administration/operations/ Remove RubySampler#sample_objects for performance as well Bugfix: User can't change the access level of an access requester Add spec for removing issues.assignee_id updated imports Keep track of storage check timings Remove a header level in the new 'Automatic CE->EE merge' doc Improve down step of removing issues.assignee_id column Fix specs after removing assignee_id field Remove issues.assignee_id column Resolve conflicts in app/models/user.rb Fix image view mode Do not raise when downstream pipeline is created Remove the need for destroy and add a comment in the spec Use build instead of create in importer spec Simplify normalizing of paths Remove allocation tracking code from InfluxDB sampler for performance ...
Diffstat (limited to 'spec/controllers/health_controller_spec.rb')
-rw-r--r--spec/controllers/health_controller_spec.rb42
1 files changed, 42 insertions, 0 deletions
diff --git a/spec/controllers/health_controller_spec.rb b/spec/controllers/health_controller_spec.rb
index 9e9cf4f2c1f..95946def5f9 100644
--- a/spec/controllers/health_controller_spec.rb
+++ b/spec/controllers/health_controller_spec.rb
@@ -14,6 +14,48 @@ describe HealthController do
stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
end
+ describe '#storage_check' do
+ before do
+ allow(Gitlab::RequestContext).to receive(:client_ip).and_return(whitelisted_ip)
+ end
+
+ subject { post :storage_check }
+
+ it 'checks all the configured storages' do
+ expect(Gitlab::Git::Storage::Checker).to receive(:check_all).and_call_original
+
+ subject
+ end
+
+ it 'returns the check interval' do
+ stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'true')
+ stub_application_setting(circuitbreaker_check_interval: 10)
+
+ subject
+
+ expect(json_response['check_interval']).to eq(10)
+ end
+
+ context 'with failing storages', :broken_storage do
+ before do
+ stub_storage_settings(
+ broken: { path: 'tmp/tests/non-existent-repositories' }
+ )
+ end
+
+ it 'includes the failure information' do
+ subject
+
+ expected_results = [
+ { 'storage' => 'broken', 'success' => false },
+ { 'storage' => 'default', 'success' => true }
+ ]
+
+ expect(json_response['results']).to eq(expected_results)
+ end
+ end
+ end
+
describe '#readiness' do
shared_context 'endpoint responding with readiness data' do
let(:request_params) { {} }