@@ -82,7 +82,7 @@ def feed_lines_without_line_breaks(driver, t, *messages, stream: nil)
8282 messages . each do |m |
8383 m . each_line do |line |
8484 line . delete! ( "\n " )
85- driver . emit ( log_entry ( line , count , stream ) , t + count )
85+ driver . feed ( t + count , log_entry ( line , count , stream ) )
8686 count += 1
8787 end
8888 end
@@ -125,10 +125,10 @@ def test_exception_detection
125125 d = create_driver
126126 t = Time . now . to_i
127127 messages = [ ARBITRARY_TEXT , JAVA_EXC , ARBITRARY_TEXT ]
128- d . run ( default_tag : DEFAULT_TAG ) do
128+ d . run ( default_tag : DEFAULT_TAG_STRIPPED ) do
129129 feed_lines ( d , t , *messages )
130130 end
131- assert_equal ( make_logs ( " test.tag" , t , *messages ) , d . events )
131+ assert_equal ( make_logs ( ' test.tag' , t , *messages ) , d . events )
132132 end
133133
134134 def test_ignore_nested_exceptions
@@ -183,7 +183,7 @@ def test_ignore_nested_exceptions
183183
184184 d . instance . router = router_mock
185185
186- d . run ( default_tag : DEFAULT_TAG ) do
186+ d . run ( default_tag : DEFAULT_TAG_STRIPPED ) do
187187 feed_lines ( d , t , json_line_with_exception + json_line_without_exception )
188188 end
189189 end
@@ -195,11 +195,11 @@ def test_single_language_config
195195languages java)
196196 d = create_driver ( cfg )
197197 t = Time . now . to_i
198- d . run ( default_tag : DEFAULT_TAG ) do
198+ d . run ( default_tag : DEFAULT_TAG_STRIPPED ) do
199199 feed_lines ( d , t , ARBITRARY_TEXT , JAVA_EXC , PYTHON_EXC )
200200 end
201201 expected = ARBITRARY_TEXT . lines + [ JAVA_EXC ] + PYTHON_EXC . lines
202- assert_equal ( make_logs ( DEFAULT_TAG , t , *expected ) , d . events )
202+ assert_equal ( make_logs ( DEFAULT_TAG_STRIPPED , t , *expected ) , d . events )
203203 end
204204
205205 def test_multi_language_config
@@ -208,11 +208,11 @@ def test_multi_language_config
208208languages python, java)
209209 d = create_driver ( cfg )
210210 t = Time . now . to_i
211- d . run ( default_tag : DEFAULT_TAG ) do
211+ d . run ( default_tag : DEFAULT_TAG_STRIPPED ) do
212212 feed_lines ( d , t , ARBITRARY_TEXT , JAVA_EXC , PYTHON_EXC )
213213 end
214214 expected = ARBITRARY_TEXT . lines + [ JAVA_EXC ] + [ PYTHON_EXC ]
215- assert_equal ( make_logs ( DEFAULT_TAG , t , *expected ) , d . events )
215+ assert_equal ( make_logs ( DEFAULT_TAG_STRIPPED , t , *expected ) , d . events )
216216 end
217217
218218 def test_split_exception_after_timeout
@@ -229,8 +229,8 @@ def test_split_exception_after_timeout
229229 t2 = Time . now . to_i
230230 feed_lines ( d , t2 , " at x\n at y\n " )
231231 end
232- assert_equal ( make_logs ( DEFAULT_TAG , t1 , JAVA_EXC ) +
233- make_logs ( DEFAULT_TAG , t2 , " at x\n " , " at y\n " ) ,
232+ assert_equal ( make_logs ( DEFAULT_TAG_STRIPPED , t1 , JAVA_EXC ) +
233+ make_logs ( DEFAULT_TAG_STRIPPED , t2 , " at x\n " , " at y\n " ) ,
234234 d . events )
235235 end
236236
@@ -246,7 +246,7 @@ def test_do_not_split_exception_after_pause
246246 feed_lines ( d , t2 , " at x\n at y\n " )
247247 d . instance . before_shutdown
248248 end
249- assert_equal ( make_logs ( " test.tag" , t1 , JAVA_EXC + " at x\n at y\n " ) , d . events )
249+ assert_equal ( make_logs ( ' test.tag' , t1 , JAVA_EXC + " at x\n at y\n " ) , d . events )
250250 end
251251
252252 def test_remove_tag_prefix_is_required
@@ -277,11 +277,11 @@ def test_force_line_breaks_false
277277force_line_breaks true)
278278 d = create_driver ( cfg )
279279 t = Time . now . to_i
280- d . run do
280+ d . run ( default_tag : DEFAULT_TAG ) do
281281 feed_lines ( d , t , JAVA_EXC )
282282 end
283283 expected = JAVA_EXC
284- assert_equal ( make_logs ( t , *expected ) , d . events )
284+ assert_equal ( make_logs ( DEFAULT_TAG_STRIPPED , t , *expected ) , d . events )
285285 end
286286
287287 def test_force_line_breaks_true
@@ -290,7 +290,7 @@ def test_force_line_breaks_true
290290force_line_breaks true)
291291 d = create_driver ( cfg )
292292 t = Time . now . to_i
293- d . run do
293+ d . run ( default_tag : DEFAULT_TAG ) do
294294 feed_lines_without_line_breaks ( d , t , JAVA_EXC )
295295 end
296296 # Expected: the first two lines of the exception are buffered and combined.
@@ -300,7 +300,7 @@ def test_force_line_breaks_true
300300 # are buffered and combined. So are the first two lines of the second
301301 # exception. Then the rest is logged line-by-line.
302302 expected = JAVA_EXC . chomp
303- assert_equal ( make_logs ( t , *expected ) , d . events )
303+ assert_equal ( make_logs ( DEFAULT_TAG_STRIPPED , t , *expected ) , d . events )
304304 end
305305
306306 def test_flush_after_max_lines
@@ -321,7 +321,7 @@ def test_flush_after_max_lines
321321 expected = [ PYTHON_EXC . lines [ 0 ..1 ] . join ] + PYTHON_EXC . lines [ 2 ..-1 ] + \
322322 [ JAVA_EXC . lines [ 0 ..1 ] . join ] + [ JAVA_EXC . lines [ 2 ..3 ] . join ] + \
323323 JAVA_EXC . lines [ 4 ..-1 ]
324- assert_equal ( make_logs ( DEFAULT_TAG , t , *expected ) , d . events )
324+ assert_equal ( make_logs ( DEFAULT_TAG_STRIPPED , t , *expected ) , d . events )
325325 end
326326
327327 def test_separate_streams
@@ -342,10 +342,10 @@ def test_separate_streams
342342 # because they belong to different streams.
343343 # Note that the Java exception is only detected when 'something else'
344344 # is processed.
345- expected = make_logs ( DEFAULT_TAG , t , JAVA_EXC , stream : 'java' ) +
346- make_logs ( DEFAULT_TAG , t , PYTHON_EXC , stream : 'python' ) +
347- make_logs ( DEFAULT_TAG , t , JAVA_EXC , stream : 'java' ) +
348- make_logs ( DEFAULT_TAG , t , 'something else' , stream : 'java' )
345+ expected = make_logs ( DEFAULT_TAG_STRIPPED , t , JAVA_EXC , stream : 'java' ) +
346+ make_logs ( DEFAULT_TAG_STRIPPED , t , PYTHON_EXC , stream : 'python' ) +
347+ make_logs ( DEFAULT_TAG_STRIPPED , t , JAVA_EXC , stream : 'java' ) +
348+ make_logs ( DEFAULT_TAG_STRIPPED , t , 'something else' , stream : 'java' )
349349 assert_equal ( expected , d . events )
350350 end
351351end
0 commit comments