File tree Expand file tree Collapse file tree 2 files changed +17
-9
lines changed Expand file tree Collapse file tree 2 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,19 @@ def api_key_tester
19
19
render json : { ok : is_good_result } , status : response_status
20
20
end
21
21
22
+ def self . impatient_mongoid_client
23
+ @impatient_mongoid_client ||= Mongo ::Client . new (
24
+ Errbit ::Config . mongo_url ,
25
+ server_selection_timeout : 0.5 ,
26
+ connect_timeout : 0.5 ,
27
+ socket_timeout : 0.5
28
+ )
29
+ end
30
+
22
31
private
23
32
33
+ delegate :impatient_mongoid_client , to : :class
34
+
24
35
def run_mongo_check
25
36
# collections might be empty which is ok but it will raise an exception if
26
37
# database cannot be contacted
@@ -31,13 +42,4 @@ def run_mongo_check
31
42
ensure
32
43
impatient_mongoid_client . close
33
44
end
34
-
35
- def impatient_mongoid_client
36
- @impatient_mongoid_client ||= Mongo ::Client . new (
37
- Errbit ::Config . mongo_url ,
38
- server_selection_timeout : 0.5 ,
39
- connect_timeout : 0.5 ,
40
- socket_timeout : 0.5
41
- )
42
- end
43
45
end
Original file line number Diff line number Diff line change 2
2
let ( :errbit_app ) { Fabricate ( :app , api_key : 'APIKEY' ) }
3
3
4
4
describe "readiness" do
5
+ before do
6
+ if HealthController . instance_variable_defined? :@impatient_mongoid_client
7
+ HealthController . remove_instance_variable :@impatient_mongoid_client
8
+ end
9
+ end
10
+
5
11
it 'can let you know when the app is ready to receive requests' do
6
12
get '/health/readiness'
7
13
expect ( response ) . to be_success
You can’t perform that action at this time.
0 commit comments