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)
322322 raise exc
323323 end
324324 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 " ) } " )
326326 raise
327327 end
328328 end
@@ -379,7 +379,7 @@ def authenticate!(pending_connection)
379379 begin
380380 Auth . get ( user ) . login ( pending_connection )
381381 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 " ) } " )
383383 raise
384384 end
385385 end
Original file line number Diff line number Diff line change @@ -204,7 +204,7 @@ def ismaster
204204 connection . ismaster
205205 end
206206 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 " ) } " )
208208 if monitoring . monitoring?
209209 monitoring . failed (
210210 Monitoring ::SERVER_HEARTBEAT ,
Original file line number Diff line number Diff line change @@ -232,7 +232,7 @@ def handshake!(socket)
232232 log_warn ( "Asked to handshake with #{ address } but there was no app metadata provided" )
233233 end
234234 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 " ) } " )
236236 raise
237237 end
238238
Original file line number Diff line number Diff line change @@ -137,12 +137,13 @@ class ConnectionSpecTestException < Exception; end
137137
138138 it 'logs a warning' do
139139 messages = [ ]
140- # Straightforward expectations are not working here for some reason
141140 expect ( Mongo ::Logger . logger ) . to receive ( :warn ) do |msg |
142141 messages << msg
143142 end
143+
144144 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
146147 end
147148
148149 end
Original file line number Diff line number Diff line change 189189
190190 it 'logs a warning' do
191191 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+
193198 expect do
194199 monitor . connection . connect!
195200 end . to raise_error ( Mongo ::Error ::SocketError , 'test error' )
201+
202+ messages . any? { |msg | msg . include? ( expected_message ) } . should be true
196203 end
197204 end
198205 end
You can’t perform that action at this time.
0 commit comments