fluentd 1.16.6 → 1.16.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +1 -0
- data/CHANGELOG.md +32 -0
- data/README.md +0 -2
- data/fluentd.gemspec +5 -0
- data/lib/fluent/supervisor.rb +1 -1
- data/lib/fluent/version.rb +1 -1
- data/lib/fluent/winsvc.rb +28 -3
- data/test/command/test_cat.rb +2 -2
- data/test/command/test_fluentd.rb +1 -1
- data/test/helper.rb +27 -7
- 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_in_forward.rb +2 -1
- data/test/plugin/test_in_http.rb +1 -1
- data/test/plugin/test_in_monitor_agent.rb +6 -6
- data/test/plugin/test_in_syslog.rb +25 -18
- data/test/plugin/test_in_tail.rb +4 -12
- data/test/plugin/test_in_tcp.rb +1 -1
- data/test/plugin/test_in_udp.rb +16 -10
- data/test/plugin/test_out_exec_filter.rb +12 -7
- data/test/plugin/test_out_file.rb +1 -1
- data/test/plugin/test_out_forward.rb +2 -3
- data/test/plugin/test_out_stream.rb +1 -1
- data/test/plugin_helper/test_http_server_helper.rb +1 -1
- data/test/plugin_helper/test_server.rb +64 -41
- data/test/plugin_helper/test_socket.rb +1 -1
- data/test/test_event_router.rb +2 -2
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0f930ec85d04a2058c7bf4bb51b1aec63a3cd99bfd00c5ac45ee8271dce8d57
|
4
|
+
data.tar.gz: 89f8a6c05c0b8088bef58c354044662ac1c48ddca7ba12600898612d49460ef9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 739775f981a042b9947ed2827c74ac75b204eca93a8d050b0fb73aa02d4a2ba7a84939e6d5d31416944e68fd74b29a7cef7c632886e8826596361adf8d83f4f1
|
7
|
+
data.tar.gz: e85f9a8bb9d2b60b145539a453f9d72d382f9e72332eeb20c226f40b948680040cfeadd5b6308c9a40419f2442573e2fcc782a2b09f30259a3e48add3939185e
|
data/.github/workflows/test.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,37 @@
|
|
1
1
|
# v1.16
|
2
2
|
|
3
|
+
## Release v1.16.7 - 2025/01/29
|
4
|
+
|
5
|
+
### Bug Fix
|
6
|
+
|
7
|
+
* Windows: Fix `NoMethodError` of `--daemon` option
|
8
|
+
https://github.com/fluent/fluentd/pull/4796
|
9
|
+
* Windows: Fixed an issue where stopping the service immediately after startup could leave the processes
|
10
|
+
https://github.com/fluent/fluentd/pull/4782
|
11
|
+
* Windows: Fixed an issue where stopping service sometimes can not be completed forever
|
12
|
+
https://github.com/fluent/fluentd/pull/4782
|
13
|
+
|
14
|
+
### Misc
|
15
|
+
|
16
|
+
* Windows: Add workaround for unexpected exception
|
17
|
+
https://github.com/fluent/fluentd/pull/4747
|
18
|
+
* README: remove deprecated google analytics beacon
|
19
|
+
https://github.com/fluent/fluentd/pull/4797
|
20
|
+
* CI improvemnts
|
21
|
+
https://github.com/fluent/fluentd/pull/4723
|
22
|
+
https://github.com/fluent/fluentd/pull/4788
|
23
|
+
https://github.com/fluent/fluentd/pull/4789
|
24
|
+
https://github.com/fluent/fluentd/pull/4790
|
25
|
+
https://github.com/fluent/fluentd/pull/4791
|
26
|
+
https://github.com/fluent/fluentd/pull/4793
|
27
|
+
https://github.com/fluent/fluentd/pull/4794
|
28
|
+
https://github.com/fluent/fluentd/pull/4795
|
29
|
+
https://github.com/fluent/fluentd/pull/4798
|
30
|
+
https://github.com/fluent/fluentd/pull/4799
|
31
|
+
https://github.com/fluent/fluentd/pull/4800
|
32
|
+
https://github.com/fluent/fluentd/pull/4801
|
33
|
+
https://github.com/fluent/fluentd/pull/4803
|
34
|
+
|
3
35
|
## Release v1.16.6 - 2024/08/16
|
4
36
|
|
5
37
|
### Bug Fix
|
data/README.md
CHANGED
@@ -71,5 +71,3 @@ See [SECURITY](SECURITY.md) to contact us about vulnerability.
|
|
71
71
|
## Contributors:
|
72
72
|
|
73
73
|
Patches contributed by [great developers](https://github.com/fluent/fluentd/contributors).
|
74
|
-
|
75
|
-
[<img src="https://ga-beacon.appspot.com/UA-24890265-6/fluent/fluentd" />](https://github.com/fluent/fluentd)
|
data/fluentd.gemspec
CHANGED
@@ -31,6 +31,11 @@ Gem::Specification.new do |gem|
|
|
31
31
|
gem.add_runtime_dependency("webrick", ["~> 1.4"])
|
32
32
|
gem.add_runtime_dependency("console", ["< 1.24"])
|
33
33
|
|
34
|
+
# gems that aren't default gems as of Ruby 3.5
|
35
|
+
# logger 1.6.3 or later cause bug on windows,
|
36
|
+
# hold on 1.6.2 for a while. see https://github.com/ruby/logger/issues/107
|
37
|
+
gem.add_runtime_dependency("logger", ["1.6.2"])
|
38
|
+
|
34
39
|
# build gem for a certain platform. see also Rakefile
|
35
40
|
fake_platform = ENV['GEM_BUILD_FAKE_PLATFORM'].to_s
|
36
41
|
gem.platform = fake_platform unless fake_platform.empty?
|
data/lib/fluent/supervisor.rb
CHANGED
@@ -440,7 +440,7 @@ module Fluent
|
|
440
440
|
stop_immediately_at_unrecoverable_exit: true,
|
441
441
|
root_dir: params['root_dir'],
|
442
442
|
logger: $log,
|
443
|
-
log: $log
|
443
|
+
log: $log&.out,
|
444
444
|
log_level: params['log_level'],
|
445
445
|
chuser: params['chuser'],
|
446
446
|
chgroup: params['chgroup'],
|
data/lib/fluent/version.rb
CHANGED
data/lib/fluent/winsvc.rb
CHANGED
@@ -63,10 +63,12 @@ begin
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def service_stop
|
66
|
-
|
67
|
-
|
68
|
-
|
66
|
+
if @pid <= 0
|
67
|
+
set_event(@service_name)
|
68
|
+
return
|
69
69
|
end
|
70
|
+
|
71
|
+
wait_supervisor_finished
|
70
72
|
end
|
71
73
|
|
72
74
|
def service_paramchange
|
@@ -91,6 +93,29 @@ begin
|
|
91
93
|
ev.set
|
92
94
|
ev.close
|
93
95
|
end
|
96
|
+
|
97
|
+
def repeat_set_event_several_times_until_success(event_name)
|
98
|
+
retries = 0
|
99
|
+
max_retries = 10
|
100
|
+
delay_sec = 3
|
101
|
+
|
102
|
+
begin
|
103
|
+
set_event(event_name)
|
104
|
+
rescue Errno::ENOENT
|
105
|
+
# This error occurs when the supervisor process has not yet created the event.
|
106
|
+
# If STOP is immediately executed, this state will occur.
|
107
|
+
# Retry `set_event' to wait for the initialization of the supervisor.
|
108
|
+
retries += 1
|
109
|
+
raise if max_retries < retries
|
110
|
+
sleep(delay_sec)
|
111
|
+
retry
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def wait_supervisor_finished
|
116
|
+
repeat_set_event_several_times_until_success(@service_name)
|
117
|
+
Process.waitpid(@pid)
|
118
|
+
end
|
94
119
|
end
|
95
120
|
|
96
121
|
FluentdService.new(opts[:service_name]).mainloop
|
data/test/command/test_cat.rb
CHANGED
@@ -18,7 +18,7 @@ class TestFluentCat < ::Test::Unit::TestCase
|
|
18
18
|
@primary = create_primary
|
19
19
|
metadata = @primary.buffer.new_metadata
|
20
20
|
@chunk = create_chunk(@primary, metadata, @es)
|
21
|
-
@port = unused_port
|
21
|
+
@port = unused_port(protocol: :all)
|
22
22
|
end
|
23
23
|
|
24
24
|
def teardown
|
@@ -87,7 +87,7 @@ class TestFluentCat < ::Test::Unit::TestCase
|
|
87
87
|
d = create_driver
|
88
88
|
d.run(expect_records: 1) do
|
89
89
|
Open3.pipeline_w("#{ServerEngine.ruby_bin_path} #{FLUENT_CAT_COMMAND} --port #{@port} --format msgpack secondary") do |stdin|
|
90
|
-
stdin.write(File.read(path))
|
90
|
+
stdin.write(File.read(path, File.size(path)))
|
91
91
|
stdin.close
|
92
92
|
end
|
93
93
|
end
|
data/test/helper.rb
CHANGED
@@ -71,17 +71,31 @@ end
|
|
71
71
|
|
72
72
|
include Fluent::Test::Helpers
|
73
73
|
|
74
|
-
def unused_port(num = 1, protocol
|
74
|
+
def unused_port(num = 1, protocol:, bind: "0.0.0.0")
|
75
75
|
case protocol
|
76
|
-
when :tcp
|
76
|
+
when :tcp, :tls
|
77
77
|
unused_port_tcp(num)
|
78
78
|
when :udp
|
79
79
|
unused_port_udp(num, bind: bind)
|
80
|
+
when :all
|
81
|
+
unused_port_tcp_udp(num)
|
80
82
|
else
|
81
83
|
raise ArgumentError, "unknown protocol: #{protocol}"
|
82
84
|
end
|
83
85
|
end
|
84
86
|
|
87
|
+
def unused_port_tcp_udp(num = 1)
|
88
|
+
raise "not support num > 1" if num > 1
|
89
|
+
|
90
|
+
# The default maximum number of file descriptors in macOS is 256.
|
91
|
+
# It might need to set num to a smaller value than that.
|
92
|
+
tcp_ports = unused_port_tcp(200)
|
93
|
+
port = unused_port_udp(1, port_list: tcp_ports)
|
94
|
+
raise "can't find unused port" unless port
|
95
|
+
|
96
|
+
port
|
97
|
+
end
|
98
|
+
|
85
99
|
def unused_port_tcp(num = 1)
|
86
100
|
ports = []
|
87
101
|
sockets = []
|
@@ -90,7 +104,7 @@ def unused_port_tcp(num = 1)
|
|
90
104
|
sockets << s
|
91
105
|
ports << s.addr[1]
|
92
106
|
end
|
93
|
-
sockets.each
|
107
|
+
sockets.each(&:close)
|
94
108
|
if num == 1
|
95
109
|
return ports.first
|
96
110
|
else
|
@@ -100,12 +114,15 @@ end
|
|
100
114
|
|
101
115
|
PORT_RANGE_AVAILABLE = (1024...65535)
|
102
116
|
|
103
|
-
def unused_port_udp(num = 1, bind: "0.0.0.0")
|
117
|
+
def unused_port_udp(num = 1, port_list: [], bind: "0.0.0.0")
|
104
118
|
family = IPAddr.new(IPSocket.getaddress(bind)).ipv4? ? ::Socket::AF_INET : ::Socket::AF_INET6
|
105
119
|
ports = []
|
106
120
|
sockets = []
|
107
|
-
|
108
|
-
|
121
|
+
|
122
|
+
use_random_port = port_list.empty?
|
123
|
+
i = 0
|
124
|
+
loop do
|
125
|
+
port = use_random_port ? rand(PORT_RANGE_AVAILABLE) : port_list[i]
|
109
126
|
u = UDPSocket.new(family)
|
110
127
|
if (u.bind(bind, port) rescue nil)
|
111
128
|
ports << port
|
@@ -113,8 +130,11 @@ def unused_port_udp(num = 1, bind: "0.0.0.0")
|
|
113
130
|
else
|
114
131
|
u.close
|
115
132
|
end
|
133
|
+
i += 1
|
134
|
+
break if ports.size >= num
|
135
|
+
break if !use_random_port && i >= port_list.size
|
116
136
|
end
|
117
|
-
sockets.each
|
137
|
+
sockets.each(&:close)
|
118
138
|
if num == 1
|
119
139
|
return ports.first
|
120
140
|
else
|
@@ -111,11 +111,11 @@ class AckHandlerTest < Test::Unit::TestCase
|
|
111
111
|
r, w = IO.pipe
|
112
112
|
begin
|
113
113
|
w.write(chunk_id)
|
114
|
-
|
114
|
+
def r.recv(arg)
|
115
115
|
sleep(1) # To ensure that multiple threads select the socket before closing.
|
116
|
-
raise IOError, 'stream closed in another thread' if
|
116
|
+
raise IOError, 'stream closed in another thread' if self.closed?
|
117
117
|
MessagePack.pack({ 'ack' => Base64.encode64('chunk_id 111') })
|
118
|
-
|
118
|
+
end
|
119
119
|
ack.enqueue(r)
|
120
120
|
|
121
121
|
threads = []
|
@@ -17,7 +17,7 @@ class SocketCacheTest < Test::Unit::TestCase
|
|
17
17
|
assert_equal(socket, c.checkout_or('key') { socket })
|
18
18
|
c.checkin(socket)
|
19
19
|
|
20
|
-
sock =
|
20
|
+
sock = mock!.open.never.subject
|
21
21
|
assert_equal(socket, c.checkout_or('key') { sock.open })
|
22
22
|
end
|
23
23
|
|
@@ -130,7 +130,7 @@ class SocketCacheTest < Test::Unit::TestCase
|
|
130
130
|
|
131
131
|
c = Fluent::Plugin::ForwardOutput::SocketCache.new(10, $log)
|
132
132
|
sock = mock!.close { 'closed' }.subject
|
133
|
-
sock2 =
|
133
|
+
sock2 = mock!.close.never.subject
|
134
134
|
stub(sock).inspect
|
135
135
|
stub(sock2).inspect
|
136
136
|
|
@@ -154,7 +154,7 @@ class SocketCacheTest < Test::Unit::TestCase
|
|
154
154
|
Timecop.freeze(Time.parse('2016-04-13 14:00:00 +0900'))
|
155
155
|
|
156
156
|
c = Fluent::Plugin::ForwardOutput::SocketCache.new(10, $log)
|
157
|
-
sock =
|
157
|
+
sock = mock!.close.never.subject
|
158
158
|
stub(sock).inspect
|
159
159
|
c.checkout_or('key') { sock }
|
160
160
|
|
@@ -18,7 +18,8 @@ class ForwardInputTest < Test::Unit::TestCase
|
|
18
18
|
Fluent::Test.setup
|
19
19
|
@responses = [] # for testing responses after sending data
|
20
20
|
@d = nil
|
21
|
-
|
21
|
+
# forward plugin uses TCP and UDP sockets on the same port number
|
22
|
+
@port = unused_port(protocol: :all)
|
22
23
|
end
|
23
24
|
|
24
25
|
def teardown
|
data/test/plugin/test_in_http.rb
CHANGED
@@ -392,7 +392,7 @@ EOC
|
|
392
392
|
end
|
393
393
|
|
394
394
|
test "emit" do
|
395
|
-
port = unused_port
|
395
|
+
port = unused_port(protocol: :tcp)
|
396
396
|
d = create_driver("
|
397
397
|
@type monitor_agent
|
398
398
|
bind '127.0.0.1'
|
@@ -451,7 +451,7 @@ EOC
|
|
451
451
|
|
452
452
|
sub_test_case "servlets" do
|
453
453
|
setup do
|
454
|
-
@port = unused_port
|
454
|
+
@port = unused_port(protocol: :tcp)
|
455
455
|
# check @type and type in one configuration
|
456
456
|
conf = <<-EOC
|
457
457
|
<source>
|
@@ -759,7 +759,7 @@ plugin_id:test_filter\tplugin_category:filter\ttype:test_filter\toutput_plugin:f
|
|
759
759
|
end
|
760
760
|
|
761
761
|
setup do
|
762
|
-
@port = unused_port
|
762
|
+
@port = unused_port(protocol: :tcp)
|
763
763
|
# check @type and type in one configuration
|
764
764
|
conf = <<-EOC
|
765
765
|
<source>
|
@@ -840,7 +840,7 @@ plugin_id:test_filter\tplugin_category:filter\ttype:test_filter\toutput_plugin:f
|
|
840
840
|
|
841
841
|
sub_test_case "check the port number of http server" do
|
842
842
|
test "on single worker environment" do
|
843
|
-
port = unused_port
|
843
|
+
port = unused_port(protocol: :tcp)
|
844
844
|
d = create_driver("
|
845
845
|
@type monitor_agent
|
846
846
|
bind '127.0.0.1'
|
@@ -851,7 +851,7 @@ plugin_id:test_filter\tplugin_category:filter\ttype:test_filter\toutput_plugin:f
|
|
851
851
|
end
|
852
852
|
|
853
853
|
test "worker_id = 2 on multi worker environment" do
|
854
|
-
port = unused_port
|
854
|
+
port = unused_port(protocol: :tcp)
|
855
855
|
Fluent::SystemConfig.overwrite_system_config('workers' => 4) do
|
856
856
|
d = Fluent::Test::Driver::Input.new(Fluent::Plugin::MonitorAgentInput)
|
857
857
|
d.instance.instance_eval{ @_fluentd_worker_id = 2 }
|
@@ -905,7 +905,7 @@ EOC
|
|
905
905
|
end
|
906
906
|
|
907
907
|
test "plugins have a variable named buffer does not throws NoMethodError" do
|
908
|
-
port = unused_port
|
908
|
+
port = unused_port(protocol: :tcp)
|
909
909
|
d = create_driver("
|
910
910
|
@type monitor_agent
|
911
911
|
bind '127.0.0.1'
|
@@ -5,24 +5,24 @@ require 'fluent/plugin/in_syslog'
|
|
5
5
|
class SyslogInputTest < Test::Unit::TestCase
|
6
6
|
def setup
|
7
7
|
Fluent::Test.setup
|
8
|
-
@port = unused_port
|
8
|
+
@port = unused_port(protocol: :udp)
|
9
9
|
end
|
10
10
|
|
11
11
|
def teardown
|
12
12
|
@port = nil
|
13
13
|
end
|
14
14
|
|
15
|
-
def ipv4_config
|
15
|
+
def ipv4_config(port = @port)
|
16
16
|
%[
|
17
|
-
port #{
|
17
|
+
port #{port}
|
18
18
|
bind 127.0.0.1
|
19
19
|
tag syslog
|
20
20
|
]
|
21
21
|
end
|
22
22
|
|
23
|
-
def ipv6_config
|
23
|
+
def ipv6_config(port = @port)
|
24
24
|
%[
|
25
|
-
port #{
|
25
|
+
port #{port}
|
26
26
|
bind ::1
|
27
27
|
tag syslog
|
28
28
|
]
|
@@ -69,7 +69,8 @@ EOS
|
|
69
69
|
'Use transport and protocol' => ["protocol_type udp\n<transport tcp>\n </transport>", :udp, :tcp])
|
70
70
|
def test_configure_protocol(param)
|
71
71
|
conf, proto_type, transport_proto_type = *param
|
72
|
-
|
72
|
+
port = unused_port(protocol: proto_type ? proto_type : transport_proto_type)
|
73
|
+
d = create_driver([ipv4_config(port), conf].join("\n"))
|
73
74
|
|
74
75
|
assert_equal(d.instance.protocol_type, proto_type)
|
75
76
|
assert_equal(d.instance.transport_config.protocol, transport_proto_type)
|
@@ -158,12 +159,13 @@ EOS
|
|
158
159
|
end
|
159
160
|
|
160
161
|
def test_msg_size_with_tcp
|
161
|
-
|
162
|
+
port = unused_port(protocol: :tcp)
|
163
|
+
d = create_driver([ipv4_config(port), "<transport tcp> \n</transport>"].join("\n"))
|
162
164
|
tests = create_test_case
|
163
165
|
|
164
166
|
d.run(expect_emits: 2) do
|
165
167
|
tests.each {|test|
|
166
|
-
TCPSocket.open('127.0.0.1',
|
168
|
+
TCPSocket.open('127.0.0.1', port) do |s|
|
167
169
|
s.send(test['msg'], 0)
|
168
170
|
end
|
169
171
|
}
|
@@ -189,11 +191,12 @@ EOS
|
|
189
191
|
end
|
190
192
|
|
191
193
|
def test_msg_size_with_same_tcp_connection
|
192
|
-
|
194
|
+
port = unused_port(protocol: :tcp)
|
195
|
+
d = create_driver([ipv4_config(port), "<transport tcp> \n</transport>"].join("\n"))
|
193
196
|
tests = create_test_case
|
194
197
|
|
195
198
|
d.run(expect_emits: 2) do
|
196
|
-
TCPSocket.open('127.0.0.1',
|
199
|
+
TCPSocket.open('127.0.0.1', port) do |s|
|
197
200
|
tests.each {|test|
|
198
201
|
s.send(test['msg'], 0)
|
199
202
|
}
|
@@ -347,12 +350,13 @@ EOS
|
|
347
350
|
|
348
351
|
sub_test_case 'octet counting frame' do
|
349
352
|
def test_msg_size_with_tcp
|
350
|
-
|
353
|
+
port = unused_port(protocol: :tcp)
|
354
|
+
d = create_driver([ipv4_config(port), "<transport tcp> \n</transport>", 'frame_type octet_count'].join("\n"))
|
351
355
|
tests = create_test_case
|
352
356
|
|
353
357
|
d.run(expect_emits: 2) do
|
354
358
|
tests.each {|test|
|
355
|
-
TCPSocket.open('127.0.0.1',
|
359
|
+
TCPSocket.open('127.0.0.1', port) do |s|
|
356
360
|
s.send(test['msg'], 0)
|
357
361
|
end
|
358
362
|
}
|
@@ -363,11 +367,12 @@ EOS
|
|
363
367
|
end
|
364
368
|
|
365
369
|
def test_msg_size_with_same_tcp_connection
|
366
|
-
|
370
|
+
port = unused_port(protocol: :tcp)
|
371
|
+
d = create_driver([ipv4_config(port), "<transport tcp> \n</transport>", 'frame_type octet_count'].join("\n"))
|
367
372
|
tests = create_test_case
|
368
373
|
|
369
374
|
d.run(expect_emits: 2) do
|
370
|
-
TCPSocket.open('127.0.0.1',
|
375
|
+
TCPSocket.open('127.0.0.1', port) do |s|
|
371
376
|
tests.each {|test|
|
372
377
|
s.send(test['msg'], 0)
|
373
378
|
}
|
@@ -469,7 +474,8 @@ EOS
|
|
469
474
|
end
|
470
475
|
|
471
476
|
def test_send_keepalive_packet_is_disabled_by_default
|
472
|
-
|
477
|
+
port = unused_port(protocol: :tcp)
|
478
|
+
d = create_driver(ipv4_config(port) + %[
|
473
479
|
<transport tcp>
|
474
480
|
</transport>
|
475
481
|
protocol tcp
|
@@ -479,19 +485,20 @@ EOS
|
|
479
485
|
|
480
486
|
def test_send_keepalive_packet_can_be_enabled
|
481
487
|
addr = "127.0.0.1"
|
482
|
-
|
488
|
+
port = unused_port(protocol: :tcp)
|
489
|
+
d = create_driver(ipv4_config(port) + %[
|
483
490
|
<transport tcp>
|
484
491
|
</transport>
|
485
492
|
send_keepalive_packet true
|
486
493
|
])
|
487
494
|
assert_true d.instance.send_keepalive_packet
|
488
495
|
mock.proxy(d.instance).server_create_connection(
|
489
|
-
:in_syslog_tcp_server,
|
496
|
+
:in_syslog_tcp_server, port,
|
490
497
|
bind: addr,
|
491
498
|
resolve_name: nil,
|
492
499
|
send_keepalive_packet: true)
|
493
500
|
d.run do
|
494
|
-
TCPSocket.open(addr,
|
501
|
+
TCPSocket.open(addr, port)
|
495
502
|
end
|
496
503
|
end
|
497
504
|
|
data/test/plugin/test_in_tail.rb
CHANGED
@@ -3172,9 +3172,7 @@ class TailInputTest < Test::Unit::TestCase
|
|
3172
3172
|
Fluent::FileWrapper.open("#{@tmp_dir}/tail.txt0", "ab") {|f| f.puts "file3 log2"}
|
3173
3173
|
end
|
3174
3174
|
|
3175
|
-
|
3176
|
-
inode_1 = tail_watchers[1]&.ino
|
3177
|
-
inode_2 = tail_watchers[2]&.ino
|
3175
|
+
pos_file_inode = tail_watchers[2].pe.read_inode
|
3178
3176
|
record_values = d.events.collect { |event| event[2]["message"] }.sort
|
3179
3177
|
position_entries = []
|
3180
3178
|
Fluent::FileWrapper.open("#{@tmp_dir}/tail.pos", "r") do |f|
|
@@ -3188,17 +3186,15 @@ class TailInputTest < Test::Unit::TestCase
|
|
3188
3186
|
{
|
3189
3187
|
record_values: ["file1 log1", "file1 log2", "file2 log1", "file2 log2", "file3 log1", "file3 log2"],
|
3190
3188
|
tail_watcher_paths: ["#{@tmp_dir}/tail.txt0", "#{@tmp_dir}/tail.txt0", "#{@tmp_dir}/tail.txt0"],
|
3191
|
-
tail_watcher_inodes: [inode_0, inode_1, inode_2],
|
3192
3189
|
tail_watcher_io_handler_opened_statuses: [false, false, false],
|
3193
3190
|
position_entries: [
|
3194
3191
|
# The recorded path is old, but it is no problem. The path is not used when using follow_inodes.
|
3195
|
-
["#{@tmp_dir}/tail.txt0", "0000000000000016",
|
3192
|
+
["#{@tmp_dir}/tail.txt0", "0000000000000016", pos_file_inode],
|
3196
3193
|
],
|
3197
3194
|
},
|
3198
3195
|
{
|
3199
3196
|
record_values: record_values,
|
3200
3197
|
tail_watcher_paths: tail_watchers.collect { |tw| tw.path },
|
3201
|
-
tail_watcher_inodes: tail_watchers.collect { |tw| tw.ino },
|
3202
3198
|
tail_watcher_io_handler_opened_statuses: tail_watchers.collect { |tw| tw.instance_variable_get(:@io_handler)&.opened? || false },
|
3203
3199
|
position_entries: position_entries
|
3204
3200
|
},
|
@@ -3253,9 +3249,7 @@ class TailInputTest < Test::Unit::TestCase
|
|
3253
3249
|
sleep 4
|
3254
3250
|
end
|
3255
3251
|
|
3256
|
-
|
3257
|
-
inode_1 = tail_watchers[1]&.ino
|
3258
|
-
inode_2 = tail_watchers[2]&.ino
|
3252
|
+
pos_file_inode = tail_watchers[2].pe.read_inode
|
3259
3253
|
record_values = d.events.collect { |event| event[2]["message"] }.sort
|
3260
3254
|
position_entries = []
|
3261
3255
|
Fluent::FileWrapper.open("#{@tmp_dir}/tail.pos", "r") do |f|
|
@@ -3269,16 +3263,14 @@ class TailInputTest < Test::Unit::TestCase
|
|
3269
3263
|
{
|
3270
3264
|
record_values: ["file1 log1", "file1 log2", "file2 log1", "file2 log2", "file3 log1", "file3 log2"],
|
3271
3265
|
tail_watcher_paths: ["#{@tmp_dir}/tail.txt0", "#{@tmp_dir}/tail.txt0", "#{@tmp_dir}/tail.txt0"],
|
3272
|
-
tail_watcher_inodes: [inode_0, inode_1, inode_2],
|
3273
3266
|
tail_watcher_io_handler_opened_statuses: [false, false, false],
|
3274
3267
|
position_entries: [
|
3275
|
-
["#{@tmp_dir}/tail.txt0", "0000000000000016",
|
3268
|
+
["#{@tmp_dir}/tail.txt0", "0000000000000016", pos_file_inode],
|
3276
3269
|
],
|
3277
3270
|
},
|
3278
3271
|
{
|
3279
3272
|
record_values: record_values,
|
3280
3273
|
tail_watcher_paths: tail_watchers.collect { |tw| tw.path },
|
3281
|
-
tail_watcher_inodes: tail_watchers.collect { |tw| tw.ino },
|
3282
3274
|
tail_watcher_io_handler_opened_statuses: tail_watchers.collect { |tw| tw.instance_variable_get(:@io_handler)&.opened? || false },
|
3283
3275
|
position_entries: position_entries
|
3284
3276
|
},
|
data/test/plugin/test_in_tcp.rb
CHANGED
data/test/plugin/test_in_udp.rb
CHANGED
@@ -5,7 +5,7 @@ require 'fluent/plugin/in_udp'
|
|
5
5
|
class UdpInputTest < Test::Unit::TestCase
|
6
6
|
def setup
|
7
7
|
Fluent::Test.setup
|
8
|
-
@port = unused_port
|
8
|
+
@port = unused_port(protocol: :udp)
|
9
9
|
end
|
10
10
|
|
11
11
|
def teardown
|
@@ -268,25 +268,31 @@ class UdpInputTest < Test::Unit::TestCase
|
|
268
268
|
|
269
269
|
test 'message_length_limit' do
|
270
270
|
message_length_limit = 32
|
271
|
+
|
272
|
+
if Fluent.windows?
|
273
|
+
expected_records = ["0" * 30, "4" * 30]
|
274
|
+
else
|
275
|
+
expected_records = 1.upto(3).collect do |i|
|
276
|
+
"#{i}" * message_length_limit
|
277
|
+
end
|
278
|
+
expected_records.prepend("0" * 30)
|
279
|
+
expected_records.append("4" * 30)
|
280
|
+
end
|
281
|
+
|
271
282
|
d = create_driver(base_config + %!
|
272
283
|
format none
|
273
284
|
message_length_limit #{message_length_limit}
|
274
285
|
!)
|
275
|
-
d.run(expect_records:
|
286
|
+
d.run(expect_records: expected_records.size, timeout: 5) do
|
276
287
|
create_udp_socket('127.0.0.1', @port) do |u|
|
277
|
-
|
288
|
+
u.send("0" * 30 + "\n", 0)
|
289
|
+
1.upto(3) do |i|
|
278
290
|
u.send("#{i}" * 40 + "\n", 0)
|
279
291
|
end
|
292
|
+
u.send("4" * 30 + "\n", 0)
|
280
293
|
end
|
281
294
|
end
|
282
295
|
|
283
|
-
if Fluent.windows?
|
284
|
-
expected_records = []
|
285
|
-
else
|
286
|
-
expected_records = 3.times.collect do |i|
|
287
|
-
"#{i}" * message_length_limit
|
288
|
-
end
|
289
|
-
end
|
290
296
|
actual_records = d.events.collect do |event|
|
291
297
|
event[2]["message"]
|
292
298
|
end
|
@@ -500,10 +500,18 @@ class ExecFilterOutputTest < Test::Unit::TestCase
|
|
500
500
|
d = create_driver(conf)
|
501
501
|
time = event_time('2011-01-02 13:14:15')
|
502
502
|
|
503
|
-
d.run(default_tag: 'test', expect_emits:
|
504
|
-
|
505
|
-
|
506
|
-
|
503
|
+
d.run(default_tag: 'test', expect_emits: 4) do
|
504
|
+
d.feed(time, {"k1" => 0})
|
505
|
+
d.flush
|
506
|
+
sleep 0.5
|
507
|
+
d.feed(time, {"k1" => 1})
|
508
|
+
d.flush
|
509
|
+
sleep 0.5
|
510
|
+
d.feed(time, {"k1" => 2})
|
511
|
+
d.flush
|
512
|
+
sleep 0.5
|
513
|
+
d.feed(time, {"k1" => 3})
|
514
|
+
end
|
507
515
|
|
508
516
|
assert_equal "2011-01-02 13:14:15\ttest\t0\n", d.formatted[0]
|
509
517
|
assert_equal "2011-01-02 13:14:15\ttest\t1\n", d.formatted[1]
|
@@ -524,9 +532,6 @@ class ExecFilterOutputTest < Test::Unit::TestCase
|
|
524
532
|
assert_equal pid_list[1], events[1][2]['child_pid']
|
525
533
|
assert_equal pid_list[0], events[2][2]['child_pid']
|
526
534
|
assert_equal pid_list[1], events[3][2]['child_pid']
|
527
|
-
|
528
|
-
ensure
|
529
|
-
d.run(start: false, shutdown: true)
|
530
535
|
end
|
531
536
|
|
532
537
|
# child process exits per 3 lines
|
@@ -12,7 +12,8 @@ class ForwardOutputTest < Test::Unit::TestCase
|
|
12
12
|
FileUtils.rm_rf(TMP_DIR)
|
13
13
|
FileUtils.mkdir_p(TMP_DIR)
|
14
14
|
@d = nil
|
15
|
-
|
15
|
+
# forward plugin uses TCP and UDP sockets on the same port number
|
16
|
+
@target_port = unused_port(protocol: :all)
|
16
17
|
end
|
17
18
|
|
18
19
|
def teardown
|
@@ -610,7 +611,6 @@ EOL
|
|
610
611
|
|
611
612
|
@d = d = create_driver(config + %[
|
612
613
|
require_ack_response true
|
613
|
-
ack_response_timeout 1s
|
614
614
|
<buffer tag>
|
615
615
|
flush_mode immediate
|
616
616
|
retry_type periodic
|
@@ -658,7 +658,6 @@ EOL
|
|
658
658
|
|
659
659
|
@d = d = create_driver(config + %[
|
660
660
|
require_ack_response true
|
661
|
-
ack_response_timeout 10s
|
662
661
|
<buffer tag>
|
663
662
|
flush_mode immediate
|
664
663
|
retry_type periodic
|
@@ -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(protocol: :tcp)
|
19
19
|
if Fluent.windows?
|
20
20
|
@socket_manager_server = ServerEngine::SocketManager::Server.open
|
21
21
|
@socket_manager_path = @socket_manager_server.path
|
@@ -233,11 +233,12 @@ 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)
|
236
237
|
assert_raise ArgumentError do
|
237
|
-
@d.__send__(m, :myserver,
|
238
|
+
@d.__send__(m, :myserver, port, proto: proto, max_bytes: 128){|x| x }
|
238
239
|
end
|
239
240
|
assert_raise ArgumentError do
|
240
|
-
@d.__send__(m, :myserver,
|
241
|
+
@d.__send__(m, :myserver, port, proto: proto, flags: 1){|x| x }
|
241
242
|
end
|
242
243
|
end
|
243
244
|
|
@@ -245,8 +246,9 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
245
246
|
'server_create udp' => [:server_create, :udp],
|
246
247
|
)
|
247
248
|
test 'raise error if tcp/tls options specified for udp' do |(m, proto)|
|
249
|
+
port = unused_port(protocol: proto)
|
248
250
|
assert_raise(ArgumentError.new("BUG: linger_timeout is available for tcp/tls")) do
|
249
|
-
@d.__send__(m, :myserver,
|
251
|
+
@d.__send__(m, :myserver, port, proto: proto, linger_timeout: 1, max_bytes: 128){|x| x }
|
250
252
|
end
|
251
253
|
end
|
252
254
|
|
@@ -254,8 +256,9 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
254
256
|
'server_create udp' => [:server_create, :udp],
|
255
257
|
)
|
256
258
|
test 'raise error if tcp/tls/unix backlog options specified for udp' do |(m, proto)|
|
259
|
+
port = unused_port(protocol: proto)
|
257
260
|
assert_raise(ArgumentError.new("BUG: backlog is available for tcp/tls")) do
|
258
|
-
@d.__send__(m, :myserver,
|
261
|
+
@d.__send__(m, :myserver, port, proto: proto, backlog: 500){|x| x }
|
259
262
|
end
|
260
263
|
end
|
261
264
|
|
@@ -263,8 +266,9 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
263
266
|
'server_create udp' => [:server_create, :udp],
|
264
267
|
)
|
265
268
|
test 'raise error if tcp/tls send_keepalive_packet option is specified for udp' do |(m, proto)|
|
269
|
+
port = unused_port(protocol: proto)
|
266
270
|
assert_raise(ArgumentError.new("BUG: send_keepalive_packet is available for tcp/tls")) do
|
267
|
-
@d.__send__(m, :myserver,
|
271
|
+
@d.__send__(m, :myserver, port, proto: proto, send_keepalive_packet: true){|x| x }
|
268
272
|
end
|
269
273
|
end
|
270
274
|
|
@@ -276,8 +280,9 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
276
280
|
# 'server_create_connection unix' => [:server_create_connection, :unix, {}],
|
277
281
|
)
|
278
282
|
test 'raise error if tls options specified for tcp/udp/unix' do |(m, proto, kwargs)|
|
283
|
+
port = unused_port(protocol: proto)
|
279
284
|
assert_raise(ArgumentError.new("BUG: tls_options is available only for tls")) do
|
280
|
-
@d.__send__(m, :myserver,
|
285
|
+
@d.__send__(m, :myserver, port, proto: proto, tls_options: {}, **kwargs){|x| x }
|
281
286
|
end
|
282
287
|
end
|
283
288
|
|
@@ -289,7 +294,8 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
289
294
|
'server_create_connection tls' => [:server_create_connection, :tls, {tls_options: {insecure: true}}],
|
290
295
|
)
|
291
296
|
test 'can bind specified IPv4 address' do |(m, proto, kwargs)|
|
292
|
-
|
297
|
+
port = unused_port(protocol: proto)
|
298
|
+
@d.__send__(m, :myserver, port, proto: proto, bind: "127.0.0.1", **kwargs){|x| x }
|
293
299
|
assert_equal "127.0.0.1", @d._servers.first.bind
|
294
300
|
assert_equal "127.0.0.1", @d._servers.first.server.instance_eval{ instance_variable_defined?(:@listen_socket) ? @listen_socket : @_io }.addr[3]
|
295
301
|
end
|
@@ -303,7 +309,8 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
303
309
|
)
|
304
310
|
test 'can bind specified IPv6 address' do |(m, proto, kwargs)| # if available
|
305
311
|
omit "IPv6 unavailable here" unless ipv6_enabled?
|
306
|
-
|
312
|
+
port = unused_port(protocol: proto)
|
313
|
+
@d.__send__(m, :myserver, port, proto: proto, bind: "::1", **kwargs){|x| x }
|
307
314
|
assert_equal "::1", @d._servers.first.bind
|
308
315
|
assert_equal "::1", @d._servers.first.server.instance_eval{ instance_variable_defined?(:@listen_socket) ? @listen_socket : @_io }.addr[3]
|
309
316
|
end
|
@@ -320,10 +327,11 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
320
327
|
test 'can create 2 or more servers which share same bind address and port if shared option is true' do |(m, proto, kwargs)|
|
321
328
|
begin
|
322
329
|
d2 = Dummy.new; d2.start; d2.after_start
|
330
|
+
port = unused_port(protocol: proto)
|
323
331
|
|
324
332
|
assert_nothing_raised do
|
325
|
-
@d.__send__(m, :myserver,
|
326
|
-
d2.__send__(m, :myserver,
|
333
|
+
@d.__send__(m, :myserver, port, proto: proto, **kwargs){|x| x }
|
334
|
+
d2.__send__(m, :myserver, port, proto: proto, **kwargs){|x| x }
|
327
335
|
end
|
328
336
|
ensure
|
329
337
|
d2.stop; d2.before_shutdown; d2.shutdown; d2.after_shutdown; d2.close; d2.terminate
|
@@ -344,12 +352,13 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
344
352
|
test 'cannot create 2 or more servers using same bind address and port if shared option is false' do |(m, proto, kwargs)|
|
345
353
|
begin
|
346
354
|
d2 = Dummy.new; d2.start; d2.after_start
|
355
|
+
port = unused_port(protocol: proto)
|
347
356
|
|
348
357
|
assert_nothing_raised do
|
349
|
-
@d.__send__(m, :myserver,
|
358
|
+
@d.__send__(m, :myserver, port, proto: proto, shared: false, **kwargs){|x| x }
|
350
359
|
end
|
351
360
|
assert_raise(Errno::EADDRINUSE, Errno::EACCES) do
|
352
|
-
d2.__send__(m, :myserver,
|
361
|
+
d2.__send__(m, :myserver, port, proto: proto, **kwargs){|x| x }
|
353
362
|
end
|
354
363
|
ensure
|
355
364
|
d2.stop; d2.before_shutdown; d2.shutdown; d2.after_shutdown; d2.close; d2.terminate
|
@@ -365,16 +374,18 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
365
374
|
# 'unix' => [:unix, {}],
|
366
375
|
)
|
367
376
|
test 'raise error if block argument is not specified or too many' do |(proto, kwargs)|
|
377
|
+
port = unused_port(protocol: proto)
|
368
378
|
assert_raise(ArgumentError.new("BUG: block must have 1 or 2 arguments")) do
|
369
|
-
@d.server_create(:myserver,
|
379
|
+
@d.server_create(:myserver, port, proto: proto, **kwargs){ 1 }
|
370
380
|
end
|
371
381
|
assert_raise(ArgumentError.new("BUG: block must have 1 or 2 arguments")) do
|
372
|
-
@d.server_create(:myserver,
|
382
|
+
@d.server_create(:myserver, port, proto: proto, **kwargs){|sock, conn, what_is_this| 1 }
|
373
383
|
end
|
374
384
|
end
|
375
385
|
|
376
386
|
test 'creates udp server if specified in proto' do
|
377
|
-
|
387
|
+
port = unused_port(protocol: :udp)
|
388
|
+
@d.server_create(:myserver, port, proto: :udp, max_bytes: 512){|x| x }
|
378
389
|
|
379
390
|
created_server_info = @d._servers.first
|
380
391
|
assert_equal :udp, created_server_info.proto
|
@@ -587,7 +598,8 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
587
598
|
sub_test_case '#server_create_udp' do
|
588
599
|
test 'can accept all keyword arguments valid for udp server' do
|
589
600
|
assert_nothing_raised do
|
590
|
-
|
601
|
+
port = unused_port(protocol: :udp)
|
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|
|
591
603
|
# ...
|
592
604
|
end
|
593
605
|
end
|
@@ -595,14 +607,15 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
595
607
|
|
596
608
|
test 'creates a udp server just to read data' do
|
597
609
|
received = ""
|
598
|
-
|
610
|
+
port = unused_port(protocol: :udp)
|
611
|
+
@d.server_create_udp(:s, port, max_bytes: 128) do |data|
|
599
612
|
received << data
|
600
613
|
end
|
601
614
|
bind_port = unused_port(protocol: :udp, bind: "127.0.0.1")
|
602
615
|
3.times do
|
603
616
|
sock = UDPSocket.new(Socket::AF_INET)
|
604
617
|
sock.bind("127.0.0.1", bind_port)
|
605
|
-
sock.connect("127.0.0.1",
|
618
|
+
sock.connect("127.0.0.1", port)
|
606
619
|
sock.puts "yay"
|
607
620
|
sock.puts "foo"
|
608
621
|
sock.close
|
@@ -614,16 +627,17 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
614
627
|
test 'creates a udp server to read and write data' do
|
615
628
|
received = ""
|
616
629
|
responses = []
|
617
|
-
|
630
|
+
port = unused_port(protocol: :udp)
|
631
|
+
@d.server_create_udp(:s, port, max_bytes: 128) do |data, sock|
|
618
632
|
received << data
|
619
633
|
sock.write "ack\n"
|
620
634
|
end
|
621
|
-
bind_port = unused_port
|
635
|
+
bind_port = unused_port(protocol: :udp)
|
622
636
|
3.times do
|
623
637
|
begin
|
624
638
|
sock = UDPSocket.new(Socket::AF_INET)
|
625
639
|
sock.bind("127.0.0.1", bind_port)
|
626
|
-
sock.connect("127.0.0.1",
|
640
|
+
sock.connect("127.0.0.1", port)
|
627
641
|
th = Thread.new do
|
628
642
|
while true
|
629
643
|
begin
|
@@ -654,11 +668,12 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
654
668
|
|
655
669
|
received = ""
|
656
670
|
responses = []
|
657
|
-
|
671
|
+
port = unused_port(protocol: :udp)
|
672
|
+
@d.server_create_udp(:s, port, bind: "::1", max_bytes: 128) do |data, sock|
|
658
673
|
received << data
|
659
674
|
sock.write "ack\n"
|
660
675
|
end
|
661
|
-
bind_port = unused_port
|
676
|
+
bind_port = unused_port(protocol: :udp)
|
662
677
|
3.times do
|
663
678
|
begin
|
664
679
|
sock = UDPSocket.new(Socket::AF_INET6)
|
@@ -667,7 +682,7 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
667
682
|
responses << sock.recv(16)
|
668
683
|
true
|
669
684
|
end
|
670
|
-
sock.connect("::1",
|
685
|
+
sock.connect("::1", port)
|
671
686
|
sock.write "yay\nfoo\n"
|
672
687
|
th.join(5)
|
673
688
|
ensure
|
@@ -682,13 +697,14 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
682
697
|
test 'does not resolve name of client address in default' do
|
683
698
|
received = ""
|
684
699
|
sources = []
|
685
|
-
|
700
|
+
port = unused_port(protocol: :udp)
|
701
|
+
@d.server_create_udp(:s, port, max_bytes: 128) do |data, sock|
|
686
702
|
received << data
|
687
703
|
sources << sock.remote_host
|
688
704
|
end
|
689
705
|
3.times do
|
690
706
|
sock = UDPSocket.new(Socket::AF_INET)
|
691
|
-
sock.connect("127.0.0.1",
|
707
|
+
sock.connect("127.0.0.1", port)
|
692
708
|
sock.puts "yay"
|
693
709
|
sock.close
|
694
710
|
end
|
@@ -702,13 +718,14 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
702
718
|
|
703
719
|
received = ""
|
704
720
|
sources = []
|
705
|
-
|
721
|
+
port = unused_port(protocol: :udp)
|
722
|
+
@d.server_create_udp(:s, port, resolve_name: true, max_bytes: 128) do |data, sock|
|
706
723
|
received << data
|
707
724
|
sources << sock.remote_host
|
708
725
|
end
|
709
726
|
3.times do
|
710
727
|
sock = UDPSocket.new(Socket::AF_INET)
|
711
|
-
sock.connect("127.0.0.1",
|
728
|
+
sock.connect("127.0.0.1", port)
|
712
729
|
sock.puts "yay"
|
713
730
|
sock.close
|
714
731
|
end
|
@@ -720,7 +737,8 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
720
737
|
test 'raises error if plugin registers data callback for connection object from #server_create' do
|
721
738
|
received = ""
|
722
739
|
errors = []
|
723
|
-
|
740
|
+
port = unused_port(protocol: :udp)
|
741
|
+
@d.server_create_udp(:s, port, max_bytes: 128) do |data, sock|
|
724
742
|
received << data
|
725
743
|
begin
|
726
744
|
sock.data{|d| received << d.upcase }
|
@@ -729,7 +747,7 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
729
747
|
end
|
730
748
|
end
|
731
749
|
sock = UDPSocket.new(Socket::AF_INET)
|
732
|
-
sock.connect("127.0.0.1",
|
750
|
+
sock.connect("127.0.0.1", port)
|
733
751
|
sock.write "foo\n"
|
734
752
|
sock.close
|
735
753
|
|
@@ -742,7 +760,8 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
742
760
|
test 'raise error if plugin registers write_complete callback for udp' do
|
743
761
|
received = ""
|
744
762
|
errors = []
|
745
|
-
|
763
|
+
port = unused_port(protocol: :udp)
|
764
|
+
@d.server_create_udp(:s, port, max_bytes: 128) do |data, sock|
|
746
765
|
received << data
|
747
766
|
begin
|
748
767
|
sock.on(:write_complete){|conn| "" }
|
@@ -751,7 +770,7 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
751
770
|
end
|
752
771
|
end
|
753
772
|
sock = UDPSocket.new(Socket::AF_INET)
|
754
|
-
sock.connect("127.0.0.1",
|
773
|
+
sock.connect("127.0.0.1", port)
|
755
774
|
sock.write "foo\n"
|
756
775
|
sock.close
|
757
776
|
|
@@ -764,7 +783,8 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
764
783
|
test 'raises error if plugin registers close callback for udp' do
|
765
784
|
received = ""
|
766
785
|
errors = []
|
767
|
-
|
786
|
+
port = unused_port(protocol: :udp)
|
787
|
+
@d.server_create_udp(:s, port, max_bytes: 128) do |data, sock|
|
768
788
|
received << data
|
769
789
|
begin
|
770
790
|
sock.on(:close){|d| "" }
|
@@ -773,7 +793,7 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
773
793
|
end
|
774
794
|
end
|
775
795
|
sock = UDPSocket.new(Socket::AF_INET)
|
776
|
-
sock.connect("127.0.0.1",
|
796
|
+
sock.connect("127.0.0.1", port)
|
777
797
|
sock.write "foo\n"
|
778
798
|
sock.close
|
779
799
|
|
@@ -786,11 +806,12 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
786
806
|
test 'can bind IPv4 / IPv6 together' do
|
787
807
|
omit "IPv6 unavailable here" unless ipv6_enabled?
|
788
808
|
|
809
|
+
port = unused_port(protocol: :udp)
|
789
810
|
assert_nothing_raised do
|
790
|
-
@d.server_create_udp(:s_ipv4_udp,
|
811
|
+
@d.server_create_udp(:s_ipv4_udp, port, bind: '0.0.0.0', shared: false, max_bytes: 128) do |data, sock|
|
791
812
|
# ...
|
792
813
|
end
|
793
|
-
@d.server_create_udp(:s_ipv6_udp,
|
814
|
+
@d.server_create_udp(:s_ipv6_udp, port, bind: '::', shared: false, max_bytes: 128) do |data, sock|
|
794
815
|
# ...
|
795
816
|
end
|
796
817
|
end
|
@@ -803,11 +824,12 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
803
824
|
max_bytes, records, expected = data.values
|
804
825
|
|
805
826
|
actual_records = []
|
806
|
-
|
827
|
+
port = unused_port(protocol: :udp)
|
828
|
+
@d.server_create_udp(:myserver, port, max_bytes: max_bytes) do |data, sock|
|
807
829
|
actual_records << data
|
808
830
|
end
|
809
831
|
|
810
|
-
open_client(:udp, "127.0.0.1",
|
832
|
+
open_client(:udp, "127.0.0.1", port) do |sock|
|
811
833
|
records.each do |record|
|
812
834
|
sock.send(record, 0)
|
813
835
|
end
|
@@ -823,11 +845,12 @@ class ServerPluginHelperTest < Test::Unit::TestCase
|
|
823
845
|
max_bytes, records, expected = data.values
|
824
846
|
|
825
847
|
actual_records = []
|
826
|
-
|
848
|
+
port = unused_port(protocol: :udp)
|
849
|
+
@d.server_create_udp(:myserver, port, max_bytes: max_bytes) do |data|
|
827
850
|
actual_records << data
|
828
851
|
end
|
829
852
|
|
830
|
-
open_client(:udp, "127.0.0.1",
|
853
|
+
open_client(:udp, "127.0.0.1", port) do |sock|
|
831
854
|
records.each do |record|
|
832
855
|
sock.send(record, 0)
|
833
856
|
end
|
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
|
+
mock(default_collector).emit_events('test', is_a(OneEventStream)).never
|
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
|
+
mock(filter).filter_stream('test', is_a(OneEventStream)).never
|
205
205
|
event_router.emit('foo', Engine.now, 'k' => 'v')
|
206
206
|
end
|
207
207
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluentd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.16.
|
4
|
+
version: 1.16.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -214,6 +214,20 @@ dependencies:
|
|
214
214
|
- - "<"
|
215
215
|
- !ruby/object:Gem::Version
|
216
216
|
version: '1.24'
|
217
|
+
- !ruby/object:Gem::Dependency
|
218
|
+
name: logger
|
219
|
+
requirement: !ruby/object:Gem::Requirement
|
220
|
+
requirements:
|
221
|
+
- - '='
|
222
|
+
- !ruby/object:Gem::Version
|
223
|
+
version: 1.6.2
|
224
|
+
type: :runtime
|
225
|
+
prerelease: false
|
226
|
+
version_requirements: !ruby/object:Gem::Requirement
|
227
|
+
requirements:
|
228
|
+
- - '='
|
229
|
+
- !ruby/object:Gem::Version
|
230
|
+
version: 1.6.2
|
217
231
|
- !ruby/object:Gem::Dependency
|
218
232
|
name: rake
|
219
233
|
requirement: !ruby/object:Gem::Requirement
|