fluentd 0.14.11-x86-mingw32 → 0.14.12-x86-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.
- checksums.yaml +4 -4
- data/.travis.yml +1 -5
- data/ChangeLog +54 -2
- data/example/in_dummy_blocks.conf +17 -0
- data/example/in_forward_tls.conf +14 -0
- data/example/in_forward_workers.conf +21 -0
- data/example/logevents.conf +25 -0
- data/example/out_forward_heartbeat_none.conf +16 -0
- data/example/out_forward_tls.conf +18 -0
- data/example/suppress_config_dump.conf +7 -0
- data/lib/fluent/agent.rb +3 -32
- data/lib/fluent/clock.rb +62 -0
- data/lib/fluent/command/fluentd.rb +12 -0
- data/lib/fluent/compat/input.rb +10 -1
- data/lib/fluent/compat/output.rb +40 -1
- data/lib/fluent/config/configure_proxy.rb +30 -7
- data/lib/fluent/config/section.rb +4 -0
- data/lib/fluent/config/types.rb +2 -2
- data/lib/fluent/configurable.rb +31 -5
- data/lib/fluent/engine.rb +61 -12
- data/lib/fluent/event_router.rb +6 -0
- data/lib/fluent/load.rb +0 -1
- data/lib/fluent/log.rb +118 -42
- data/lib/fluent/match.rb +37 -0
- data/lib/fluent/plugin.rb +25 -3
- data/lib/fluent/plugin/base.rb +4 -0
- data/lib/fluent/plugin/buf_file.rb +38 -14
- data/lib/fluent/plugin/buffer.rb +20 -20
- data/lib/fluent/plugin/buffer/file_chunk.rb +2 -2
- data/lib/fluent/plugin/compressable.rb +1 -0
- data/lib/fluent/plugin/filter_record_transformer.rb +3 -6
- data/lib/fluent/plugin/formatter_csv.rb +4 -1
- data/lib/fluent/plugin/formatter_hash.rb +5 -1
- data/lib/fluent/plugin/formatter_json.rb +10 -0
- data/lib/fluent/plugin/formatter_ltsv.rb +2 -1
- data/lib/fluent/plugin/in_dummy.rb +4 -0
- data/lib/fluent/plugin/in_exec.rb +4 -0
- data/lib/fluent/plugin/in_forward.rb +11 -3
- data/lib/fluent/plugin/in_gc_stat.rb +4 -0
- data/lib/fluent/plugin/in_http.rb +4 -0
- data/lib/fluent/plugin/in_monitor_agent.rb +29 -2
- data/lib/fluent/plugin/in_object_space.rb +4 -1
- data/lib/fluent/plugin/in_syslog.rb +4 -0
- data/lib/fluent/plugin/in_tail.rb +193 -116
- data/lib/fluent/plugin/in_tcp.rb +5 -1
- data/lib/fluent/plugin/in_udp.rb +4 -0
- data/lib/fluent/plugin/input.rb +4 -0
- data/lib/fluent/plugin/out_copy.rb +4 -0
- data/lib/fluent/plugin/out_exec.rb +4 -0
- data/lib/fluent/plugin/out_exec_filter.rb +4 -0
- data/lib/fluent/plugin/out_file.rb +70 -30
- data/lib/fluent/plugin/out_forward.rb +132 -28
- data/lib/fluent/plugin/out_null.rb +10 -0
- data/lib/fluent/plugin/out_relabel.rb +4 -0
- data/lib/fluent/plugin/out_roundrobin.rb +4 -0
- data/lib/fluent/plugin/out_secondary_file.rb +5 -0
- data/lib/fluent/plugin/out_stdout.rb +5 -0
- data/lib/fluent/plugin/output.rb +18 -9
- data/lib/fluent/plugin/storage_local.rb +25 -2
- data/lib/fluent/plugin_helper/cert_option.rb +159 -0
- data/lib/fluent/plugin_helper/child_process.rb +6 -6
- data/lib/fluent/plugin_helper/compat_parameters.rb +1 -1
- data/lib/fluent/plugin_helper/event_loop.rb +29 -4
- data/lib/fluent/plugin_helper/inject.rb +14 -1
- data/lib/fluent/plugin_helper/server.rb +275 -31
- data/lib/fluent/plugin_helper/socket.rb +144 -4
- data/lib/fluent/plugin_helper/socket_option.rb +2 -17
- data/lib/fluent/plugin_helper/storage.rb +7 -1
- data/lib/fluent/plugin_helper/thread.rb +16 -4
- data/lib/fluent/registry.rb +26 -9
- data/lib/fluent/root_agent.rb +7 -3
- data/lib/fluent/supervisor.rb +37 -15
- data/lib/fluent/system_config.rb +37 -10
- data/lib/fluent/test.rb +2 -0
- data/lib/fluent/test/driver/base.rb +24 -26
- data/lib/fluent/test/helpers.rb +21 -0
- data/lib/fluent/version.rb +1 -1
- data/test/command/test_fluentd.rb +274 -4
- data/test/config/test_configurable.rb +154 -0
- data/test/config/test_configure_proxy.rb +180 -1
- data/test/config/test_system_config.rb +10 -0
- data/test/config/test_types.rb +1 -0
- data/test/plugin/test_base.rb +4 -0
- data/test/plugin/test_buf_file.rb +241 -9
- data/test/plugin/test_buffer.rb +11 -11
- data/test/plugin/test_buffer_file_chunk.rb +6 -6
- data/test/plugin/test_compressable.rb +3 -0
- data/test/plugin/test_filter.rb +4 -0
- data/test/plugin/test_filter_record_transformer.rb +20 -0
- data/test/plugin/test_formatter_csv.rb +9 -0
- data/test/plugin/test_formatter_hash.rb +35 -0
- data/test/plugin/test_formatter_json.rb +8 -0
- data/test/plugin/test_formatter_ltsv.rb +7 -0
- data/test/plugin/test_in_dummy.rb +7 -3
- data/test/plugin/test_in_monitor_agent.rb +43 -5
- data/test/plugin/test_in_tail.rb +97 -4
- data/test/plugin/test_input.rb +4 -0
- data/test/plugin/test_out_file.rb +46 -7
- data/test/plugin/test_out_forward.rb +59 -7
- data/test/plugin/test_output.rb +10 -4
- data/test/plugin/test_output_as_buffered.rb +37 -25
- data/test/plugin/test_output_as_buffered_compress.rb +1 -1
- data/test/plugin/test_output_as_buffered_retries.rb +6 -6
- data/test/plugin/test_output_as_buffered_secondary.rb +91 -31
- data/test/plugin/test_storage_local.rb +40 -1
- data/test/plugin_helper/test_child_process.rb +29 -28
- data/test/plugin_helper/test_compat_parameters.rb +1 -1
- data/test/plugin_helper/test_inject.rb +27 -9
- data/test/plugin_helper/test_server.rb +822 -50
- data/test/plugin_helper/test_storage.rb +11 -0
- data/test/plugin_helper/test_timer.rb +1 -0
- data/test/test_clock.rb +164 -0
- data/test/test_log.rb +146 -15
- data/test/test_plugin.rb +251 -0
- data/test/test_supervisor.rb +65 -57
- data/test/test_test_drivers.rb +2 -2
- metadata +18 -7
- data/lib/fluent/process.rb +0 -504
- data/test/test_process.rb +0 -48
@@ -24,6 +24,12 @@ module ConfigurableSpec
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
+
class Base1Safe < Base1
|
28
|
+
config_set_default :name1, "basex1"
|
29
|
+
config_set_default :name2, "basex2"
|
30
|
+
config_set_default :opt1, :baz
|
31
|
+
end
|
32
|
+
|
27
33
|
class Base2 < Base1
|
28
34
|
config_set_default :name2, "base2"
|
29
35
|
config_set_default :name4, "base2"
|
@@ -89,6 +95,40 @@ module ConfigurableSpec
|
|
89
95
|
end
|
90
96
|
end
|
91
97
|
|
98
|
+
class Base4Safe < Base4
|
99
|
+
# config_section :node, param_name: :nodes do
|
100
|
+
# config_argument :num, :integer
|
101
|
+
# config_param :name, :string, default: "node"
|
102
|
+
# config_param :type, :string, default: "b4"
|
103
|
+
# end
|
104
|
+
# config_section :description1, required: false, multi: false do
|
105
|
+
# config_argument :note, :string, default: "desc1"
|
106
|
+
# config_param :text, :string
|
107
|
+
# end
|
108
|
+
# config_section :description2, required: true, multi: false do
|
109
|
+
# config_argument :note, :string, default: "desc2"
|
110
|
+
# config_param :text, :string
|
111
|
+
# end
|
112
|
+
# config_section :description3, required: true, multi: true do
|
113
|
+
# config_argument :note, default: "desc3" do |val|
|
114
|
+
# "desc3: #{val}"
|
115
|
+
# end
|
116
|
+
# config_param :text, :string
|
117
|
+
# end
|
118
|
+
config_section :node do
|
119
|
+
config_set_default :num, 0
|
120
|
+
end
|
121
|
+
config_section :description1 do
|
122
|
+
config_set_default :text, "teeeext"
|
123
|
+
end
|
124
|
+
config_section :description2 do
|
125
|
+
config_set_default :text, nil
|
126
|
+
end
|
127
|
+
config_section :description3 do
|
128
|
+
config_set_default :text, "yay"
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
92
132
|
class Init0
|
93
133
|
include Fluent::Configurable
|
94
134
|
config_section :sec1, init: true, multi: false do
|
@@ -407,6 +447,61 @@ module Fluent::Config
|
|
407
447
|
end
|
408
448
|
end
|
409
449
|
|
450
|
+
sub_test_case '#configured_section_create' do
|
451
|
+
test 'raises configuration error if required param exists but no configuration element is specified' do
|
452
|
+
obj = ConfigurableSpec::Base1.new
|
453
|
+
assert_raise(Fluent::ConfigError.new("'name1' parameter is required")) do
|
454
|
+
obj.configured_section_create(nil)
|
455
|
+
end
|
456
|
+
end
|
457
|
+
|
458
|
+
test 'creates root section with default values if name and config are specified with nil' do
|
459
|
+
obj = ConfigurableSpec::Base1Safe.new
|
460
|
+
root = obj.configured_section_create(nil)
|
461
|
+
|
462
|
+
assert_equal "node", root.node
|
463
|
+
assert_false root.flag1
|
464
|
+
assert_true root.flag2
|
465
|
+
assert_equal "basex1", root.name1
|
466
|
+
assert_equal "basex2", root.name2
|
467
|
+
assert_equal "base1", root.name3
|
468
|
+
assert_equal "base1", root.name4
|
469
|
+
assert_equal :baz, root.opt1
|
470
|
+
assert_equal :foo, root.opt2
|
471
|
+
end
|
472
|
+
|
473
|
+
test 'creates root section with default values if name is nil and config is empty element' do
|
474
|
+
obj = ConfigurableSpec::Base1Safe.new
|
475
|
+
root = obj.configured_section_create(nil, config_element())
|
476
|
+
|
477
|
+
assert_equal "node", root.node
|
478
|
+
assert_false root.flag1
|
479
|
+
assert_true root.flag2
|
480
|
+
assert_equal "basex1", root.name1
|
481
|
+
assert_equal "basex2", root.name2
|
482
|
+
assert_equal "base1", root.name3
|
483
|
+
assert_equal "base1", root.name4
|
484
|
+
assert_equal :baz, root.opt1
|
485
|
+
assert_equal :foo, root.opt2
|
486
|
+
end
|
487
|
+
|
488
|
+
test 'creates root section with specified value if name is nil and configuration element is specified' do
|
489
|
+
obj = ConfigurableSpec::Base1Safe.new
|
490
|
+
root = obj.configured_section_create(nil, config_element('match', '', {'node' => "nodename", 'flag1' => 'true', 'name1' => 'fixed1', 'opt1' => 'foo'}))
|
491
|
+
|
492
|
+
assert_equal "nodename", root.node
|
493
|
+
assert_equal "fixed1", root.name1
|
494
|
+
assert_true root.flag1
|
495
|
+
assert_equal :foo, root.opt1
|
496
|
+
|
497
|
+
assert_true root.flag2
|
498
|
+
assert_equal "basex2", root.name2
|
499
|
+
assert_equal "base1", root.name3
|
500
|
+
assert_equal "base1", root.name4
|
501
|
+
assert_equal :foo, root.opt2
|
502
|
+
end
|
503
|
+
end
|
504
|
+
|
410
505
|
sub_test_case '#configure' do
|
411
506
|
test 'returns configurable object itself' do
|
412
507
|
b2 = ConfigurableSpec::Base2.new
|
@@ -526,6 +621,65 @@ module Fluent::Config
|
|
526
621
|
end
|
527
622
|
end
|
528
623
|
|
624
|
+
sub_test_case '#configured_section_create' do
|
625
|
+
test 'raises configuration error if required param exists but no configuration element is specified' do
|
626
|
+
obj = ConfigurableSpec::Base4.new
|
627
|
+
assert_raise(Fluent::ConfigError.new("'<node ARG>' section requires argument")) do
|
628
|
+
obj.configured_section_create(:node)
|
629
|
+
end
|
630
|
+
assert_raise(Fluent::ConfigError.new("'text' parameter is required")) do
|
631
|
+
obj.configured_section_create(:description1)
|
632
|
+
end
|
633
|
+
end
|
634
|
+
|
635
|
+
test 'creates any defined section with default values if name is nil and config is not specified' do
|
636
|
+
obj = ConfigurableSpec::Base4Safe.new
|
637
|
+
node = obj.configured_section_create(:node)
|
638
|
+
assert_equal 0, node.num
|
639
|
+
assert_equal "node", node.name
|
640
|
+
assert_equal "b4", node.type
|
641
|
+
|
642
|
+
desc1 = obj.configured_section_create(:description1)
|
643
|
+
assert_equal "desc1", desc1.note
|
644
|
+
assert_equal "teeeext", desc1.text
|
645
|
+
end
|
646
|
+
|
647
|
+
test 'creates any defined section with default values if name is nil and config is empty element' do
|
648
|
+
obj = ConfigurableSpec::Base4Safe.new
|
649
|
+
node = obj.configured_section_create(:node, config_element())
|
650
|
+
assert_equal 0, node.num
|
651
|
+
assert_equal "node", node.name
|
652
|
+
assert_equal "b4", node.type
|
653
|
+
|
654
|
+
desc1 = obj.configured_section_create(:description1, config_element())
|
655
|
+
assert_equal "desc1", desc1.note
|
656
|
+
assert_equal "teeeext", desc1.text
|
657
|
+
end
|
658
|
+
|
659
|
+
test 'creates any defined section with specified value if name is nil and configuration element is specified' do
|
660
|
+
obj = ConfigurableSpec::Base4Safe.new
|
661
|
+
node = obj.configured_section_create(:node, config_element('node', '1', {'name' => 'node1', 'type' => 'b1'}))
|
662
|
+
assert_equal 1, node.num
|
663
|
+
assert_equal "node1", node.name
|
664
|
+
assert_equal "b1", node.type
|
665
|
+
|
666
|
+
desc1 = obj.configured_section_create(:description1, config_element('description1', 'desc one', {'text' => 't'}))
|
667
|
+
assert_equal "desc one", desc1.note
|
668
|
+
assert_equal "t", desc1.text
|
669
|
+
end
|
670
|
+
|
671
|
+
test 'creates a defined section instance even if it is defined as multi:true' do
|
672
|
+
obj = ConfigurableSpec::Base4Safe.new
|
673
|
+
desc3 = obj.configured_section_create(:description3)
|
674
|
+
assert_equal "desc3", desc3.note
|
675
|
+
assert_equal "yay", desc3.text
|
676
|
+
|
677
|
+
desc3 = obj.configured_section_create(:description3, config_element('description3', 'foo'))
|
678
|
+
assert_equal "desc3: foo", desc3.note
|
679
|
+
assert_equal "yay", desc3.text
|
680
|
+
end
|
681
|
+
end
|
682
|
+
|
529
683
|
sub_test_case '#configure' do
|
530
684
|
BASE_ATTRS = {
|
531
685
|
"name1" => "1", "name2" => "2", "name3" => "3",
|
@@ -45,7 +45,7 @@ module Fluent::Config
|
|
45
45
|
assert_false(proxy.multi?)
|
46
46
|
end
|
47
47
|
test 'raise error if both of init and required are true' do
|
48
|
-
assert_raise "init and required are exclusive" do
|
48
|
+
assert_raise RuntimeError.new("init and required are exclusive") do
|
49
49
|
Fluent::Config::ConfigureProxy.new(:section, init: true, required: true, type_lookup: @type_lookup)
|
50
50
|
end
|
51
51
|
end
|
@@ -164,6 +164,185 @@ module Fluent::Config
|
|
164
164
|
@proxy = Fluent::Config::ConfigureProxy.new(:section, type_lookup: @type_lookup)
|
165
165
|
end
|
166
166
|
|
167
|
+
test 'handles configuration parameters without type as string' do
|
168
|
+
@proxy.config_argument(:label)
|
169
|
+
@proxy.config_param(:name)
|
170
|
+
assert_equal :label, @proxy.argument[0]
|
171
|
+
assert_equal :string, @proxy.argument[2][:type]
|
172
|
+
assert_equal :string, @proxy.params[:name][1][:type]
|
173
|
+
end
|
174
|
+
|
175
|
+
data(
|
176
|
+
default: [:default, nil],
|
177
|
+
alias: [:alias, :alias_name_in_config],
|
178
|
+
secret: [:secret, true],
|
179
|
+
skip_accessor: [:skip_accessor, true],
|
180
|
+
deprecated: [:deprecated, 'it is deprecated'],
|
181
|
+
obsoleted: [:obsoleted, 'it is obsoleted'],
|
182
|
+
desc: [:desc, "description"],
|
183
|
+
)
|
184
|
+
test 'always allow options for all types' do |(option, value)|
|
185
|
+
opt = {option => value}
|
186
|
+
assert_nothing_raised{ @proxy.config_argument(:param0, **opt) }
|
187
|
+
assert_nothing_raised{ @proxy.config_param(:p1, :string, **opt) }
|
188
|
+
assert_nothing_raised{ @proxy.config_param(:p2, :enum, list: [:a, :b, :c], **opt) }
|
189
|
+
assert_nothing_raised{ @proxy.config_param(:p3, :integer, **opt) }
|
190
|
+
assert_nothing_raised{ @proxy.config_param(:p4, :float, **opt) }
|
191
|
+
assert_nothing_raised{ @proxy.config_param(:p5, :size, **opt) }
|
192
|
+
assert_nothing_raised{ @proxy.config_param(:p6, :bool, **opt) }
|
193
|
+
assert_nothing_raised{ @proxy.config_param(:p7, :time, **opt) }
|
194
|
+
assert_nothing_raised{ @proxy.config_param(:p8, :hash, **opt) }
|
195
|
+
assert_nothing_raised{ @proxy.config_param(:p9, :array, **opt) }
|
196
|
+
end
|
197
|
+
|
198
|
+
data(string: :string, integer: :integer, float: :float, size: :size, bool: :bool, time: :time, hash: :hash, array: :array)
|
199
|
+
test 'deny list for non-enum types' do |type|
|
200
|
+
assert_raise ArgumentError.new(":list is valid only for :enum type, but #{type}: arg") do
|
201
|
+
@proxy.config_argument(:arg, type, list: [:a, :b])
|
202
|
+
end
|
203
|
+
assert_raise ArgumentError.new(":list is valid only for :enum type, but #{type}: p1") do
|
204
|
+
@proxy.config_param(:p1, type, list: [:a, :b])
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
data(string: :string, integer: :integer, float: :float, size: :size, bool: :bool, time: :time)
|
209
|
+
test 'deny value_type for non-hash/array types' do |type|
|
210
|
+
assert_raise ArgumentError.new(":value_type is valid only for :hash and :array, but #{type}: arg") do
|
211
|
+
@proxy.config_argument(:arg, type, value_type: :string)
|
212
|
+
end
|
213
|
+
assert_raise ArgumentError.new(":value_type is valid only for :hash and :array, but #{type}: p1") do
|
214
|
+
@proxy.config_param(:p1, type, value_type: :integer)
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
data(string: :string, integer: :integer, float: :float, size: :size, bool: :bool, time: :time, array: :array)
|
219
|
+
test 'deny symbolize_keys for non-hash types' do |type|
|
220
|
+
assert_raise ArgumentError.new(":symbolize_keys is valid only for :hash, but #{type}: arg") do
|
221
|
+
@proxy.config_argument(:arg, type, symbolize_keys: true)
|
222
|
+
end
|
223
|
+
assert_raise ArgumentError.new(":symbolize_keys is valid only for :hash, but #{type}: p1") do
|
224
|
+
@proxy.config_param(:p1, type, symbolize_keys: true)
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
data(string: :string, integer: :integer, float: :float, size: :size, bool: :bool, time: :time, hash: :hash, array: :array)
|
229
|
+
test 'deny unknown options' do |type|
|
230
|
+
assert_raise ArgumentError.new("unknown option 'required' for configuration parameter: arg") do
|
231
|
+
@proxy.config_argument(:arg, type, required: true)
|
232
|
+
end
|
233
|
+
assert_raise ArgumentError.new("unknown option 'param_name' for configuration parameter: p1") do
|
234
|
+
@proxy.config_argument(:p1, type, param_name: :yay)
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
test 'desc gets string' do
|
239
|
+
assert_nothing_raised do
|
240
|
+
@proxy.config_param(:name, :string, desc: "it is description")
|
241
|
+
end
|
242
|
+
assert_raise ArgumentError.new("name1: desc must be a String, but Symbol") do
|
243
|
+
@proxy.config_param(:name1, :string, desc: :yaaaaaaaay)
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
test 'alias gets symbol' do
|
248
|
+
assert_nothing_raised do
|
249
|
+
@proxy.config_param(:name, :string, alias: :label)
|
250
|
+
end
|
251
|
+
assert_raise ArgumentError.new("name1: alias must be a Symbol, but String") do
|
252
|
+
@proxy.config_param(:name1, :string, alias: 'label1')
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
test 'secret gets true/false' do
|
257
|
+
assert_nothing_raised do
|
258
|
+
@proxy.config_param(:name1, :string, secret: false)
|
259
|
+
end
|
260
|
+
assert_nothing_raised do
|
261
|
+
@proxy.config_param(:name2, :string, secret: true)
|
262
|
+
end
|
263
|
+
assert_raise ArgumentError.new("name3: secret must be true or false, but String") do
|
264
|
+
@proxy.config_param(:name3, :string, secret: 'yes')
|
265
|
+
end
|
266
|
+
assert_raise ArgumentError.new("name4: secret must be true or false, but NilClass") do
|
267
|
+
@proxy.config_param(:name4, :string, secret: nil)
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
test 'symbolize_keys gets true/false' do
|
272
|
+
assert_nothing_raised do
|
273
|
+
@proxy.config_param(:data1, :hash, symbolize_keys: false)
|
274
|
+
end
|
275
|
+
assert_nothing_raised do
|
276
|
+
@proxy.config_param(:data2, :hash, symbolize_keys: true)
|
277
|
+
end
|
278
|
+
assert_raise ArgumentError.new("data3: symbolize_keys must be true or false, but NilClass") do
|
279
|
+
@proxy.config_param(:data3, :hash, symbolize_keys: nil)
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
test 'value_type gets symbol' do
|
284
|
+
assert_nothing_raised do
|
285
|
+
@proxy.config_param(:data1, :array, value_type: :integer)
|
286
|
+
end
|
287
|
+
assert_raise ArgumentError.new("data2: value_type must be a Symbol, but Class") do
|
288
|
+
@proxy.config_param(:data2, :array, value_type: Integer)
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
test 'list gets an array of symbols' do
|
293
|
+
assert_nothing_raised do
|
294
|
+
@proxy.config_param(:proto1, :enum, list: [:a, :b])
|
295
|
+
end
|
296
|
+
assert_raise ArgumentError.new("proto2: enum parameter requires :list of Symbols") do
|
297
|
+
@proxy.config_param(:proto2, :enum, list: nil)
|
298
|
+
end
|
299
|
+
assert_raise ArgumentError.new("proto3: enum parameter requires :list of Symbols") do
|
300
|
+
@proxy.config_param(:proto3, :enum, list: ['a', 'b'])
|
301
|
+
end
|
302
|
+
assert_raise ArgumentError.new("proto4: enum parameter requires :list of Symbols") do
|
303
|
+
@proxy.config_param(:proto4, :enum, list: [])
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
test 'deprecated gets string' do
|
308
|
+
assert_nothing_raised do
|
309
|
+
@proxy.config_param(:name1, :string, deprecated: "use name2 instead")
|
310
|
+
end
|
311
|
+
assert_raise ArgumentError.new("name2: deprecated must be a String, but TrueClass") do
|
312
|
+
@proxy.config_param(:name2, :string, deprecated: true)
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
316
|
+
test 'obsoleted gets string' do
|
317
|
+
assert_nothing_raised do
|
318
|
+
@proxy.config_param(:name1, :string, obsoleted: "use name2 instead")
|
319
|
+
end
|
320
|
+
assert_raise ArgumentError.new("name2: obsoleted must be a String, but TrueClass") do
|
321
|
+
@proxy.config_param(:name2, :string, obsoleted: true)
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
test 'skip_accessor gets true/false' do
|
326
|
+
assert_nothing_raised do
|
327
|
+
@proxy.config_param(:format1, :string, skip_accessor: false)
|
328
|
+
end
|
329
|
+
assert_nothing_raised do
|
330
|
+
@proxy.config_param(:format2, :string, skip_accessor: true)
|
331
|
+
end
|
332
|
+
assert_raise ArgumentError.new("format2: skip_accessor must be true or false, but String") do
|
333
|
+
@proxy.config_param(:format2, :string, skip_accessor: 'yes')
|
334
|
+
end
|
335
|
+
end
|
336
|
+
|
337
|
+
test 'list is required for :enum' do
|
338
|
+
assert_nothing_raised do
|
339
|
+
@proxy.config_param(:proto1, :enum, list: [:a, :b])
|
340
|
+
end
|
341
|
+
assert_raise ArgumentError.new("proto1: enum parameter requires :list of Symbols") do
|
342
|
+
@proxy.config_param(:proto1, :enum, default: :a)
|
343
|
+
end
|
344
|
+
end
|
345
|
+
|
167
346
|
test 'does not permit config_set_default for param w/ :default option' do
|
168
347
|
@proxy.config_param(:name, :string, default: "name1")
|
169
348
|
assert_raise(ArgumentError) { @proxy.config_set_default(:name, "name2") }
|
@@ -14,12 +14,15 @@ module Fluent::Config
|
|
14
14
|
|
15
15
|
class FakeSupervisor
|
16
16
|
def initialize
|
17
|
+
@workers = nil
|
17
18
|
@root_dir = nil
|
18
19
|
@log = FakeLoggerInitializer.new
|
19
20
|
@log_level = nil
|
20
21
|
@suppress_interval = nil
|
21
22
|
@suppress_config_dump = nil
|
22
23
|
@suppress_repeated_stacktrace = nil
|
24
|
+
@log_event_label = nil
|
25
|
+
@log_event_verbose = nil
|
23
26
|
@without_source = nil
|
24
27
|
@emit_error_log_interval = nil
|
25
28
|
@file_permission = nil
|
@@ -43,27 +46,32 @@ module Fluent::Config
|
|
43
46
|
s = FakeSupervisor.new
|
44
47
|
sc = Fluent::SystemConfig.new(conf)
|
45
48
|
sc.apply(s)
|
49
|
+
assert_equal(1, sc.workers)
|
46
50
|
assert_nil(sc.root_dir)
|
47
51
|
assert_nil(sc.log_level)
|
48
52
|
assert_nil(sc.suppress_repeated_stacktrace)
|
49
53
|
assert_nil(sc.emit_error_log_interval)
|
50
54
|
assert_nil(sc.suppress_config_dump)
|
51
55
|
assert_nil(sc.without_source)
|
56
|
+
assert_equal(1, s.instance_variable_get(:@workers))
|
52
57
|
assert_nil(s.instance_variable_get(:@root_dir))
|
53
58
|
assert_nil(s.instance_variable_get(:@log_level))
|
54
59
|
assert_nil(s.instance_variable_get(:@suppress_repeated_stacktrace))
|
55
60
|
assert_nil(s.instance_variable_get(:@emit_error_log_interval))
|
56
61
|
assert_nil(s.instance_variable_get(:@suppress_config_dump))
|
62
|
+
assert_nil(s.instance_variable_get(:@log_event_verbose))
|
57
63
|
assert_nil(s.instance_variable_get(:@without_source))
|
58
64
|
assert_nil(s.instance_variable_get(:@file_permission))
|
59
65
|
assert_nil(s.instance_variable_get(:@dir_permission))
|
60
66
|
end
|
61
67
|
|
62
68
|
data(
|
69
|
+
'workers' => ['workers', 3],
|
63
70
|
'root_dir' => ['root_dir', File.join(TMP_DIR, 'root')],
|
64
71
|
'log_level' => ['log_level', 'error'],
|
65
72
|
'suppress_repeated_stacktrace' => ['suppress_repeated_stacktrace', true],
|
66
73
|
'emit_error_log_interval' => ['emit_error_log_interval', 60],
|
74
|
+
'log_event_verbose' => ['log_event_verbose', true],
|
67
75
|
'suppress_config_dump' => ['suppress_config_dump', true],
|
68
76
|
'without_source' => ['without_source', true],
|
69
77
|
)
|
@@ -89,11 +97,13 @@ module Fluent::Config
|
|
89
97
|
s = FakeSupervisor.new
|
90
98
|
sc = Fluent::SystemConfig.new({k => v})
|
91
99
|
sc.apply(s)
|
100
|
+
assert_equal(1, s.instance_variable_get(:@workers))
|
92
101
|
assert_nil(s.instance_variable_get(:@root_dir))
|
93
102
|
assert_nil(s.instance_variable_get(:@log_level))
|
94
103
|
assert_nil(s.instance_variable_get(:@suppress_repeated_stacktrace))
|
95
104
|
assert_nil(s.instance_variable_get(:@emit_error_log_interval))
|
96
105
|
assert_nil(s.instance_variable_get(:@suppress_config_dump))
|
106
|
+
assert_nil(s.instance_variable_get(:@log_event_verbose))
|
97
107
|
assert_nil(s.instance_variable_get(:@without_source))
|
98
108
|
assert_nil(s.instance_variable_get(:@file_permission))
|
99
109
|
assert_nil(s.instance_variable_get(:@dir_permission))
|
data/test/config/test_types.rb
CHANGED
@@ -66,6 +66,7 @@ class TestConfigTypes < ::Test::Unit::TestCase
|
|
66
66
|
assert_equal 'test', Config::STRING_TYPE.call('test', {})
|
67
67
|
assert_equal '1', Config::STRING_TYPE.call('1', {})
|
68
68
|
assert_equal ' ', Config::STRING_TYPE.call(' ', {})
|
69
|
+
assert_equal Encoding::UTF_8, Config::STRING_TYPE.call('test', {}).encoding
|
69
70
|
end
|
70
71
|
|
71
72
|
test 'enum' do
|
data/test/plugin/test_base.rb
CHANGED
@@ -93,6 +93,10 @@ class BaseTest < Test::Unit::TestCase
|
|
93
93
|
assert_equal 99, p2.mysection.myparam2
|
94
94
|
end
|
95
95
|
|
96
|
+
test 'plugins are available with multi worker configuration in default' do
|
97
|
+
assert @p.multi_workers_ready?
|
98
|
+
end
|
99
|
+
|
96
100
|
test 'provides #string_safe_encoding to scrub invalid sequence string with info logging' do
|
97
101
|
logger = Fluent::Test::TestLogger.new
|
98
102
|
m = Module.new do
|