fluentd 1.13.3 → 1.16.5
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.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/{bug_report.yaml → bug_report.yml} +2 -0
- data/.github/ISSUE_TEMPLATE/config.yml +2 -2
- data/.github/ISSUE_TEMPLATE/{feature_request.yaml → feature_request.yml} +1 -0
- data/.github/workflows/stale-actions.yml +11 -9
- data/.github/workflows/test.yml +32 -0
- data/CHANGELOG.md +490 -10
- data/CONTRIBUTING.md +2 -2
- data/MAINTAINERS.md +7 -5
- data/README.md +3 -23
- data/Rakefile +1 -1
- data/SECURITY.md +14 -0
- data/fluentd.gemspec +7 -8
- data/lib/fluent/command/cat.rb +13 -3
- data/lib/fluent/command/ctl.rb +6 -3
- data/lib/fluent/command/fluentd.rb +73 -65
- data/lib/fluent/command/plugin_config_formatter.rb +1 -1
- data/lib/fluent/compat/output.rb +9 -6
- data/lib/fluent/config/dsl.rb +1 -1
- data/lib/fluent/config/error.rb +12 -0
- data/lib/fluent/config/literal_parser.rb +2 -2
- data/lib/fluent/config/parser.rb +1 -1
- data/lib/fluent/config/v1_parser.rb +3 -3
- data/lib/fluent/config/yaml_parser/fluent_value.rb +47 -0
- data/lib/fluent/config/yaml_parser/loader.rb +108 -0
- data/lib/fluent/config/yaml_parser/parser.rb +166 -0
- data/lib/fluent/config/yaml_parser/section_builder.rb +107 -0
- data/lib/fluent/config/yaml_parser.rb +56 -0
- data/lib/fluent/config.rb +14 -1
- data/lib/fluent/counter/server.rb +1 -1
- data/lib/fluent/counter/validator.rb +3 -3
- data/lib/fluent/daemon.rb +2 -4
- data/lib/fluent/engine.rb +1 -1
- data/lib/fluent/env.rb +4 -0
- data/lib/fluent/error.rb +3 -0
- data/lib/fluent/event.rb +8 -4
- data/lib/fluent/event_router.rb +47 -2
- data/lib/fluent/file_wrapper.rb +137 -0
- data/lib/fluent/log/console_adapter.rb +66 -0
- data/lib/fluent/log.rb +44 -5
- data/lib/fluent/match.rb +1 -1
- data/lib/fluent/msgpack_factory.rb +6 -1
- data/lib/fluent/oj_options.rb +1 -2
- data/lib/fluent/plugin/bare_output.rb +49 -8
- data/lib/fluent/plugin/base.rb +26 -9
- data/lib/fluent/plugin/buf_file.rb +34 -5
- data/lib/fluent/plugin/buf_file_single.rb +32 -3
- data/lib/fluent/plugin/buffer/file_chunk.rb +1 -1
- data/lib/fluent/plugin/buffer.rb +216 -70
- data/lib/fluent/plugin/filter.rb +35 -1
- data/lib/fluent/plugin/filter_record_transformer.rb +1 -1
- data/lib/fluent/plugin/in_forward.rb +2 -2
- data/lib/fluent/plugin/in_http.rb +39 -10
- data/lib/fluent/plugin/in_monitor_agent.rb +4 -2
- data/lib/fluent/plugin/in_sample.rb +1 -1
- data/lib/fluent/plugin/in_syslog.rb +13 -1
- data/lib/fluent/plugin/in_tail/group_watch.rb +204 -0
- data/lib/fluent/plugin/in_tail/position_file.rb +33 -33
- data/lib/fluent/plugin/in_tail.rb +216 -84
- data/lib/fluent/plugin/in_tcp.rb +47 -2
- data/lib/fluent/plugin/input.rb +39 -1
- data/lib/fluent/plugin/metrics.rb +119 -0
- data/lib/fluent/plugin/metrics_local.rb +96 -0
- data/lib/fluent/plugin/multi_output.rb +43 -6
- data/lib/fluent/plugin/out_copy.rb +1 -1
- data/lib/fluent/plugin/out_exec_filter.rb +2 -2
- data/lib/fluent/plugin/out_file.rb +20 -2
- data/lib/fluent/plugin/out_forward/ack_handler.rb +19 -4
- data/lib/fluent/plugin/out_forward/socket_cache.rb +2 -0
- data/lib/fluent/plugin/out_forward.rb +17 -9
- data/lib/fluent/plugin/out_secondary_file.rb +39 -22
- data/lib/fluent/plugin/output.rb +167 -78
- data/lib/fluent/plugin/parser.rb +3 -4
- data/lib/fluent/plugin/parser_apache2.rb +1 -1
- data/lib/fluent/plugin/parser_json.rb +1 -1
- data/lib/fluent/plugin/parser_syslog.rb +1 -1
- data/lib/fluent/plugin/storage_local.rb +3 -5
- data/lib/fluent/plugin.rb +10 -1
- data/lib/fluent/plugin_helper/child_process.rb +3 -0
- data/lib/fluent/plugin_helper/event_emitter.rb +8 -1
- data/lib/fluent/plugin_helper/event_loop.rb +2 -2
- data/lib/fluent/plugin_helper/http_server/server.rb +2 -1
- data/lib/fluent/plugin_helper/metrics.rb +129 -0
- data/lib/fluent/plugin_helper/record_accessor.rb +1 -1
- data/lib/fluent/plugin_helper/retry_state.rb +14 -4
- data/lib/fluent/plugin_helper/server.rb +35 -6
- data/lib/fluent/plugin_helper/service_discovery.rb +2 -2
- data/lib/fluent/plugin_helper/socket.rb +13 -2
- data/lib/fluent/plugin_helper/thread.rb +3 -3
- data/lib/fluent/plugin_helper.rb +1 -0
- data/lib/fluent/plugin_id.rb +3 -2
- data/lib/fluent/registry.rb +2 -1
- data/lib/fluent/root_agent.rb +6 -0
- data/lib/fluent/rpc.rb +4 -3
- data/lib/fluent/supervisor.rb +283 -259
- data/lib/fluent/system_config.rb +13 -3
- data/lib/fluent/test/driver/base.rb +11 -5
- data/lib/fluent/test/driver/filter.rb +4 -0
- data/lib/fluent/test/startup_shutdown.rb +6 -8
- data/lib/fluent/time.rb +21 -20
- data/lib/fluent/version.rb +1 -1
- data/lib/fluent/win32api.rb +38 -0
- data/lib/fluent/winsvc.rb +5 -8
- data/templates/new_gem/test/helper.rb.erb +0 -1
- data/test/command/test_cat.rb +31 -2
- data/test/command/test_ctl.rb +1 -2
- data/test/command/test_fluentd.rb +209 -24
- data/test/command/test_plugin_config_formatter.rb +0 -1
- data/test/compat/test_parser.rb +6 -6
- data/test/config/test_system_config.rb +13 -11
- data/test/config/test_types.rb +1 -1
- data/test/log/test_console_adapter.rb +110 -0
- data/test/plugin/in_tail/test_io_handler.rb +26 -8
- data/test/plugin/in_tail/test_position_file.rb +48 -59
- data/test/plugin/out_forward/test_ack_handler.rb +39 -0
- data/test/plugin/out_forward/test_socket_cache.rb +26 -1
- data/test/plugin/test_bare_output.rb +14 -1
- data/test/plugin/test_base.rb +133 -1
- data/test/plugin/test_buf_file.rb +62 -23
- data/test/plugin/test_buf_file_single.rb +65 -0
- data/test/plugin/test_buffer.rb +267 -3
- data/test/plugin/test_buffer_chunk.rb +11 -0
- data/test/plugin/test_filter.rb +12 -1
- data/test/plugin/test_filter_parser.rb +1 -1
- data/test/plugin/test_filter_stdout.rb +2 -2
- data/test/plugin/test_in_forward.rb +9 -11
- data/test/plugin/test_in_http.rb +65 -3
- data/test/plugin/test_in_monitor_agent.rb +216 -11
- data/test/plugin/test_in_object_space.rb +9 -3
- data/test/plugin/test_in_syslog.rb +35 -0
- data/test/plugin/test_in_tail.rb +1393 -385
- data/test/plugin/test_in_tcp.rb +87 -2
- data/test/plugin/test_in_udp.rb +28 -0
- data/test/plugin/test_in_unix.rb +2 -2
- data/test/plugin/test_input.rb +12 -1
- data/test/plugin/test_metrics.rb +294 -0
- data/test/plugin/test_metrics_local.rb +96 -0
- data/test/plugin/test_multi_output.rb +25 -1
- data/test/plugin/test_out_exec.rb +6 -4
- data/test/plugin/test_out_exec_filter.rb +6 -2
- data/test/plugin/test_out_file.rb +34 -17
- data/test/plugin/test_out_forward.rb +78 -77
- data/test/plugin/test_out_http.rb +1 -0
- data/test/plugin/test_out_stdout.rb +2 -2
- data/test/plugin/test_output.rb +297 -12
- data/test/plugin/test_output_as_buffered.rb +44 -44
- data/test/plugin/test_output_as_buffered_compress.rb +32 -18
- data/test/plugin/test_output_as_buffered_retries.rb +54 -7
- data/test/plugin/test_output_as_buffered_secondary.rb +4 -4
- data/test/plugin/test_parser_regexp.rb +1 -6
- data/test/plugin/test_parser_syslog.rb +1 -1
- data/test/plugin_helper/test_cert_option.rb +1 -1
- data/test/plugin_helper/test_child_process.rb +38 -16
- data/test/plugin_helper/test_event_emitter.rb +29 -0
- data/test/plugin_helper/test_http_server_helper.rb +1 -1
- data/test/plugin_helper/test_metrics.rb +137 -0
- data/test/plugin_helper/test_retry_state.rb +602 -38
- data/test/plugin_helper/test_server.rb +78 -6
- data/test/plugin_helper/test_timer.rb +2 -2
- data/test/test_config.rb +191 -24
- data/test/test_event_router.rb +17 -0
- data/test/test_file_wrapper.rb +53 -0
- data/test/test_formatter.rb +24 -21
- data/test/test_log.rb +122 -40
- data/test/test_msgpack_factory.rb +32 -0
- data/test/test_plugin_classes.rb +102 -0
- data/test/test_root_agent.rb +30 -1
- data/test/test_supervisor.rb +477 -257
- data/test/test_time_parser.rb +22 -0
- metadata +55 -34
- data/.drone.yml +0 -35
- data/.github/workflows/issue-auto-closer.yml +0 -12
- data/.github/workflows/linux-test.yaml +0 -36
- data/.github/workflows/macos-test.yaml +0 -30
- data/.github/workflows/windows-test.yaml +0 -46
- data/.gitlab-ci.yml +0 -103
- data/lib/fluent/plugin/file_wrapper.rb +0 -187
- data/test/plugin/test_file_wrapper.rb +0 -126
- data/test/test_logger_initializer.rb +0 -46
|
@@ -5,6 +5,7 @@ require 'fileutils'
|
|
|
5
5
|
require 'time'
|
|
6
6
|
require 'timecop'
|
|
7
7
|
require 'zlib'
|
|
8
|
+
require 'fluent/file_wrapper'
|
|
8
9
|
|
|
9
10
|
class FileOutputTest < Test::Unit::TestCase
|
|
10
11
|
def setup
|
|
@@ -263,8 +264,8 @@ class FileOutputTest < Test::Unit::TestCase
|
|
|
263
264
|
assert !(Dir.exist?("#{TMP_DIR}/my.data/a"))
|
|
264
265
|
assert !(Dir.exist?("#{TMP_DIR}/your.data/a"))
|
|
265
266
|
buffer_files = Dir.entries("#{TMP_DIR}/buf_full").reject{|e| e =~ /^\.+$/ }
|
|
266
|
-
assert_equal 2, buffer_files.
|
|
267
|
-
assert_equal 2, buffer_files.
|
|
267
|
+
assert_equal 2, buffer_files.count{|n| n.end_with?('.meta') }
|
|
268
|
+
assert_equal 2, buffer_files.count{|n| !n.end_with?('.meta') }
|
|
268
269
|
|
|
269
270
|
m1 = d.instance.metadata('my.data', t1, {"type" => "a"})
|
|
270
271
|
m2 = d.instance.metadata('your.data', t3, {"type" => "a"})
|
|
@@ -394,6 +395,11 @@ class FileOutputTest < Test::Unit::TestCase
|
|
|
394
395
|
assert_equal expect, result
|
|
395
396
|
end
|
|
396
397
|
|
|
398
|
+
def check_result(path, expect)
|
|
399
|
+
result = File.read(path, mode: "rb")
|
|
400
|
+
assert_equal expect, result
|
|
401
|
+
end
|
|
402
|
+
|
|
397
403
|
sub_test_case 'write' do
|
|
398
404
|
test 'basic case' do
|
|
399
405
|
d = create_driver
|
|
@@ -535,20 +541,27 @@ class FileOutputTest < Test::Unit::TestCase
|
|
|
535
541
|
assert_equal 3, Dir.glob("#{TMP_DIR}/out_file_test.*").size
|
|
536
542
|
end
|
|
537
543
|
|
|
538
|
-
|
|
544
|
+
data(
|
|
545
|
+
"with compression" => true,
|
|
546
|
+
"without compression" => false,
|
|
547
|
+
)
|
|
548
|
+
test 'append' do |compression|
|
|
539
549
|
time = event_time("2011-01-02 13:14:15 UTC")
|
|
540
550
|
formatted_lines = %[2011-01-02T13:14:15Z\ttest\t{"a":1}#{@default_newline}] + %[2011-01-02T13:14:15Z\ttest\t{"a":2}#{@default_newline}]
|
|
541
551
|
|
|
542
552
|
write_once = ->(){
|
|
543
|
-
|
|
553
|
+
config = %[
|
|
544
554
|
path #{TMP_DIR}/out_file_test
|
|
545
|
-
compress gz
|
|
546
555
|
utc
|
|
547
556
|
append true
|
|
548
557
|
<buffer>
|
|
549
558
|
timekey_use_utc true
|
|
550
559
|
</buffer>
|
|
551
560
|
]
|
|
561
|
+
if compression
|
|
562
|
+
config << " compress gz"
|
|
563
|
+
end
|
|
564
|
+
d = create_driver(config)
|
|
552
565
|
d.run(default_tag: 'test'){
|
|
553
566
|
d.feed(time, {"a"=>1})
|
|
554
567
|
d.feed(time, {"a"=>2})
|
|
@@ -556,17 +569,21 @@ class FileOutputTest < Test::Unit::TestCase
|
|
|
556
569
|
d.instance.last_written_path
|
|
557
570
|
}
|
|
558
571
|
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
path = write_once.call
|
|
564
|
-
assert_equal "#{TMP_DIR}/out_file_test.20110102.log.gz", path
|
|
565
|
-
check_gzipped_result(path, formatted_lines * 2)
|
|
572
|
+
log_file_name = "out_file_test.20110102.log"
|
|
573
|
+
if compression
|
|
574
|
+
log_file_name << ".gz"
|
|
575
|
+
end
|
|
566
576
|
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
577
|
+
1.upto(3) do |i|
|
|
578
|
+
path = write_once.call
|
|
579
|
+
assert_equal "#{TMP_DIR}/#{log_file_name}", path
|
|
580
|
+
expect = formatted_lines * i
|
|
581
|
+
if compression
|
|
582
|
+
check_gzipped_result(path, expect)
|
|
583
|
+
else
|
|
584
|
+
check_result(path, expect)
|
|
585
|
+
end
|
|
586
|
+
end
|
|
570
587
|
end
|
|
571
588
|
|
|
572
589
|
test 'append when JST' do
|
|
@@ -1000,7 +1017,7 @@ class FileOutputTest < Test::Unit::TestCase
|
|
|
1000
1017
|
|
|
1001
1018
|
test 'returns filepath with index which does not exist yet' do
|
|
1002
1019
|
5.times do |i|
|
|
1003
|
-
|
|
1020
|
+
Fluent::FileWrapper.open(File.join(@tmp, "exist_#{i}.log"), 'a'){|f| } # open(create) and close
|
|
1004
1021
|
end
|
|
1005
1022
|
@i.find_filepath_available(File.join(@tmp, "exist_**.log")) do |path|
|
|
1006
1023
|
assert_equal File.join(@tmp, "exist_5.log"), path
|
|
@@ -1009,7 +1026,7 @@ class FileOutputTest < Test::Unit::TestCase
|
|
|
1009
1026
|
|
|
1010
1027
|
test 'creates lock directory when with_lock is true to exclude operations of other worker process' do
|
|
1011
1028
|
5.times do |i|
|
|
1012
|
-
|
|
1029
|
+
Fluent::FileWrapper.open(File.join(@tmp, "exist_#{i}.log"), 'a')
|
|
1013
1030
|
end
|
|
1014
1031
|
Dir.mkdir(File.join(@tmp, "exist_5.log.lock"))
|
|
1015
1032
|
@i.find_filepath_available(File.join(@tmp, "exist_**.log"), with_lock: true) do |path|
|
|
@@ -156,7 +156,14 @@ EOL
|
|
|
156
156
|
normal_conf = config_element('match', '**', {}, [
|
|
157
157
|
config_element('server', '', {'name' => 'test', 'host' => 'unexisting.yaaaaaaaaaaaaaay.host.example.com'})
|
|
158
158
|
])
|
|
159
|
-
|
|
159
|
+
|
|
160
|
+
if Socket.const_defined?(:ResolutionError) # as of Ruby 3.3
|
|
161
|
+
error_class = Socket::ResolutionError
|
|
162
|
+
else
|
|
163
|
+
error_class = SocketError
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
assert_raise error_class do
|
|
160
167
|
create_driver(normal_conf)
|
|
161
168
|
end
|
|
162
169
|
|
|
@@ -165,7 +172,7 @@ EOL
|
|
|
165
172
|
])
|
|
166
173
|
@d = d = create_driver(conf)
|
|
167
174
|
expected_log = "failed to resolve node name when configured"
|
|
168
|
-
expected_detail =
|
|
175
|
+
expected_detail = "server=\"test\" error_class=#{error_class.name}"
|
|
169
176
|
logs = d.logs
|
|
170
177
|
assert{ logs.any?{|log| log.include?(expected_log) && log.include?(expected_detail) } }
|
|
171
178
|
end
|
|
@@ -431,10 +438,12 @@ EOL
|
|
|
431
438
|
]
|
|
432
439
|
|
|
433
440
|
stub(d.instance.ack_handler).read_ack_from_sock(anything).never
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
441
|
+
assert_rr do
|
|
442
|
+
target_input_driver.run(expect_records: 2) do
|
|
443
|
+
d.run do
|
|
444
|
+
emit_events.each do |tag, t, record|
|
|
445
|
+
d.feed(tag, t, record)
|
|
446
|
+
end
|
|
438
447
|
end
|
|
439
448
|
end
|
|
440
449
|
end
|
|
@@ -461,10 +470,12 @@ EOL
|
|
|
461
470
|
]
|
|
462
471
|
|
|
463
472
|
stub(d.instance.ack_handler).read_ack_from_sock(anything).never
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
473
|
+
assert_rr do
|
|
474
|
+
target_input_driver.run(expect_records: 2) do
|
|
475
|
+
d.run(default_tag: 'test') do
|
|
476
|
+
records.each do |record|
|
|
477
|
+
d.feed(time, record)
|
|
478
|
+
end
|
|
468
479
|
end
|
|
469
480
|
end
|
|
470
481
|
end
|
|
@@ -491,10 +502,12 @@ EOL
|
|
|
491
502
|
{"a" => 2}
|
|
492
503
|
]
|
|
493
504
|
stub(d.instance.ack_handler).read_ack_from_sock(anything).never
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
505
|
+
assert_rr do
|
|
506
|
+
target_input_driver.run(expect_records: 2) do
|
|
507
|
+
d.run(default_tag: 'test') do
|
|
508
|
+
records.each do |record|
|
|
509
|
+
d.feed(time, record)
|
|
510
|
+
end
|
|
498
511
|
end
|
|
499
512
|
end
|
|
500
513
|
end
|
|
@@ -549,10 +562,12 @@ EOL
|
|
|
549
562
|
]
|
|
550
563
|
# not attempt to receive responses
|
|
551
564
|
stub(d.instance.ack_handler).read_ack_from_sock(anything).never
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
565
|
+
assert_rr do
|
|
566
|
+
target_input_driver.run(expect_records: 2) do
|
|
567
|
+
d.run(default_tag: 'test') do
|
|
568
|
+
records.each do |record|
|
|
569
|
+
d.feed(time, record)
|
|
570
|
+
end
|
|
556
571
|
end
|
|
557
572
|
end
|
|
558
573
|
end
|
|
@@ -575,10 +590,12 @@ EOL
|
|
|
575
590
|
]
|
|
576
591
|
# not attempt to receive responses
|
|
577
592
|
stub(d.instance.ack_handler).read_ack_from_sock(anything).never
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
593
|
+
assert_rr do
|
|
594
|
+
target_input_driver.run(expect_records: 2) do
|
|
595
|
+
d.run(default_tag: 'test') do
|
|
596
|
+
records.each do |record|
|
|
597
|
+
d.feed(time, record)
|
|
598
|
+
end
|
|
582
599
|
end
|
|
583
600
|
end
|
|
584
601
|
end
|
|
@@ -1231,27 +1248,22 @@ EOL
|
|
|
1231
1248
|
target_input_driver = create_target_input_driver(conf: target_config)
|
|
1232
1249
|
output_conf = config
|
|
1233
1250
|
d = create_driver(output_conf)
|
|
1234
|
-
d.instance_start
|
|
1235
1251
|
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
) { |sock| mock(sock).close.once; sock }.twice
|
|
1252
|
+
chunk = Fluent::Plugin::Buffer::MemoryChunk.new(Fluent::Plugin::Buffer::Metadata.new(nil, nil, nil))
|
|
1253
|
+
mock.proxy(d.instance).socket_create_tcp(TARGET_HOST, @target_port,
|
|
1254
|
+
linger_timeout: anything,
|
|
1255
|
+
send_timeout: anything,
|
|
1256
|
+
recv_timeout: anything,
|
|
1257
|
+
connect_timeout: anything
|
|
1258
|
+
) { |sock| mock(sock).close.once; sock }.twice
|
|
1244
1259
|
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
end
|
|
1260
|
+
target_input_driver.run(timeout: 15) do
|
|
1261
|
+
d.run do
|
|
1262
|
+
node = d.instance.nodes.first
|
|
1263
|
+
2.times do
|
|
1264
|
+
node.send_data('test', chunk) rescue nil
|
|
1251
1265
|
end
|
|
1252
1266
|
end
|
|
1253
|
-
ensure
|
|
1254
|
-
d.instance_shutdown
|
|
1255
1267
|
end
|
|
1256
1268
|
end
|
|
1257
1269
|
|
|
@@ -1265,7 +1277,6 @@ EOL
|
|
|
1265
1277
|
port #{@target_port}
|
|
1266
1278
|
</server>
|
|
1267
1279
|
])
|
|
1268
|
-
d.instance_start
|
|
1269
1280
|
assert_nothing_raised { d.run }
|
|
1270
1281
|
end
|
|
1271
1282
|
|
|
@@ -1277,33 +1288,28 @@ EOL
|
|
|
1277
1288
|
keepalive_timeout 2
|
|
1278
1289
|
]
|
|
1279
1290
|
d = create_driver(output_conf)
|
|
1280
|
-
d.instance_start
|
|
1281
1291
|
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
) { |sock| mock(sock).close.once; sock }.once
|
|
1292
|
+
chunk = Fluent::Plugin::Buffer::MemoryChunk.new(Fluent::Plugin::Buffer::Metadata.new(nil, nil, nil))
|
|
1293
|
+
mock.proxy(d.instance).socket_create_tcp(TARGET_HOST, @target_port,
|
|
1294
|
+
linger_timeout: anything,
|
|
1295
|
+
send_timeout: anything,
|
|
1296
|
+
recv_timeout: anything,
|
|
1297
|
+
connect_timeout: anything
|
|
1298
|
+
) { |sock| mock(sock).close.once; sock }.once
|
|
1290
1299
|
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
end
|
|
1300
|
+
target_input_driver.run(timeout: 15) do
|
|
1301
|
+
d.run do
|
|
1302
|
+
node = d.instance.nodes.first
|
|
1303
|
+
2.times do
|
|
1304
|
+
node.send_data('test', chunk) rescue nil
|
|
1297
1305
|
end
|
|
1298
1306
|
end
|
|
1299
|
-
ensure
|
|
1300
|
-
d.instance_shutdown
|
|
1301
1307
|
end
|
|
1302
1308
|
end
|
|
1303
1309
|
|
|
1304
1310
|
test 'create timer of purging obsolete sockets' do
|
|
1305
1311
|
output_conf = config + %[keepalive true]
|
|
1306
|
-
d = create_driver(output_conf)
|
|
1312
|
+
@d = d = create_driver(output_conf)
|
|
1307
1313
|
|
|
1308
1314
|
mock(d.instance).timer_execute(:out_forward_heartbeat_request, 1).once
|
|
1309
1315
|
mock(d.instance).timer_execute(:out_forward_keep_alived_socket_watcher, 5).once
|
|
@@ -1319,28 +1325,23 @@ EOL
|
|
|
1319
1325
|
keepalive_timeout 2
|
|
1320
1326
|
]
|
|
1321
1327
|
d = create_driver(output_conf)
|
|
1322
|
-
d.instance_start
|
|
1323
1328
|
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
d.
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
node.send_data('test', chunk) rescue nil
|
|
1339
|
-
end
|
|
1329
|
+
chunk = Fluent::Plugin::Buffer::MemoryChunk.new(Fluent::Plugin::Buffer::Metadata.new(nil, nil, nil))
|
|
1330
|
+
mock.proxy(d.instance).socket_create_tcp(TARGET_HOST, @target_port,
|
|
1331
|
+
linger_timeout: anything,
|
|
1332
|
+
send_timeout: anything,
|
|
1333
|
+
recv_timeout: anything,
|
|
1334
|
+
connect_timeout: anything) { |sock|
|
|
1335
|
+
mock(sock).close.once; sock
|
|
1336
|
+
}.twice
|
|
1337
|
+
|
|
1338
|
+
target_input_driver.run(timeout: 15) do
|
|
1339
|
+
d.run do
|
|
1340
|
+
node = d.instance.nodes.first
|
|
1341
|
+
2.times do
|
|
1342
|
+
node.send_data('test', chunk) rescue nil
|
|
1340
1343
|
end
|
|
1341
1344
|
end
|
|
1342
|
-
ensure
|
|
1343
|
-
d.instance_shutdown
|
|
1344
1345
|
end
|
|
1345
1346
|
end
|
|
1346
1347
|
end
|
|
@@ -378,6 +378,7 @@ class HTTPOutputTest < Test::Unit::TestCase
|
|
|
378
378
|
password hello?
|
|
379
379
|
</auth>
|
|
380
380
|
])
|
|
381
|
+
d.instance.system_config_override(root_dir: TMP_DIR) # Backup files are generated in TMP_DIR.
|
|
381
382
|
d.run(default_tag: 'test.http', shutdown: false) do
|
|
382
383
|
test_events.each { |event|
|
|
383
384
|
d.feed(event)
|
|
@@ -32,7 +32,7 @@ class StdoutOutputTest < Test::Unit::TestCase
|
|
|
32
32
|
assert_kind_of Fluent::Plugin::StdoutFormatter, d.instance.formatter
|
|
33
33
|
assert_equal 'hash', d.instance.formatter.output_type
|
|
34
34
|
|
|
35
|
-
assert_raise(Fluent::
|
|
35
|
+
assert_raise(Fluent::NotFoundPluginError) do
|
|
36
36
|
d = create_driver(CONFIG + "\noutput_type foo")
|
|
37
37
|
end
|
|
38
38
|
end
|
|
@@ -126,7 +126,7 @@ class StdoutOutputTest < Test::Unit::TestCase
|
|
|
126
126
|
assert_kind_of Fluent::Plugin::StdoutFormatter, d.instance.formatter
|
|
127
127
|
assert_equal 'hash', d.instance.formatter.output_type
|
|
128
128
|
|
|
129
|
-
assert_raise(Fluent::
|
|
129
|
+
assert_raise(Fluent::NotFoundPluginError) do
|
|
130
130
|
create_driver(config_element("ROOT", "", {"output_type" => "foo"}, [config_element("buffer")]))
|
|
131
131
|
end
|
|
132
132
|
end
|