fluentd 0.14.4-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 +7 -0
- data/.github/ISSUE_TEMPLATE.md +6 -0
- data/.gitignore +26 -0
- data/.travis.yml +45 -0
- data/AUTHORS +2 -0
- data/CONTRIBUTING.md +35 -0
- data/COPYING +14 -0
- data/ChangeLog +276 -0
- data/Gemfile +9 -0
- data/README.md +51 -0
- data/Rakefile +53 -0
- data/Vagrantfile +17 -0
- data/appveyor.yml +41 -0
- data/bin/fluent-debug +5 -0
- data/example/copy_roundrobin.conf +39 -0
- data/example/filter_stdout.conf +22 -0
- data/example/in_forward.conf +11 -0
- data/example/in_http.conf +14 -0
- data/example/in_out_forward.conf +17 -0
- data/example/in_syslog.conf +15 -0
- data/example/in_tail.conf +14 -0
- data/example/in_tcp.conf +13 -0
- data/example/in_udp.conf +13 -0
- data/example/multi_filters.conf +61 -0
- data/example/out_buffered_null.conf +32 -0
- data/example/out_copy.conf +20 -0
- data/example/out_file.conf +13 -0
- data/example/out_forward.conf +35 -0
- data/example/out_forward_buf_file.conf +23 -0
- data/example/v0_12_filter.conf +78 -0
- data/example/v1_literal_example.conf +36 -0
- data/fluent.conf +139 -0
- data/fluentd.gemspec +51 -0
- data/lib/fluent/agent.rb +194 -0
- data/lib/fluent/command/bundler_injection.rb +45 -0
- data/lib/fluent/command/cat.rb +319 -0
- data/lib/fluent/command/debug.rb +102 -0
- data/lib/fluent/command/fluentd.rb +273 -0
- data/lib/fluent/compat/call_super_mixin.rb +67 -0
- data/lib/fluent/compat/exec_util.rb +129 -0
- data/lib/fluent/compat/file_util.rb +54 -0
- data/lib/fluent/compat/filter.rb +68 -0
- data/lib/fluent/compat/formatter.rb +111 -0
- data/lib/fluent/compat/formatter_utils.rb +85 -0
- data/lib/fluent/compat/handle_tag_and_time_mixin.rb +62 -0
- data/lib/fluent/compat/handle_tag_name_mixin.rb +53 -0
- data/lib/fluent/compat/input.rb +49 -0
- data/lib/fluent/compat/output.rb +677 -0
- data/lib/fluent/compat/output_chain.rb +60 -0
- data/lib/fluent/compat/parser.rb +180 -0
- data/lib/fluent/compat/parser_utils.rb +40 -0
- data/lib/fluent/compat/propagate_default.rb +62 -0
- data/lib/fluent/compat/record_filter_mixin.rb +34 -0
- data/lib/fluent/compat/set_tag_key_mixin.rb +50 -0
- data/lib/fluent/compat/set_time_key_mixin.rb +69 -0
- data/lib/fluent/compat/socket_util.rb +165 -0
- data/lib/fluent/compat/string_util.rb +34 -0
- data/lib/fluent/compat/structured_format_mixin.rb +26 -0
- data/lib/fluent/compat/type_converter.rb +90 -0
- data/lib/fluent/config.rb +56 -0
- data/lib/fluent/config/basic_parser.rb +123 -0
- data/lib/fluent/config/configure_proxy.rb +366 -0
- data/lib/fluent/config/dsl.rb +149 -0
- data/lib/fluent/config/element.rb +218 -0
- data/lib/fluent/config/error.rb +26 -0
- data/lib/fluent/config/literal_parser.rb +251 -0
- data/lib/fluent/config/parser.rb +107 -0
- data/lib/fluent/config/section.rb +212 -0
- data/lib/fluent/config/types.rb +136 -0
- data/lib/fluent/config/v1_parser.rb +190 -0
- data/lib/fluent/configurable.rb +176 -0
- data/lib/fluent/daemon.rb +15 -0
- data/lib/fluent/engine.rb +220 -0
- data/lib/fluent/env.rb +27 -0
- data/lib/fluent/event.rb +287 -0
- data/lib/fluent/event_router.rb +259 -0
- data/lib/fluent/filter.rb +21 -0
- data/lib/fluent/formatter.rb +23 -0
- data/lib/fluent/input.rb +21 -0
- data/lib/fluent/label.rb +38 -0
- data/lib/fluent/load.rb +36 -0
- data/lib/fluent/log.rb +445 -0
- data/lib/fluent/match.rb +141 -0
- data/lib/fluent/mixin.rb +31 -0
- data/lib/fluent/msgpack_factory.rb +62 -0
- data/lib/fluent/output.rb +26 -0
- data/lib/fluent/output_chain.rb +23 -0
- data/lib/fluent/parser.rb +23 -0
- data/lib/fluent/plugin.rb +161 -0
- data/lib/fluent/plugin/bare_output.rb +63 -0
- data/lib/fluent/plugin/base.rb +130 -0
- data/lib/fluent/plugin/buf_file.rb +154 -0
- data/lib/fluent/plugin/buf_memory.rb +34 -0
- data/lib/fluent/plugin/buffer.rb +603 -0
- data/lib/fluent/plugin/buffer/chunk.rb +160 -0
- data/lib/fluent/plugin/buffer/file_chunk.rb +323 -0
- data/lib/fluent/plugin/buffer/memory_chunk.rb +90 -0
- data/lib/fluent/plugin/exec_util.rb +22 -0
- data/lib/fluent/plugin/file_util.rb +22 -0
- data/lib/fluent/plugin/file_wrapper.rb +120 -0
- data/lib/fluent/plugin/filter.rb +93 -0
- data/lib/fluent/plugin/filter_grep.rb +75 -0
- data/lib/fluent/plugin/filter_record_transformer.rb +342 -0
- data/lib/fluent/plugin/filter_stdout.rb +53 -0
- data/lib/fluent/plugin/formatter.rb +45 -0
- data/lib/fluent/plugin/formatter_csv.rb +47 -0
- data/lib/fluent/plugin/formatter_hash.rb +29 -0
- data/lib/fluent/plugin/formatter_json.rb +44 -0
- data/lib/fluent/plugin/formatter_ltsv.rb +41 -0
- data/lib/fluent/plugin/formatter_msgpack.rb +29 -0
- data/lib/fluent/plugin/formatter_out_file.rb +78 -0
- data/lib/fluent/plugin/formatter_single_value.rb +34 -0
- data/lib/fluent/plugin/formatter_stdout.rb +74 -0
- data/lib/fluent/plugin/in_debug_agent.rb +64 -0
- data/lib/fluent/plugin/in_dummy.rb +135 -0
- data/lib/fluent/plugin/in_exec.rb +149 -0
- data/lib/fluent/plugin/in_forward.rb +366 -0
- data/lib/fluent/plugin/in_gc_stat.rb +52 -0
- data/lib/fluent/plugin/in_http.rb +422 -0
- data/lib/fluent/plugin/in_monitor_agent.rb +401 -0
- data/lib/fluent/plugin/in_object_space.rb +90 -0
- data/lib/fluent/plugin/in_syslog.rb +204 -0
- data/lib/fluent/plugin/in_tail.rb +838 -0
- data/lib/fluent/plugin/in_tcp.rb +41 -0
- data/lib/fluent/plugin/in_udp.rb +37 -0
- data/lib/fluent/plugin/in_unix.rb +201 -0
- data/lib/fluent/plugin/input.rb +33 -0
- data/lib/fluent/plugin/multi_output.rb +95 -0
- data/lib/fluent/plugin/out_buffered_null.rb +59 -0
- data/lib/fluent/plugin/out_buffered_stdout.rb +70 -0
- data/lib/fluent/plugin/out_copy.rb +42 -0
- data/lib/fluent/plugin/out_exec.rb +114 -0
- data/lib/fluent/plugin/out_exec_filter.rb +393 -0
- data/lib/fluent/plugin/out_file.rb +167 -0
- data/lib/fluent/plugin/out_forward.rb +646 -0
- data/lib/fluent/plugin/out_null.rb +27 -0
- data/lib/fluent/plugin/out_relabel.rb +28 -0
- data/lib/fluent/plugin/out_roundrobin.rb +80 -0
- data/lib/fluent/plugin/out_stdout.rb +48 -0
- data/lib/fluent/plugin/out_stream.rb +130 -0
- data/lib/fluent/plugin/output.rb +1020 -0
- data/lib/fluent/plugin/owned_by_mixin.rb +42 -0
- data/lib/fluent/plugin/parser.rb +175 -0
- data/lib/fluent/plugin/parser_apache.rb +28 -0
- data/lib/fluent/plugin/parser_apache2.rb +84 -0
- data/lib/fluent/plugin/parser_apache_error.rb +26 -0
- data/lib/fluent/plugin/parser_csv.rb +33 -0
- data/lib/fluent/plugin/parser_json.rb +79 -0
- data/lib/fluent/plugin/parser_ltsv.rb +50 -0
- data/lib/fluent/plugin/parser_multiline.rb +104 -0
- data/lib/fluent/plugin/parser_nginx.rb +28 -0
- data/lib/fluent/plugin/parser_none.rb +36 -0
- data/lib/fluent/plugin/parser_regexp.rb +73 -0
- data/lib/fluent/plugin/parser_syslog.rb +82 -0
- data/lib/fluent/plugin/parser_tsv.rb +37 -0
- data/lib/fluent/plugin/socket_util.rb +22 -0
- data/lib/fluent/plugin/storage.rb +84 -0
- data/lib/fluent/plugin/storage_local.rb +132 -0
- data/lib/fluent/plugin/string_util.rb +22 -0
- data/lib/fluent/plugin_helper.rb +42 -0
- data/lib/fluent/plugin_helper/child_process.rb +298 -0
- data/lib/fluent/plugin_helper/compat_parameters.rb +224 -0
- data/lib/fluent/plugin_helper/event_emitter.rb +80 -0
- data/lib/fluent/plugin_helper/event_loop.rb +118 -0
- data/lib/fluent/plugin_helper/formatter.rb +149 -0
- data/lib/fluent/plugin_helper/inject.rb +125 -0
- data/lib/fluent/plugin_helper/parser.rb +147 -0
- data/lib/fluent/plugin_helper/retry_state.rb +177 -0
- data/lib/fluent/plugin_helper/storage.rb +331 -0
- data/lib/fluent/plugin_helper/thread.rb +147 -0
- data/lib/fluent/plugin_helper/timer.rb +90 -0
- data/lib/fluent/plugin_id.rb +63 -0
- data/lib/fluent/process.rb +504 -0
- data/lib/fluent/registry.rb +99 -0
- data/lib/fluent/root_agent.rb +314 -0
- data/lib/fluent/rpc.rb +94 -0
- data/lib/fluent/supervisor.rb +680 -0
- data/lib/fluent/system_config.rb +122 -0
- data/lib/fluent/test.rb +56 -0
- data/lib/fluent/test/base.rb +85 -0
- data/lib/fluent/test/driver/base.rb +179 -0
- data/lib/fluent/test/driver/base_owned.rb +70 -0
- data/lib/fluent/test/driver/base_owner.rb +125 -0
- data/lib/fluent/test/driver/event_feeder.rb +98 -0
- data/lib/fluent/test/driver/filter.rb +57 -0
- data/lib/fluent/test/driver/formatter.rb +30 -0
- data/lib/fluent/test/driver/input.rb +31 -0
- data/lib/fluent/test/driver/multi_output.rb +52 -0
- data/lib/fluent/test/driver/output.rb +76 -0
- data/lib/fluent/test/driver/parser.rb +30 -0
- data/lib/fluent/test/driver/test_event_router.rb +45 -0
- data/lib/fluent/test/filter_test.rb +77 -0
- data/lib/fluent/test/formatter_test.rb +65 -0
- data/lib/fluent/test/helpers.rb +79 -0
- data/lib/fluent/test/input_test.rb +172 -0
- data/lib/fluent/test/log.rb +73 -0
- data/lib/fluent/test/output_test.rb +156 -0
- data/lib/fluent/test/parser_test.rb +70 -0
- data/lib/fluent/time.rb +175 -0
- data/lib/fluent/timezone.rb +133 -0
- data/lib/fluent/unique_id.rb +39 -0
- data/lib/fluent/version.rb +21 -0
- data/lib/fluent/winsvc.rb +71 -0
- data/test/compat/test_calls_super.rb +166 -0
- data/test/compat/test_parser.rb +82 -0
- data/test/config/assertions.rb +42 -0
- data/test/config/test_config_parser.rb +507 -0
- data/test/config/test_configurable.rb +1194 -0
- data/test/config/test_configure_proxy.rb +386 -0
- data/test/config/test_dsl.rb +415 -0
- data/test/config/test_element.rb +403 -0
- data/test/config/test_literal_parser.rb +297 -0
- data/test/config/test_section.rb +184 -0
- data/test/config/test_system_config.rb +120 -0
- data/test/config/test_types.rb +171 -0
- data/test/helper.rb +119 -0
- data/test/plugin/data/2010/01/20100102-030405.log +0 -0
- data/test/plugin/data/2010/01/20100102-030406.log +0 -0
- data/test/plugin/data/2010/01/20100102.log +0 -0
- data/test/plugin/data/log/bar +0 -0
- data/test/plugin/data/log/foo/bar.log +0 -0
- data/test/plugin/data/log/test.log +0 -0
- data/test/plugin/test_bare_output.rb +118 -0
- data/test/plugin/test_base.rb +75 -0
- data/test/plugin/test_buf_file.rb +571 -0
- data/test/plugin/test_buf_memory.rb +42 -0
- data/test/plugin/test_buffer.rb +1200 -0
- data/test/plugin/test_buffer_chunk.rb +168 -0
- data/test/plugin/test_buffer_file_chunk.rb +771 -0
- data/test/plugin/test_buffer_memory_chunk.rb +265 -0
- data/test/plugin/test_file_util.rb +96 -0
- data/test/plugin/test_filter.rb +353 -0
- data/test/plugin/test_filter_grep.rb +119 -0
- data/test/plugin/test_filter_record_transformer.rb +600 -0
- data/test/plugin/test_filter_stdout.rb +211 -0
- data/test/plugin/test_formatter_csv.rb +94 -0
- data/test/plugin/test_formatter_json.rb +30 -0
- data/test/plugin/test_formatter_ltsv.rb +52 -0
- data/test/plugin/test_formatter_msgpack.rb +28 -0
- data/test/plugin/test_formatter_out_file.rb +95 -0
- data/test/plugin/test_formatter_single_value.rb +38 -0
- data/test/plugin/test_in_debug_agent.rb +28 -0
- data/test/plugin/test_in_dummy.rb +188 -0
- data/test/plugin/test_in_exec.rb +133 -0
- data/test/plugin/test_in_forward.rb +635 -0
- data/test/plugin/test_in_gc_stat.rb +39 -0
- data/test/plugin/test_in_http.rb +442 -0
- data/test/plugin/test_in_monitor_agent.rb +329 -0
- data/test/plugin/test_in_object_space.rb +64 -0
- data/test/plugin/test_in_syslog.rb +205 -0
- data/test/plugin/test_in_tail.rb +1001 -0
- data/test/plugin/test_in_tcp.rb +102 -0
- data/test/plugin/test_in_udp.rb +121 -0
- data/test/plugin/test_in_unix.rb +126 -0
- data/test/plugin/test_input.rb +122 -0
- data/test/plugin/test_multi_output.rb +180 -0
- data/test/plugin/test_out_buffered_null.rb +79 -0
- data/test/plugin/test_out_buffered_stdout.rb +122 -0
- data/test/plugin/test_out_copy.rb +160 -0
- data/test/plugin/test_out_exec.rb +155 -0
- data/test/plugin/test_out_exec_filter.rb +262 -0
- data/test/plugin/test_out_file.rb +383 -0
- data/test/plugin/test_out_forward.rb +590 -0
- data/test/plugin/test_out_null.rb +29 -0
- data/test/plugin/test_out_relabel.rb +28 -0
- data/test/plugin/test_out_roundrobin.rb +146 -0
- data/test/plugin/test_out_stdout.rb +92 -0
- data/test/plugin/test_out_stream.rb +93 -0
- data/test/plugin/test_output.rb +568 -0
- data/test/plugin/test_output_as_buffered.rb +1604 -0
- data/test/plugin/test_output_as_buffered_overflow.rb +250 -0
- data/test/plugin/test_output_as_buffered_retries.rb +839 -0
- data/test/plugin/test_output_as_buffered_secondary.rb +817 -0
- data/test/plugin/test_output_as_standard.rb +374 -0
- data/test/plugin/test_owned_by.rb +35 -0
- data/test/plugin/test_parser_apache.rb +42 -0
- data/test/plugin/test_parser_apache2.rb +38 -0
- data/test/plugin/test_parser_apache_error.rb +45 -0
- data/test/plugin/test_parser_base.rb +32 -0
- data/test/plugin/test_parser_csv.rb +104 -0
- data/test/plugin/test_parser_json.rb +107 -0
- data/test/plugin/test_parser_labeled_tsv.rb +129 -0
- data/test/plugin/test_parser_multiline.rb +100 -0
- data/test/plugin/test_parser_nginx.rb +48 -0
- data/test/plugin/test_parser_none.rb +53 -0
- data/test/plugin/test_parser_regexp.rb +277 -0
- data/test/plugin/test_parser_syslog.rb +66 -0
- data/test/plugin/test_parser_time.rb +46 -0
- data/test/plugin/test_parser_tsv.rb +121 -0
- data/test/plugin/test_storage.rb +167 -0
- data/test/plugin/test_storage_local.rb +8 -0
- data/test/plugin/test_string_util.rb +26 -0
- data/test/plugin_helper/test_child_process.rb +608 -0
- data/test/plugin_helper/test_compat_parameters.rb +242 -0
- data/test/plugin_helper/test_event_emitter.rb +51 -0
- data/test/plugin_helper/test_event_loop.rb +52 -0
- data/test/plugin_helper/test_formatter.rb +252 -0
- data/test/plugin_helper/test_inject.rb +487 -0
- data/test/plugin_helper/test_parser.rb +263 -0
- data/test/plugin_helper/test_retry_state.rb +399 -0
- data/test/plugin_helper/test_storage.rb +521 -0
- data/test/plugin_helper/test_thread.rb +164 -0
- data/test/plugin_helper/test_timer.rb +131 -0
- data/test/scripts/exec_script.rb +32 -0
- data/test/scripts/fluent/plugin/formatter_known.rb +8 -0
- data/test/scripts/fluent/plugin/out_test.rb +81 -0
- data/test/scripts/fluent/plugin/out_test2.rb +80 -0
- data/test/scripts/fluent/plugin/parser_known.rb +4 -0
- data/test/test_config.rb +179 -0
- data/test/test_configdsl.rb +148 -0
- data/test/test_event.rb +329 -0
- data/test/test_event_router.rb +331 -0
- data/test/test_event_time.rb +184 -0
- data/test/test_filter.rb +121 -0
- data/test/test_formatter.rb +319 -0
- data/test/test_input.rb +31 -0
- data/test/test_log.rb +572 -0
- data/test/test_match.rb +137 -0
- data/test/test_mixin.rb +351 -0
- data/test/test_output.rb +214 -0
- data/test/test_plugin_classes.rb +136 -0
- data/test/test_plugin_helper.rb +81 -0
- data/test/test_process.rb +48 -0
- data/test/test_root_agent.rb +278 -0
- data/test/test_supervisor.rb +339 -0
- data/test/test_time_formatter.rb +186 -0
- data/test/test_unique_id.rb +47 -0
- metadata +823 -0
@@ -0,0 +1,278 @@
|
|
1
|
+
require_relative 'helper'
|
2
|
+
require 'fluent/event_router'
|
3
|
+
require 'fluent/system_config'
|
4
|
+
require_relative 'test_plugin_classes'
|
5
|
+
|
6
|
+
class RootAgentTest < ::Test::Unit::TestCase
|
7
|
+
include Fluent
|
8
|
+
include FluentTest
|
9
|
+
|
10
|
+
def test_initialize
|
11
|
+
ra = RootAgent.new(log: $log)
|
12
|
+
assert_equal 0, ra.instance_variable_get(:@suppress_emit_error_log_interval)
|
13
|
+
assert_nil ra.instance_variable_get(:@next_emit_error_log_time)
|
14
|
+
end
|
15
|
+
|
16
|
+
data(
|
17
|
+
'suppress interval' => [{'emit_error_log_interval' => 30}, {:@suppress_emit_error_log_interval => 30}],
|
18
|
+
'without source' => [{'without_source' => true}, {:@without_source => true}]
|
19
|
+
)
|
20
|
+
def test_initialize_with_opt(data)
|
21
|
+
opt, expected = data
|
22
|
+
ra = RootAgent.new(log: $log, system_config: SystemConfig.new(opt))
|
23
|
+
expected.each { |k, v|
|
24
|
+
assert_equal v, ra.instance_variable_get(k)
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
sub_test_case 'configure' do
|
29
|
+
setup do
|
30
|
+
@ra = RootAgent.new(log: $log)
|
31
|
+
stub(Engine).root_agent { @ra }
|
32
|
+
end
|
33
|
+
|
34
|
+
def configure_ra(conf_str)
|
35
|
+
conf = Config.parse(conf_str, "(test)", "(test_dir)", true)
|
36
|
+
@ra.configure(conf)
|
37
|
+
@ra
|
38
|
+
end
|
39
|
+
|
40
|
+
test 'empty' do
|
41
|
+
ra = configure_ra('')
|
42
|
+
assert_empty ra.inputs
|
43
|
+
assert_empty ra.labels
|
44
|
+
assert_empty ra.outputs
|
45
|
+
assert_empty ra.filters
|
46
|
+
assert_nil ra.context
|
47
|
+
assert_nil ra.error_collector
|
48
|
+
end
|
49
|
+
|
50
|
+
test 'with plugins' do
|
51
|
+
# check @type and type in one configuration
|
52
|
+
conf = <<-EOC
|
53
|
+
<source>
|
54
|
+
@type test_in
|
55
|
+
@id test_in
|
56
|
+
</source>
|
57
|
+
<filter>
|
58
|
+
type test_filter
|
59
|
+
id test_filter
|
60
|
+
</filter>
|
61
|
+
<match **>
|
62
|
+
@type relabel
|
63
|
+
@id test_relabel
|
64
|
+
@label @test
|
65
|
+
</match>
|
66
|
+
<label @test>
|
67
|
+
<match **>
|
68
|
+
type test_out
|
69
|
+
id test_out
|
70
|
+
</match>
|
71
|
+
</label>
|
72
|
+
<label @ERROR>
|
73
|
+
<match>
|
74
|
+
@type null
|
75
|
+
</match>
|
76
|
+
</label>
|
77
|
+
EOC
|
78
|
+
ra = configure_ra(conf)
|
79
|
+
assert_kind_of FluentTestInput, ra.inputs.first
|
80
|
+
assert_kind_of Plugin::RelabelOutput, ra.outputs.first
|
81
|
+
assert_kind_of FluentTestFilter, ra.filters.first
|
82
|
+
assert ra.error_collector
|
83
|
+
|
84
|
+
%W(@test @ERROR).each { |label_symbol|
|
85
|
+
assert_include ra.labels, label_symbol
|
86
|
+
assert_kind_of Label, ra.labels[label_symbol]
|
87
|
+
}
|
88
|
+
|
89
|
+
test_label = ra.labels['@test']
|
90
|
+
assert_kind_of FluentTestOutput, test_label.outputs.first
|
91
|
+
assert_equal ra, test_label.root_agent
|
92
|
+
|
93
|
+
error_label = ra.labels['@ERROR']
|
94
|
+
assert_kind_of Fluent::Plugin::NullOutput, error_label.outputs.first
|
95
|
+
assert_kind_of RootAgent::RootAgentProxyWithoutErrorCollector, error_label.root_agent
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
sub_test_case 'start/shutdown' do
|
100
|
+
setup do
|
101
|
+
@ra = RootAgent.new(log: $log)
|
102
|
+
stub(Engine).root_agent { @ra }
|
103
|
+
@ra.configure(Config.parse(<<-EOC, "(test)", "(test_dir)", true))
|
104
|
+
<source>
|
105
|
+
@type test_in
|
106
|
+
@id test_in
|
107
|
+
</source>
|
108
|
+
<filter>
|
109
|
+
type test_filter
|
110
|
+
id test_filter
|
111
|
+
</filter>
|
112
|
+
<match **>
|
113
|
+
@type test_out
|
114
|
+
@id test_out
|
115
|
+
</match>
|
116
|
+
EOC
|
117
|
+
@ra
|
118
|
+
end
|
119
|
+
|
120
|
+
test 'plugin status' do
|
121
|
+
@ra.start
|
122
|
+
assert_true @ra.inputs.first.started
|
123
|
+
assert_true @ra.filters.first.started
|
124
|
+
assert_true @ra.outputs.first.started
|
125
|
+
|
126
|
+
@ra.shutdown
|
127
|
+
assert_false @ra.inputs.first.started
|
128
|
+
assert_false @ra.filters.first.started
|
129
|
+
assert_false @ra.outputs.first.started
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
sub_test_case 'configured with MultiOutput plugins' do
|
134
|
+
setup do
|
135
|
+
@ra = RootAgent.new(log: $log)
|
136
|
+
stub(Engine).root_agent { @ra }
|
137
|
+
@ra.configure(Config.parse(<<-EOC, "(test)", "(test_dir)", true))
|
138
|
+
<source>
|
139
|
+
@type test_in
|
140
|
+
@id test_in
|
141
|
+
</source>
|
142
|
+
<filter>
|
143
|
+
@type test_filter
|
144
|
+
@id test_filter
|
145
|
+
</filter>
|
146
|
+
<match **>
|
147
|
+
@type copy
|
148
|
+
@id test_copy
|
149
|
+
<store>
|
150
|
+
@type test_out
|
151
|
+
@id test_out1
|
152
|
+
</store>
|
153
|
+
<store>
|
154
|
+
@type test_out
|
155
|
+
@id test_out2
|
156
|
+
</store>
|
157
|
+
</match>
|
158
|
+
EOC
|
159
|
+
@ra
|
160
|
+
end
|
161
|
+
|
162
|
+
test 'plugin status with multi output' do
|
163
|
+
assert_equal 1, @ra.inputs.size
|
164
|
+
assert_equal 1, @ra.filters.size
|
165
|
+
assert_equal 3, @ra.outputs.size
|
166
|
+
|
167
|
+
@ra.start
|
168
|
+
assert_equal [true], @ra.inputs.map{|i| i.started? }
|
169
|
+
assert_equal [true], @ra.filters.map{|i| i.started? }
|
170
|
+
assert_equal [true, true, true], @ra.outputs.map{|i| i.started? }
|
171
|
+
|
172
|
+
assert_equal [true], @ra.inputs.map{|i| i.after_started? }
|
173
|
+
assert_equal [true], @ra.filters.map{|i| i.after_started? }
|
174
|
+
assert_equal [true, true, true], @ra.outputs.map{|i| i.after_started? }
|
175
|
+
|
176
|
+
@ra.shutdown
|
177
|
+
assert_equal [true], @ra.inputs.map{|i| i.stopped? }
|
178
|
+
assert_equal [true], @ra.filters.map{|i| i.stopped? }
|
179
|
+
assert_equal [true, true, true], @ra.outputs.map{|i| i.stopped? }
|
180
|
+
|
181
|
+
assert_equal [true], @ra.inputs.map{|i| i.before_shutdown? }
|
182
|
+
assert_equal [true], @ra.filters.map{|i| i.before_shutdown? }
|
183
|
+
assert_equal [true, true, true], @ra.outputs.map{|i| i.before_shutdown? }
|
184
|
+
|
185
|
+
assert_equal [true], @ra.inputs.map{|i| i.shutdown? }
|
186
|
+
assert_equal [true], @ra.filters.map{|i| i.shutdown? }
|
187
|
+
assert_equal [true, true, true], @ra.outputs.map{|i| i.shutdown? }
|
188
|
+
|
189
|
+
assert_equal [true], @ra.inputs.map{|i| i.after_shutdown? }
|
190
|
+
assert_equal [true], @ra.filters.map{|i| i.after_shutdown? }
|
191
|
+
assert_equal [true, true, true], @ra.outputs.map{|i| i.after_shutdown? }
|
192
|
+
|
193
|
+
assert_equal [true], @ra.inputs.map{|i| i.closed? }
|
194
|
+
assert_equal [true], @ra.filters.map{|i| i.closed? }
|
195
|
+
assert_equal [true, true, true], @ra.outputs.map{|i| i.closed? }
|
196
|
+
|
197
|
+
assert_equal [true], @ra.inputs.map{|i| i.terminated? }
|
198
|
+
assert_equal [true], @ra.filters.map{|i| i.terminated? }
|
199
|
+
assert_equal [true, true, true], @ra.outputs.map{|i| i.terminated? }
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
sub_test_case 'configured with MultiOutput plugins and labels' do
|
204
|
+
setup do
|
205
|
+
@ra = RootAgent.new(log: $log)
|
206
|
+
stub(Engine).root_agent { @ra }
|
207
|
+
@ra.configure(Config.parse(<<-EOC, "(test)", "(test_dir)", true))
|
208
|
+
<source>
|
209
|
+
@type test_in
|
210
|
+
@id test_in
|
211
|
+
@label @testing
|
212
|
+
</source>
|
213
|
+
<label @testing>
|
214
|
+
<filter>
|
215
|
+
@type test_filter
|
216
|
+
@id test_filter
|
217
|
+
</filter>
|
218
|
+
<match **>
|
219
|
+
@type copy
|
220
|
+
@id test_copy
|
221
|
+
<store>
|
222
|
+
@type test_out
|
223
|
+
@id test_out1
|
224
|
+
</store>
|
225
|
+
<store>
|
226
|
+
@type test_out
|
227
|
+
@id test_out2
|
228
|
+
</store>
|
229
|
+
</match>
|
230
|
+
</label>
|
231
|
+
EOC
|
232
|
+
@ra
|
233
|
+
end
|
234
|
+
|
235
|
+
test 'plugin status with multi output' do
|
236
|
+
assert_equal 1, @ra.inputs.size
|
237
|
+
assert_equal 0, @ra.filters.size
|
238
|
+
assert_equal 0, @ra.outputs.size
|
239
|
+
assert_equal 1, @ra.labels.size
|
240
|
+
assert_equal '@testing', @ra.labels.keys.first
|
241
|
+
assert_equal 1, @ra.labels.values.first.filters.size
|
242
|
+
assert_equal 3, @ra.labels.values.first.outputs.size
|
243
|
+
|
244
|
+
label_filters = @ra.labels.values.first.filters
|
245
|
+
label_outputs = @ra.labels.values.first.outputs
|
246
|
+
|
247
|
+
@ra.start
|
248
|
+
assert_equal [true], @ra.inputs.map{|i| i.started? }
|
249
|
+
assert_equal [true], label_filters.map{|i| i.started? }
|
250
|
+
assert_equal [true, true, true], label_outputs.map{|i| i.started? }
|
251
|
+
|
252
|
+
@ra.shutdown
|
253
|
+
assert_equal [true], @ra.inputs.map{|i| i.stopped? }
|
254
|
+
assert_equal [true], label_filters.map{|i| i.stopped? }
|
255
|
+
assert_equal [true, true, true], label_outputs.map{|i| i.stopped? }
|
256
|
+
|
257
|
+
assert_equal [true], @ra.inputs.map{|i| i.before_shutdown? }
|
258
|
+
assert_equal [true], label_filters.map{|i| i.before_shutdown? }
|
259
|
+
assert_equal [true, true, true], label_outputs.map{|i| i.before_shutdown? }
|
260
|
+
|
261
|
+
assert_equal [true], @ra.inputs.map{|i| i.shutdown? }
|
262
|
+
assert_equal [true], label_filters.map{|i| i.shutdown? }
|
263
|
+
assert_equal [true, true, true], label_outputs.map{|i| i.shutdown? }
|
264
|
+
|
265
|
+
assert_equal [true], @ra.inputs.map{|i| i.after_shutdown? }
|
266
|
+
assert_equal [true], label_filters.map{|i| i.after_shutdown? }
|
267
|
+
assert_equal [true, true, true], label_outputs.map{|i| i.after_shutdown? }
|
268
|
+
|
269
|
+
assert_equal [true], @ra.inputs.map{|i| i.closed? }
|
270
|
+
assert_equal [true], label_filters.map{|i| i.closed? }
|
271
|
+
assert_equal [true, true, true], label_outputs.map{|i| i.closed? }
|
272
|
+
|
273
|
+
assert_equal [true], @ra.inputs.map{|i| i.terminated? }
|
274
|
+
assert_equal [true], label_filters.map{|i| i.terminated? }
|
275
|
+
assert_equal [true, true, true], label_outputs.map{|i| i.terminated? }
|
276
|
+
end
|
277
|
+
end
|
278
|
+
end
|
@@ -0,0 +1,339 @@
|
|
1
|
+
require_relative 'helper'
|
2
|
+
require 'fluent/event_router'
|
3
|
+
require 'fluent/system_config'
|
4
|
+
require 'fluent/supervisor'
|
5
|
+
require_relative 'test_plugin_classes'
|
6
|
+
|
7
|
+
require 'net/http'
|
8
|
+
require 'uri'
|
9
|
+
require 'fileutils'
|
10
|
+
|
11
|
+
class SupervisorTest < ::Test::Unit::TestCase
|
12
|
+
include Fluent
|
13
|
+
include FluentTest
|
14
|
+
include ServerModule
|
15
|
+
include WorkerModule
|
16
|
+
|
17
|
+
TMP_DIR = File.dirname(__FILE__) + "/tmp/config#{ENV['TEST_ENV_NUMBER']}"
|
18
|
+
|
19
|
+
def setup
|
20
|
+
FileUtils.mkdir_p('test/tmp/supervisor')
|
21
|
+
end
|
22
|
+
|
23
|
+
def write_config(path, data)
|
24
|
+
FileUtils.mkdir_p(File.dirname(path))
|
25
|
+
File.open(path, "w") {|f| f.write data }
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_initialize
|
29
|
+
opts = Fluent::Supervisor.default_options
|
30
|
+
sv = Fluent::Supervisor.new(opts)
|
31
|
+
opts.each { |k, v|
|
32
|
+
assert_equal v, sv.instance_variable_get("@#{k}")
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_read_config
|
37
|
+
create_info_dummy_logger
|
38
|
+
|
39
|
+
tmp_dir = "#{TMP_DIR}/dir/test_read_config.conf"
|
40
|
+
conf_str = %[
|
41
|
+
<source>
|
42
|
+
@type forward
|
43
|
+
@id forward_input
|
44
|
+
</source>
|
45
|
+
<match debug.**>
|
46
|
+
@type stdout
|
47
|
+
@id stdout_output
|
48
|
+
</match>
|
49
|
+
]
|
50
|
+
write_config tmp_dir, conf_str
|
51
|
+
opts = Fluent::Supervisor.default_options
|
52
|
+
sv = Fluent::Supervisor.new(opts)
|
53
|
+
|
54
|
+
use_v1_config = {}
|
55
|
+
use_v1_config['use_v1_config'] = true
|
56
|
+
|
57
|
+
sv.instance_variable_set(:@config_path, tmp_dir)
|
58
|
+
sv.instance_variable_set(:@use_v1_config, use_v1_config)
|
59
|
+
sv.send(:read_config)
|
60
|
+
|
61
|
+
conf = sv.instance_variable_get(:@conf)
|
62
|
+
|
63
|
+
elem = conf.elements.find { |e| e.name == 'source' }
|
64
|
+
assert_equal "forward", elem['@type']
|
65
|
+
assert_equal "forward_input", elem['@id']
|
66
|
+
|
67
|
+
elem = conf.elements.find { |e| e.name == 'match' }
|
68
|
+
assert_equal "debug.**", elem.arg
|
69
|
+
assert_equal "stdout", elem['@type']
|
70
|
+
assert_equal "stdout_output", elem['@id']
|
71
|
+
|
72
|
+
$log.out.reset
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_system_config
|
76
|
+
opts = Fluent::Supervisor.default_options
|
77
|
+
sv = Fluent::Supervisor.new(opts)
|
78
|
+
conf_data = <<-EOC
|
79
|
+
<system>
|
80
|
+
rpc_endpoint 127.0.0.1:24445
|
81
|
+
suppress_repeated_stacktrace true
|
82
|
+
suppress_config_dump true
|
83
|
+
without_source true
|
84
|
+
enable_get_dump true
|
85
|
+
process_name "process_name"
|
86
|
+
log_level info
|
87
|
+
</system>
|
88
|
+
EOC
|
89
|
+
conf = Fluent::Config.parse(conf_data, "(test)", "(test_dir)", true)
|
90
|
+
sv.instance_variable_set(:@conf, conf)
|
91
|
+
sv.send(:set_system_config)
|
92
|
+
sys_conf = sv.instance_variable_get(:@system_config)
|
93
|
+
|
94
|
+
assert_equal '127.0.0.1:24445', sys_conf.rpc_endpoint
|
95
|
+
assert_equal true, sys_conf.suppress_repeated_stacktrace
|
96
|
+
assert_equal true, sys_conf.suppress_config_dump
|
97
|
+
assert_equal true, sys_conf.without_source
|
98
|
+
assert_equal true, sys_conf.enable_get_dump
|
99
|
+
assert_equal "process_name", sys_conf.process_name
|
100
|
+
assert_equal 2, sys_conf.log_level
|
101
|
+
end
|
102
|
+
|
103
|
+
def test_main_process_signal_handlers
|
104
|
+
create_info_dummy_logger
|
105
|
+
|
106
|
+
unless Fluent.windows?
|
107
|
+
opts = Fluent::Supervisor.default_options
|
108
|
+
sv = Fluent::Supervisor.new(opts)
|
109
|
+
sv.send(:install_main_process_signal_handlers)
|
110
|
+
|
111
|
+
begin
|
112
|
+
Process.kill :USR1, $$
|
113
|
+
rescue
|
114
|
+
end
|
115
|
+
|
116
|
+
sleep 1
|
117
|
+
|
118
|
+
info_msg = '[info]: force flushing buffered events' + "\n"
|
119
|
+
assert{ $log.out.logs.first.end_with?(info_msg) }
|
120
|
+
end
|
121
|
+
|
122
|
+
$log.out.reset
|
123
|
+
end
|
124
|
+
|
125
|
+
def test_supervisor_signal_handler
|
126
|
+
create_debug_dummy_logger
|
127
|
+
|
128
|
+
unless Fluent.windows?
|
129
|
+
|
130
|
+
install_supervisor_signal_handlers
|
131
|
+
begin
|
132
|
+
Process.kill :USR1, $$
|
133
|
+
rescue
|
134
|
+
end
|
135
|
+
|
136
|
+
sleep 1
|
137
|
+
|
138
|
+
debug_msg = '[debug]: fluentd supervisor process get SIGUSR1' + "\n"
|
139
|
+
assert{ $log.out.logs.first.end_with?(debug_msg) }
|
140
|
+
end
|
141
|
+
|
142
|
+
$log.out.reset
|
143
|
+
end
|
144
|
+
|
145
|
+
def test_rpc_server
|
146
|
+
create_info_dummy_logger
|
147
|
+
|
148
|
+
unless Fluent.windows?
|
149
|
+
opts = Fluent::Supervisor.default_options
|
150
|
+
sv = Fluent::Supervisor.new(opts)
|
151
|
+
conf_data = <<-EOC
|
152
|
+
<system>
|
153
|
+
rpc_endpoint 0.0.0.0:24447
|
154
|
+
</system>
|
155
|
+
EOC
|
156
|
+
conf = Fluent::Config.parse(conf_data, "(test)", "(test_dir)", true)
|
157
|
+
sv.instance_variable_set(:@conf, conf)
|
158
|
+
sv.send(:set_system_config)
|
159
|
+
sys_conf = sv.instance_variable_get(:@system_config)
|
160
|
+
@rpc_endpoint = sys_conf.rpc_endpoint
|
161
|
+
@enable_get_dump = sys_conf.enable_get_dump
|
162
|
+
|
163
|
+
run_rpc_server
|
164
|
+
|
165
|
+
sv.send(:install_main_process_signal_handlers)
|
166
|
+
Net::HTTP.get URI.parse('http://0.0.0.0:24447/api/plugins.flushBuffers')
|
167
|
+
info_msg = '[info]: force flushing buffered events' + "\n"
|
168
|
+
|
169
|
+
stop_rpc_server
|
170
|
+
|
171
|
+
# In TravisCI with OSX(Xcode), it seems that can't use rpc server.
|
172
|
+
# This test will be passed in such environment.
|
173
|
+
pend unless $log.out.logs.first
|
174
|
+
|
175
|
+
assert{ $log.out.logs.first.end_with?(info_msg) }
|
176
|
+
end
|
177
|
+
|
178
|
+
$log.out.reset
|
179
|
+
end
|
180
|
+
|
181
|
+
def test_load_config
|
182
|
+
tmp_dir = "#{TMP_DIR}/dir/test_load_config.conf"
|
183
|
+
conf_info_str = %[
|
184
|
+
<system>
|
185
|
+
log_level info
|
186
|
+
</system>
|
187
|
+
]
|
188
|
+
conf_debug_str = %[
|
189
|
+
<system>
|
190
|
+
log_level debug
|
191
|
+
</system>
|
192
|
+
]
|
193
|
+
write_config tmp_dir, conf_info_str
|
194
|
+
|
195
|
+
params = {}
|
196
|
+
params['use_v1_config'] = true
|
197
|
+
params['log_path'] = 'test/tmp/supervisor/log'
|
198
|
+
params['suppress_repeated_stacktrace'] = true
|
199
|
+
params['log_level'] = Fluent::Log::LEVEL_INFO
|
200
|
+
load_config_proc = Proc.new { Fluent::Supervisor.load_config(tmp_dir, params) }
|
201
|
+
|
202
|
+
# first call
|
203
|
+
se_config = load_config_proc.call
|
204
|
+
assert_equal Fluent::Log::LEVEL_INFO, se_config[:log_level]
|
205
|
+
assert_equal true, se_config[:suppress_repeated_stacktrace]
|
206
|
+
assert_equal 'spawn', se_config[:worker_type]
|
207
|
+
assert_equal 1, se_config[:workers]
|
208
|
+
assert_equal false, se_config[:log_stdin]
|
209
|
+
assert_equal false, se_config[:log_stdout]
|
210
|
+
assert_equal false, se_config[:log_stderr]
|
211
|
+
assert_equal true, se_config[:enable_heartbeat]
|
212
|
+
assert_equal false, se_config[:auto_heartbeat]
|
213
|
+
assert_equal false, se_config[:daemonize]
|
214
|
+
assert_nil se_config[:pid_path]
|
215
|
+
|
216
|
+
# second call immediately(reuse config)
|
217
|
+
se_config = load_config_proc.call
|
218
|
+
pre_config_mtime = se_config[:windows_daemon_cmdline][5]['pre_config_mtime']
|
219
|
+
pre_loadtime = se_config[:windows_daemon_cmdline][5]['pre_loadtime']
|
220
|
+
assert_nil pre_config_mtime
|
221
|
+
assert_nil pre_loadtime
|
222
|
+
|
223
|
+
sleep 5
|
224
|
+
|
225
|
+
# third call after 5 seconds(don't reuse config)
|
226
|
+
se_config = load_config_proc.call
|
227
|
+
pre_config_mtime = se_config[:windows_daemon_cmdline][5]['pre_config_mtime']
|
228
|
+
pre_loadtime = se_config[:windows_daemon_cmdline][5]['pre_loadtime']
|
229
|
+
assert_not_nil pre_config_mtime
|
230
|
+
assert_not_nil pre_loadtime
|
231
|
+
|
232
|
+
# forth call immediately(reuse config)
|
233
|
+
se_config = load_config_proc.call
|
234
|
+
# test that pre_config_mtime and pre_loadtime are not changed from previous one because reused pre_config
|
235
|
+
assert_equal pre_config_mtime, se_config[:windows_daemon_cmdline][5]['pre_config_mtime']
|
236
|
+
assert_equal pre_loadtime, se_config[:windows_daemon_cmdline][5]['pre_loadtime']
|
237
|
+
|
238
|
+
write_config tmp_dir, conf_debug_str
|
239
|
+
|
240
|
+
# fifth call after changed conf file(don't reuse config)
|
241
|
+
se_config = load_config_proc.call
|
242
|
+
assert_equal Fluent::Log::LEVEL_DEBUG, se_config[:log_level]
|
243
|
+
end
|
244
|
+
|
245
|
+
def test_load_config_for_daemonize
|
246
|
+
tmp_dir = "#{TMP_DIR}/dir/test_load_config.conf"
|
247
|
+
conf_info_str = %[
|
248
|
+
<system>
|
249
|
+
log_level info
|
250
|
+
</system>
|
251
|
+
]
|
252
|
+
conf_debug_str = %[
|
253
|
+
<system>
|
254
|
+
log_level debug
|
255
|
+
</system>
|
256
|
+
]
|
257
|
+
write_config tmp_dir, conf_info_str
|
258
|
+
|
259
|
+
params = {}
|
260
|
+
params['use_v1_config'] = true
|
261
|
+
params['log_path'] = 'test/tmp/supervisor/log'
|
262
|
+
params['suppress_repeated_stacktrace'] = true
|
263
|
+
params['log_level'] = Fluent::Log::LEVEL_INFO
|
264
|
+
params['daemonize'] = './fluentd.pid'
|
265
|
+
load_config_proc = Proc.new { Fluent::Supervisor.load_config(tmp_dir, params) }
|
266
|
+
|
267
|
+
# first call
|
268
|
+
se_config = load_config_proc.call
|
269
|
+
assert_equal Fluent::Log::LEVEL_INFO, se_config[:log_level]
|
270
|
+
assert_equal true, se_config[:suppress_repeated_stacktrace]
|
271
|
+
assert_equal 'spawn', se_config[:worker_type]
|
272
|
+
assert_equal 1, se_config[:workers]
|
273
|
+
assert_equal false, se_config[:log_stdin]
|
274
|
+
assert_equal false, se_config[:log_stdout]
|
275
|
+
assert_equal false, se_config[:log_stderr]
|
276
|
+
assert_equal true, se_config[:enable_heartbeat]
|
277
|
+
assert_equal false, se_config[:auto_heartbeat]
|
278
|
+
assert_equal true, se_config[:daemonize]
|
279
|
+
assert_equal './fluentd.pid', se_config[:pid_path]
|
280
|
+
|
281
|
+
# second call immediately(reuse config)
|
282
|
+
se_config = load_config_proc.call
|
283
|
+
pre_config_mtime = se_config[:windows_daemon_cmdline][5]['pre_config_mtime']
|
284
|
+
pre_loadtime = se_config[:windows_daemon_cmdline][5]['pre_loadtime']
|
285
|
+
assert_nil pre_config_mtime
|
286
|
+
assert_nil pre_loadtime
|
287
|
+
|
288
|
+
sleep 5
|
289
|
+
|
290
|
+
# third call after 5 seconds(don't reuse config)
|
291
|
+
se_config = load_config_proc.call
|
292
|
+
pre_config_mtime = se_config[:windows_daemon_cmdline][5]['pre_config_mtime']
|
293
|
+
pre_loadtime = se_config[:windows_daemon_cmdline][5]['pre_loadtime']
|
294
|
+
assert_not_nil pre_config_mtime
|
295
|
+
assert_not_nil pre_loadtime
|
296
|
+
|
297
|
+
# forth call immediately(reuse config)
|
298
|
+
se_config = load_config_proc.call
|
299
|
+
# test that pre_config_mtime and pre_loadtime are not changed from previous one because reused pre_config
|
300
|
+
assert_equal pre_config_mtime, se_config[:windows_daemon_cmdline][5]['pre_config_mtime']
|
301
|
+
assert_equal pre_loadtime, se_config[:windows_daemon_cmdline][5]['pre_loadtime']
|
302
|
+
|
303
|
+
write_config tmp_dir, conf_debug_str
|
304
|
+
|
305
|
+
# fifth call after changed conf file(don't reuse config)
|
306
|
+
se_config = load_config_proc.call
|
307
|
+
assert_equal Fluent::Log::LEVEL_DEBUG, se_config[:log_level]
|
308
|
+
end
|
309
|
+
|
310
|
+
def test_logger
|
311
|
+
opts = Fluent::Supervisor.default_options
|
312
|
+
sv = Fluent::Supervisor.new(opts)
|
313
|
+
log = sv.instance_variable_get(:@log)
|
314
|
+
log.init
|
315
|
+
logger = $log.instance_variable_get(:@logger)
|
316
|
+
|
317
|
+
assert_equal Fluent::Log::LEVEL_INFO, $log.level
|
318
|
+
|
319
|
+
# test that DamonLogger#level= overwrites Fluent.log#level
|
320
|
+
logger.level = 'debug'
|
321
|
+
assert_equal Fluent::Log::LEVEL_DEBUG, $log.level
|
322
|
+
end
|
323
|
+
|
324
|
+
def create_debug_dummy_logger
|
325
|
+
dl_opts = {}
|
326
|
+
dl_opts[:log_level] = ServerEngine::DaemonLogger::DEBUG
|
327
|
+
logdev = Fluent::Test::DummyLogDevice.new
|
328
|
+
logger = ServerEngine::DaemonLogger.new(logdev, dl_opts)
|
329
|
+
$log = Fluent::Log.new(logger)
|
330
|
+
end
|
331
|
+
|
332
|
+
def create_info_dummy_logger
|
333
|
+
dl_opts = {}
|
334
|
+
dl_opts[:log_level] = ServerEngine::DaemonLogger::INFO
|
335
|
+
logdev = Fluent::Test::DummyLogDevice.new
|
336
|
+
logger = ServerEngine::DaemonLogger.new(logdev, dl_opts)
|
337
|
+
$log = Fluent::Log.new(logger)
|
338
|
+
end
|
339
|
+
end
|