File tree Expand file tree Collapse file tree 5 files changed +15
-7
lines changed Expand file tree Collapse file tree 5 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -322,7 +322,7 @@ def handshake!(socket)
322
322
raise exc
323
323
end
324
324
rescue => e
325
- log_warn ( "Failed to handshake with #{ address } : #{ e . class } : #{ e } " )
325
+ log_warn ( "Failed to handshake with #{ address } : #{ e . class } : #{ e } : \n #{ e . backtrace [ 0 .. 5 ] . join ( " \n " ) } " )
326
326
raise
327
327
end
328
328
end
@@ -379,7 +379,7 @@ def authenticate!(pending_connection)
379
379
begin
380
380
Auth . get ( user ) . login ( pending_connection )
381
381
rescue => e
382
- log_warn ( "Failed to handshake with #{ address } : #{ e . class } : #{ e } " )
382
+ log_warn ( "Failed to handshake with #{ address } : #{ e . class } : #{ e } : \n #{ e . backtrace [ 0 .. 5 ] . join ( " \n " ) } " )
383
383
raise
384
384
end
385
385
end
Original file line number Diff line number Diff line change @@ -204,7 +204,7 @@ def ismaster
204
204
connection . ismaster
205
205
end
206
206
if exc
207
- log_debug ( "Error running ismaster on #{ server . address } : #{ exc . class } : #{ exc . message } " )
207
+ log_debug ( "Error running ismaster on #{ server . address } : #{ exc . class } : #{ exc } : \n #{ exc . backtrace [ 0 .. 5 ] . join ( " \n " ) } " )
208
208
if monitoring . monitoring?
209
209
monitoring . failed (
210
210
Monitoring ::SERVER_HEARTBEAT ,
Original file line number Diff line number Diff line change @@ -232,7 +232,7 @@ def handshake!(socket)
232
232
log_warn ( "Asked to handshake with #{ address } but there was no app metadata provided" )
233
233
end
234
234
rescue => e
235
- log_warn ( "Failed to handshake with #{ address } : #{ e . class } : #{ e } " )
235
+ log_warn ( "Failed to handshake with #{ address } : #{ e . class } : #{ e } : \n #{ e . backtrace [ 0 .. 5 ] . join ( " \n " ) } " )
236
236
raise
237
237
end
238
238
Original file line number Diff line number Diff line change @@ -137,12 +137,13 @@ class ConnectionSpecTestException < Exception; end
137
137
138
138
it 'logs a warning' do
139
139
messages = [ ]
140
- # Straightforward expectations are not working here for some reason
141
140
expect ( Mongo ::Logger . logger ) . to receive ( :warn ) do |msg |
142
141
messages << msg
143
142
end
143
+
144
144
expect ( error ) . not_to be nil
145
- expect ( messages ) . to include ( expected_message )
145
+
146
+ messages . any? { |msg | msg . include? ( expected_message ) } . should be true
146
147
end
147
148
148
149
end
Original file line number Diff line number Diff line change 189
189
190
190
it 'logs a warning' do
191
191
expect_any_instance_of ( Mongo ::Socket ) . to receive ( :write ) . and_raise ( Mongo ::Error ::SocketError , 'test error' )
192
- expect ( Mongo ::Logger . logger ) . to receive ( :warn ) . with ( expected_message ) . and_call_original
192
+
193
+ messages = [ ]
194
+ expect ( Mongo ::Logger . logger ) . to receive ( :warn ) do |msg |
195
+ messages << msg
196
+ end
197
+
193
198
expect do
194
199
monitor . connection . connect!
195
200
end . to raise_error ( Mongo ::Error ::SocketError , 'test error' )
201
+
202
+ messages . any? { |msg | msg . include? ( expected_message ) } . should be true
196
203
end
197
204
end
198
205
end
You can’t perform that action at this time.
0 commit comments