@@ -496,7 +496,7 @@ def test_emit_with_read_lines_limit(data)
496496 config = CONFIG_READ_FROM_HEAD + config_element ( "" , "" , { "read_lines_limit" => limit } ) + PARSE_SINGLE_LINE_CONFIG
497497 end
498498 d = create_driver ( config )
499- msg = 'test ' * 2000 # in_tail reads 8192 bytes at once.
499+ msg = 'x ' * 65000 # in_tail reads 65536 bytes at once.
500500
501501 d . run ( expect_emits : num_events , timeout : 2 ) do
502502 Fluent ::FileWrapper . open ( "#{ @tmp_dir } /tail.txt" , "ab" ) { |f |
@@ -518,15 +518,15 @@ def test_emit_with_read_lines_limit(data)
518518 end
519519
520520 sub_test_case "reads_bytes_per_second w/o throttled" do
521- data ( "flat 8192 bytes, 2 events" => [ :flat , 100 , 8192 , 2 ] ,
522- "flat 8192 bytes, 2 events w/o stat watcher" => [ :flat_without_stat , 100 , 8192 , 2 ] ,
523- "flat #{ 8192 *10 } bytes, 20 events" => [ :flat , 100 , ( 8192 * 10 ) , 20 ] ,
524- "flat #{ 8192 *10 } bytes, 20 events w/o stat watcher" => [ :flat_without_stat , 100 , ( 8192 * 10 ) , 20 ] ,
525- "parse #{ 8192 *4 } bytes, 8 events" => [ :parse , 100 , ( 8192 * 4 ) , 8 ] ,
526- "parse #{ 8192 *4 } bytes, 8 events w/o stat watcher" => [ :parse_without_stat , 100 , ( 8192 * 4 ) , 8 ] ,
527- "parse #{ 8192 *10 } bytes, 20 events" => [ :parse , 100 , ( 8192 * 10 ) , 20 ] ,
528- "parse #{ 8192 *10 } bytes, 20 events w/o stat watcher" => [ :parse_without_stat , 100 , ( 8192 * 10 ) , 20 ] ,
529- "flat 8k bytes with unit, 2 events" => [ :flat , 100 , "8k " , 2 ] )
521+ data ( "flat 65536 bytes, 2 events" => [ :flat , 100 , 65536 , 2 ] ,
522+ "flat 65536 bytes, 2 events w/o stat watcher" => [ :flat_without_stat , 100 , 65536 , 2 ] ,
523+ "flat #{ 65536 *10 } bytes, 20 events" => [ :flat , 100 , ( 65536 * 10 ) , 20 ] ,
524+ "flat #{ 65536 *10 } bytes, 20 events w/o stat watcher" => [ :flat_without_stat , 100 , ( 65536 * 10 ) , 20 ] ,
525+ "parse #{ 65536 *4 } bytes, 8 events" => [ :parse , 100 , ( 65536 * 4 ) , 8 ] ,
526+ "parse #{ 65536 *4 } bytes, 8 events w/o stat watcher" => [ :parse_without_stat , 100 , ( 65536 * 4 ) , 8 ] ,
527+ "parse #{ 65536 *10 } bytes, 20 events" => [ :parse , 100 , ( 65536 * 10 ) , 20 ] ,
528+ "parse #{ 65536 *10 } bytes, 20 events w/o stat watcher" => [ :parse_without_stat , 100 , ( 65536 * 10 ) , 20 ] ,
529+ "flat 64k bytes with unit, 2 events" => [ :flat , 100 , "64k " , 2 ] )
530530 def test_emit_with_read_bytes_limit_per_second ( data )
531531 config_style , limit , limit_bytes , num_events = data
532532 case config_style
@@ -540,7 +540,7 @@ def test_emit_with_read_bytes_limit_per_second(data)
540540 config = CONFIG_READ_FROM_HEAD + CONFIG_DISABLE_STAT_WATCHER + config_element ( "" , "" , { "read_lines_limit" => limit , "read_bytes_limit_per_second" => limit_bytes } ) + PARSE_SINGLE_LINE_CONFIG
541541 end
542542
543- msg = 'test ' * 2000 # in_tail reads 8192 bytes at once.
543+ msg = 'x ' * 65000 # in_tail reads 65536 bytes at once.
544544 start_time = Fluent ::Clock . now
545545
546546 d = create_driver ( config )
@@ -553,8 +553,8 @@ def test_emit_with_read_bytes_limit_per_second(data)
553553 end
554554
555555 assert_true ( Fluent ::Clock . now - start_time > 1 )
556- assert_equal ( Array . new ( num_events ) { { "message" => msg } } ,
557- d . events . collect { |event | event [ 2 ] } )
556+ assert_equal ( num_events , d . events . size )
557+ assert_true ( d . events . all? { |event | { "message" => msg } == event [ 2 ] } )
558558 end
559559
560560 def test_read_bytes_limit_precede_read_lines_limit
@@ -564,7 +564,7 @@ def test_read_bytes_limit_precede_read_lines_limit
564564 "read_lines_limit" => 1000 ,
565565 "read_bytes_limit_per_second" => 8192
566566 } )
567- msg = 'abc'
567+ msg = 'abc' * 8
568568 start_time = Fluent ::Clock . now
569569 d = create_driver ( config )
570570 d . run ( expect_emits : 2 ) do
@@ -576,14 +576,14 @@ def test_read_bytes_limit_precede_read_lines_limit
576576 end
577577
578578 assert_true ( Fluent ::Clock . now - start_time > 1 )
579- assert_equal ( Array . new ( 4096 ) { { "message" => msg } } ,
580- d . events . collect { |event | event [ 2 ] } )
579+ assert_equal ( 5242 , d . events . size )
580+ assert_true ( d . events . all? { |event | { "message" => msg } == event [ 2 ] } )
581581 end
582582 end
583583
584584 sub_test_case "reads_bytes_per_second w/ throttled already" do
585- data ( "flat 8192 bytes" => [ :flat , 100 , 8192 ] ,
586- "parse 8192 bytes" => [ :parse , 100 , 8192 ] )
585+ data ( "flat 65536 bytes" => [ :flat , 100 , 65536 ] ,
586+ "parse 65536 bytes" => [ :parse , 100 , 65536 ] )
587587 def test_emit_with_read_bytes_limit_per_second ( data )
588588 config_style , limit , limit_bytes = data
589589 case config_style
@@ -593,7 +593,7 @@ def test_emit_with_read_bytes_limit_per_second(data)
593593 config = CONFIG_READ_FROM_HEAD + config_element ( "" , "" , { "read_lines_limit" => limit , "read_bytes_limit_per_second" => limit_bytes } ) + PARSE_SINGLE_LINE_CONFIG
594594 end
595595 d = create_driver ( config )
596- msg = 'test ' * 2000 # in_tail reads 8192 bytes at once.
596+ msg = 'x ' * 65000 # in_tail reads 65536 bytes at once.
597597
598598 mock . proxy ( d . instance ) . io_handler ( anything , anything ) do |io_handler |
599599 require 'fluent/config/types'
@@ -1238,7 +1238,7 @@ def test_encoding_for_regular_expression_parsing
12381238 assert_equal ( true , events . length > 0 )
12391239 assert_equal ( { "name" => "いうえ" } , events [ 0 ] [ 2 ] )
12401240 end
1241-
1241+
12421242 sub_test_case "multiline" do
12431243 data ( flat : MULTILINE_CONFIG ,
12441244 parse : PARSE_MULTILINE_CONFIG )
0 commit comments