fluentd 1.12.0-x86-mingw32 → 1.13.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fluentd might be problematic. Click here for more details.

Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.deepsource.toml +13 -0
  3. data/.github/ISSUE_TEMPLATE/config.yml +2 -2
  4. data/.github/workflows/linux-test.yaml +36 -0
  5. data/.github/workflows/macos-test.yaml +30 -0
  6. data/.github/workflows/windows-test.yaml +46 -0
  7. data/.gitlab-ci.yml +41 -19
  8. data/CHANGELOG.md +164 -2
  9. data/CONTRIBUTING.md +2 -2
  10. data/MAINTAINERS.md +5 -2
  11. data/README.md +7 -4
  12. data/example/counter.conf +1 -1
  13. data/fluentd.gemspec +5 -4
  14. data/lib/fluent/command/bundler_injection.rb +1 -1
  15. data/lib/fluent/command/ca_generate.rb +6 -3
  16. data/lib/fluent/command/cat.rb +19 -4
  17. data/lib/fluent/command/fluentd.rb +5 -2
  18. data/lib/fluent/command/plugin_config_formatter.rb +16 -1
  19. data/lib/fluent/command/plugin_generator.rb +31 -1
  20. data/lib/fluent/compat/parser.rb +2 -2
  21. data/lib/fluent/config/section.rb +2 -2
  22. data/lib/fluent/config/types.rb +2 -2
  23. data/lib/fluent/event.rb +3 -13
  24. data/lib/fluent/load.rb +0 -1
  25. data/lib/fluent/log.rb +1 -0
  26. data/lib/fluent/plugin/file_wrapper.rb +49 -4
  27. data/lib/fluent/plugin/formatter_ltsv.rb +2 -2
  28. data/lib/fluent/plugin/in_http.rb +11 -1
  29. data/lib/fluent/plugin/in_monitor_agent.rb +1 -1
  30. data/lib/fluent/plugin/in_tail.rb +141 -41
  31. data/lib/fluent/plugin/in_tail/position_file.rb +15 -1
  32. data/lib/fluent/plugin/out_copy.rb +18 -5
  33. data/lib/fluent/plugin/out_exec_filter.rb +3 -3
  34. data/lib/fluent/plugin/out_forward.rb +74 -58
  35. data/lib/fluent/plugin/out_http.rb +9 -2
  36. data/lib/fluent/plugin/output.rb +11 -9
  37. data/lib/fluent/plugin/parser_csv.rb +2 -2
  38. data/lib/fluent/plugin/parser_syslog.rb +2 -2
  39. data/lib/fluent/plugin/storage_local.rb +4 -4
  40. data/lib/fluent/plugin_helper/server.rb +4 -2
  41. data/lib/fluent/plugin_helper/service_discovery.rb +39 -1
  42. data/lib/fluent/plugin_helper/service_discovery/manager.rb +11 -5
  43. data/lib/fluent/plugin_helper/socket_option.rb +2 -2
  44. data/lib/fluent/supervisor.rb +28 -5
  45. data/lib/fluent/system_config.rb +16 -1
  46. data/lib/fluent/time.rb +57 -1
  47. data/lib/fluent/version.rb +1 -1
  48. data/templates/new_gem/fluent-plugin.gemspec.erb +3 -3
  49. data/templates/plugin_config_formatter/param.md-table.erb +10 -0
  50. data/test/command/test_cat.rb +96 -0
  51. data/test/command/test_fluentd.rb +38 -0
  52. data/test/command/test_plugin_config_formatter.rb +67 -0
  53. data/test/config/test_configurable.rb +1 -1
  54. data/test/config/test_system_config.rb +46 -0
  55. data/test/plugin/in_tail/test_io_handler.rb +4 -4
  56. data/test/plugin/in_tail/test_position_file.rb +59 -5
  57. data/test/plugin/test_file_wrapper.rb +115 -0
  58. data/test/plugin/test_in_exec.rb +1 -1
  59. data/test/plugin/test_in_http.rb +15 -0
  60. data/test/plugin/test_in_tail.rb +309 -26
  61. data/test/plugin/test_out_copy.rb +87 -0
  62. data/test/plugin/test_out_forward.rb +104 -11
  63. data/test/plugin/test_out_http.rb +20 -1
  64. data/test/plugin/test_output.rb +15 -3
  65. data/test/plugin/test_output_as_buffered_backup.rb +2 -0
  66. data/test/plugin/test_parser_csv.rb +14 -0
  67. data/test/plugin/test_parser_syslog.rb +14 -0
  68. data/test/plugin/test_sd_file.rb +1 -1
  69. data/test/plugin_helper/service_discovery/test_manager.rb +1 -1
  70. data/test/plugin_helper/test_child_process.rb +5 -2
  71. data/test/plugin_helper/test_http_server_helper.rb +4 -2
  72. data/test/plugin_helper/test_server.rb +26 -7
  73. data/test/plugin_helper/test_service_discovery.rb +74 -14
  74. data/test/test_config.rb +2 -1
  75. data/test/test_event.rb +16 -0
  76. data/test/test_formatter.rb +30 -0
  77. data/test/test_output.rb +2 -2
  78. data/test/test_supervisor.rb +66 -0
  79. data/test/test_time_parser.rb +109 -0
  80. metadata +58 -31
  81. data/.travis.yml +0 -77
  82. data/appveyor.yml +0 -31
@@ -2,8 +2,11 @@ require_relative '../helper'
2
2
  require 'fluent/test/driver/multi_output'
3
3
  require 'fluent/plugin/out_copy'
4
4
  require 'fluent/event'
5
+ require 'flexmock/test_unit'
5
6
 
6
7
  class CopyOutputTest < Test::Unit::TestCase
8
+ include FlexMock::TestCase
9
+
7
10
  class << self
8
11
  def startup
9
12
  $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), '..', 'scripts'))
@@ -54,6 +57,48 @@ class CopyOutputTest < Test::Unit::TestCase
54
57
  assert_equal :no_copy, d.instance.copy_mode
55
58
  end
56
59
 
60
+ ERRORNEOUS_IGNORE_IF_PREV_SUCCESS_CONFIG = %[
61
+ <store ignore_if_prev_success ignore_error>
62
+ @type test
63
+ name c0
64
+ </store>
65
+ <store ignore_if_prev_success ignore_error>
66
+ @type test
67
+ name c1
68
+ </store>
69
+ <store ignore_if_prev_success>
70
+ @type test
71
+ name c2
72
+ </store>
73
+ ]
74
+ def test_configure_with_errorneus_ignore_if_prev_success
75
+ assert_raise(Fluent::ConfigError) do
76
+ create_driver(ERRORNEOUS_IGNORE_IF_PREV_SUCCESS_CONFIG)
77
+ end
78
+ end
79
+
80
+ ALL_IGNORE_ERROR_WITHOUT_IGNORE_IF_PREV_SUCCESS_CONFIG = %[
81
+ @log_level info
82
+ <store ignore_error>
83
+ @type test
84
+ name c0
85
+ </store>
86
+ <store ignore_error>
87
+ @type test
88
+ name c1
89
+ </store>
90
+ <store ignore_error>
91
+ @type test
92
+ name c2
93
+ </store>
94
+ ]
95
+ def test_configure_all_ignore_errors_without_ignore_if_prev_success
96
+ d = create_driver(ALL_IGNORE_ERROR_WITHOUT_IGNORE_IF_PREV_SUCCESS_CONFIG)
97
+ expected = /ignore_errors are specified in all <store>, but ignore_if_prev_success is not specified./
98
+ matches = d.logs.grep(expected)
99
+ assert_equal(1, matches.length, "Logs do not contain '#{expected}' '#{d.logs}'")
100
+ end
101
+
57
102
  def test_configure_with_deep_copy_and_use_shallow_copy_mode
58
103
  d = create_driver(%[
59
104
  deep_copy true
@@ -217,5 +262,47 @@ class CopyOutputTest < Test::Unit::TestCase
217
262
  end
218
263
  end
219
264
  end
265
+
266
+ IGNORE_IF_PREV_SUCCESS_CONFIG = %[
267
+ <store ignore_error>
268
+ @type test
269
+ name c0
270
+ </store>
271
+ <store ignore_if_prev_success ignore_error>
272
+ @type test
273
+ name c1
274
+ </store>
275
+ <store ignore_if_prev_success>
276
+ @type test
277
+ name c2
278
+ </store>
279
+ ]
280
+
281
+ def test_ignore_if_prev_success
282
+ d = create_driver(IGNORE_IF_PREV_SUCCESS_CONFIG)
283
+
284
+ # override to raise an error
285
+ d.instance.outputs[0].define_singleton_method(:process) do |tag, es|
286
+ raise ArgumentError, 'Failed'
287
+ end
288
+
289
+ # check ingore_if_prev_success functionality:
290
+ # 1. output 2 is succeeded.
291
+ # 2. output 3 is not called.
292
+ flexstub(d.instance.outputs[1]) do |output|
293
+ output.should_receive(:process).once
294
+ end
295
+ flexstub(d.instance.outputs[2]) do |output|
296
+ output.should_receive(:process).never
297
+ end
298
+
299
+ time = Time.parse("2011-01-02 13:14:15 UTC").to_i
300
+ assert_nothing_raised do
301
+ d.run(default_tag: 'test') do
302
+ d.feed(time, {"a"=>1})
303
+ end
304
+ end
305
+ end
306
+
220
307
  end
221
308
 
@@ -277,11 +277,16 @@ EOL
277
277
  </service_discovery>
278
278
  ])
279
279
 
280
- assert_equal 2, d.instance.discovery_manager.services.size
281
- assert_equal '127.0.0.1', d.instance.discovery_manager.services[0].host
282
- assert_equal 1234, d.instance.discovery_manager.services[0].port
283
- assert_equal '127.0.0.1', d.instance.discovery_manager.services[1].host
284
- assert_equal 1235, d.instance.discovery_manager.services[1].port
280
+
281
+ assert_equal(
282
+ [
283
+ { host: '127.0.0.1', port: 1234 },
284
+ { host: '127.0.0.1', port: 1235 },
285
+ ],
286
+ d.instance.discovery_manager.services.collect do |service|
287
+ { host: service.host, port: service.port }
288
+ end
289
+ )
285
290
  end
286
291
 
287
292
  test 'pass username and password as empty string to HandshakeProtocol' do
@@ -367,10 +372,31 @@ EOL
367
372
  require_ack_response true
368
373
  ack_response_timeout 2s
369
374
  ])
375
+ d.instance_start
370
376
  assert d.instance.require_ack_response
371
377
  assert_equal 2, d.instance.ack_response_timeout
372
378
  end
373
379
 
380
+ test 'suspend_flush is disable before before_shutdown' do
381
+ @d = d = create_driver(CONFIG + %[
382
+ require_ack_response true
383
+ ack_response_timeout 2s
384
+ ])
385
+ d.instance_start
386
+ assert_false d.instance.instance_variable_get(:@suspend_flush)
387
+ end
388
+
389
+ test 'suspend_flush should be enabled and try_flush returns nil after before_shutdown' do
390
+ @d = d = create_driver(CONFIG + %[
391
+ require_ack_response true
392
+ ack_response_timeout 2s
393
+ ])
394
+ d.instance_start
395
+ d.instance.before_shutdown
396
+ assert_true d.instance.instance_variable_get(:@suspend_flush)
397
+ assert_nil d.instance.try_flush
398
+ end
399
+
374
400
  test 'verify_connection_at_startup is disabled in default' do
375
401
  @d = d = create_driver(CONFIG)
376
402
  assert_false d.instance.verify_connection_at_startup
@@ -566,31 +592,88 @@ EOL
566
592
  flush_mode immediate
567
593
  retry_type periodic
568
594
  retry_wait 30s
569
- flush_at_shutdown false # suppress errors in d.instance_shutdown
595
+ flush_at_shutdown true
570
596
  </buffer>
571
597
  ])
572
598
 
573
599
  time = event_time("2011-01-02 13:14:15 UTC")
574
600
 
575
601
  acked_chunk_ids = []
602
+ nacked = false
576
603
  mock.proxy(d.instance.ack_handler).read_ack_from_sock(anything) do |info, success|
577
604
  if success
578
605
  acked_chunk_ids << info.chunk_id
606
+ else
607
+ nacked = true
579
608
  end
580
- [chunk_id, success]
609
+ [info, success]
581
610
  end
582
611
 
583
612
  records = [
584
613
  {"a" => 1},
585
614
  {"a" => 2}
586
615
  ]
587
- target_input_driver.run(expect_records: 2) do
588
- d.end_if { acked_chunk_ids.size > 0 }
616
+ target_input_driver.run(expect_records: 2, timeout: 5) do
617
+ d.end_if { acked_chunk_ids.size > 0 || nacked }
589
618
  d.run(default_tag: 'test', wait_flush_completion: false, shutdown: false) do
590
619
  d.feed([[time, records[0]], [time,records[1]]])
591
620
  end
592
621
  end
593
622
 
623
+ assert(!nacked, d.instance.log.logs.join)
624
+
625
+ events = target_input_driver.events
626
+ assert_equal ['test', time, records[0]], events[0]
627
+ assert_equal ['test', time, records[1]], events[1]
628
+
629
+ assert_equal 1, acked_chunk_ids.size
630
+ assert_equal d.instance.sent_chunk_ids.first, acked_chunk_ids.first
631
+ end
632
+
633
+ test 'a node supporting responses after stop' do
634
+ target_input_driver = create_target_input_driver
635
+
636
+ @d = d = create_driver(CONFIG + %[
637
+ require_ack_response true
638
+ ack_response_timeout 1s
639
+ <buffer tag>
640
+ flush_mode immediate
641
+ retry_type periodic
642
+ retry_wait 30s
643
+ flush_at_shutdown true
644
+ </buffer>
645
+ ])
646
+
647
+ time = event_time("2011-01-02 13:14:15 UTC")
648
+
649
+ acked_chunk_ids = []
650
+ nacked = false
651
+ mock.proxy(d.instance.ack_handler).read_ack_from_sock(anything) do |info, success|
652
+ if success
653
+ acked_chunk_ids << info.chunk_id
654
+ else
655
+ nacked = true
656
+ end
657
+ [info, success]
658
+ end
659
+
660
+ records = [
661
+ {"a" => 1},
662
+ {"a" => 2}
663
+ ]
664
+ target_input_driver.run(expect_records: 2, timeout: 5) do
665
+ d.end_if { acked_chunk_ids.size > 0 || nacked }
666
+ d.run(default_tag: 'test', wait_flush_completion: false, shutdown: false) do
667
+ d.instance.stop
668
+ d.feed([[time, records[0]], [time,records[1]]])
669
+ d.instance.before_shutdown
670
+ d.instance.shutdown
671
+ d.instance.after_shutdown
672
+ end
673
+ end
674
+
675
+ assert(!nacked, d.instance.log.logs.join)
676
+
594
677
  events = target_input_driver.events
595
678
  assert_equal ['test', time, records[0]], events[0]
596
679
  assert_equal ['test', time, records[1]], events[1]
@@ -995,7 +1078,7 @@ EOL
995
1078
  test 'when out_forward has @id' do
996
1079
  # cancel https://github.com/fluent/fluentd/blob/077508ac817b7637307434d0c978d7cdc3d1c534/lib/fluent/plugin_id.rb#L43-L53
997
1080
  # it always return true in test
998
- mock.proxy(Fluent::Plugin).new_sd(:static, anything) { |v|
1081
+ mock.proxy(Fluent::Plugin).new_sd('static', parent: anything) { |v|
999
1082
  stub(v).plugin_id_for_test? { false }
1000
1083
  }.once
1001
1084
 
@@ -1137,6 +1220,8 @@ EOL
1137
1220
  end
1138
1221
 
1139
1222
  test 'Create new connection per send_data' do
1223
+ omit "Proxy of RR doesn't support kwargs of Ruby 3 yet" if RUBY_VERSION.split('.')[0].to_i >= 3
1224
+
1140
1225
  target_input_driver = create_target_input_driver(conf: TARGET_CONFIG)
1141
1226
  output_conf = CONFIG
1142
1227
  d = create_driver(output_conf)
@@ -1175,6 +1260,8 @@ EOL
1175
1260
 
1176
1261
  sub_test_case 'keepalive' do
1177
1262
  test 'Do not create connection per send_data' do
1263
+ omit "Proxy of RR doesn't support kwargs of Ruby 3 yet" if RUBY_VERSION.split('.')[0].to_i >= 3
1264
+
1178
1265
  target_input_driver = create_target_input_driver(conf: TARGET_CONFIG)
1179
1266
  output_conf = CONFIG + %[
1180
1267
  keepalive true
@@ -1222,7 +1309,13 @@ EOL
1222
1309
 
1223
1310
  begin
1224
1311
  chunk = Fluent::Plugin::Buffer::MemoryChunk.new(Fluent::Plugin::Buffer::Metadata.new(nil, nil, nil))
1225
- mock.proxy(d.instance).socket_create_tcp(TARGET_HOST, TARGET_PORT, anything) { |sock| mock(sock).close.once; sock }.twice
1312
+ mock.proxy(d.instance).socket_create_tcp(TARGET_HOST, TARGET_PORT,
1313
+ linger_timeout: anything,
1314
+ send_timeout: anything,
1315
+ recv_timeout: anything,
1316
+ connect_timeout: anything) { |sock|
1317
+ mock(sock).close.once; sock
1318
+ }.twice
1226
1319
 
1227
1320
  target_input_driver.run(timeout: 15) do
1228
1321
  d.run(shutdown: false) do
@@ -127,7 +127,7 @@ class HTTPOutputTest < Test::Unit::TestCase
127
127
  now = Time.now
128
128
  started = false
129
129
  until started
130
- raise "Server not started" if (now - Time.now > 10.0)
130
+ raise "Server not started" if (Time.now - now > 10.0)
131
131
  begin
132
132
  http_client { |c| c.request_get('/') }
133
133
  started = true
@@ -280,6 +280,25 @@ class HTTPOutputTest < Test::Unit::TestCase
280
280
  assert_equal "fluentd!", result.headers['test_header']
281
281
  end
282
282
 
283
+ def test_write_with_headers_from_placeholders
284
+ d = create_driver(config + %[
285
+ headers_from_placeholders {"x-test":"${$.foo.bar}-test","x-tag":"${tag}"}
286
+ <buffer tag,$.foo.bar>
287
+ </buffer>
288
+ ])
289
+ d.run(default_tag: 'test.http') do
290
+ test_events.each { |event|
291
+ ev = event.dup
292
+ ev['foo'] = {'bar' => 'abcd'}
293
+ d.feed(ev)
294
+ }
295
+ end
296
+
297
+ result = @@result
298
+ assert_equal "abcd-test", result.headers['x-test']
299
+ assert_equal "test.http", result.headers['x-tag']
300
+ end
301
+
283
302
  def test_write_with_retryable_response
284
303
  old_report_on_exception = Thread.report_on_exception
285
304
  Thread.report_on_exception = false # thread finished as invalid state since RetryableResponse raises.
@@ -390,6 +390,18 @@ class OutputTest < Test::Unit::TestCase
390
390
  assert { logs.none? { |log| log.include?("${chunk_id}") } }
391
391
  end
392
392
 
393
+ test '#extract_placeholders does not log for ${chunk_id} placeholder (with @chunk_keys)' do
394
+ @i.configure(config_element('ROOT', '', {}, [config_element('buffer', 'key1')]))
395
+ tmpl = "/mypath/${chunk_id}/${key1}/tail"
396
+ t = event_time('2016-04-11 20:30:00 +0900')
397
+ v = {key1: "value1", key2: "value2"}
398
+ c = create_chunk(timekey: t, tag: 'fluentd.test.output', variables: v)
399
+ @i.log.out.logs.clear
400
+ @i.extract_placeholders(tmpl, c)
401
+ logs = @i.log.out.logs
402
+ assert { logs.none? { |log| log.include?("${chunk_id}") } }
403
+ end
404
+
393
405
  test '#extract_placeholders logs warn message with not replaced key' do
394
406
  @i.configure(config_element('ROOT', '', {}, [config_element('buffer', '')]))
395
407
  tmpl = "/mypath/${key1}/test"
@@ -868,7 +880,7 @@ class OutputTest < Test::Unit::TestCase
868
880
  test "Warn if primary type is different from secondary type and either primary or secondary has custom_format" do
869
881
  o = create_output(:buffered)
870
882
  mock(o.log).warn("Use different plugin for secondary. Check the plugin works with primary like secondary_file",
871
- { primary: o.class.to_s, secondary: "Fluent::Plugin::TestOutput" })
883
+ primary: o.class.to_s, secondary: "Fluent::Plugin::TestOutput")
872
884
 
873
885
  o.configure(config_element('ROOT','',{},[config_element('secondary','',{'@type'=>'test', 'name' => "cool"})]))
874
886
  assert_not_nil o.instance_variable_get(:@secondary)
@@ -877,7 +889,7 @@ class OutputTest < Test::Unit::TestCase
877
889
  test "don't warn if primary type is the same as secondary type" do
878
890
  o = Fluent::Plugin::TestOutput.new
879
891
  mock(o.log).warn("Use different plugin for secondary. Check the plugin works with primary like secondary_file",
880
- { primary: o.class.to_s, secondary: "Fluent::Plugin::TestOutput" }).never
892
+ primary: o.class.to_s, secondary: "Fluent::Plugin::TestOutput" ).never
881
893
 
882
894
  o.configure(config_element('ROOT','',{'name' => "cool2"},
883
895
  [config_element('secondary','',{'@type'=>'test', 'name' => "cool"}),
@@ -889,7 +901,7 @@ class OutputTest < Test::Unit::TestCase
889
901
  test "don't warn if primary type is different from secondary type and both don't have custom_format" do
890
902
  o = create_output(:standard)
891
903
  mock(o.log).warn("Use different plugin for secondary. Check the plugin works with primary like secondary_file",
892
- { primary: o.class.to_s, secondary: "Fluent::Plugin::TestOutput" }).never
904
+ primary: o.class.to_s, secondary: "Fluent::Plugin::TestOutput").never
893
905
 
894
906
  o.configure(config_element('ROOT','',{},[config_element('secondary','',{'@type'=>'test', 'name' => "cool"})]))
895
907
  assert_not_nil o.instance_variable_get(:@secondary)
@@ -173,6 +173,8 @@ class BufferedOutputBackupTest < Test::Unit::TestCase
173
173
  waiting(5) {
174
174
  target_dir = File.join(File.dirname(target_file), "*")
175
175
  while Dir.glob(target_dir).size.zero?
176
+ # Avoid to lose globbed entries on Windows in busy loop
177
+ sleep 0.1 if Fluent.windows?
176
178
  end
177
179
  }
178
180
  end
@@ -183,4 +183,18 @@ class CSVParserTest < ::Test::Unit::TestCase
183
183
  # And more...
184
184
  end
185
185
  end
186
+
187
+ # "parser_type" config shouldn't hide Fluent::Plugin::Parser#plugin_type
188
+ # https://github.com/fluent/fluentd/issues/3296
189
+ data('normal' => :normal, 'fast' => :fast)
190
+ def test_parser_type_method(engine)
191
+ d = create_driver('keys' => '["time"]','time_key' => 'time', 'parser_type' => engine.to_s)
192
+ assert_equal(:text_per_line, d.instance.parser_type)
193
+ end
194
+
195
+ data('normal' => :normal, 'fast' => :fast)
196
+ def test_parser_engine(engine)
197
+ d = create_driver('keys' => '["time"]', 'time_key' => 'time', 'parser_engine' => engine.to_s)
198
+ assert_equal(engine, d.instance.parser_engine)
199
+ end
186
200
  end
@@ -633,4 +633,18 @@ class SyslogParserTest < ::Test::Unit::TestCase
633
633
  end
634
634
  end
635
635
  end
636
+
637
+ # "parser_type" config shouldn't hide Fluent::Plugin::Parser#plugin_type
638
+ # https://github.com/fluent/fluentd/issues/3296
639
+ data('regexp' => :regexp, 'fast' => :string)
640
+ def test_parser_type_method(engine)
641
+ @parser.configure({'parser_type' => engine.to_s})
642
+ assert_equal(:text_per_line, @parser.instance.parser_type)
643
+ end
644
+
645
+ data('regexp' => :regexp, 'string' => :string)
646
+ def test_parser_engine(engine)
647
+ d = @parser.configure({'parser_engine' => engine.to_s})
648
+ assert_equal(engine, @parser.instance.parser_engine)
649
+ end
636
650
  end
@@ -149,7 +149,7 @@ class FileServiceDiscoveryTest < ::Test::Unit::TestCase
149
149
  assert_empty queue
150
150
  end
151
151
 
152
- test 'Skip if error is occured' do
152
+ test 'Skip if error is occurred' do
153
153
  @sd_file.extend(TestStatEventHelperWrapper)
154
154
 
155
155
  create_tmp_config('config.json', JSON.generate([{ port: 1233, host: '127.0.0.1' }]))
@@ -71,7 +71,7 @@ class TestServiceDiscoveryManager < ::Test::Unit::TestCase
71
71
  test 'if new service added and deleted' do
72
72
  sdm = Fluent::PluginHelper::ServiceDiscovery::Manager.new(log: $log)
73
73
  t = TestSdPlugin.new
74
- mock(Fluent::Plugin).new_sd(:sd_test, anything) { t }
74
+ mock(Fluent::Plugin).new_sd(:sd_test, parent: anything) { t }
75
75
  sdm.configure([{ type: :sd_test, conf: config_element('service_discovery', '', {})}])
76
76
  sdm.start
77
77
 
@@ -1,3 +1,4 @@
1
+ # coding: utf-8
1
2
  require_relative '../helper'
2
3
  require 'fluent/plugin_helper/child_process'
3
4
  require 'fluent/plugin/base'
@@ -269,10 +270,12 @@ class ChildProcessTest < Test::Unit::TestCase
269
270
  Timeout.timeout(TEST_DEADLOCK_TIMEOUT) do
270
271
  ran = false
271
272
  @d.child_process_execute(:t4, "ruby -e 'Signal.trap(:TERM, nil); while sleep 0.1; puts 1; STDOUT.flush rescue nil; end'", mode: [:read]) do |io|
272
- m.lock
273
- ran = true
274
273
  begin
275
274
  while line = io.readline
275
+ unless ran
276
+ m.lock
277
+ ran = true
278
+ end
276
279
  ary << line
277
280
  end
278
281
  rescue