fluentd 0.14.10-x64-mingw32 → 0.14.11-x64-mingw32

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.

Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +14 -6
  3. data/ChangeLog +28 -2
  4. data/appveyor.yml +1 -0
  5. data/lib/fluent/engine.rb +4 -7
  6. data/lib/fluent/error.rb +30 -0
  7. data/lib/fluent/log.rb +0 -7
  8. data/lib/fluent/plugin/base.rb +11 -0
  9. data/lib/fluent/plugin/buf_file.rb +9 -7
  10. data/lib/fluent/plugin/formatter_csv.rb +4 -2
  11. data/lib/fluent/plugin/in_forward.rb +46 -17
  12. data/lib/fluent/plugin/in_http.rb +2 -0
  13. data/lib/fluent/plugin/in_monitor_agent.rb +27 -2
  14. data/lib/fluent/plugin/in_syslog.rb +52 -36
  15. data/lib/fluent/plugin/in_tail.rb +1 -0
  16. data/lib/fluent/plugin/out_forward.rb +39 -29
  17. data/lib/fluent/plugin/output.rb +17 -0
  18. data/lib/fluent/plugin/storage_local.rb +16 -13
  19. data/lib/fluent/plugin_helper/storage.rb +21 -9
  20. data/lib/fluent/plugin_id.rb +17 -0
  21. data/lib/fluent/supervisor.rb +73 -45
  22. data/lib/fluent/system_config.rb +24 -21
  23. data/lib/fluent/version.rb +1 -1
  24. data/test/command/test_fluentd.rb +348 -0
  25. data/test/config/test_system_config.rb +39 -31
  26. data/test/plugin/test_base.rb +20 -0
  27. data/test/plugin/test_buf_file.rb +40 -0
  28. data/test/plugin/test_formatter_csv.rb +8 -0
  29. data/test/plugin/test_in_forward.rb +56 -21
  30. data/test/plugin/test_in_monitor_agent.rb +80 -8
  31. data/test/plugin/test_in_syslog.rb +75 -45
  32. data/test/plugin/test_out_file.rb +0 -1
  33. data/test/plugin/test_out_forward.rb +19 -11
  34. data/test/plugin/test_output.rb +44 -0
  35. data/test/plugin/test_storage_local.rb +290 -2
  36. data/test/plugin_helper/test_child_process.rb +40 -39
  37. data/test/plugin_helper/test_storage.rb +4 -3
  38. data/test/test_log.rb +1 -1
  39. data/test/test_output.rb +3 -0
  40. data/test/test_plugin_id.rb +101 -0
  41. data/test/test_supervisor.rb +3 -0
  42. metadata +7 -2
@@ -23,6 +23,7 @@ class ChildProcessTest < Test::Unit::TestCase
23
23
  @d.shutdown unless @d.shutdown?
24
24
  @d.close unless @d.closed?
25
25
  @d.terminate unless @d.terminated?
26
+ @d.log.reset
26
27
  end
27
28
  end
28
29
 
@@ -226,55 +227,55 @@ class ChildProcessTest < Test::Unit::TestCase
226
227
  end
227
228
  end
228
229
 
229
- unless Fluent.windows?
230
- # In windows environment, child_process try KILL at first (because there's no SIGTERM)
231
- test 'can execute external command just once, and can terminate it forcedly when shutdown/terminate even if it ignore SIGTERM' do
232
- m = Mutex.new
233
- ary = []
234
- Timeout.timeout(TEST_DEADLOCK_TIMEOUT) do
235
- ran = false
236
- @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|
237
- m.lock
238
- ran = true
239
- begin
240
- while line = io.readline
241
- ary << line
242
- end
243
- rescue
244
- # ignore
245
- ensure
246
- m.unlock
230
+ # In windows environment, child_process try KILL at first (because there's no SIGTERM)
231
+ test 'can execute external command just once, and can terminate it forcedly when shutdown/terminate even if it ignore SIGTERM' do
232
+ omit "SIGTERM is unavailable on Windows" if Fluent.windows?
233
+
234
+ m = Mutex.new
235
+ ary = []
236
+ Timeout.timeout(TEST_DEADLOCK_TIMEOUT) do
237
+ ran = false
238
+ @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|
239
+ m.lock
240
+ ran = true
241
+ begin
242
+ while line = io.readline
243
+ ary << line
247
244
  end
245
+ rescue
246
+ # ignore
247
+ ensure
248
+ m.unlock
248
249
  end
249
- sleep TEST_WAIT_INTERVAL_FOR_BLOCK_RUNNING until m.locked? || ran
250
+ end
251
+ sleep TEST_WAIT_INTERVAL_FOR_BLOCK_RUNNING until m.locked? || ran
250
252
 
251
- assert_equal [], @d.log.out.logs
253
+ assert_equal [], @d.log.out.logs
252
254
 
253
- @d.stop # nothing occurs
254
- sleep TEST_WAIT_INTERVAL_FOR_LOOP * 5
255
- lines1 = ary.size
256
- assert{ lines1 > 1 }
255
+ @d.stop # nothing occurs
256
+ sleep TEST_WAIT_INTERVAL_FOR_LOOP * 5
257
+ lines1 = ary.size
258
+ assert{ lines1 > 1 }
257
259
 
258
- pid = @d._child_process_processes.keys.first
260
+ pid = @d._child_process_processes.keys.first
259
261
 
260
- @d.shutdown
261
- sleep TEST_WAIT_INTERVAL_FOR_LOOP * 5
262
- lines2 = ary.size
263
- assert{ lines2 > lines1 }
262
+ @d.shutdown
263
+ sleep TEST_WAIT_INTERVAL_FOR_LOOP * 5
264
+ lines2 = ary.size
265
+ assert{ lines2 > lines1 }
264
266
 
265
- @d.close
267
+ @d.close
266
268
 
267
- assert_nil((Process.waitpid(pid, Process::WNOHANG) rescue nil))
269
+ assert_nil((Process.waitpid(pid, Process::WNOHANG) rescue nil))
268
270
 
269
- @d.terminate
270
- assert @d._child_process_processes.empty?
271
- begin
272
- Process.waitpid(pid)
273
- rescue Errno::ECHILD
274
- end
275
- # Process successfully KILLed if test reaches here
276
- assert true
271
+ @d.terminate
272
+ assert @d._child_process_processes.empty?
273
+ begin
274
+ Process.waitpid(pid)
275
+ rescue Errno::ECHILD
277
276
  end
277
+ # Process successfully KILLed if test reaches here
278
+ assert true
278
279
  end
279
280
  end
280
281
 
@@ -102,7 +102,8 @@ class StorageHelperTest < Test::Unit::TestCase
102
102
  test 'can override default configuration parameters, but not overwrite whole definition' do
103
103
  d = Dummy.new
104
104
  d.configure(config_element())
105
- assert_equal [], d.storage_configs
105
+ assert_equal 1, d.storage_configs.size
106
+ assert_equal 'local', d.storage_configs.first[:@type]
106
107
 
107
108
  d = Dummy2.new
108
109
  d.configure(config_element('ROOT', '', {}, [config_element('storage', '', {}, [])]))
@@ -130,7 +131,7 @@ class StorageHelperTest < Test::Unit::TestCase
130
131
  d = Dummy2.new
131
132
  d.configure(config_element())
132
133
  assert_raise Fluent::ConfigError.new("@type is required in <storage>") do
133
- d.storage_create(conf: config_element('storage', '', {}), default_type: 'ex2')
134
+ d.storage_create(conf: config_element('storage', 'foo', {}), default_type: 'ex2')
134
135
  end
135
136
  end
136
137
 
@@ -139,7 +140,7 @@ class StorageHelperTest < Test::Unit::TestCase
139
140
  assert_nothing_raised do
140
141
  d.configure(config_element())
141
142
  end
142
- assert_equal 0, d._storages.size
143
+ assert_equal 1, d._storages.size
143
144
  end
144
145
 
145
146
  test 'can be configured with a storage section' do
data/test/test_log.rb CHANGED
@@ -643,7 +643,7 @@ class PluginLoggerMixinTest < Test::Unit::TestCase
643
643
 
644
644
  def test_start
645
645
  plugin = DummyPlugin.new
646
- mock(plugin.log).reset
646
+ mock(plugin.log).should_receive(:reset).never
647
647
  plugin.start
648
648
  end
649
649
 
data/test/test_output.rb CHANGED
@@ -246,6 +246,9 @@ module FluentOutputTest
246
246
  d.instance.after_start
247
247
  d.instance.emit_events('test', OneEventStream.new(event_time("2016-11-08 17:44:30 +0900"), {"message" => "yay"}))
248
248
  d.instance.force_flush
249
+ waiting(10) do
250
+ sleep 0.1 until d.instance.written_chunk_keys.size == 1
251
+ end
249
252
  assert_equal [], d.instance.errors_in_write
250
253
  assert_equal ["2016110808"], d.instance.written_chunk_keys # default timezone is UTC
251
254
  end
@@ -0,0 +1,101 @@
1
+ require_relative 'helper'
2
+ require 'fluent/plugin/base'
3
+ require 'fluent/system_config'
4
+ require 'fileutils'
5
+
6
+ class PluginIdTest < Test::Unit::TestCase
7
+ TMP_DIR = File.expand_path(File.dirname(__FILE__) + "/tmp/plugin_id/#{ENV['TEST_ENV_NUMBER']}")
8
+
9
+ class MyPlugin < Fluent::Plugin::Base
10
+ include Fluent::PluginId
11
+ end
12
+
13
+ setup do
14
+ @p = MyPlugin.new
15
+ end
16
+
17
+ sub_test_case '#plugin_id_for_test?' do
18
+ test 'returns true always in test files' do
19
+ assert @p.plugin_id_for_test?
20
+ end
21
+
22
+ test 'returns false always out of test files' do
23
+ # TODO: no good way to write this test....
24
+ end
25
+ end
26
+
27
+ sub_test_case 'configured without @id' do
28
+ setup do
29
+ @p.configure(config_element())
30
+ end
31
+
32
+ test '#plugin_id_configured? returns false' do
33
+ assert_false @p.plugin_id_configured?
34
+ end
35
+
36
+ test '#plugin_id returns object_id based string' do
37
+ assert_kind_of String, @p.plugin_id
38
+ assert @p.plugin_id =~ /^object:[0-9a-f]+/
39
+ end
40
+
41
+ test '#plugin_root_dir returns nil' do
42
+ assert_nil @p.plugin_root_dir
43
+ end
44
+ end
45
+
46
+ sub_test_case 'configured with @id' do
47
+ setup do
48
+ FileUtils.rm_rf(TMP_DIR)
49
+ FileUtils.mkdir_p(TMP_DIR)
50
+ @p.configure(config_element('ROOT', '', {'@id' => 'testing_plugin_id'}))
51
+ end
52
+
53
+ test '#plugin_id_configured? returns true' do
54
+ assert @p.plugin_id_configured?
55
+ end
56
+
57
+ test '#plugin_id returns the configured value' do
58
+ assert_equal 'testing_plugin_id', @p.plugin_id
59
+ end
60
+
61
+ test '#plugin_root_dir returns nil without system root directory configuration' do
62
+ assert_nil @p.plugin_root_dir
63
+ end
64
+
65
+ test '#plugin_root_dir returns an existing directory path frozen String' do
66
+ root_dir = Fluent::SystemConfig.overwrite_system_config('root_dir' => File.join(TMP_DIR, "myroot")) do
67
+ @p.plugin_root_dir
68
+ end
69
+ assert_kind_of String, root_dir
70
+ assert Dir.exist?(root_dir)
71
+ assert root_dir =~ %r!/worker0/!
72
+ assert root_dir.frozen?
73
+ end
74
+
75
+ test '#plugin_root_dir returns the same value for 2nd or more call' do
76
+ root_dir = Fluent::SystemConfig.overwrite_system_config('root_dir' => File.join(TMP_DIR, "myroot")) do
77
+ @p.plugin_root_dir
78
+ end
79
+ twice = Fluent::SystemConfig.overwrite_system_config('root_dir' => File.join(TMP_DIR, "myroot")) do
80
+ @p.plugin_root_dir
81
+ end
82
+ assert_equal root_dir.object_id, twice.object_id
83
+ end
84
+
85
+ test '#plugin_root_dir referres SERVERENGINE_WORKER_ID environment path to create it' do
86
+ prev_env_val = ENV['SERVERENGINE_WORKER_ID']
87
+ begin
88
+ ENV['SERVERENGINE_WORKER_ID'] = '7'
89
+ root_dir = Fluent::SystemConfig.overwrite_system_config('root_dir' => File.join(TMP_DIR, "myroot")) do
90
+ @p.plugin_root_dir
91
+ end
92
+ assert_kind_of String, root_dir
93
+ assert Dir.exist?(root_dir)
94
+ assert root_dir =~ %r!/worker7/!
95
+ assert root_dir.frozen?
96
+ ensure
97
+ ENV['SERVERENGINE_WORKER_ID'] = prev_env_val
98
+ end
99
+ end
100
+ end
101
+ end
@@ -15,6 +15,7 @@ class SupervisorTest < ::Test::Unit::TestCase
15
15
  include WorkerModule
16
16
 
17
17
  TMP_DIR = File.expand_path(File.dirname(__FILE__) + "/tmp/supervisor#{ENV['TEST_ENV_NUMBER']}")
18
+ TMP_ROOT_DIR = File.join(TMP_DIR, 'root')
18
19
 
19
20
  def setup
20
21
  FileUtils.rm_rf(TMP_DIR)
@@ -85,6 +86,7 @@ class SupervisorTest < ::Test::Unit::TestCase
85
86
  enable_get_dump true
86
87
  process_name "process_name"
87
88
  log_level info
89
+ root_dir #{TMP_ROOT_DIR}
88
90
  </system>
89
91
  EOC
90
92
  conf = Fluent::Config.parse(conf_data, "(test)", "(test_dir)", true)
@@ -99,6 +101,7 @@ class SupervisorTest < ::Test::Unit::TestCase
99
101
  assert_equal true, sys_conf.enable_get_dump
100
102
  assert_equal "process_name", sys_conf.process_name
101
103
  assert_equal 2, sys_conf.log_level
104
+ assert_equal TMP_ROOT_DIR, sys_conf.root_dir
102
105
  end
103
106
 
104
107
  def test_main_process_signal_handlers
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: 0.14.10
4
+ version: 0.14.11
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-14 00:00:00.000000000 Z
11
+ date: 2016-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -437,6 +437,7 @@ files:
437
437
  - lib/fluent/daemon.rb
438
438
  - lib/fluent/engine.rb
439
439
  - lib/fluent/env.rb
440
+ - lib/fluent/error.rb
440
441
  - lib/fluent/event.rb
441
442
  - lib/fluent/event_router.rb
442
443
  - lib/fluent/filter.rb
@@ -575,6 +576,7 @@ files:
575
576
  - lib/fluent/version.rb
576
577
  - lib/fluent/winsvc.rb
577
578
  - test/command/test_binlog_reader.rb
579
+ - test/command/test_fluentd.rb
578
580
  - test/compat/test_calls_super.rb
579
581
  - test/compat/test_parser.rb
580
582
  - test/config/assertions.rb
@@ -699,6 +701,7 @@ files:
699
701
  - test/test_output.rb
700
702
  - test/test_plugin_classes.rb
701
703
  - test/test_plugin_helper.rb
704
+ - test/test_plugin_id.rb
702
705
  - test/test_process.rb
703
706
  - test/test_root_agent.rb
704
707
  - test/test_supervisor.rb
@@ -732,6 +735,7 @@ specification_version: 4
732
735
  summary: Fluentd event collector
733
736
  test_files:
734
737
  - test/command/test_binlog_reader.rb
738
+ - test/command/test_fluentd.rb
735
739
  - test/compat/test_calls_super.rb
736
740
  - test/compat/test_parser.rb
737
741
  - test/config/assertions.rb
@@ -856,6 +860,7 @@ test_files:
856
860
  - test/test_output.rb
857
861
  - test/test_plugin_classes.rb
858
862
  - test/test_plugin_helper.rb
863
+ - test/test_plugin_id.rb
859
864
  - test/test_process.rb
860
865
  - test/test_root_agent.rb
861
866
  - test/test_supervisor.rb