fluentd 1.16.8 → 1.17.0
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/DISCUSSION_TEMPLATE/q-a-japanese.yml +50 -0
- data/.github/DISCUSSION_TEMPLATE/q-a.yml +47 -0
- data/.github/workflows/test-ruby-head.yml +31 -0
- data/.github/workflows/test.yml +2 -13
- data/CHANGELOG.md +33 -69
- data/README.md +3 -1
- data/Rakefile +1 -1
- data/fluentd.gemspec +9 -10
- data/lib/fluent/command/binlog_reader.rb +1 -1
- data/lib/fluent/command/fluentd.rb +1 -1
- data/lib/fluent/compat/formatter.rb +0 -6
- data/lib/fluent/config/configure_proxy.rb +2 -2
- data/lib/fluent/config/parser.rb +3 -15
- data/lib/fluent/config/types.rb +1 -1
- data/lib/fluent/config/v1_parser.rb +1 -1
- data/lib/fluent/config/yaml_parser/parser.rb +0 -4
- data/lib/fluent/configurable.rb +2 -2
- data/lib/fluent/counter/mutex_hash.rb +1 -1
- data/lib/fluent/fluent_log_event_router.rb +0 -2
- data/lib/fluent/plugin/buf_file.rb +1 -1
- data/lib/fluent/plugin/buffer/file_chunk.rb +1 -1
- data/lib/fluent/plugin/buffer/file_single_chunk.rb +2 -3
- data/lib/fluent/plugin/filter_parser.rb +26 -8
- data/lib/fluent/plugin/formatter_csv.rb +4 -18
- data/lib/fluent/plugin/in_http.rb +17 -52
- data/lib/fluent/plugin/in_tail.rb +35 -3
- data/lib/fluent/plugin/out_file.rb +0 -8
- data/lib/fluent/plugin/out_http.rb +125 -13
- data/lib/fluent/plugin/owned_by_mixin.rb +0 -1
- data/lib/fluent/plugin/parser_json.rb +34 -9
- data/lib/fluent/plugin/parser_msgpack.rb +24 -3
- data/lib/fluent/plugin_helper/metrics.rb +2 -2
- data/lib/fluent/registry.rb +6 -6
- data/lib/fluent/supervisor.rb +3 -3
- data/lib/fluent/test/output_test.rb +1 -1
- data/lib/fluent/unique_id.rb +1 -1
- data/lib/fluent/version.rb +1 -1
- data/lib/fluent/winsvc.rb +8 -38
- data/test/command/test_cat.rb +2 -2
- data/test/command/test_fluentd.rb +10 -57
- data/test/config/test_plugin_configuration.rb +6 -6
- data/test/helper.rb +7 -27
- data/test/log/test_console_adapter.rb +10 -3
- data/test/plugin/data/log_numeric/01.log +0 -0
- data/test/plugin/data/log_numeric/02.log +0 -0
- data/test/plugin/data/log_numeric/12.log +0 -0
- data/test/plugin/data/log_numeric/14.log +0 -0
- data/test/plugin/in_tail/test_io_handler.rb +14 -13
- data/test/plugin/in_tail/test_position_file.rb +7 -6
- data/test/plugin/out_forward/test_ack_handler.rb +3 -3
- data/test/plugin/out_forward/test_socket_cache.rb +3 -3
- data/test/plugin/test_buffer.rb +2 -2
- data/test/plugin/test_filter_grep.rb +1 -1
- data/test/plugin/test_in_forward.rb +1 -2
- data/test/plugin/test_in_http.rb +23 -1
- data/test/plugin/test_in_monitor_agent.rb +6 -6
- data/test/plugin/test_in_syslog.rb +18 -25
- data/test/plugin/test_in_tail.rb +153 -5
- data/test/plugin/test_in_tcp.rb +1 -1
- data/test/plugin/test_in_udp.rb +10 -16
- data/test/plugin/test_out_exec_filter.rb +7 -12
- data/test/plugin/test_out_file.rb +2 -22
- data/test/plugin/test_out_forward.rb +3 -2
- data/test/plugin/test_out_http.rb +128 -0
- data/test/plugin/test_out_stream.rb +1 -1
- data/test/plugin/test_output.rb +1 -1
- data/test/plugin/test_output_as_buffered.rb +2 -2
- data/test/plugin/test_output_as_buffered_retries.rb +2 -2
- data/test/plugin/test_owned_by.rb +0 -1
- data/test/plugin/test_parser_csv.rb +1 -1
- data/test/plugin/test_parser_json.rb +106 -31
- data/test/plugin/test_parser_msgpack.rb +127 -0
- data/test/plugin/test_storage.rb +0 -1
- data/test/plugin_helper/test_child_process.rb +4 -4
- data/test/plugin_helper/test_http_server_helper.rb +1 -1
- data/test/plugin_helper/test_server.rb +41 -64
- data/test/plugin_helper/test_socket.rb +1 -1
- data/test/test_config.rb +0 -6
- data/test/test_event_router.rb +2 -2
- data/test/test_supervisor.rb +21 -30
- data/test/test_tls.rb +1 -1
- metadata +85 -16
@@ -15,7 +15,7 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
15
15
|
TMP_DIR = File.expand_path(File.dirname(__FILE__) + "/../tmp/plugin_helper_server")
|
16
16
|
|
17
17
|
setup do
|
18
|
-
@port = unused_port
|
18
|
+
@port = unused_port
|
19
19
|
if Fluent.windows?
|
20
20
|
@socket_manager_server = ServerEngine::SocketManager::Server.open
|
21
21
|
@socket_manager_path = @socket_manager_server.path
|
@@ -233,12 +233,11 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
233
233
|
# 'server_create_connection tcp' => [:server_create_connection, :unix],
|
234
234
|
)
|
235
235
|
test 'raise error if udp options specified for tcp/tls/unix' do |(m, proto)|
|
236
|
-
port = unused_port(protocol: proto)
|
237
236
|
assert_raise ArgumentError do
|
238
|
-
@d.__send__(m, :myserver, port, proto: proto, max_bytes: 128){|x| x }
|
237
|
+
@d.__send__(m, :myserver, @port, proto: proto, max_bytes: 128){|x| x }
|
239
238
|
end
|
240
239
|
assert_raise ArgumentError do
|
241
|
-
@d.__send__(m, :myserver, port, proto: proto, flags: 1){|x| x }
|
240
|
+
@d.__send__(m, :myserver, @port, proto: proto, flags: 1){|x| x }
|
242
241
|
end
|
243
242
|
end
|
244
243
|
|
@@ -246,9 +245,8 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
246
245
|
'server_create udp' => [:server_create, :udp],
|
247
246
|
)
|
248
247
|
test 'raise error if tcp/tls options specified for udp' do |(m, proto)|
|
249
|
-
port = unused_port(protocol: proto)
|
250
248
|
assert_raise(ArgumentError.new("BUG: linger_timeout is available for tcp/tls")) do
|
251
|
-
@d.__send__(m, :myserver, port, proto: proto, linger_timeout: 1, max_bytes: 128){|x| x }
|
249
|
+
@d.__send__(m, :myserver, @port, proto: proto, linger_timeout: 1, max_bytes: 128){|x| x }
|
252
250
|
end
|
253
251
|
end
|
254
252
|
|
@@ -256,9 +254,8 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
256
254
|
'server_create udp' => [:server_create, :udp],
|
257
255
|
)
|
258
256
|
test 'raise error if tcp/tls/unix backlog options specified for udp' do |(m, proto)|
|
259
|
-
port = unused_port(protocol: proto)
|
260
257
|
assert_raise(ArgumentError.new("BUG: backlog is available for tcp/tls")) do
|
261
|
-
@d.__send__(m, :myserver, port, proto: proto, backlog: 500){|x| x }
|
258
|
+
@d.__send__(m, :myserver, @port, proto: proto, backlog: 500){|x| x }
|
262
259
|
end
|
263
260
|
end
|
264
261
|
|
@@ -266,9 +263,8 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
266
263
|
'server_create udp' => [:server_create, :udp],
|
267
264
|
)
|
268
265
|
test 'raise error if tcp/tls send_keepalive_packet option is specified for udp' do |(m, proto)|
|
269
|
-
port = unused_port(protocol: proto)
|
270
266
|
assert_raise(ArgumentError.new("BUG: send_keepalive_packet is available for tcp/tls")) do
|
271
|
-
@d.__send__(m, :myserver, port, proto: proto, send_keepalive_packet: true){|x| x }
|
267
|
+
@d.__send__(m, :myserver, @port, proto: proto, send_keepalive_packet: true){|x| x }
|
272
268
|
end
|
273
269
|
end
|
274
270
|
|
@@ -280,9 +276,8 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
280
276
|
# 'server_create_connection unix' => [:server_create_connection, :unix, {}],
|
281
277
|
)
|
282
278
|
test 'raise error if tls options specified for tcp/udp/unix' do |(m, proto, kwargs)|
|
283
|
-
port = unused_port(protocol: proto)
|
284
279
|
assert_raise(ArgumentError.new("BUG: tls_options is available only for tls")) do
|
285
|
-
@d.__send__(m, :myserver, port, proto: proto, tls_options: {}, **kwargs){|x| x }
|
280
|
+
@d.__send__(m, :myserver, @port, proto: proto, tls_options: {}, **kwargs){|x| x }
|
286
281
|
end
|
287
282
|
end
|
288
283
|
|
@@ -294,8 +289,7 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
294
289
|
'server_create_connection tls' => [:server_create_connection, :tls, {tls_options: {insecure: true}}],
|
295
290
|
)
|
296
291
|
test 'can bind specified IPv4 address' do |(m, proto, kwargs)|
|
297
|
-
port
|
298
|
-
@d.__send__(m, :myserver, port, proto: proto, bind: "127.0.0.1", **kwargs){|x| x }
|
292
|
+
@d.__send__(m, :myserver, @port, proto: proto, bind: "127.0.0.1", **kwargs){|x| x }
|
299
293
|
assert_equal "127.0.0.1", @d._servers.first.bind
|
300
294
|
assert_equal "127.0.0.1", @d._servers.first.server.instance_eval{ instance_variable_defined?(:@listen_socket) ? @listen_socket : @_io }.addr[3]
|
301
295
|
end
|
@@ -309,8 +303,7 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
309
303
|
)
|
310
304
|
test 'can bind specified IPv6 address' do |(m, proto, kwargs)| # if available
|
311
305
|
omit "IPv6 unavailable here" unless ipv6_enabled?
|
312
|
-
port
|
313
|
-
@d.__send__(m, :myserver, port, proto: proto, bind: "::1", **kwargs){|x| x }
|
306
|
+
@d.__send__(m, :myserver, @port, proto: proto, bind: "::1", **kwargs){|x| x }
|
314
307
|
assert_equal "::1", @d._servers.first.bind
|
315
308
|
assert_equal "::1", @d._servers.first.server.instance_eval{ instance_variable_defined?(:@listen_socket) ? @listen_socket : @_io }.addr[3]
|
316
309
|
end
|
@@ -327,11 +320,10 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
327
320
|
test 'can create 2 or more servers which share same bind address and port if shared option is true' do |(m, proto, kwargs)|
|
328
321
|
begin
|
329
322
|
d2 = Dummy.new; d2.start; d2.after_start
|
330
|
-
port = unused_port(protocol: proto)
|
331
323
|
|
332
324
|
assert_nothing_raised do
|
333
|
-
@d.__send__(m, :myserver, port, proto: proto, **kwargs){|x| x }
|
334
|
-
d2.__send__(m, :myserver, port, proto: proto, **kwargs){|x| x }
|
325
|
+
@d.__send__(m, :myserver, @port, proto: proto, **kwargs){|x| x }
|
326
|
+
d2.__send__(m, :myserver, @port, proto: proto, **kwargs){|x| x }
|
335
327
|
end
|
336
328
|
ensure
|
337
329
|
d2.stop; d2.before_shutdown; d2.shutdown; d2.after_shutdown; d2.close; d2.terminate
|
@@ -352,13 +344,12 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
352
344
|
test 'cannot create 2 or more servers using same bind address and port if shared option is false' do |(m, proto, kwargs)|
|
353
345
|
begin
|
354
346
|
d2 = Dummy.new; d2.start; d2.after_start
|
355
|
-
port = unused_port(protocol: proto)
|
356
347
|
|
357
348
|
assert_nothing_raised do
|
358
|
-
@d.__send__(m, :myserver, port, proto: proto, shared: false, **kwargs){|x| x }
|
349
|
+
@d.__send__(m, :myserver, @port, proto: proto, shared: false, **kwargs){|x| x }
|
359
350
|
end
|
360
351
|
assert_raise(Errno::EADDRINUSE, Errno::EACCES) do
|
361
|
-
d2.__send__(m, :myserver, port, proto: proto, **kwargs){|x| x }
|
352
|
+
d2.__send__(m, :myserver, @port, proto: proto, **kwargs){|x| x }
|
362
353
|
end
|
363
354
|
ensure
|
364
355
|
d2.stop; d2.before_shutdown; d2.shutdown; d2.after_shutdown; d2.close; d2.terminate
|
@@ -374,18 +365,16 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
374
365
|
# 'unix' => [:unix, {}],
|
375
366
|
)
|
376
367
|
test 'raise error if block argument is not specified or too many' do |(proto, kwargs)|
|
377
|
-
port = unused_port(protocol: proto)
|
378
368
|
assert_raise(ArgumentError.new("BUG: block must have 1 or 2 arguments")) do
|
379
|
-
@d.server_create(:myserver, port, proto: proto, **kwargs){ 1 }
|
369
|
+
@d.server_create(:myserver, @port, proto: proto, **kwargs){ 1 }
|
380
370
|
end
|
381
371
|
assert_raise(ArgumentError.new("BUG: block must have 1 or 2 arguments")) do
|
382
|
-
@d.server_create(:myserver, port, proto: proto, **kwargs){|sock, conn, what_is_this| 1 }
|
372
|
+
@d.server_create(:myserver, @port, proto: proto, **kwargs){|sock, conn, what_is_this| 1 }
|
383
373
|
end
|
384
374
|
end
|
385
375
|
|
386
376
|
test 'creates udp server if specified in proto' do
|
387
|
-
port
|
388
|
-
@d.server_create(:myserver, port, proto: :udp, max_bytes: 512){|x| x }
|
377
|
+
@d.server_create(:myserver, @port, proto: :udp, max_bytes: 512){|x| x }
|
389
378
|
|
390
379
|
created_server_info = @d._servers.first
|
391
380
|
assert_equal :udp, created_server_info.proto
|
@@ -598,8 +587,7 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
598
587
|
sub_test_case '#server_create_udp' do
|
599
588
|
test 'can accept all keyword arguments valid for udp server' do
|
600
589
|
assert_nothing_raised do
|
601
|
-
port
|
602
|
-
@d.server_create_udp(:s, port, bind: '127.0.0.1', shared: false, resolve_name: true, max_bytes: 100, flags: 1) do |data, conn|
|
590
|
+
@d.server_create_udp(:s, @port, bind: '127.0.0.1', shared: false, resolve_name: true, max_bytes: 100, flags: 1) do |data, conn|
|
603
591
|
# ...
|
604
592
|
end
|
605
593
|
end
|
@@ -607,15 +595,14 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
607
595
|
|
608
596
|
test 'creates a udp server just to read data' do
|
609
597
|
received = ""
|
610
|
-
port
|
611
|
-
@d.server_create_udp(:s, port, max_bytes: 128) do |data|
|
598
|
+
@d.server_create_udp(:s, @port, max_bytes: 128) do |data|
|
612
599
|
received << data
|
613
600
|
end
|
614
601
|
bind_port = unused_port(protocol: :udp, bind: "127.0.0.1")
|
615
602
|
3.times do
|
616
603
|
sock = UDPSocket.new(Socket::AF_INET)
|
617
604
|
sock.bind("127.0.0.1", bind_port)
|
618
|
-
sock.connect("127.0.0.1", port)
|
605
|
+
sock.connect("127.0.0.1", @port)
|
619
606
|
sock.puts "yay"
|
620
607
|
sock.puts "foo"
|
621
608
|
sock.close
|
@@ -627,17 +614,16 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
627
614
|
test 'creates a udp server to read and write data' do
|
628
615
|
received = ""
|
629
616
|
responses = []
|
630
|
-
port
|
631
|
-
@d.server_create_udp(:s, port, max_bytes: 128) do |data, sock|
|
617
|
+
@d.server_create_udp(:s, @port, max_bytes: 128) do |data, sock|
|
632
618
|
received << data
|
633
619
|
sock.write "ack\n"
|
634
620
|
end
|
635
|
-
bind_port = unused_port
|
621
|
+
bind_port = unused_port
|
636
622
|
3.times do
|
637
623
|
begin
|
638
624
|
sock = UDPSocket.new(Socket::AF_INET)
|
639
625
|
sock.bind("127.0.0.1", bind_port)
|
640
|
-
sock.connect("127.0.0.1", port)
|
626
|
+
sock.connect("127.0.0.1", @port)
|
641
627
|
th = Thread.new do
|
642
628
|
while true
|
643
629
|
begin
|
@@ -668,12 +654,11 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
668
654
|
|
669
655
|
received = ""
|
670
656
|
responses = []
|
671
|
-
|
672
|
-
@d.server_create_udp(:s, port, bind: "::1", max_bytes: 128) do |data, sock|
|
657
|
+
@d.server_create_udp(:s, @port, bind: "::1", max_bytes: 128) do |data, sock|
|
673
658
|
received << data
|
674
659
|
sock.write "ack\n"
|
675
660
|
end
|
676
|
-
bind_port = unused_port
|
661
|
+
bind_port = unused_port
|
677
662
|
3.times do
|
678
663
|
begin
|
679
664
|
sock = UDPSocket.new(Socket::AF_INET6)
|
@@ -682,7 +667,7 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
682
667
|
responses << sock.recv(16)
|
683
668
|
true
|
684
669
|
end
|
685
|
-
sock.connect("::1", port)
|
670
|
+
sock.connect("::1", @port)
|
686
671
|
sock.write "yay\nfoo\n"
|
687
672
|
th.join(5)
|
688
673
|
ensure
|
@@ -697,14 +682,13 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
697
682
|
test 'does not resolve name of client address in default' do
|
698
683
|
received = ""
|
699
684
|
sources = []
|
700
|
-
port
|
701
|
-
@d.server_create_udp(:s, port, max_bytes: 128) do |data, sock|
|
685
|
+
@d.server_create_udp(:s, @port, max_bytes: 128) do |data, sock|
|
702
686
|
received << data
|
703
687
|
sources << sock.remote_host
|
704
688
|
end
|
705
689
|
3.times do
|
706
690
|
sock = UDPSocket.new(Socket::AF_INET)
|
707
|
-
sock.connect("127.0.0.1", port)
|
691
|
+
sock.connect("127.0.0.1", @port)
|
708
692
|
sock.puts "yay"
|
709
693
|
sock.close
|
710
694
|
end
|
@@ -718,14 +702,13 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
718
702
|
|
719
703
|
received = ""
|
720
704
|
sources = []
|
721
|
-
port
|
722
|
-
@d.server_create_udp(:s, port, resolve_name: true, max_bytes: 128) do |data, sock|
|
705
|
+
@d.server_create_udp(:s, @port, resolve_name: true, max_bytes: 128) do |data, sock|
|
723
706
|
received << data
|
724
707
|
sources << sock.remote_host
|
725
708
|
end
|
726
709
|
3.times do
|
727
710
|
sock = UDPSocket.new(Socket::AF_INET)
|
728
|
-
sock.connect("127.0.0.1", port)
|
711
|
+
sock.connect("127.0.0.1", @port)
|
729
712
|
sock.puts "yay"
|
730
713
|
sock.close
|
731
714
|
end
|
@@ -737,8 +720,7 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
737
720
|
test 'raises error if plugin registers data callback for connection object from #server_create' do
|
738
721
|
received = ""
|
739
722
|
errors = []
|
740
|
-
port
|
741
|
-
@d.server_create_udp(:s, port, max_bytes: 128) do |data, sock|
|
723
|
+
@d.server_create_udp(:s, @port, max_bytes: 128) do |data, sock|
|
742
724
|
received << data
|
743
725
|
begin
|
744
726
|
sock.data{|d| received << d.upcase }
|
@@ -747,7 +729,7 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
747
729
|
end
|
748
730
|
end
|
749
731
|
sock = UDPSocket.new(Socket::AF_INET)
|
750
|
-
sock.connect("127.0.0.1", port)
|
732
|
+
sock.connect("127.0.0.1", @port)
|
751
733
|
sock.write "foo\n"
|
752
734
|
sock.close
|
753
735
|
|
@@ -760,8 +742,7 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
760
742
|
test 'raise error if plugin registers write_complete callback for udp' do
|
761
743
|
received = ""
|
762
744
|
errors = []
|
763
|
-
port
|
764
|
-
@d.server_create_udp(:s, port, max_bytes: 128) do |data, sock|
|
745
|
+
@d.server_create_udp(:s, @port, max_bytes: 128) do |data, sock|
|
765
746
|
received << data
|
766
747
|
begin
|
767
748
|
sock.on(:write_complete){|conn| "" }
|
@@ -770,7 +751,7 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
770
751
|
end
|
771
752
|
end
|
772
753
|
sock = UDPSocket.new(Socket::AF_INET)
|
773
|
-
sock.connect("127.0.0.1", port)
|
754
|
+
sock.connect("127.0.0.1", @port)
|
774
755
|
sock.write "foo\n"
|
775
756
|
sock.close
|
776
757
|
|
@@ -783,8 +764,7 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
783
764
|
test 'raises error if plugin registers close callback for udp' do
|
784
765
|
received = ""
|
785
766
|
errors = []
|
786
|
-
port
|
787
|
-
@d.server_create_udp(:s, port, max_bytes: 128) do |data, sock|
|
767
|
+
@d.server_create_udp(:s, @port, max_bytes: 128) do |data, sock|
|
788
768
|
received << data
|
789
769
|
begin
|
790
770
|
sock.on(:close){|d| "" }
|
@@ -793,7 +773,7 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
793
773
|
end
|
794
774
|
end
|
795
775
|
sock = UDPSocket.new(Socket::AF_INET)
|
796
|
-
sock.connect("127.0.0.1", port)
|
776
|
+
sock.connect("127.0.0.1", @port)
|
797
777
|
sock.write "foo\n"
|
798
778
|
sock.close
|
799
779
|
|
@@ -806,12 +786,11 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
806
786
|
test 'can bind IPv4 / IPv6 together' do
|
807
787
|
omit "IPv6 unavailable here" unless ipv6_enabled?
|
808
788
|
|
809
|
-
port = unused_port(protocol: :udp)
|
810
789
|
assert_nothing_raised do
|
811
|
-
@d.server_create_udp(:s_ipv4_udp, port, bind: '0.0.0.0', shared: false, max_bytes: 128) do |data, sock|
|
790
|
+
@d.server_create_udp(:s_ipv4_udp, @port, bind: '0.0.0.0', shared: false, max_bytes: 128) do |data, sock|
|
812
791
|
# ...
|
813
792
|
end
|
814
|
-
@d.server_create_udp(:s_ipv6_udp, port, bind: '::', shared: false, max_bytes: 128) do |data, sock|
|
793
|
+
@d.server_create_udp(:s_ipv6_udp, @port, bind: '::', shared: false, max_bytes: 128) do |data, sock|
|
815
794
|
# ...
|
816
795
|
end
|
817
796
|
end
|
@@ -824,12 +803,11 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
824
803
|
max_bytes, records, expected = data.values
|
825
804
|
|
826
805
|
actual_records = []
|
827
|
-
port
|
828
|
-
@d.server_create_udp(:myserver, port, max_bytes: max_bytes) do |data, sock|
|
806
|
+
@d.server_create_udp(:myserver, @port, max_bytes: max_bytes) do |data, sock|
|
829
807
|
actual_records << data
|
830
808
|
end
|
831
809
|
|
832
|
-
open_client(:udp, "127.0.0.1", port) do |sock|
|
810
|
+
open_client(:udp, "127.0.0.1", @port) do |sock|
|
833
811
|
records.each do |record|
|
834
812
|
sock.send(record, 0)
|
835
813
|
end
|
@@ -845,12 +823,11 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
845
823
|
max_bytes, records, expected = data.values
|
846
824
|
|
847
825
|
actual_records = []
|
848
|
-
port
|
849
|
-
@d.server_create_udp(:myserver, port, max_bytes: max_bytes) do |data|
|
826
|
+
@d.server_create_udp(:myserver, @port, max_bytes: max_bytes) do |data|
|
850
827
|
actual_records << data
|
851
828
|
end
|
852
829
|
|
853
|
-
open_client(:udp, "127.0.0.1", port) do |sock|
|
830
|
+
open_client(:udp, "127.0.0.1", @port) do |sock|
|
854
831
|
records.each do |record|
|
855
832
|
sock.send(record, 0)
|
856
833
|
end
|
data/test/test_config.rb
CHANGED
@@ -167,7 +167,6 @@ class ConfigTest < Test::Unit::TestCase
|
|
167
167
|
tag: tag.dummy
|
168
168
|
- source:
|
169
169
|
$type: tcp
|
170
|
-
$log_level: info
|
171
170
|
tag: tag.tcp
|
172
171
|
parse:
|
173
172
|
$arg:
|
@@ -177,7 +176,6 @@ class ConfigTest < Test::Unit::TestCase
|
|
177
176
|
- match:
|
178
177
|
$tag: tag.*
|
179
178
|
$type: stdout
|
180
|
-
$log_level: debug
|
181
179
|
buffer:
|
182
180
|
$type: memory
|
183
181
|
flush_interval: 1s
|
@@ -210,12 +208,10 @@ class ConfigTest < Test::Unit::TestCase
|
|
210
208
|
'tag.dummy',
|
211
209
|
'tcp',
|
212
210
|
'tag.tcp',
|
213
|
-
'info',
|
214
211
|
'none',
|
215
212
|
'why.parse.section.doesnot.have.arg,huh',
|
216
213
|
'stdout',
|
217
214
|
'tag.*',
|
218
|
-
'debug',
|
219
215
|
'null',
|
220
216
|
'**',
|
221
217
|
'@FLUENT_LOG',
|
@@ -228,12 +224,10 @@ class ConfigTest < Test::Unit::TestCase
|
|
228
224
|
dummy_source_conf['tag'],
|
229
225
|
tcp_source_conf['@type'],
|
230
226
|
tcp_source_conf['tag'],
|
231
|
-
tcp_source_conf['@log_level'],
|
232
227
|
parse_tcp_conf['@type'],
|
233
228
|
parse_tcp_conf.arg,
|
234
229
|
match_conf['@type'],
|
235
230
|
match_conf.arg,
|
236
|
-
match_conf['@log_level'],
|
237
231
|
fluent_log_conf['@type'],
|
238
232
|
fluent_log_conf.arg,
|
239
233
|
label_conf.arg,
|
data/test/test_event_router.rb
CHANGED
@@ -175,7 +175,7 @@ class EventRouterTest < ::Test::Unit::TestCase
|
|
175
175
|
test "don't call default collector when tag matched" do
|
176
176
|
event_router.add_rule('test', output)
|
177
177
|
assert_rr do
|
178
|
-
|
178
|
+
dont_allow(default_collector).emit_events('test', is_a(OneEventStream))
|
179
179
|
event_router.emit('test', Engine.now, 'k' => 'v')
|
180
180
|
end
|
181
181
|
# check emit handler doesn't catch rr error
|
@@ -201,7 +201,7 @@ class EventRouterTest < ::Test::Unit::TestCase
|
|
201
201
|
event_router.add_rule('test', filter)
|
202
202
|
|
203
203
|
assert_rr do
|
204
|
-
|
204
|
+
dont_allow(filter).filter_stream('test', is_a(OneEventStream)) { events }
|
205
205
|
event_router.emit('foo', Engine.now, 'k' => 'v')
|
206
206
|
end
|
207
207
|
end
|
data/test/test_supervisor.rb
CHANGED
@@ -214,9 +214,6 @@ class SupervisorTest < ::Test::Unit::TestCase
|
|
214
214
|
def test_cont_in_main_process_signal_handlers
|
215
215
|
omit "Windows cannot handle signals" if Fluent.windows?
|
216
216
|
|
217
|
-
# https://github.com/fluent/fluentd/issues/4063
|
218
|
-
GC.start
|
219
|
-
|
220
217
|
sv = Fluent::Supervisor.new({})
|
221
218
|
sv.send(:install_main_process_signal_handlers)
|
222
219
|
|
@@ -232,9 +229,6 @@ class SupervisorTest < ::Test::Unit::TestCase
|
|
232
229
|
def test_term_cont_in_main_process_signal_handlers
|
233
230
|
omit "Windows cannot handle signals" if Fluent.windows?
|
234
231
|
|
235
|
-
# https://github.com/fluent/fluentd/issues/4063
|
236
|
-
GC.start
|
237
|
-
|
238
232
|
create_debug_dummy_logger
|
239
233
|
|
240
234
|
sv = Fluent::Supervisor.new({})
|
@@ -302,9 +296,6 @@ class SupervisorTest < ::Test::Unit::TestCase
|
|
302
296
|
def test_cont_in_supervisor_signal_handler
|
303
297
|
omit "Windows cannot handle signals" if Fluent.windows?
|
304
298
|
|
305
|
-
# https://github.com/fluent/fluentd/issues/4063
|
306
|
-
GC.start
|
307
|
-
|
308
299
|
server = DummyServer.new
|
309
300
|
server.install_supervisor_signal_handlers
|
310
301
|
|
@@ -320,9 +311,6 @@ class SupervisorTest < ::Test::Unit::TestCase
|
|
320
311
|
def test_term_cont_in_supervisor_signal_handler
|
321
312
|
omit "Windows cannot handle signals" if Fluent.windows?
|
322
313
|
|
323
|
-
# https://github.com/fluent/fluentd/issues/4063
|
324
|
-
GC.start
|
325
|
-
|
326
314
|
server = DummyServer.new
|
327
315
|
server.install_supervisor_signal_handlers
|
328
316
|
|
@@ -402,31 +390,34 @@ class SupervisorTest < ::Test::Unit::TestCase
|
|
402
390
|
def test_supervisor_event_dump_windows
|
403
391
|
omit "Only for Windows, alternative to UNIX signals" unless Fluent.windows?
|
404
392
|
|
405
|
-
# https://github.com/fluent/fluentd/issues/4063
|
406
|
-
GC.start
|
407
|
-
|
408
|
-
ENV['SIGDUMP_PATH'] = TMP_DIR + "/sigdump.log"
|
409
|
-
|
410
393
|
server = DummyServer.new
|
411
394
|
def server.config
|
412
395
|
{:signame => "TestFluentdEvent"}
|
413
396
|
end
|
414
397
|
server.install_windows_event_handler
|
415
398
|
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
399
|
+
assert_rr do
|
400
|
+
# Have to use mock because `Sigdump.dump` seems to be somehow incompatible with RR.
|
401
|
+
# The `mock(server).restart(true) { nil }` line in `test_rpc_server_windows` cause the next error.
|
402
|
+
# Failure: test_supervisor_event_dump_windows(SupervisorTest):
|
403
|
+
# class()
|
404
|
+
# Called 0 times.
|
405
|
+
# Expected 1 times.
|
406
|
+
# .../Ruby26-x64/lib/ruby/gems/2.6.0/gems/sigdump-0.2.4/lib/sigdump.rb:74:in `block in dump_object_count'
|
407
|
+
# 73: ObjectSpace.each_object {|o|
|
408
|
+
# 74: c = o.class <-- HERE!
|
409
|
+
mock(Sigdump).dump(anything)
|
410
|
+
|
411
|
+
begin
|
412
|
+
sleep 0.1 # Wait for starting windows event thread
|
413
|
+
event = Win32::Event.open("TestFluentdEvent_CONT")
|
414
|
+
event.set
|
415
|
+
event.close
|
416
|
+
sleep 1.0 # Wait for dumping
|
417
|
+
ensure
|
418
|
+
server.stop_windows_event_thread
|
419
|
+
end
|
424
420
|
end
|
425
|
-
|
426
|
-
result_filepaths = Dir.glob("#{TMP_DIR}/*")
|
427
|
-
assert {result_filepaths.length > 0}
|
428
|
-
ensure
|
429
|
-
ENV.delete('SIGDUMP_PATH')
|
430
421
|
end
|
431
422
|
|
432
423
|
data(:ipv4 => ["0.0.0.0", "127.0.0.1", false],
|
data/test/test_tls.rb
CHANGED