fluentd 0.14.8 → 0.14.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/CONTRIBUTING.md +6 -1
  4. data/ChangeLog +38 -0
  5. data/Rakefile +21 -0
  6. data/example/out_exec_filter.conf +42 -0
  7. data/lib/fluent/agent.rb +2 -2
  8. data/lib/fluent/command/binlog_reader.rb +1 -1
  9. data/lib/fluent/command/cat.rb +5 -2
  10. data/lib/fluent/compat/output.rb +7 -8
  11. data/lib/fluent/compat/parser.rb +139 -11
  12. data/lib/fluent/config/configure_proxy.rb +2 -11
  13. data/lib/fluent/config/section.rb +7 -0
  14. data/lib/fluent/configurable.rb +1 -3
  15. data/lib/fluent/log.rb +1 -1
  16. data/lib/fluent/plugin/base.rb +17 -0
  17. data/lib/fluent/plugin/filter_parser.rb +108 -0
  18. data/lib/fluent/plugin/filter_record_transformer.rb +4 -7
  19. data/lib/fluent/plugin/filter_stdout.rb +1 -1
  20. data/lib/fluent/plugin/formatter.rb +5 -0
  21. data/lib/fluent/plugin/formatter_msgpack.rb +4 -0
  22. data/lib/fluent/plugin/formatter_stdout.rb +3 -2
  23. data/lib/fluent/plugin/formatter_tsv.rb +34 -0
  24. data/lib/fluent/plugin/in_exec.rb +48 -93
  25. data/lib/fluent/plugin/in_forward.rb +25 -105
  26. data/lib/fluent/plugin/in_http.rb +68 -65
  27. data/lib/fluent/plugin/in_syslog.rb +29 -51
  28. data/lib/fluent/plugin/multi_output.rb +1 -3
  29. data/lib/fluent/plugin/out_exec.rb +58 -71
  30. data/lib/fluent/plugin/out_exec_filter.rb +199 -279
  31. data/lib/fluent/plugin/out_file.rb +155 -80
  32. data/lib/fluent/plugin/out_forward.rb +44 -47
  33. data/lib/fluent/plugin/out_stdout.rb +6 -21
  34. data/lib/fluent/plugin/output.rb +23 -17
  35. data/lib/fluent/plugin/parser.rb +121 -61
  36. data/lib/fluent/plugin/parser_csv.rb +9 -3
  37. data/lib/fluent/plugin/parser_json.rb +37 -35
  38. data/lib/fluent/plugin/parser_ltsv.rb +11 -19
  39. data/lib/fluent/plugin/parser_msgpack.rb +50 -0
  40. data/lib/fluent/plugin/parser_regexp.rb +15 -42
  41. data/lib/fluent/plugin/parser_tsv.rb +8 -3
  42. data/lib/fluent/plugin_helper.rb +8 -1
  43. data/lib/fluent/plugin_helper/child_process.rb +139 -73
  44. data/lib/fluent/plugin_helper/compat_parameters.rb +93 -4
  45. data/lib/fluent/plugin_helper/event_emitter.rb +14 -1
  46. data/lib/fluent/plugin_helper/extract.rb +16 -4
  47. data/lib/fluent/plugin_helper/formatter.rb +9 -11
  48. data/lib/fluent/plugin_helper/inject.rb +4 -0
  49. data/lib/fluent/plugin_helper/parser.rb +3 -3
  50. data/lib/fluent/root_agent.rb +1 -1
  51. data/lib/fluent/test/driver/base.rb +51 -37
  52. data/lib/fluent/test/driver/base_owner.rb +18 -8
  53. data/lib/fluent/test/driver/multi_output.rb +2 -1
  54. data/lib/fluent/test/driver/output.rb +29 -6
  55. data/lib/fluent/test/helpers.rb +3 -1
  56. data/lib/fluent/test/log.rb +4 -0
  57. data/lib/fluent/test/startup_shutdown.rb +13 -0
  58. data/lib/fluent/time.rb +14 -8
  59. data/lib/fluent/version.rb +1 -1
  60. data/test/command/test_binlog_reader.rb +5 -1
  61. data/test/config/test_configurable.rb +173 -0
  62. data/test/config/test_configure_proxy.rb +0 -43
  63. data/test/plugin/test_base.rb +16 -0
  64. data/test/plugin/test_filter_parser.rb +665 -0
  65. data/test/plugin/test_filter_record_transformer.rb +11 -3
  66. data/test/plugin/test_filter_stdout.rb +18 -27
  67. data/test/plugin/test_in_dummy.rb +1 -1
  68. data/test/plugin/test_in_exec.rb +206 -94
  69. data/test/plugin/test_in_forward.rb +310 -327
  70. data/test/plugin/test_in_http.rb +310 -186
  71. data/test/plugin/test_out_exec.rb +223 -68
  72. data/test/plugin/test_out_exec_filter.rb +520 -169
  73. data/test/plugin/test_out_file.rb +620 -177
  74. data/test/plugin/test_out_forward.rb +110 -132
  75. data/test/plugin/test_out_null.rb +1 -1
  76. data/test/plugin/test_out_secondary_file.rb +4 -2
  77. data/test/plugin/test_out_stdout.rb +14 -35
  78. data/test/plugin/test_parser.rb +359 -0
  79. data/test/plugin/test_parser_csv.rb +1 -2
  80. data/test/plugin/test_parser_json.rb +3 -4
  81. data/test/plugin/test_parser_labeled_tsv.rb +1 -2
  82. data/test/plugin/test_parser_none.rb +1 -2
  83. data/test/plugin/test_parser_regexp.rb +8 -4
  84. data/test/plugin/test_parser_tsv.rb +4 -3
  85. data/test/plugin_helper/test_child_process.rb +184 -0
  86. data/test/plugin_helper/test_compat_parameters.rb +88 -1
  87. data/test/plugin_helper/test_extract.rb +0 -1
  88. data/test/plugin_helper/test_formatter.rb +5 -2
  89. data/test/plugin_helper/test_parser.rb +6 -5
  90. data/test/test_output.rb +24 -2
  91. data/test/test_plugin_classes.rb +20 -0
  92. data/test/test_root_agent.rb +139 -0
  93. data/test/test_test_drivers.rb +132 -0
  94. metadata +12 -4
  95. data/test/plugin/test_parser_base.rb +0 -32
@@ -1,9 +1,12 @@
1
1
  require_relative '../helper'
2
- require 'fluent/test'
2
+ require 'fluent/test/driver/output'
3
3
  require 'fluent/test/startup_shutdown'
4
4
  require 'fluent/plugin/out_forward'
5
5
  require 'flexmock/test_unit'
6
6
 
7
+ require 'fluent/test/driver/input'
8
+ require 'fluent/plugin/in_forward'
9
+
7
10
  class ForwardOutputTest < Test::Unit::TestCase
8
11
  extend Fluent::Test::StartupShutdown
9
12
 
@@ -29,9 +32,13 @@ class ForwardOutputTest < Test::Unit::TestCase
29
32
  ]
30
33
 
31
34
  def create_driver(conf=CONFIG)
32
- d = Fluent::Test::BufferedOutputTestDriver.new(Fluent::ForwardOutput) {
35
+ Fluent::Test::Driver::Output.new(Fluent::Plugin::ForwardOutput) {
33
36
  attr_reader :responses, :exceptions
34
37
 
38
+ def write(chunk)
39
+ super
40
+ end
41
+
35
42
  def initialize
36
43
  super
37
44
  @responses = []
@@ -53,12 +60,6 @@ class ForwardOutputTest < Test::Unit::TestCase
53
60
  end
54
61
  end
55
62
  }.configure(conf)
56
- router = Object.new
57
- def router.method_missing(name, *args, **kw_args, &block)
58
- Engine.root_agent.event_router.__send__(name, *args, **kw_args, &block)
59
- end
60
- d.instance.router = router
61
- d
62
63
  end
63
64
 
64
65
  def test_configure
@@ -173,29 +174,26 @@ class ForwardOutputTest < Test::Unit::TestCase
173
174
 
174
175
  d = create_driver(CONFIG + %[flush_interval 1s])
175
176
 
176
- time = Fluent::EventTime.parse("2011-01-02 13:14:15 UTC")
177
+ time = event_time("2011-01-02 13:14:15 UTC")
177
178
 
178
179
  records = [
179
180
  {"a" => 1},
180
181
  {"a" => 2}
181
182
  ]
182
- d.register_run_post_condition do
183
- d.instance.responses.length == 1
184
- end
185
-
186
183
  target_input_driver.run do
187
- d.run do
184
+ d.end_if{ d.instance.responses.length == 1 }
185
+ d.run(default_tag: 'test') do
188
186
  records.each do |record|
189
- d.emit record, time
187
+ d.feed(time, record)
190
188
  end
191
189
  end
192
190
  end
193
191
 
194
- emits = target_input_driver.emits
195
- assert_equal ['test', time, records[0]], emits[0]
196
- assert_equal ['test', time, records[1]], emits[1]
197
- assert(emits[0][1].is_a?(Integer))
198
- assert(emits[1][1].is_a?(Integer))
192
+ events = target_input_driver.events
193
+ assert_equal_event_time(time, events[0][1])
194
+ assert_equal ['test', time, records[0]], events[0]
195
+ assert_equal_event_time(time, events[1][1])
196
+ assert_equal ['test', time, records[1]], events[1]
199
197
 
200
198
  assert_equal [nil], d.instance.responses # not attempt to receive responses, so nil is returned
201
199
  assert_empty d.instance.exceptions
@@ -209,29 +207,26 @@ class ForwardOutputTest < Test::Unit::TestCase
209
207
  time_as_integer false
210
208
  ])
211
209
 
212
- time = Fluent::EventTime.parse("2011-01-02 13:14:15 UTC")
210
+ time = event_time("2011-01-02 13:14:15 UTC")
213
211
 
214
212
  records = [
215
213
  {"a" => 1},
216
214
  {"a" => 2}
217
215
  ]
218
- d.register_run_post_condition do
219
- d.instance.responses.length == 1
220
- end
221
-
222
216
  target_input_driver.run do
223
- d.run do
217
+ d.end_if{ d.instance.responses.length == 1 }
218
+ d.run(default_tag: 'test') do
224
219
  records.each do |record|
225
- d.emit record, time
220
+ d.feed(time, record)
226
221
  end
227
222
  end
228
223
  end
229
224
 
230
- emits = target_input_driver.emits
231
- assert_equal ['test', time, records[0]], emits[0]
232
- assert_equal ['test', time, records[1]], emits[1]
233
- assert_equal_event_time(time, emits[0][1])
234
- assert_equal_event_time(time, emits[1][1])
225
+ events = target_input_driver.events
226
+ assert_equal_event_time(time, events[0][1])
227
+ assert_equal ['test', time, records[0]], events[0]
228
+ assert_equal_event_time(time, events[1][1])
229
+ assert_equal ['test', time, records[1]], events[1]
235
230
 
236
231
  assert_equal [nil], d.instance.responses # not attempt to receive responses, so nil is returned
237
232
  assert_empty d.instance.exceptions
@@ -251,24 +246,21 @@ class ForwardOutputTest < Test::Unit::TestCase
251
246
  {"a" => 1},
252
247
  {"a" => 2}
253
248
  ]
254
- d.register_run_post_condition do
255
- d.instance.responses.length == 1
256
- end
257
-
258
249
  target_input_driver.run do
259
- d.run do
250
+ d.end_if{ d.instance.responses.length == 1 }
251
+ d.run(default_tag: 'test') do
260
252
  records.each do |record|
261
- d.emit record, time
253
+ d.feed(time, record)
262
254
  end
263
255
  end
264
256
  end
265
257
 
266
258
  event_streams = target_input_driver.event_streams
267
- assert_true event_streams[0].is_a?(Fluent::CompressedMessagePackEventStream)
259
+ assert_true event_streams[0][1].is_a?(Fluent::CompressedMessagePackEventStream)
268
260
 
269
- emits = target_input_driver.emits
270
- assert_equal ['test', time, records[0]], emits[0]
271
- assert_equal ['test', time, records[1]], emits[1]
261
+ events = target_input_driver.events
262
+ assert_equal ['test', time, records[0]], events[0]
263
+ assert_equal ['test', time, records[1]], events[1]
272
264
  end
273
265
 
274
266
  def test_send_to_a_node_supporting_responses
@@ -276,27 +268,24 @@ class ForwardOutputTest < Test::Unit::TestCase
276
268
 
277
269
  d = create_driver(CONFIG + %[flush_interval 1s])
278
270
 
279
- time = Time.parse("2011-01-02 13:14:15 UTC").to_i
271
+ time = event_time("2011-01-02 13:14:15 UTC")
280
272
 
281
273
  records = [
282
274
  {"a" => 1},
283
275
  {"a" => 2}
284
276
  ]
285
- d.register_run_post_condition do
286
- d.instance.responses.length == 1
287
- end
288
-
289
277
  target_input_driver.run do
290
- d.run do
278
+ d.end_if{ d.instance.responses.length == 1 }
279
+ d.run(default_tag: 'test') do
291
280
  records.each do |record|
292
- d.emit record, time
281
+ d.feed(time, record)
293
282
  end
294
283
  end
295
284
  end
296
285
 
297
- emits = target_input_driver.emits
298
- assert_equal ['test', time, records[0]], emits[0]
299
- assert_equal ['test', time, records[1]], emits[1]
286
+ events = target_input_driver.events
287
+ assert_equal ['test', time, records[0]], events[0]
288
+ assert_equal ['test', time, records[1]], events[1]
300
289
 
301
290
  assert_equal [nil], d.instance.responses # not attempt to receive responses, so nil is returned
302
291
  assert_empty d.instance.exceptions
@@ -307,27 +296,24 @@ class ForwardOutputTest < Test::Unit::TestCase
307
296
 
308
297
  d = create_driver(CONFIG + %[flush_interval 1s])
309
298
 
310
- time = Time.parse("2011-01-02 13:14:15 UTC").to_i
299
+ time = event_time("2011-01-02 13:14:15 UTC")
311
300
 
312
301
  records = [
313
302
  {"a" => 1},
314
303
  {"a" => 2}
315
304
  ]
316
- d.register_run_post_condition do
317
- d.instance.responses.length == 1
318
- end
319
-
320
305
  target_input_driver.run do
321
- d.run do
306
+ d.end_if{ d.instance.responses.length == 1 }
307
+ d.run(default_tag: 'test') do
322
308
  records.each do |record|
323
- d.emit record, time
309
+ d.feed(time, record)
324
310
  end
325
311
  end
326
312
  end
327
313
 
328
- emits = target_input_driver.emits
329
- assert_equal ['test', time, records[0]], emits[0]
330
- assert_equal ['test', time, records[1]], emits[1]
314
+ events = target_input_driver.events
315
+ assert_equal ['test', time, records[0]], events[0]
316
+ assert_equal ['test', time, records[1]], events[1]
331
317
 
332
318
  assert_equal [nil], d.instance.responses # not attempt to receive responses, so nil is returned
333
319
  assert_empty d.instance.exceptions
@@ -342,27 +328,24 @@ class ForwardOutputTest < Test::Unit::TestCase
342
328
  ack_response_timeout 1s
343
329
  ])
344
330
 
345
- time = Time.parse("2011-01-02 13:14:15 UTC").to_i
331
+ time = event_time("2011-01-02 13:14:15 UTC")
346
332
 
347
333
  records = [
348
334
  {"a" => 1},
349
335
  {"a" => 2}
350
336
  ]
351
- d.register_run_post_condition do
352
- d.instance.responses.length == 1
353
- end
354
-
355
337
  target_input_driver.run do
356
- d.run do
338
+ d.end_if{ d.instance.responses.length == 1 }
339
+ d.run(default_tag: 'test') do
357
340
  records.each do |record|
358
- d.emit record, time
341
+ d.feed(time, record)
359
342
  end
360
343
  end
361
344
  end
362
345
 
363
- emits = target_input_driver.emits
364
- assert_equal ['test', time, records[0]], emits[0]
365
- assert_equal ['test', time, records[1]], emits[1]
346
+ events = target_input_driver.events
347
+ assert_equal ['test', time, records[0]], events[0]
348
+ assert_equal ['test', time, records[1]], events[1]
366
349
 
367
350
  assert_equal 1, d.instance.responses.length
368
351
  assert d.instance.responses[0].has_key?('ack')
@@ -378,30 +361,26 @@ class ForwardOutputTest < Test::Unit::TestCase
378
361
  ack_response_timeout 1s
379
362
  ])
380
363
 
381
- time = Time.parse("2011-01-02 13:14:15 UTC").to_i
364
+ time = event_time("2011-01-02 13:14:15 UTC")
382
365
 
383
366
  records = [
384
367
  {"a" => 1},
385
368
  {"a" => 2}
386
369
  ]
387
- d.register_run_post_condition do
388
- d.instance.responses.length == 1
389
- end
390
- d.run_timeout = 2
391
-
392
- assert_raise Fluent::ForwardOutputACKTimeoutError do
370
+ assert_raise Fluent::Plugin::ForwardOutput::ACKTimeoutError do
393
371
  target_input_driver.run do
394
- d.run do
372
+ d.end_if{ d.instance.responses.length == 1 }
373
+ d.run(default_tag: 'test', timeout: 2, wait_flush_completion: false) do
395
374
  records.each do |record|
396
- d.emit record, time
375
+ d.feed(time, record)
397
376
  end
398
377
  end
399
378
  end
400
379
  end
401
380
 
402
- emits = target_input_driver.emits
403
- assert_equal ['test', time, records[0]], emits[0]
404
- assert_equal ['test', time, records[1]], emits[1]
381
+ events = target_input_driver.events
382
+ assert_equal ['test', time, records[0]], events[0]
383
+ assert_equal ['test', time, records[1]], events[1]
405
384
 
406
385
  node = d.instance.nodes.first
407
386
  assert_equal false, node.available # node is regarded as unavailable when timeout
@@ -421,30 +400,26 @@ class ForwardOutputTest < Test::Unit::TestCase
421
400
  ack_response_timeout 5s
422
401
  ])
423
402
 
424
- time = Time.parse("2011-01-02 13:14:15 UTC").to_i
403
+ time = event_time("2011-01-02 13:14:15 UTC")
425
404
 
426
405
  records = [
427
406
  {"a" => 1},
428
407
  {"a" => 2}
429
408
  ]
430
- d.register_run_post_condition do
431
- d.instance.responses.length == 1
432
- end
433
- d.run_timeout = 2
434
-
435
- assert_raise Fluent::ForwardOutputACKTimeoutError do
409
+ assert_raise Fluent::Plugin::ForwardOutput::ACKTimeoutError do
436
410
  target_input_driver.run do
437
- d.run do
411
+ d.end_if{ d.instance.responses.length == 1 }
412
+ d.run(default_tag: 'test', timeout: 2, wait_flush_completion: false) do
438
413
  records.each do |record|
439
- d.emit record, time
414
+ d.feed(time, record)
440
415
  end
441
416
  end
442
417
  end
443
418
  end
444
419
 
445
- emits = target_input_driver.emits
446
- assert_equal ['test', time, records[0]], emits[0]
447
- assert_equal ['test', time, records[1]], emits[1]
420
+ events = target_input_driver.events
421
+ assert_equal ['test', time, records[0]], events[0]
422
+ assert_equal ['test', time, records[1]], events[1]
448
423
 
449
424
  assert_equal 0, d.instance.responses.size
450
425
  assert_equal 1, d.instance.exceptions.size # send_data() fails and to be retried
@@ -480,32 +455,24 @@ class ForwardOutputTest < Test::Unit::TestCase
480
455
  ]
481
456
  d = create_driver(output_conf)
482
457
 
483
- time = Time.parse("2011-01-02 13:14:15 UTC").to_i
458
+ time = event_time("2011-01-02 13:14:15 UTC")
484
459
  records = [
485
460
  {"a" => 1},
486
461
  {"a" => 2}
487
462
  ]
488
463
 
489
- target_input_driver.run do
490
- sleep 0.1 until target_input_driver.instance.instance_eval{ @thread } && target_input_driver.instance.instance_eval{ @thread }.status
491
-
492
- d.run do
464
+ target_input_driver.run(expect_records: 2, timeout: 15) do
465
+ d.run(default_tag: 'test') do
493
466
  records.each do |record|
494
- d.emit(record, time)
495
- end
496
-
497
- # run_post_condition of Fluent::Test::*Driver are buggy:
498
- t = Time.now
499
- while Time.now < t + 15 && target_input_driver.emits.size < 2
500
- sleep 0.1
467
+ d.feed(time, record)
501
468
  end
502
469
  end
503
470
  end
504
471
 
505
- emits = target_input_driver.emits
506
- assert{ emits != [] }
507
- assert_equal(['test', time, records[0]], emits[0])
508
- assert_equal(['test', time, records[1]], emits[1])
472
+ events = target_input_driver.events
473
+ assert{ events != [] }
474
+ assert_equal(['test', time, records[0]], events[0])
475
+ assert_equal(['test', time, records[1]], events[1])
509
476
  end
510
477
 
511
478
  def test_authentication_with_user_auth
@@ -542,39 +509,31 @@ class ForwardOutputTest < Test::Unit::TestCase
542
509
  ]
543
510
  d = create_driver(output_conf)
544
511
 
545
- time = Time.parse("2011-01-02 13:14:15 UTC").to_i
512
+ time = event_time("2011-01-02 13:14:15 UTC")
546
513
  records = [
547
514
  {"a" => 1},
548
515
  {"a" => 2}
549
516
  ]
550
517
 
551
- target_input_driver.run do
552
- sleep 0.1 until target_input_driver.instance.instance_eval{ @thread } && target_input_driver.instance.instance_eval{ @thread }.status
553
-
554
- d.run do
518
+ target_input_driver.run(expect_records: 2, timeout: 15) do
519
+ d.run(default_tag: 'test') do
555
520
  records.each do |record|
556
- d.emit(record, time)
557
- end
558
-
559
- # run_post_condition of Fluent::Test::*Driver are buggy:
560
- t = Time.now
561
- while Time.now < t + 15 && target_input_driver.emits.size < 2
562
- sleep 0.1
521
+ d.feed(time, record)
563
522
  end
564
523
  end
565
524
  end
566
525
 
567
- emits = target_input_driver.emits
568
- assert{ emits != [] }
569
- assert_equal(['test', time, records[0]], emits[0])
570
- assert_equal(['test', time, records[1]], emits[1])
526
+ events = target_input_driver.events
527
+ assert{ events != [] }
528
+ assert_equal(['test', time, records[0]], events[0])
529
+ assert_equal(['test', time, records[1]], events[1])
571
530
  end
572
531
 
573
532
  def create_target_input_driver(response_stub: nil, disconnect: false, conf: TARGET_CONFIG)
574
533
  require 'fluent/plugin/in_forward'
575
534
 
576
535
  # TODO: Support actual TCP heartbeat test
577
- Fluent::Test::InputTestDriver.new(Fluent::ForwardInput) {
536
+ Fluent::Test::Driver::Input.new(Fluent::Plugin::ForwardInput) {
578
537
  if response_stub.nil?
579
538
  # do nothing because in_forward responds for ack option in default
580
539
  else
@@ -588,7 +547,7 @@ class ForwardOutputTest < Test::Unit::TestCase
588
547
  def test_heartbeat_type_none
589
548
  d = create_driver(CONFIG + "\nheartbeat_type none")
590
549
  node = d.instance.nodes.first
591
- assert_equal Fluent::ForwardOutput::NoneHeartbeatNode, node.class
550
+ assert_equal Fluent::Plugin::ForwardOutput::NoneHeartbeatNode, node.class
592
551
 
593
552
  d.instance.start
594
553
  assert_nil d.instance.instance_variable_get(:@loop) # no HeartbeatHandler, or HeartbeatRequestTimer
@@ -607,11 +566,30 @@ class ForwardOutputTest < Test::Unit::TestCase
607
566
  timer = d.instance.instance_variable_get(:@timer)
608
567
  hb = d.instance.instance_variable_get(:@hb)
609
568
  assert_equal UDPSocket, usock.class
610
- assert_equal Fluent::ForwardOutput::HeartbeatRequestTimer, timer.class
611
- assert_equal Fluent::ForwardOutput::HeartbeatHandler, hb.class
569
+ assert_equal Fluent::Plugin::ForwardOutput::HeartbeatRequestTimer, timer.class
570
+ assert_equal Fluent::Plugin::ForwardOutput::HeartbeatHandler, hb.class
612
571
 
613
572
  mock(usock).send("\0", 0, Socket.pack_sockaddr_in(TARGET_PORT, '127.0.0.1')).once
614
573
  timer.disable # call send_heartbeat at just once
615
574
  timer.on_timer
616
575
  end
576
+
577
+ def test_acts_as_secondary
578
+ i = Fluent::Plugin::ForwardOutput.new
579
+ conf = config_element(
580
+ 'match',
581
+ 'primary.**',
582
+ {'@type' => 'forward'},
583
+ [
584
+ config_element('server', '', {'host' => '127.0.0.1'}),
585
+ config_element('secondary', '', {}, [
586
+ config_element('server', '', {'host' => '192.168.1.2'}),
587
+ config_element('server', '', {'host' => '192.168.1.3'})
588
+ ]),
589
+ ]
590
+ )
591
+ assert_nothing_raised do
592
+ i.configure(conf)
593
+ end
594
+ end
617
595
  end