fluentd 1.9.0.rc2 → 1.9.0

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

Potentially problematic release.


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

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d435419feb5d6622dfcfcaa8e464234a0ba8aa73abd501d61521568982c33736
4
- data.tar.gz: 0a153fdfa008135008379514314c42575495004ba9f7fb49ce6d39c8fa647713
3
+ metadata.gz: 27b8afc3247102ea42612c63559beda8c597b9d5365ea80840e543d6ebd74227
4
+ data.tar.gz: c74a703d9fdca1e392233725c89d26a84bf21d2177ed34b1f9904cca317ece7c
5
5
  SHA512:
6
- metadata.gz: fd0d19edc1817113632a530c931d155a46dce8af3bbc9c2b511c835dcb4ee69397a58e1af297ada745d4882008e58fbddba8beba9eb3f01c88120ffed716059b
7
- data.tar.gz: b57a69591accb5eb39620afe1aeb0fbf39c171a431979349b110b15ad2892424bee5a28c4dbd7aad24ad1d19d3881759b86ca3d3595423e5c8b9004ec0d5d215
6
+ metadata.gz: 4f73b4928035cb3e6246f61ca7d40ce166263b7cbf0543f8d2075cf8b13dcd5db49bc060595a0cb8fbaf68c52dcfe679d829e60e3b304977c0d043d925afe5d8
7
+ data.tar.gz: dba22fde477a7032467f84310d102d315172df9a6e708d278fb16105128a0856294c420eee94c60f33d3df05760f0a63e9240e0407005d1431edebc4b24b961f
@@ -1,6 +1,6 @@
1
1
  # v1.9
2
2
 
3
- ## Unreleased
3
+ ## Release v1.9.0 - 2020/01/22
4
4
 
5
5
  ### New feature
6
6
 
@@ -17,17 +17,25 @@
17
17
  https://github.com/fluent/fluentd/pull/2670
18
18
  * Support Ruby's Time class in msgpack serde
19
19
  https://github.com/fluent/fluentd/pull/2775
20
- * Clean up code
20
+ * Clean up code/test
21
21
  https://github.com/fluent/fluentd/pull/2753
22
22
  https://github.com/fluent/fluentd/pull/2763
23
23
  https://github.com/fluent/fluentd/pull/2764
24
+ https://github.com/fluent/fluentd/pull/2780
24
25
 
25
- ### Bug fixes
26
+ ### Bug fix
26
27
 
28
+ * buffer: Disable the optimization of Metadata instance comparison on Windows
29
+ https://github.com/fluent/fluentd/pull/2778
27
30
  * outut/buffer: Fix stage size computation
28
31
  https://github.com/fluent/fluentd/pull/2734
29
32
  * server: Ignore Errno::EHOSTUNREACH in TLS accept to avoid fluentd restart
30
33
  https://github.com/fluent/fluentd/pull/2773
34
+ * server: Fix IPv6 dual stack mode issue for udp socket
35
+ https://github.com/fluent/fluentd/pull/2781
36
+ * config: Support @include/include directive for spaces included path
37
+ https://github.com/fluent/fluentd/pull/2780
38
+
31
39
 
32
40
  # v1.8
33
41
 
@@ -147,11 +147,13 @@ module Fluent
147
147
  end
148
148
 
149
149
  def eval_include(attrs, elems, uri)
150
- u = URI.parse(uri)
151
- if u.scheme == 'file' || (!u.scheme.nil? && u.scheme.length == 1) || u.path == uri # file path
150
+ # replace space(s)(' ') with '+' to prevent invalid uri due to space(s).
151
+ # See: https://github.com/fluent/fluentd/pull/2780#issuecomment-576081212
152
+ u = URI.parse(uri.gsub(/ /, '+'))
153
+ if u.scheme == 'file' || (!u.scheme.nil? && u.scheme.length == 1) || u.path == uri.gsub(/ /, '+') # file path
152
154
  # When the Windows absolute path then u.scheme.length == 1
153
155
  # e.g. C:
154
- path = u.path
156
+ path = URI.decode_www_form_component(u.path)
155
157
  if path[0] != ?/
156
158
  pattern = File.expand_path("#{@include_basepath}/#{path}")
157
159
  else
@@ -138,9 +138,12 @@ module Fluent
138
138
  # Actually this overhead is very small but this class is generated *per chunk* (and used in hash object).
139
139
  # This means that this class is one of the most called object in Fluentd.
140
140
  # See https://github.com/fluent/fluentd/pull/2560
141
+ # But, this optimization has a side effect on Windows due to differing object_id.
142
+ # This difference causes flood of buffer files.
143
+ # So, this optimization should be enabled on non-Windows platform.
141
144
  def hash
142
145
  timekey.object_id
143
- end
146
+ end unless Fluent.windows?
144
147
  end
145
148
 
146
149
  # for tests
@@ -370,10 +370,10 @@ module Fluent
370
370
  sock = if shared
371
371
  server_socket_manager_client.listen_udp(bind, port)
372
372
  else
373
- family = IPAddr.new(IPSocket.getaddress(bind)).ipv4? ? ::Socket::AF_INET : ::Socket::AF_INET6
374
- usock = UDPSocket.new(family)
375
- usock.bind(bind, port)
376
- usock
373
+ # UDPSocket.new doesn't set IPV6_V6ONLY flag, so use Addrinfo class instead.
374
+ usock = Addrinfo.udp(bind, port).bind
375
+ usock.autoclose = false
376
+ UDPSocket.for_fd(usock.fileno)
377
377
  end
378
378
  # close-on-exec is set by default in Ruby 2.0 or later (, and it's unavailable on Windows)
379
379
  sock.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK) # nonblock
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Fluent
18
18
 
19
- VERSION = '1.9.0.rc2'
19
+ VERSION = '1.9.0'
20
20
 
21
21
  end
@@ -362,55 +362,56 @@ module Fluent::Config
362
362
  # port from test_config.rb
363
363
  sub_test_case '@include parsing' do
364
364
  TMP_DIR = File.dirname(__FILE__) + "/tmp/v1_config#{ENV['TEST_ENV_NUMBER']}"
365
+ TMP_DIR_WITH_SPACES = File.dirname(__FILE__) + "/tmp/folder with spaces/v1_config#{ENV['TEST_ENV_NUMBER']}"
365
366
 
366
367
  def write_config(path, data)
367
368
  FileUtils.mkdir_p(File.dirname(path))
368
369
  File.open(path, "w") { |f| f.write data }
369
370
  end
370
371
 
371
- def prepare_config
372
- write_config "#{TMP_DIR}/config_test_1.conf", %[
372
+ def prepare_config(tmp_dir)
373
+ write_config "#{tmp_dir}/config_test_1.conf", %[
373
374
  k1 root_config
374
375
  include dir/config_test_2.conf #
375
- @include #{TMP_DIR}/config_test_4.conf
376
- include file://#{TMP_DIR}/config_test_5.conf
376
+ @include #{tmp_dir}/config_test_4.conf
377
+ include file://#{tmp_dir}/config_test_5.conf
377
378
  @include config.d/*.conf
378
379
  ]
379
- write_config "#{TMP_DIR}/dir/config_test_2.conf", %[
380
+ write_config "#{tmp_dir}/dir/config_test_2.conf", %[
380
381
  k2 relative_path_include
381
382
  @include ../config_test_3.conf
382
383
  ]
383
- write_config "#{TMP_DIR}/config_test_3.conf", %[
384
+ write_config "#{tmp_dir}/config_test_3.conf", %[
384
385
  k3 relative_include_in_included_file
385
386
  ]
386
- write_config "#{TMP_DIR}/config_test_4.conf", %[
387
+ write_config "#{tmp_dir}/config_test_4.conf", %[
387
388
  k4 absolute_path_include
388
389
  ]
389
- write_config "#{TMP_DIR}/config_test_5.conf", %[
390
+ write_config "#{tmp_dir}/config_test_5.conf", %[
390
391
  k5 uri_include
391
392
  ]
392
- write_config "#{TMP_DIR}/config.d/config_test_6.conf", %[
393
+ write_config "#{tmp_dir}/config.d/config_test_6.conf", %[
393
394
  k6 wildcard_include_1
394
395
  <elem1 name>
395
396
  include normal_parameter
396
397
  </elem1>
397
398
  ]
398
- write_config "#{TMP_DIR}/config.d/config_test_7.conf", %[
399
+ write_config "#{tmp_dir}/config.d/config_test_7.conf", %[
399
400
  k7 wildcard_include_2
400
401
  ]
401
- write_config "#{TMP_DIR}/config.d/config_test_8.conf", %[
402
+ write_config "#{tmp_dir}/config.d/config_test_8.conf", %[
402
403
  <elem2 name>
403
404
  @include ../dir/config_test_9.conf
404
405
  </elem2>
405
406
  ]
406
- write_config "#{TMP_DIR}/dir/config_test_9.conf", %[
407
+ write_config "#{tmp_dir}/dir/config_test_9.conf", %[
407
408
  k9 embedded
408
409
  <elem3 name>
409
410
  nested nested_value
410
411
  include hoge
411
412
  </elem3>
412
413
  ]
413
- write_config "#{TMP_DIR}/config.d/00_config_test_8.conf", %[
414
+ write_config "#{tmp_dir}/config.d/00_config_test_8.conf", %[
414
415
  k8 wildcard_include_3
415
416
  <elem4 name>
416
417
  include normal_parameter
@@ -418,9 +419,11 @@ module Fluent::Config
418
419
  ]
419
420
  end
420
421
 
421
- test 'parses @include / include correctly' do
422
- prepare_config
423
- c = read_config("#{TMP_DIR}/config_test_1.conf")
422
+ data("TMP_DIR without spaces" => TMP_DIR,
423
+ "TMP_DIR with spaces" => TMP_DIR_WITH_SPACES)
424
+ test 'parses @include / include correctly' do |data|
425
+ prepare_config(data)
426
+ c = read_config("#{data}/config_test_1.conf")
424
427
  assert_equal('root_config', c['k1'])
425
428
  assert_equal('relative_path_include', c['k2'])
426
429
  assert_equal('relative_include_in_included_file', c['k3'])
@@ -28,7 +28,7 @@ class ExecInputTest < Test::Unit::TestCase
28
28
 
29
29
  TSV_CONFIG = %[
30
30
  command ruby #{SCRIPT_PATH} "#{TEST_TIME}" 0
31
- run_interval 1s
31
+ run_interval 0.3
32
32
  <parse>
33
33
  @type tsv
34
34
  keys time, tag, k1
@@ -43,7 +43,7 @@ class ExecInputTest < Test::Unit::TestCase
43
43
 
44
44
  JSON_CONFIG = %[
45
45
  command ruby #{SCRIPT_PATH} #{TEST_UNIX_TIME.to_i} 1
46
- run_interval 1s
46
+ run_interval 0.3
47
47
  <parse>
48
48
  @type json
49
49
  </parse>
@@ -56,7 +56,7 @@ class ExecInputTest < Test::Unit::TestCase
56
56
 
57
57
  MSGPACK_CONFIG = %[
58
58
  command ruby #{SCRIPT_PATH} #{TEST_UNIX_TIME.to_i} 2
59
- run_interval 1s
59
+ run_interval 0.3
60
60
  <parse>
61
61
  @type msgpack
62
62
  </parse>
@@ -70,7 +70,7 @@ class ExecInputTest < Test::Unit::TestCase
70
70
  # here document for not de-quoting backslashes
71
71
  REGEXP_CONFIG = %[
72
72
  command ruby #{SCRIPT_PATH} "#{TEST_TIME}" 3
73
- run_interval 1s
73
+ run_interval 0.3
74
74
  tag regex_tag
75
75
  ] + <<'EOC'
76
76
  <parse>
@@ -143,7 +143,7 @@ EOC
143
143
  time_key time
144
144
  tag_key tag
145
145
  time_format %Y-%m-%d %H:%M:%S
146
- run_interval 1s
146
+ run_interval 0.3
147
147
  ]
148
148
 
149
149
  JSON_CONFIG_COMPAT = %[
@@ -151,7 +151,7 @@ EOC
151
151
  format json
152
152
  tag_key tag
153
153
  time_key time
154
- run_interval 1s
154
+ run_interval 0.3
155
155
  ]
156
156
 
157
157
  MSGPACK_CONFIG_COMPAT = %[
@@ -159,14 +159,14 @@ EOC
159
159
  format msgpack
160
160
  tag_key tagger
161
161
  time_key datetime
162
- run_interval 1s
162
+ run_interval 0.3
163
163
  ]
164
164
 
165
165
  REGEXP_CONFIG_COMPAT = %[
166
166
  command ruby #{SCRIPT_PATH} "#{TEST_TIME}" 3
167
167
  format /(?<time>[^\\\]]*) (?<message>[^ ]*)/
168
168
  tag regex_tag
169
- run_interval 1s
169
+ run_interval 0.3
170
170
  ]
171
171
 
172
172
  sub_test_case 'with traditional configuration' do
@@ -235,7 +235,7 @@ EOC
235
235
  d.run(expect_emits: 2, timeout: 10)
236
236
 
237
237
  assert{ d.events.length > 0 }
238
- d.events.each_with_index {|event, i|
238
+ d.events.each {|event|
239
239
  assert_equal_event_time(time, event[1])
240
240
  assert_equal [tag, time, record], event
241
241
  }
@@ -231,10 +231,9 @@ class ForwardInputTest < Test::Unit::TestCase
231
231
  ["tag2", time_i, {"a"=>2}],
232
232
  ]
233
233
 
234
- d.run(expect_records: records.length, timeout: 20) do
234
+ d.run(expect_records: records.length, timeout: 20, shutdown: true) do
235
235
  records.each {|tag, _time, record|
236
236
  send_data [tag, _time, record].to_json + "\n"
237
- sleep 1
238
237
  }
239
238
  end
240
239
 
@@ -727,7 +726,7 @@ class ForwardInputTest < Test::Unit::TestCase
727
726
  events.each {|tag, _time, record|
728
727
  op = { 'chunk' => Base64.encode64(record.object_id.to_s) }
729
728
  expected_acks << op['chunk']
730
- send_data [tag, _time, record, op].to_msgpack, try_to_receive_response: true, **options
729
+ send_data([tag, _time, record, op].to_msgpack, try_to_receive_response: true, response_timeout: 1, **options)
731
730
  }
732
731
  end
733
732
 
@@ -769,7 +768,7 @@ class ForwardInputTest < Test::Unit::TestCase
769
768
  }
770
769
  op = { 'chunk' => Base64.encode64(entries.object_id.to_s) }
771
770
  expected_acks << op['chunk']
772
- send_data ["tag1", entries, op].to_msgpack, try_to_receive_response: true, **options
771
+ send_data(["tag1", entries, op].to_msgpack, try_to_receive_response: true, response_timeout: 1, **options)
773
772
  end
774
773
 
775
774
  assert_equal events, d.events
@@ -809,7 +808,7 @@ class ForwardInputTest < Test::Unit::TestCase
809
808
  }
810
809
  op = { 'chunk' => Base64.encode64(entries.object_id.to_s) }
811
810
  expected_acks << op['chunk']
812
- send_data ["tag1", entries, op].to_msgpack, try_to_receive_response: true, **options
811
+ send_data(["tag1", entries, op].to_msgpack, try_to_receive_response: true, response_timeout: 1, **options)
813
812
  end
814
813
 
815
814
  assert_equal events, d.events
@@ -849,7 +848,7 @@ class ForwardInputTest < Test::Unit::TestCase
849
848
  events.each {|tag, _time, record|
850
849
  op = { 'chunk' => Base64.encode64(record.object_id.to_s) }
851
850
  expected_acks << op['chunk']
852
- send_data [tag, _time, record, op].to_json, try_to_receive_response: true, **options
851
+ send_data([tag, _time, record, op].to_json, try_to_receive_response: true, response_timeout: 1, **options)
853
852
  }
854
853
  end
855
854
 
@@ -885,7 +884,7 @@ class ForwardInputTest < Test::Unit::TestCase
885
884
 
886
885
  d.run(expect_records: events.size, timeout: 20) do
887
886
  events.each {|tag, _time, record|
888
- send_data [tag, _time, record].to_msgpack, try_to_receive_response: true, **options
887
+ send_data([tag, _time, record].to_msgpack, try_to_receive_response: true, response_timeout: 1, **options)
889
888
  }
890
889
  end
891
890
 
@@ -922,7 +921,7 @@ class ForwardInputTest < Test::Unit::TestCase
922
921
  events.each {|tag, _time, record|
923
922
  entries << [_time, record]
924
923
  }
925
- send_data ["tag1", entries].to_msgpack, try_to_receive_response: true, **options
924
+ send_data(["tag1", entries].to_msgpack, try_to_receive_response: true, response_timeout: 1, **options)
926
925
  end
927
926
 
928
927
  assert_equal events, d.events
@@ -958,7 +957,7 @@ class ForwardInputTest < Test::Unit::TestCase
958
957
  events.each {|tag, _time, record|
959
958
  [_time, record].to_msgpack(entries)
960
959
  }
961
- send_data ["tag1", entries].to_msgpack, try_to_receive_response: true, **options
960
+ send_data(["tag1", entries].to_msgpack, try_to_receive_response: true, response_timeout: 1, **options)
962
961
  end
963
962
 
964
963
  assert_equal events, d.events
@@ -994,7 +993,7 @@ class ForwardInputTest < Test::Unit::TestCase
994
993
 
995
994
  d.run(expect_records: events.size, timeout: 20) do
996
995
  events.each {|tag, _time, record|
997
- send_data [tag, _time, record].to_json, try_to_receive_response: true, **options
996
+ send_data([tag, _time, record].to_json, try_to_receive_response: true, response_timeout: 1, **options)
998
997
  }
999
998
  end
1000
999
 
@@ -1016,7 +1015,7 @@ class ForwardInputTest < Test::Unit::TestCase
1016
1015
  # nil: socket read timeout
1017
1016
  def read_data(io, timeout, &block)
1018
1017
  res = ''
1019
- select_timeout = 2
1018
+ select_timeout = 0.5
1020
1019
  clock_id = Process::CLOCK_MONOTONIC_RAW rescue Process::CLOCK_MONOTONIC
1021
1020
  timeout_at = Process.clock_gettime(clock_id) + timeout
1022
1021
  begin
@@ -27,7 +27,7 @@ class ObjectSpaceInputTest < Test::Unit::TestCase
27
27
  end
28
28
 
29
29
  TESTCONFIG = %[
30
- emit_interval 1
30
+ emit_interval 0.2
31
31
  tag t1
32
32
  top 2
33
33
  ]
@@ -38,7 +38,7 @@ class ObjectSpaceInputTest < Test::Unit::TestCase
38
38
 
39
39
  def test_configure
40
40
  d = create_driver
41
- assert_equal 1, d.instance.emit_interval
41
+ assert_equal 0.2, d.instance.emit_interval
42
42
  assert_equal "t1", d.instance.tag
43
43
  assert_equal 2, d.instance.top
44
44
  end
@@ -46,11 +46,7 @@ class ObjectSpaceInputTest < Test::Unit::TestCase
46
46
  def test_emit
47
47
  d = create_driver
48
48
 
49
- d.run do
50
- waiting(10, d.instance) do
51
- sleep 0.5 until d.events.size > 3
52
- end
53
- end
49
+ d.run(expect_emits: 3)
54
50
 
55
51
  emits = d.events
56
52
  assert{ emits.length > 0 }
@@ -460,7 +460,7 @@ class ExecFilterOutputTest < Test::Unit::TestCase
460
460
 
461
461
  CONFIG_ROUND_ROBIN = %[
462
462
  command ruby -e 'STDOUT.sync = true; STDIN.each_line{|line| puts line.chomp + "\t" + Process.pid.to_s }'
463
- num_children 3
463
+ num_children 2
464
464
  <inject>
465
465
  tag_key tag
466
466
  time_key time_in
@@ -489,7 +489,7 @@ class ExecFilterOutputTest < Test::Unit::TestCase
489
489
  out_time_key time_out
490
490
  time_format %Y-%m-%d %H:%M:%S
491
491
  localtime
492
- num_children 3
492
+ num_children 2
493
493
  ]
494
494
 
495
495
  data(
@@ -498,53 +498,38 @@ class ExecFilterOutputTest < Test::Unit::TestCase
498
498
  )
499
499
  test 'using child processes by round robin' do |conf|
500
500
  d = create_driver(conf)
501
- time = event_time("2011-01-02 13:14:15")
501
+ time = event_time('2011-01-02 13:14:15')
502
502
 
503
- d.run(default_tag: 'test', expect_emits: 1, timeout: 10, start: true, shutdown: false){ d.feed(time, {"k1"=>1}) }
504
- d.run(default_tag: 'test', expect_emits: 1, timeout: 10, start: false, shutdown: false){ d.feed(time, {"k1"=>2}) }
505
- d.run(default_tag: 'test', expect_emits: 1, timeout: 10, start: false, shutdown: false){ d.feed(time, {"k1"=>3}) }
506
- d.run(default_tag: 'test', expect_emits: 1, timeout: 10, start: false, shutdown: false){ d.feed(time, {"k1"=>4}) }
507
- d.run(default_tag: 'test', expect_emits: 1, timeout: 10, start: false, shutdown: false){ d.feed(time, {"k1"=>5}) }
508
- d.run(default_tag: 'test', expect_emits: 1, timeout: 10, start: false, shutdown: false){ d.feed(time, {"k1"=>6}) }
509
- d.run(default_tag: 'test', expect_emits: 1, timeout: 10, start: false, shutdown: false){ d.feed(time, {"k1"=>7}) }
510
- d.run(default_tag: 'test', expect_emits: 1, timeout: 10, start: false, shutdown: false){ d.feed(time, {"k1"=>8}) }
511
- d.run(default_tag: 'test', expect_emits: 1, timeout: 10, start: false, shutdown: true ){ d.feed(time, {"k1"=>9}) }
503
+ d.run(default_tag: 'test', expect_emits: 1, timeout: 10, start: true, shutdown: false){ d.feed(time, {"k1" => 0}) }
504
+ d.run(default_tag: 'test', expect_emits: 1, timeout: 10, start: false, shutdown: false){ d.feed(time, {"k1" => 1}) }
505
+ d.run(default_tag: 'test', expect_emits: 1, timeout: 10, start: false, shutdown: false){ d.feed(time, {"k1" => 2}) }
506
+ d.run(default_tag: 'test', expect_emits: 1, timeout: 10, start: false, shutdown: false){ d.feed(time, {"k1" => 3}) }
512
507
 
513
- assert_equal "2011-01-02 13:14:15\ttest\t1\n", d.formatted[0]
514
- assert_equal "2011-01-02 13:14:15\ttest\t2\n", d.formatted[1]
515
- assert_equal "2011-01-02 13:14:15\ttest\t3\n", d.formatted[2]
516
- assert_equal "2011-01-02 13:14:15\ttest\t4\n", d.formatted[3]
517
- assert_equal "2011-01-02 13:14:15\ttest\t5\n", d.formatted[4]
518
- assert_equal "2011-01-02 13:14:15\ttest\t6\n", d.formatted[5]
519
- assert_equal "2011-01-02 13:14:15\ttest\t7\n", d.formatted[6]
520
- assert_equal "2011-01-02 13:14:15\ttest\t8\n", d.formatted[7]
521
- assert_equal "2011-01-02 13:14:15\ttest\t9\n", d.formatted[8]
508
+ assert_equal "2011-01-02 13:14:15\ttest\t0\n", d.formatted[0]
509
+ assert_equal "2011-01-02 13:14:15\ttest\t1\n", d.formatted[1]
510
+ assert_equal "2011-01-02 13:14:15\ttest\t2\n", d.formatted[2]
511
+ assert_equal "2011-01-02 13:14:15\ttest\t3\n", d.formatted[3]
522
512
 
523
513
  events = d.events
524
- assert_equal 9, events.length
514
+ assert_equal 4, events.length
525
515
 
526
516
  pid_list = []
527
517
  events.each do |event|
528
518
  pid = event[2]['child_pid']
529
519
  pid_list << pid unless pid_list.include?(pid)
530
520
  end
531
- assert_equal 3, pid_list.size, "the number of pids should be same with number of child processes: #{pid_list.inspect}"
521
+ assert_equal 2, pid_list.size, "the number of pids should be same with number of child processes: #{pid_list.inspect}"
532
522
 
533
523
  assert_equal pid_list[0], events[0][2]['child_pid']
534
524
  assert_equal pid_list[1], events[1][2]['child_pid']
535
- assert_equal pid_list[2], events[2][2]['child_pid']
536
- assert_equal pid_list[0], events[3][2]['child_pid']
537
- assert_equal pid_list[1], events[4][2]['child_pid']
538
- assert_equal pid_list[2], events[5][2]['child_pid']
539
- assert_equal pid_list[0], events[6][2]['child_pid']
540
- assert_equal pid_list[1], events[7][2]['child_pid']
541
- assert_equal pid_list[2], events[8][2]['child_pid']
525
+ assert_equal pid_list[0], events[2][2]['child_pid']
526
+ assert_equal pid_list[1], events[3][2]['child_pid']
542
527
  end
543
528
 
544
529
  # child process exits per 3 lines
545
530
  CONFIG_RESPAWN = %[
546
531
  command ruby -e 'STDOUT.sync = true; proc = ->(){line = STDIN.readline.chomp; puts line + "\t" + Process.pid.to_s}; proc.call; proc.call; proc.call'
547
- num_children 4
532
+ num_children 2
548
533
  child_respawn -1
549
534
  <inject>
550
535
  tag_key tag
@@ -566,7 +551,7 @@ class ExecFilterOutputTest < Test::Unit::TestCase
566
551
 
567
552
  CONFIG_RESPAWN_COMPAT = %[
568
553
  command ruby -e 'STDOUT.sync = true; proc = ->(){line = STDIN.readline.chomp; puts line + "\t" + Process.pid.to_s}; proc.call; proc.call; proc.call'
569
- num_children 4
554
+ num_children 2
570
555
  child_respawn -1
571
556
  in_keys time_in,tag,k1
572
557
  out_keys time_out,tag,k2,child_pid
@@ -584,35 +569,33 @@ class ExecFilterOutputTest < Test::Unit::TestCase
584
569
  test 'emit events via child processes which exits sometimes' do |conf|
585
570
  d = create_driver(conf)
586
571
  time = event_time("2011-01-02 13:14:15")
587
-
588
572
  countup = 0
589
573
 
590
574
  d.run(start: true, shutdown: false)
575
+ assert_equal 2, d.instance.instance_eval{ @_child_process_processes.size }
591
576
 
592
- assert_equal 4, d.instance.instance_eval{ @_child_process_processes.size }
593
-
594
- 20.times do
595
- d.run(default_tag: 'test', expect_emits: 1, timeout: 10, force_flush_retry: true, start: false, shutdown: false) do
596
- d.feed(time, {"k1"=>countup}); countup += 1
597
- d.feed(time, {"k1"=>countup}); countup += 1
598
- d.feed(time, {"k1"=>countup}); countup += 1
577
+ 2.times do
578
+ d.run(default_tag: 'test', expect_emits: 3, timeout: 3, force_flush_retry: true, start: false, shutdown: false) do
579
+ d.feed(time, { "k1" => countup }); countup += 1
580
+ d.feed(time, { "k1" => countup }); countup += 1
581
+ d.feed(time, { "k1" => countup }); countup += 1
599
582
  end
600
583
  end
601
584
 
602
585
  events = d.events
603
- assert_equal 60, events.length
586
+ assert_equal 6, events.length
604
587
 
605
588
  pid_list = []
606
589
  events.each do |event|
607
590
  pid = event[2]['child_pid']
608
591
  pid_list << pid unless pid_list.include?(pid)
609
592
  end
610
- # the number of pids should be same with number of child processes
611
- assert{ pid_list.size >= 18 }
612
593
 
594
+ # the number of pids should be same with number of child processes
595
+ assert_equal 2, pid_list.size
613
596
  logs = d.instance.log.out.logs
614
- assert{ logs.select{|l| l.include?("child process exits with error code") }.size >= 18 } # 20
615
- assert{ logs.select{|l| l.include?("respawning child process") }.size >= 18 } # 20
597
+ assert_equal 2, logs.select { |l| l.include?('child process exits with error code') }.size
598
+ assert_equal 2, logs.select { |l| l.include?('respawning child process') }.size
616
599
 
617
600
  d.run(start: false, shutdown: true)
618
601
  end
@@ -671,7 +671,7 @@ EOL
671
671
 
672
672
  @d = d = create_driver(CONFIG + %[
673
673
  require_ack_response true
674
- ack_response_timeout 5s
674
+ ack_response_timeout 1s
675
675
  <buffer tag>
676
676
  flush_mode immediate
677
677
  retry_type periodic
@@ -699,7 +699,7 @@ EOL
699
699
  end
700
700
  end
701
701
 
702
- assert_equal (5 + 2), delayed_commit_timeout_value
702
+ assert_equal (1 + 2), delayed_commit_timeout_value
703
703
 
704
704
  events = target_input_driver.events
705
705
  assert_equal ['test', time, records[0]], events[0]
@@ -699,7 +699,7 @@ class BufferedOutputTest < Test::Unit::TestCase
699
699
  r["key#{i}"] = "value #{i}"
700
700
  end
701
701
 
702
- 3.times do |i|
702
+ 2.times do |i|
703
703
  rand_records = rand(1..4)
704
704
  es = Fluent::ArrayEventStream.new([ [t, r] ] * rand_records)
705
705
  assert_equal rand_records, es.size
@@ -141,7 +141,7 @@ class BufferedOutputOverflowTest < Test::Unit::TestCase
141
141
  assert !@i.buffer.storable?
142
142
 
143
143
  Thread.new do
144
- sleep 3
144
+ sleep 1
145
145
  failing = false
146
146
  end
147
147
 
@@ -232,30 +232,26 @@ class ChildProcessTest < Test::Unit::TestCase
232
232
  end
233
233
 
234
234
  test 'can execute external command at just once, which runs forever' do
235
- m = Mutex.new
236
235
  ary = []
237
236
  Timeout.timeout(TEST_DEADLOCK_TIMEOUT) do
238
237
  ran = false
239
- args = ["-e", "while sleep #{TEST_WAIT_INTERVAL_FOR_LOOP}; puts 1; STDOUT.flush; end"]
238
+ args = ["-e", "while sleep 0.1; puts 1; STDOUT.flush; end"]
240
239
  @d.child_process_execute(:t3, "ruby", arguments: args, mode: [:read]) do |io|
241
- m.lock
242
- ran = true
243
240
  begin
244
241
  while @d.child_process_running? && line = io.readline
242
+ ran ||= true
245
243
  ary << line
246
244
  end
247
245
  rescue
248
246
  # ignore
249
- ensure
250
- m.unlock
251
247
  end
252
248
  end
253
- sleep TEST_WAIT_INTERVAL_FOR_BLOCK_RUNNING until m.locked? || ran
254
- sleep TEST_WAIT_INTERVAL_FOR_LOOP * 10
249
+ sleep TEST_WAIT_INTERVAL_FOR_BLOCK_RUNNING until ran
250
+ sleep 1
251
+
255
252
  @d.stop # nothing occurs
256
253
  @d.shutdown
257
-
258
- assert{ ary.size > 5 }
254
+ assert { ary.size >= 4 }
259
255
 
260
256
  @d.close
261
257
 
@@ -272,7 +268,7 @@ class ChildProcessTest < Test::Unit::TestCase
272
268
  ary = []
273
269
  Timeout.timeout(TEST_DEADLOCK_TIMEOUT) do
274
270
  ran = false
275
- @d.child_process_execute(:t4, "ruby -e 'Signal.trap(:TERM, nil); while sleep #{TEST_WAIT_INTERVAL_FOR_LOOP}; puts 1; STDOUT.flush rescue nil; end'", mode: [:read]) do |io|
271
+ @d.child_process_execute(:t4, "ruby -e 'Signal.trap(:TERM, nil); while sleep 0.1; puts 1; STDOUT.flush rescue nil; end'", mode: [:read]) do |io|
276
272
  m.lock
277
273
  ran = true
278
274
  begin
@@ -290,17 +286,17 @@ class ChildProcessTest < Test::Unit::TestCase
290
286
  assert_equal [], @d.log.out.logs
291
287
 
292
288
  @d.stop # nothing occurs
293
- sleep TEST_WAIT_INTERVAL_FOR_LOOP * 5
289
+ sleep TEST_WAIT_INTERVAL_FOR_LOOP
294
290
  lines1 = ary.size
295
291
  assert{ lines1 > 1 }
296
292
 
297
293
  pid = @d._child_process_processes.keys.first
298
-
294
+ # default value 10 is too long for test
295
+ @d.instance_eval { @_child_process_exit_timeout = 1 }
299
296
  @d.shutdown
300
- sleep TEST_WAIT_INTERVAL_FOR_LOOP * 5
297
+ sleep TEST_WAIT_INTERVAL_FOR_LOOP
301
298
  lines2 = ary.size
302
- assert{ lines2 > lines1 }
303
-
299
+ assert { lines2 > lines1 }
304
300
  @d.close
305
301
 
306
302
  assert_nil((Process.waitpid(pid, Process::WNOHANG) rescue nil))
@@ -318,12 +314,12 @@ class ChildProcessTest < Test::Unit::TestCase
318
314
 
319
315
  test 'can execute external command many times, which finishes immediately' do
320
316
  ary = []
321
- arguments = ["-e", "3.times{ puts 'okay'; STDOUT.flush rescue nil; sleep #{TEST_WAIT_INTERVAL_FOR_LOOP} }"] # 0.5 * 3
317
+ arguments = ["-e", "puts 'okay'; STDOUT.flush rescue nil"]
322
318
  Timeout.timeout(TEST_DEADLOCK_TIMEOUT) do
323
- @d.child_process_execute(:t5, "ruby", arguments: arguments, interval: 5, mode: [:read]) do |io|
319
+ @d.child_process_execute(:t5, "ruby", arguments: arguments, interval: 1, mode: [:read]) do |io|
324
320
  ary << io.read.split("\n").map(&:chomp).join
325
321
  end
326
- sleep 13 # 5sec * 2 + 3sec
322
+ sleep 2.5 # 2sec(second invocation) + 0.5sec
327
323
  assert_equal [], @d.log.out.logs
328
324
  @d.stop
329
325
  assert_equal [], @d.log.out.logs
@@ -334,13 +330,12 @@ class ChildProcessTest < Test::Unit::TestCase
334
330
 
335
331
  test 'can execute external command many times, with leading once executed immediately' do
336
332
  ary = []
337
- arguments = ["-e", "3.times{ puts 'okay'; STDOUT.flush rescue nil; sleep #{TEST_WAIT_INTERVAL_FOR_LOOP} }"]
333
+ arguments = ["-e", "puts 'okay'; STDOUT.flush rescue nil"]
338
334
  Timeout.timeout(TEST_DEADLOCK_TIMEOUT) do
339
- @d.child_process_execute(:t6, "ruby", arguments: arguments, interval: 5, immediate: true, mode: [:read]) do |io|
335
+ @d.child_process_execute(:t6, "ruby", arguments: arguments, interval: 1, immediate: true, mode: [:read]) do |io|
340
336
  ary << io.read.split("\n").map(&:chomp).join
341
337
  end
342
- sleep 8 # 5sec * 1 + 3sec
343
- # but expected lines are same with test above
338
+ sleep 1.5 # 2sec(second invocation) + 0.5sec
344
339
  @d.stop; @d.shutdown; @d.close; @d.terminate
345
340
  assert_equal 2, ary.size
346
341
  assert_equal [], @d.log.out.logs
@@ -349,7 +344,7 @@ class ChildProcessTest < Test::Unit::TestCase
349
344
 
350
345
  test 'does not execute long running external command in parallel in default' do
351
346
  ary = []
352
- arguments = ["-e", "10.times{ puts 'okay'; STDOUT.flush rescue nil; sleep #{TEST_WAIT_INTERVAL_FOR_LOOP} }"] # 0.5 * 10
347
+ arguments = ["-e", "10.times{ sleep #{TEST_WAIT_INTERVAL_FOR_LOOP} }"] # 5 sec
353
348
  Timeout.timeout(TEST_DEADLOCK_TIMEOUT) do
354
349
  assert_equal [], @d.log.out.logs
355
350
  @d.log.out.singleton_class.module_eval do
@@ -359,13 +354,13 @@ class ChildProcessTest < Test::Unit::TestCase
359
354
  }
360
355
  end
361
356
 
362
- @d.child_process_execute(:t7, "ruby", arguments: arguments, interval: 2, immediate: true, mode: [:read]) do |io|
357
+ @d.child_process_execute(:t7, "ruby", arguments: arguments, interval: 1, immediate: true, mode: [:read]) do |io|
363
358
  ary << io.read.split("\n").map(&:chomp).join
364
359
  end
365
- sleep 4
360
+ sleep 2
366
361
  assert_equal 1, @d._child_process_processes.size
367
362
  @d.stop
368
- warn_msg = '[warn]: previous child process is still running. skipped. title=:t7 command="ruby" arguments=["-e", "10.times{ puts \'okay\'; STDOUT.flush rescue nil; sleep 0.5 }"] interval=2 parallel=false' + "\n"
363
+ warn_msg = '[warn]: previous child process is still running. skipped. title=:t7 command="ruby" arguments=["-e", "10.times{ sleep 0.5 }"] interval=1 parallel=false' + "\n"
369
364
  logs = @d.log.out.logs
370
365
  assert{ logs.first.end_with?(warn_msg) }
371
366
  assert{ logs.all?{|line| line.end_with?(warn_msg) } }
@@ -376,14 +371,14 @@ class ChildProcessTest < Test::Unit::TestCase
376
371
 
377
372
  test 'can execute long running external command in parallel if specified' do
378
373
  ary = []
379
- arguments = ["-e", "10.times{ puts 'okay'; STDOUT.flush rescue nil; sleep #{TEST_WAIT_INTERVAL_FOR_LOOP} }"] # 0.5 * 10 sec
374
+ arguments = ["-e", "10.times{ puts 'okay'; STDOUT.flush rescue nil; sleep #{TEST_WAIT_INTERVAL_FOR_LOOP} }"] # 5 sec
380
375
  Timeout.timeout(TEST_DEADLOCK_TIMEOUT) do
381
376
  @d.child_process_execute(:t8, "ruby", arguments: arguments, interval: 1, immediate: true, parallel: true, mode: [:read]) do |io|
382
377
  ary << io.read.split("\n").map(&:chomp).join
383
378
  end
384
- sleep 4
379
+ sleep 2
385
380
  processes = @d._child_process_processes.size
386
- assert{ processes >= 3 && processes <= 5 }
381
+ assert { processes >= 2 && processes <= 4 }
387
382
  @d.stop; @d.shutdown; @d.close; @d.terminate
388
383
  assert_equal [], @d.log.out.logs
389
384
  end
@@ -662,14 +657,14 @@ class ChildProcessTest < Test::Unit::TestCase
662
657
  block_exits = false
663
658
  callback_called = false
664
659
  exit_status = nil
665
- args = ['-e', 'sleep ARGV[0].to_i; puts "yay"; File.unlink ARGV[1]', '1', @temp_path]
660
+ args = ['-e', 'puts "yay"; File.unlink ARGV[0]', @temp_path]
666
661
  cb = ->(status){ exit_status = status; callback_called = true }
667
662
 
668
663
  str = nil
669
-
670
664
  pid = nil
671
665
  @d.child_process_execute(:st1, "ruby", arguments: args, mode: [:read], on_exit_callback: cb) do |readio|
672
- pid = @d.instance_eval{ child_process_id }
666
+ assert !callback_called # ensure yet to be called
667
+ pid = @d.instance_eval { child_process_id }
673
668
  str = readio.read.chomp
674
669
  block_exits = true
675
670
  end
@@ -697,16 +692,11 @@ class ChildProcessTest < Test::Unit::TestCase
697
692
  cb = ->(status){ exit_status = status; callback_called = true }
698
693
 
699
694
  str = nil
700
-
701
695
  pid = nil
702
696
  @d.child_process_execute(:st1, "ruby", arguments: args, mode: [:read], on_exit_callback: cb) do |readio|
703
- pid = @d.instance_eval{ child_process_id }
704
- sleep 10 # to run child process correctly
705
- Process.kill(:QUIT, pid)
697
+ pid = @d.instance_eval { child_process_id }
706
698
  sleep 1
707
- Process.kill(:QUIT, pid) rescue nil # once more to send kill
708
- sleep 1
709
- Process.kill(:QUIT, pid) rescue nil # just like sync
699
+ Process.kill(:QUIT, pid)
710
700
  str = readio.read.chomp rescue nil # empty string before EOF
711
701
  block_exits = true
712
702
  end
@@ -717,29 +707,28 @@ class ChildProcessTest < Test::Unit::TestCase
717
707
  assert callback_called
718
708
  assert exit_status
719
709
 
720
- # This test sometimes fails on TravisCI
721
- # with [nil, 11] # SIGSEGV
722
- # or with [1, nil] # ???
723
- assert_equal [nil, 3, true, ""], [exit_status.exitstatus, exit_status.termsig, File.exist?(@temp_path), str] # SIGQUIT
724
- # SIGSEGV looks a kind of BUG of ruby...
710
+ assert_equal nil, exit_status.exitstatus
711
+ assert_equal 3, exit_status.termsig
712
+ assert File.exist?(@temp_path)
713
+ assert_equal '', str
725
714
  end
726
715
 
727
716
  test 'calls on_exit_callback for each process exits for interval call using on_exit_callback' do
728
717
  read_data_list = []
729
718
  exit_status_list = []
730
719
 
731
- args = ['-e', 'puts "yay"', '1']
720
+ args = ['-e', 'puts "yay"']
732
721
  cb = ->(status){ exit_status_list << status }
733
722
 
734
723
  Timeout.timeout(TEST_DEADLOCK_TIMEOUT) do
735
- @d.child_process_execute(:st1, "ruby", arguments: args, immediate: true, interval: 2, mode: [:read], on_exit_callback: cb) do |readio|
724
+ @d.child_process_execute(:st1, "ruby", arguments: args, immediate: true, interval: 1, mode: [:read], on_exit_callback: cb) do |readio|
736
725
  read_data_list << readio.read.chomp
737
726
  end
738
- sleep 10
727
+ sleep 2
739
728
  end
740
729
 
741
- assert{ read_data_list.size >= 3 }
742
- assert{ exit_status_list.size >= 3 }
730
+ assert { read_data_list.size >= 2 }
731
+ assert { exit_status_list.size >= 2 }
743
732
  end
744
733
 
745
734
  test 'waits lasting child process until wait_timeout if block is not specified' do
@@ -747,11 +736,11 @@ class ChildProcessTest < Test::Unit::TestCase
747
736
 
748
737
  callback_called = false
749
738
  exit_status = nil
750
- args = ['-e', 'sleep ARGV[0].to_i; File.unlink ARGV[1]', '1', @temp_path]
739
+ args = ['-e', 'File.unlink ARGV[0]', @temp_path]
751
740
  cb = ->(status){ exit_status = status; callback_called = true }
752
741
 
753
742
  Timeout.timeout(TEST_DEADLOCK_TIMEOUT) do
754
- @d.child_process_execute(:t17, "ruby", arguments: args, on_exit_callback: cb, wait_timeout: 5)
743
+ @d.child_process_execute(:t17, "ruby", arguments: args, on_exit_callback: cb, wait_timeout: 2)
755
744
  sleep TEST_WAIT_INTERVAL_FOR_BLOCK_RUNNING until callback_called
756
745
  end
757
746
 
@@ -766,7 +755,7 @@ class ChildProcessTest < Test::Unit::TestCase
766
755
 
767
756
  callback_called = false
768
757
  exit_status = nil
769
- args = ['-e', 'sleep ARGV[0].to_i; File.unlink ARGV[1]', '3', @temp_path]
758
+ args = ['-e', 'File.unlink ARGV[0]', @temp_path]
770
759
  cb = ->(status){ exit_status = status; callback_called = true }
771
760
 
772
761
  Timeout.timeout(TEST_DEADLOCK_TIMEOUT) do
@@ -791,7 +780,7 @@ class ChildProcessTest < Test::Unit::TestCase
791
780
  cb = ->(status){ exit_status = status; callback_called = true }
792
781
 
793
782
  Timeout.timeout(TEST_DEADLOCK_TIMEOUT) do
794
- @d.child_process_execute(:t17, "ruby", arguments: args, on_exit_callback: cb, wait_timeout: 3)
783
+ @d.child_process_execute(:t17, "ruby", arguments: args, on_exit_callback: cb, wait_timeout: 1)
795
784
  sleep TEST_WAIT_INTERVAL_FOR_BLOCK_RUNNING until callback_called
796
785
  end
797
786
 
@@ -813,8 +802,8 @@ class ChildProcessTest < Test::Unit::TestCase
813
802
  cb = ->(status){ exit_status = status; callback_called = true }
814
803
 
815
804
  Timeout.timeout(TEST_DEADLOCK_TIMEOUT) do
816
- @d.child_process_execute(:t17, "ruby", arguments: args, mode: nil, on_exit_callback: cb, wait_timeout: 3) do
817
- sleep 3
805
+ @d.child_process_execute(:t17, "ruby", arguments: args, mode: nil, on_exit_callback: cb, wait_timeout: 1) do
806
+ sleep 1
818
807
  end
819
808
  sleep TEST_WAIT_INTERVAL_FOR_BLOCK_RUNNING until callback_called
820
809
  end
@@ -751,6 +751,19 @@ class ServerPluginHelperTest < Test::Unit::TestCase
751
751
  assert_equal 1, errors.size
752
752
  assert_equal "BUG: this event is disabled for udp: close", errors.first.message
753
753
  end
754
+
755
+ test 'can bind IPv4 / IPv6 together' do
756
+ omit "IPv6 unavailable here" unless ipv6_enabled?
757
+
758
+ assert_nothing_raised do
759
+ @d.server_create_udp(:s_ipv4_udp, PORT, bind: '0.0.0.0', shared: false, max_bytes: 128) do |data, sock|
760
+ # ...
761
+ end
762
+ @d.server_create_udp(:s_ipv6_udp, PORT, bind: '::', shared: false, max_bytes: 128) do |data, sock|
763
+ # ...
764
+ end
765
+ end
766
+ end
754
767
  end
755
768
 
756
769
  module CertUtil
@@ -34,12 +34,12 @@ class TimerTest < Test::Unit::TestCase
34
34
  counter += 1
35
35
  end
36
36
 
37
- sleep 5
37
+ sleep 2
38
38
 
39
39
  d1.stop
40
40
  assert !d1.timer_running?
41
41
 
42
- assert{ counter >= 3 && counter <= 6 }
42
+ assert{ counter >= 1 && counter <= 2 }
43
43
 
44
44
  d1.shutdown; d1.close; d1.terminate
45
45
  end
@@ -52,19 +52,18 @@ class TimerTest < Test::Unit::TestCase
52
52
  counter1 = 0
53
53
  counter2 = 0
54
54
 
55
- d1.timer_execute(:t1, 1) do
55
+ d1.timer_execute(:t1, 0.2) do
56
56
  counter1 += 1
57
57
  end
58
- d1.timer_execute(:t2, 2) do
58
+ d1.timer_execute(:t2, 0.2) do
59
59
  counter2 += 1
60
60
  end
61
61
 
62
- sleep 6
63
-
62
+ sleep 1
64
63
  d1.stop
65
64
 
66
- assert{ counter1 >= 4 && counter1 <= 7 }
67
- assert{ counter2 >= 2 && counter2 <= 4 }
65
+ assert{ counter1 >= 4 && counter1 <= 5 }
66
+ assert{ counter2 >= 4 && counter2 <= 5 }
68
67
 
69
68
  d1.shutdown; d1.close; d1.terminate
70
69
  end
@@ -77,19 +76,18 @@ class TimerTest < Test::Unit::TestCase
77
76
  counter1 = 0
78
77
  counter2 = 0
79
78
 
80
- d1.timer_execute(:t1, 1) do
79
+ d1.timer_execute(:t1, 0.2) do
81
80
  counter1 += 1
82
81
  end
83
- d1.timer_execute(:t2, 1) do
82
+ d1.timer_execute(:t2, 0.2) do
84
83
  raise "abort!!!!!!" if counter2 > 1
85
84
  counter2 += 1
86
85
  end
87
86
 
88
- sleep 5
89
-
87
+ sleep 1
90
88
  d1.stop
91
89
 
92
- assert{ counter1 >= 3 && counter1 <= 6 }
90
+ assert{ counter1 >= 4 && counter1 <= 5 }
93
91
  assert{ counter2 == 2 }
94
92
  msg = "Unexpected error raised. Stopping the timer. title=:t2"
95
93
  assert{ d1.log.out.logs.any?{|line| line.include?("[error]:") && line.include?(msg) && line.include?("abort!!!!!!") } }
@@ -176,6 +176,9 @@ class SupervisorTest < ::Test::Unit::TestCase
176
176
  log_level debug
177
177
  </system>
178
178
  ]
179
+ now = Time.now
180
+ Timecop.freeze(now)
181
+
179
182
  write_config tmp_dir, conf_info_str
180
183
 
181
184
  params = {}
@@ -208,7 +211,7 @@ class SupervisorTest < ::Test::Unit::TestCase
208
211
  assert_nil pre_config_mtime
209
212
  assert_nil pre_loadtime
210
213
 
211
- sleep 5
214
+ Timecop.freeze(now + 5)
212
215
 
213
216
  # third call after 5 seconds(don't reuse config)
214
217
  se_config = load_config_proc.call
@@ -228,6 +231,8 @@ class SupervisorTest < ::Test::Unit::TestCase
228
231
  # fifth call after changed conf file(don't reuse config)
229
232
  se_config = load_config_proc.call
230
233
  assert_equal Fluent::Log::LEVEL_INFO, se_config[:log_level]
234
+ ensure
235
+ Timecop.return
231
236
  end
232
237
 
233
238
  def test_load_config_for_daemonize
@@ -242,6 +247,10 @@ class SupervisorTest < ::Test::Unit::TestCase
242
247
  log_level debug
243
248
  </system>
244
249
  ]
250
+
251
+ now = Time.now
252
+ Timecop.freeze(now)
253
+
245
254
  write_config tmp_dir, conf_info_str
246
255
 
247
256
  params = {}
@@ -275,9 +284,9 @@ class SupervisorTest < ::Test::Unit::TestCase
275
284
  assert_nil pre_config_mtime
276
285
  assert_nil pre_loadtime
277
286
 
278
- sleep 5
287
+ Timecop.freeze(now + 5)
279
288
 
280
- # third call after 5 seconds(don't reuse config)
289
+ # third call after 6 seconds(don't reuse config)
281
290
  se_config = load_config_proc.call
282
291
  pre_config_mtime = se_config[:windows_daemon_cmdline][5]['pre_config_mtime']
283
292
  pre_loadtime = se_config[:windows_daemon_cmdline][5]['pre_loadtime']
@@ -295,6 +304,8 @@ class SupervisorTest < ::Test::Unit::TestCase
295
304
  # fifth call after changed conf file(don't reuse config)
296
305
  se_config = load_config_proc.call
297
306
  assert_equal Fluent::Log::LEVEL_INFO, se_config[:log_level]
307
+ ensure
308
+ Timecop.return
298
309
  end
299
310
 
300
311
  def test_logger
@@ -47,8 +47,8 @@ class TestDriverTest < ::Test::Unit::TestCase
47
47
  driver_class, plugin_class = args
48
48
  d = driver_class.new(Class.new(plugin_class))
49
49
  assert_raise Fluent::Test::Driver::TestTimedOut do
50
- d.run(timeout: 1) do
51
- sleep 5
50
+ d.run(timeout: 0.5) do
51
+ sleep 2
52
52
  end
53
53
  end
54
54
  end
@@ -67,7 +67,7 @@ class TestDriverTest < ::Test::Unit::TestCase
67
67
  assert_nothing_raised do
68
68
  before = Process.clock_gettime(Process::CLOCK_MONOTONIC)
69
69
  d.end_if{ false }
70
- d.run(timeout: 5) do
70
+ d.run(timeout: 1) do
71
71
  sleep 0.1 until d.stop?
72
72
  end
73
73
  after = Process.clock_gettime(Process::CLOCK_MONOTONIC)
@@ -89,6 +89,7 @@ class TestDriverTest < ::Test::Unit::TestCase
89
89
  end
90
90
  end
91
91
  end
92
+
92
93
  assert_raise RuntimeError.new("yaaaaaaaaaay!") do
93
94
  d.end_if{ false }
94
95
  d.run(timeout: 3) do
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.9.0.rc2
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-15 00:00:00.000000000 Z
11
+ date: 2020-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -848,9 +848,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
848
848
  version: '2.4'
849
849
  required_rubygems_version: !ruby/object:Gem::Requirement
850
850
  requirements:
851
- - - ">"
851
+ - - ">="
852
852
  - !ruby/object:Gem::Version
853
- version: 1.3.1
853
+ version: '0'
854
854
  requirements: []
855
855
  rubygems_version: 3.0.3
856
856
  signing_key: