fluentd 1.17.0-x64-mingw-ucrt → 1.17.1-x64-mingw-ucrt
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +46 -0
- data/README.md +1 -0
- data/SECURITY.md +2 -2
- data/fluent.conf +14 -14
- data/lib/fluent/command/cap_ctl.rb +4 -4
- data/lib/fluent/compat/call_super_mixin.rb +3 -3
- data/lib/fluent/compat/propagate_default.rb +4 -4
- data/lib/fluent/config/yaml_parser/parser.rb +4 -0
- data/lib/fluent/log/console_adapter.rb +4 -2
- data/lib/fluent/plugin/in_exec.rb +14 -2
- data/lib/fluent/plugin/in_http.rb +1 -1
- data/lib/fluent/plugin/in_sample.rb +13 -7
- data/lib/fluent/plugin/in_tail.rb +65 -23
- data/lib/fluent/plugin/out_copy.rb +1 -1
- data/lib/fluent/plugin/out_file.rb +8 -0
- data/lib/fluent/plugin/out_http.rb +12 -0
- data/lib/fluent/plugin/parser_json.rb +4 -12
- data/lib/fluent/plugin_helper/http_server/server.rb +1 -1
- data/lib/fluent/version.rb +1 -1
- data/templates/new_gem/fluent-plugin.gemspec.erb +6 -5
- metadata +25 -472
- data/.github/DISCUSSION_TEMPLATE/q-a-japanese.yml +0 -50
- data/.github/DISCUSSION_TEMPLATE/q-a.yml +0 -47
- data/.github/ISSUE_TEMPLATE/bug_report.yml +0 -71
- data/.github/ISSUE_TEMPLATE/config.yml +0 -5
- data/.github/ISSUE_TEMPLATE/feature_request.yml +0 -39
- data/.github/ISSUE_TEMPLATE.md +0 -17
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -14
- data/.github/workflows/stale-actions.yml +0 -24
- data/.github/workflows/test-ruby-head.yml +0 -31
- data/.github/workflows/test.yml +0 -32
- data/.gitignore +0 -30
- data/Gemfile +0 -9
- data/fluentd.gemspec +0 -62
- data/test/command/test_binlog_reader.rb +0 -362
- data/test/command/test_ca_generate.rb +0 -70
- data/test/command/test_cap_ctl.rb +0 -100
- data/test/command/test_cat.rb +0 -128
- data/test/command/test_ctl.rb +0 -56
- data/test/command/test_fluentd.rb +0 -1291
- data/test/command/test_plugin_config_formatter.rb +0 -397
- data/test/command/test_plugin_generator.rb +0 -109
- data/test/compat/test_calls_super.rb +0 -166
- data/test/compat/test_parser.rb +0 -92
- data/test/config/assertions.rb +0 -42
- data/test/config/test_config_parser.rb +0 -551
- data/test/config/test_configurable.rb +0 -1784
- data/test/config/test_configure_proxy.rb +0 -604
- data/test/config/test_dsl.rb +0 -415
- data/test/config/test_element.rb +0 -518
- data/test/config/test_literal_parser.rb +0 -309
- data/test/config/test_plugin_configuration.rb +0 -56
- data/test/config/test_section.rb +0 -191
- data/test/config/test_system_config.rb +0 -195
- data/test/config/test_types.rb +0 -408
- data/test/counter/test_client.rb +0 -563
- data/test/counter/test_error.rb +0 -44
- data/test/counter/test_mutex_hash.rb +0 -179
- data/test/counter/test_server.rb +0 -589
- data/test/counter/test_store.rb +0 -258
- data/test/counter/test_validator.rb +0 -137
- data/test/helper.rb +0 -155
- data/test/helpers/fuzzy_assert.rb +0 -89
- data/test/helpers/process_extenstion.rb +0 -33
- data/test/log/test_console_adapter.rb +0 -117
- 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/foo/bar2 +0 -0
- data/test/plugin/data/log/test.log +0 -0
- data/test/plugin/data/log_numeric/01.log +0 -0
- data/test/plugin/data/log_numeric/02.log +0 -0
- data/test/plugin/data/log_numeric/12.log +0 -0
- data/test/plugin/data/log_numeric/14.log +0 -0
- data/test/plugin/data/sd_file/config +0 -11
- data/test/plugin/data/sd_file/config.json +0 -17
- data/test/plugin/data/sd_file/config.yaml +0 -11
- data/test/plugin/data/sd_file/config.yml +0 -11
- data/test/plugin/data/sd_file/invalid_config.yml +0 -7
- data/test/plugin/in_tail/test_fifo.rb +0 -121
- data/test/plugin/in_tail/test_io_handler.rb +0 -150
- data/test/plugin/in_tail/test_position_file.rb +0 -346
- data/test/plugin/out_forward/test_ack_handler.rb +0 -140
- data/test/plugin/out_forward/test_connection_manager.rb +0 -145
- data/test/plugin/out_forward/test_handshake_protocol.rb +0 -112
- data/test/plugin/out_forward/test_load_balancer.rb +0 -106
- data/test/plugin/out_forward/test_socket_cache.rb +0 -174
- data/test/plugin/test_bare_output.rb +0 -131
- data/test/plugin/test_base.rb +0 -247
- data/test/plugin/test_buf_file.rb +0 -1314
- data/test/plugin/test_buf_file_single.rb +0 -898
- data/test/plugin/test_buf_memory.rb +0 -42
- data/test/plugin/test_buffer.rb +0 -1493
- data/test/plugin/test_buffer_chunk.rb +0 -209
- data/test/plugin/test_buffer_file_chunk.rb +0 -871
- data/test/plugin/test_buffer_file_single_chunk.rb +0 -611
- data/test/plugin/test_buffer_memory_chunk.rb +0 -339
- data/test/plugin/test_compressable.rb +0 -87
- data/test/plugin/test_file_util.rb +0 -96
- data/test/plugin/test_filter.rb +0 -368
- data/test/plugin/test_filter_grep.rb +0 -697
- data/test/plugin/test_filter_parser.rb +0 -731
- data/test/plugin/test_filter_record_transformer.rb +0 -577
- data/test/plugin/test_filter_stdout.rb +0 -207
- data/test/plugin/test_formatter_csv.rb +0 -136
- data/test/plugin/test_formatter_hash.rb +0 -38
- data/test/plugin/test_formatter_json.rb +0 -61
- data/test/plugin/test_formatter_ltsv.rb +0 -70
- data/test/plugin/test_formatter_msgpack.rb +0 -28
- data/test/plugin/test_formatter_out_file.rb +0 -116
- data/test/plugin/test_formatter_single_value.rb +0 -44
- data/test/plugin/test_formatter_tsv.rb +0 -76
- data/test/plugin/test_in_debug_agent.rb +0 -49
- data/test/plugin/test_in_exec.rb +0 -261
- data/test/plugin/test_in_forward.rb +0 -1178
- data/test/plugin/test_in_gc_stat.rb +0 -62
- data/test/plugin/test_in_http.rb +0 -1124
- data/test/plugin/test_in_monitor_agent.rb +0 -922
- data/test/plugin/test_in_object_space.rb +0 -66
- data/test/plugin/test_in_sample.rb +0 -190
- data/test/plugin/test_in_syslog.rb +0 -505
- data/test/plugin/test_in_tail.rb +0 -3429
- data/test/plugin/test_in_tcp.rb +0 -328
- data/test/plugin/test_in_udp.rb +0 -296
- data/test/plugin/test_in_unix.rb +0 -181
- data/test/plugin/test_input.rb +0 -137
- data/test/plugin/test_metadata.rb +0 -89
- data/test/plugin/test_metrics.rb +0 -294
- data/test/plugin/test_metrics_local.rb +0 -96
- data/test/plugin/test_multi_output.rb +0 -204
- data/test/plugin/test_out_copy.rb +0 -308
- data/test/plugin/test_out_exec.rb +0 -312
- data/test/plugin/test_out_exec_filter.rb +0 -606
- data/test/plugin/test_out_file.rb +0 -1038
- data/test/plugin/test_out_forward.rb +0 -1349
- data/test/plugin/test_out_http.rb +0 -557
- data/test/plugin/test_out_null.rb +0 -105
- data/test/plugin/test_out_relabel.rb +0 -28
- data/test/plugin/test_out_roundrobin.rb +0 -146
- data/test/plugin/test_out_secondary_file.rb +0 -458
- data/test/plugin/test_out_stdout.rb +0 -205
- data/test/plugin/test_out_stream.rb +0 -103
- data/test/plugin/test_output.rb +0 -1334
- data/test/plugin/test_output_as_buffered.rb +0 -2024
- data/test/plugin/test_output_as_buffered_backup.rb +0 -363
- data/test/plugin/test_output_as_buffered_compress.rb +0 -179
- data/test/plugin/test_output_as_buffered_overflow.rb +0 -250
- data/test/plugin/test_output_as_buffered_retries.rb +0 -966
- data/test/plugin/test_output_as_buffered_secondary.rb +0 -882
- data/test/plugin/test_output_as_standard.rb +0 -374
- data/test/plugin/test_owned_by.rb +0 -34
- data/test/plugin/test_parser.rb +0 -399
- data/test/plugin/test_parser_apache.rb +0 -42
- data/test/plugin/test_parser_apache2.rb +0 -47
- data/test/plugin/test_parser_apache_error.rb +0 -45
- data/test/plugin/test_parser_csv.rb +0 -200
- data/test/plugin/test_parser_json.rb +0 -244
- data/test/plugin/test_parser_labeled_tsv.rb +0 -160
- data/test/plugin/test_parser_msgpack.rb +0 -127
- data/test/plugin/test_parser_multiline.rb +0 -111
- data/test/plugin/test_parser_nginx.rb +0 -88
- data/test/plugin/test_parser_none.rb +0 -52
- data/test/plugin/test_parser_regexp.rb +0 -284
- data/test/plugin/test_parser_syslog.rb +0 -650
- data/test/plugin/test_parser_tsv.rb +0 -122
- data/test/plugin/test_sd_file.rb +0 -228
- data/test/plugin/test_sd_srv.rb +0 -230
- data/test/plugin/test_storage.rb +0 -166
- data/test/plugin/test_storage_local.rb +0 -335
- data/test/plugin/test_string_util.rb +0 -26
- data/test/plugin_helper/data/cert/cert-key.pem +0 -27
- data/test/plugin_helper/data/cert/cert-with-CRLF.pem +0 -19
- data/test/plugin_helper/data/cert/cert-with-no-newline.pem +0 -19
- data/test/plugin_helper/data/cert/cert.pem +0 -19
- data/test/plugin_helper/data/cert/cert_chains/ca-cert-key.pem +0 -27
- data/test/plugin_helper/data/cert/cert_chains/ca-cert.pem +0 -20
- data/test/plugin_helper/data/cert/cert_chains/cert-key.pem +0 -27
- data/test/plugin_helper/data/cert/cert_chains/cert.pem +0 -40
- data/test/plugin_helper/data/cert/empty.pem +0 -0
- data/test/plugin_helper/data/cert/generate_cert.rb +0 -125
- data/test/plugin_helper/data/cert/with_ca/ca-cert-key-pass.pem +0 -30
- data/test/plugin_helper/data/cert/with_ca/ca-cert-key.pem +0 -27
- data/test/plugin_helper/data/cert/with_ca/ca-cert-pass.pem +0 -20
- data/test/plugin_helper/data/cert/with_ca/ca-cert.pem +0 -20
- data/test/plugin_helper/data/cert/with_ca/cert-key-pass.pem +0 -30
- data/test/plugin_helper/data/cert/with_ca/cert-key.pem +0 -27
- data/test/plugin_helper/data/cert/with_ca/cert-pass.pem +0 -21
- data/test/plugin_helper/data/cert/with_ca/cert.pem +0 -21
- data/test/plugin_helper/data/cert/without_ca/cert-key-pass.pem +0 -30
- data/test/plugin_helper/data/cert/without_ca/cert-key.pem +0 -27
- data/test/plugin_helper/data/cert/without_ca/cert-pass.pem +0 -20
- data/test/plugin_helper/data/cert/without_ca/cert.pem +0 -20
- data/test/plugin_helper/http_server/test_app.rb +0 -65
- data/test/plugin_helper/http_server/test_route.rb +0 -32
- data/test/plugin_helper/service_discovery/test_manager.rb +0 -93
- data/test/plugin_helper/service_discovery/test_round_robin_balancer.rb +0 -21
- data/test/plugin_helper/test_cert_option.rb +0 -25
- data/test/plugin_helper/test_child_process.rb +0 -862
- data/test/plugin_helper/test_compat_parameters.rb +0 -358
- data/test/plugin_helper/test_event_emitter.rb +0 -80
- data/test/plugin_helper/test_event_loop.rb +0 -52
- data/test/plugin_helper/test_extract.rb +0 -194
- data/test/plugin_helper/test_formatter.rb +0 -255
- data/test/plugin_helper/test_http_server_helper.rb +0 -372
- data/test/plugin_helper/test_inject.rb +0 -561
- data/test/plugin_helper/test_metrics.rb +0 -137
- data/test/plugin_helper/test_parser.rb +0 -264
- data/test/plugin_helper/test_record_accessor.rb +0 -238
- data/test/plugin_helper/test_retry_state.rb +0 -1006
- data/test/plugin_helper/test_server.rb +0 -1895
- data/test/plugin_helper/test_service_discovery.rb +0 -165
- data/test/plugin_helper/test_socket.rb +0 -146
- data/test/plugin_helper/test_storage.rb +0 -542
- data/test/plugin_helper/test_thread.rb +0 -164
- data/test/plugin_helper/test_timer.rb +0 -130
- data/test/scripts/exec_script.rb +0 -32
- data/test/scripts/fluent/plugin/formatter1/formatter_test1.rb +0 -7
- data/test/scripts/fluent/plugin/formatter2/formatter_test2.rb +0 -7
- data/test/scripts/fluent/plugin/formatter_known.rb +0 -8
- data/test/scripts/fluent/plugin/out_test.rb +0 -81
- data/test/scripts/fluent/plugin/out_test2.rb +0 -80
- data/test/scripts/fluent/plugin/parser_known.rb +0 -4
- data/test/test_capability.rb +0 -74
- data/test/test_clock.rb +0 -164
- data/test/test_config.rb +0 -369
- data/test/test_configdsl.rb +0 -148
- data/test/test_daemonizer.rb +0 -91
- data/test/test_engine.rb +0 -203
- data/test/test_event.rb +0 -531
- data/test/test_event_router.rb +0 -348
- data/test/test_event_time.rb +0 -199
- data/test/test_file_wrapper.rb +0 -53
- data/test/test_filter.rb +0 -121
- data/test/test_fluent_log_event_router.rb +0 -99
- data/test/test_formatter.rb +0 -369
- data/test/test_input.rb +0 -31
- data/test/test_log.rb +0 -1076
- data/test/test_match.rb +0 -148
- data/test/test_mixin.rb +0 -351
- data/test/test_msgpack_factory.rb +0 -50
- data/test/test_oj_options.rb +0 -55
- data/test/test_output.rb +0 -278
- data/test/test_plugin.rb +0 -251
- data/test/test_plugin_classes.rb +0 -370
- data/test/test_plugin_helper.rb +0 -81
- data/test/test_plugin_id.rb +0 -119
- data/test/test_process.rb +0 -14
- data/test/test_root_agent.rb +0 -951
- data/test/test_static_config_analysis.rb +0 -177
- data/test/test_supervisor.rb +0 -821
- data/test/test_test_drivers.rb +0 -136
- data/test/test_time_formatter.rb +0 -301
- data/test/test_time_parser.rb +0 -362
- data/test/test_tls.rb +0 -65
- data/test/test_unique_id.rb +0 -47
- data/test/test_variable_store.rb +0 -65
@@ -1,358 +0,0 @@
|
|
1
|
-
require_relative '../helper'
|
2
|
-
require 'fluent/plugin_helper/compat_parameters'
|
3
|
-
require 'fluent/plugin/input'
|
4
|
-
require 'fluent/plugin/output'
|
5
|
-
require 'fluent/time'
|
6
|
-
|
7
|
-
require 'time'
|
8
|
-
|
9
|
-
class CompatParameterTest < Test::Unit::TestCase
|
10
|
-
setup do
|
11
|
-
Fluent::Test.setup
|
12
|
-
@i = nil
|
13
|
-
@default_newline = if Fluent.windows?
|
14
|
-
"\r\n"
|
15
|
-
else
|
16
|
-
"\n"
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
teardown do
|
21
|
-
if @i
|
22
|
-
@i.stop unless @i.stopped?
|
23
|
-
@i.before_shutdown unless @i.before_shutdown?
|
24
|
-
@i.shutdown unless @i.shutdown?
|
25
|
-
@i.after_shutdown unless @i.after_shutdown?
|
26
|
-
@i.close unless @i.closed?
|
27
|
-
@i.terminate unless @i.terminated?
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
class DummyI0 < Fluent::Plugin::Input
|
32
|
-
helpers :compat_parameters, :parser, :extract
|
33
|
-
attr_reader :parser
|
34
|
-
def configure(conf)
|
35
|
-
compat_parameters_convert(conf, :extract, :parser)
|
36
|
-
super
|
37
|
-
end
|
38
|
-
def start
|
39
|
-
super
|
40
|
-
@parser = parser_create
|
41
|
-
end
|
42
|
-
def produce_events(input_data)
|
43
|
-
emit_events = [] # tag, time, record
|
44
|
-
@parser.parse(input_data) do |time, record|
|
45
|
-
tag = extract_tag_from_record(record) || 'dummy_tag'
|
46
|
-
emit_events << [tag, time, record]
|
47
|
-
end
|
48
|
-
emit_events
|
49
|
-
end
|
50
|
-
end
|
51
|
-
class DummyO0 < Fluent::Plugin::Output
|
52
|
-
helpers :compat_parameters
|
53
|
-
def configure(conf)
|
54
|
-
compat_parameters_buffer(conf, default_chunk_key: '')
|
55
|
-
super
|
56
|
-
end
|
57
|
-
def write(chunk); end # dummy
|
58
|
-
end
|
59
|
-
class DummyO1 < Fluent::Plugin::Output
|
60
|
-
helpers :compat_parameters
|
61
|
-
def configure(conf)
|
62
|
-
compat_parameters_buffer(conf, default_chunk_key: 'time')
|
63
|
-
super
|
64
|
-
end
|
65
|
-
def write(chunk); end # dummy
|
66
|
-
end
|
67
|
-
class DummyO2 < Fluent::Plugin::Output
|
68
|
-
helpers :compat_parameters
|
69
|
-
def configure(conf)
|
70
|
-
compat_parameters_buffer(conf, default_chunk_key: 'time')
|
71
|
-
super
|
72
|
-
end
|
73
|
-
def write(chunk); end # dummy
|
74
|
-
end
|
75
|
-
class DummyO3 < Fluent::Plugin::Output
|
76
|
-
helpers :compat_parameters
|
77
|
-
def configure(conf)
|
78
|
-
compat_parameters_buffer(conf, default_chunk_key: 'tag')
|
79
|
-
super
|
80
|
-
end
|
81
|
-
def write(chunk); end # dummy
|
82
|
-
end
|
83
|
-
class DummyO4 < Fluent::Plugin::Output
|
84
|
-
helpers :compat_parameters, :inject, :formatter
|
85
|
-
attr_reader :f
|
86
|
-
def configure(conf)
|
87
|
-
compat_parameters_convert(conf, :buffer, :inject, :formatter, default_chunk_key: 'tag')
|
88
|
-
super
|
89
|
-
end
|
90
|
-
def start
|
91
|
-
super
|
92
|
-
@f = formatter_create()
|
93
|
-
end
|
94
|
-
def write(chunk); end # dummy
|
95
|
-
end
|
96
|
-
|
97
|
-
sub_test_case 'output plugins which does not have default chunk key' do
|
98
|
-
test 'plugin helper converts parameters into plugin configuration parameters' do
|
99
|
-
hash = {
|
100
|
-
'num_threads' => 8,
|
101
|
-
'flush_interval' => '10s',
|
102
|
-
'buffer_chunk_limit' => '8m',
|
103
|
-
'buffer_queue_limit' => '1024',
|
104
|
-
'flush_at_shutdown' => 'yes',
|
105
|
-
}
|
106
|
-
conf = config_element('ROOT', '', hash)
|
107
|
-
@i = DummyO0.new
|
108
|
-
@i.configure(conf)
|
109
|
-
|
110
|
-
assert_equal 'memory', @i.buffer_config[:@type]
|
111
|
-
assert_equal [], @i.buffer_config.chunk_keys
|
112
|
-
assert_equal 8, @i.buffer_config.flush_thread_count
|
113
|
-
assert_equal 10, @i.buffer_config.flush_interval
|
114
|
-
assert_equal :default, @i.buffer_config.flush_mode
|
115
|
-
assert @i.buffer_config.flush_at_shutdown
|
116
|
-
|
117
|
-
assert_equal 8*1024*1024, @i.buffer.chunk_limit_size
|
118
|
-
assert_equal 1024, @i.buffer.queue_limit_length
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
sub_test_case 'output plugins which has default chunk key: time' do
|
123
|
-
test 'plugin helper converts parameters into plugin configuration parameters' do
|
124
|
-
hash = {
|
125
|
-
'buffer_type' => 'file',
|
126
|
-
'buffer_path' => '/tmp/mybuffer',
|
127
|
-
'disable_retry_limit' => 'yes',
|
128
|
-
'max_retry_wait' => '1h',
|
129
|
-
'buffer_queue_full_action' => 'block',
|
130
|
-
}
|
131
|
-
conf = config_element('ROOT', '', hash)
|
132
|
-
@i = DummyO1.new
|
133
|
-
@i.configure(conf)
|
134
|
-
|
135
|
-
assert_equal 'file', @i.buffer_config[:@type]
|
136
|
-
assert_equal 24*60*60, @i.buffer_config.timekey
|
137
|
-
assert @i.buffer_config.retry_forever
|
138
|
-
assert_equal 60*60, @i.buffer_config.retry_max_interval
|
139
|
-
assert_equal :block, @i.buffer_config.overflow_action
|
140
|
-
assert_equal :default, @i.buffer_config.flush_mode
|
141
|
-
|
142
|
-
assert !@i.chunk_key_tag
|
143
|
-
assert_equal [], @i.chunk_keys
|
144
|
-
|
145
|
-
assert_equal '/tmp/mybuffer/buffer.*.log', @i.buffer.path
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
sub_test_case 'output plugins which does not have default chunk key' do
|
150
|
-
test 'plugin helper converts parameters into plugin configuration parameters' do
|
151
|
-
hash = {
|
152
|
-
'buffer_type' => 'file',
|
153
|
-
'buffer_path' => '/tmp/mybuffer',
|
154
|
-
'time_slice_format' => '%Y%m%d%H',
|
155
|
-
'time_slice_wait' => '10',
|
156
|
-
'retry_limit' => '1024',
|
157
|
-
'buffer_queue_full_action' => 'drop_oldest_chunk',
|
158
|
-
}
|
159
|
-
conf = config_element('ROOT', '', hash)
|
160
|
-
@i = DummyO2.new
|
161
|
-
@i.configure(conf)
|
162
|
-
|
163
|
-
assert_equal 'file', @i.buffer_config[:@type]
|
164
|
-
assert_equal 60*60, @i.buffer_config.timekey
|
165
|
-
assert_equal 10, @i.buffer_config.timekey_wait
|
166
|
-
assert_equal 1024, @i.buffer_config.retry_max_times
|
167
|
-
assert_equal :drop_oldest_chunk, @i.buffer_config.overflow_action
|
168
|
-
|
169
|
-
assert @i.chunk_key_time
|
170
|
-
assert !@i.chunk_key_tag
|
171
|
-
assert_equal [], @i.chunk_keys
|
172
|
-
|
173
|
-
assert_equal '/tmp/mybuffer/buffer.*.log', @i.buffer.path
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
|
-
sub_test_case 'output plugins which has default chunk key: tag' do
|
178
|
-
test 'plugin helper converts parameters into plugin configuration parameters' do
|
179
|
-
hash = {
|
180
|
-
'buffer_type' => 'memory',
|
181
|
-
'num_threads' => '10',
|
182
|
-
'flush_interval' => '10s',
|
183
|
-
'try_flush_interval' => '0.1',
|
184
|
-
'queued_chunk_flush_interval' => '0.5',
|
185
|
-
}
|
186
|
-
conf = config_element('ROOT', '', hash)
|
187
|
-
@i = DummyO3.new
|
188
|
-
@i.configure(conf)
|
189
|
-
|
190
|
-
assert_equal 'memory', @i.buffer_config[:@type]
|
191
|
-
assert_equal 10, @i.buffer_config.flush_thread_count
|
192
|
-
assert_equal 10, @i.buffer_config.flush_interval
|
193
|
-
assert_equal 0.1, @i.buffer_config.flush_thread_interval
|
194
|
-
assert_equal 0.5, @i.buffer_config.flush_thread_burst_interval
|
195
|
-
|
196
|
-
assert !@i.chunk_key_time
|
197
|
-
assert @i.chunk_key_tag
|
198
|
-
assert_equal [], @i.chunk_keys
|
199
|
-
end
|
200
|
-
end
|
201
|
-
|
202
|
-
sub_test_case 'output plugins which has default chunk key: tag, and enables inject and formatter' do
|
203
|
-
test 'plugin helper converts parameters into plugin configuration parameters for all of buffer, inject and formatter' do
|
204
|
-
hash = {
|
205
|
-
'buffer_type' => 'file',
|
206
|
-
'buffer_path' => File.expand_path('../../tmp/compat_parameters/mybuffer.*.log', __FILE__),
|
207
|
-
'num_threads' => '10',
|
208
|
-
'format' => 'ltsv',
|
209
|
-
'delimiter' => ',',
|
210
|
-
'label_delimiter' => '%',
|
211
|
-
'include_time_key' => 'true', # default time_key 'time' and default time format (iso8601: 2016-06-24T15:57:38) at localtime
|
212
|
-
'include_tag_key' => 'yes', # default tag_key 'tag'
|
213
|
-
}
|
214
|
-
conf = config_element('ROOT', '', hash)
|
215
|
-
@i = DummyO4.new
|
216
|
-
@i.configure(conf)
|
217
|
-
@i.start
|
218
|
-
@i.after_start
|
219
|
-
|
220
|
-
assert_equal 'file', @i.buffer_config[:@type]
|
221
|
-
assert_equal 10, @i.buffer_config.flush_thread_count
|
222
|
-
formatter = @i.f
|
223
|
-
assert{ formatter.is_a? Fluent::Plugin::LabeledTSVFormatter }
|
224
|
-
assert_equal ',', @i.f.delimiter
|
225
|
-
assert_equal '%', @i.f.label_delimiter
|
226
|
-
|
227
|
-
assert !@i.chunk_key_time
|
228
|
-
assert @i.chunk_key_tag
|
229
|
-
assert_equal [], @i.chunk_keys
|
230
|
-
|
231
|
-
t = event_time('2016-06-24 16:05:01') # localtime
|
232
|
-
iso8601str = Time.at(t.to_i).iso8601
|
233
|
-
formatted = @i.f.format('tag.test', t, @i.inject_values_to_record('tag.test', t, {"value" => 1}))
|
234
|
-
assert_equal "value%1,tag%tag.test,time%#{iso8601str}#{@default_newline}", formatted
|
235
|
-
end
|
236
|
-
|
237
|
-
test 'plugin helper setups time injecting as unix time (integer from epoch)' do
|
238
|
-
hash = {
|
239
|
-
'buffer_type' => 'file',
|
240
|
-
'buffer_path' => File.expand_path('../../tmp/compat_parameters/mybuffer.*.log', __FILE__),
|
241
|
-
'num_threads' => '10',
|
242
|
-
'format' => 'ltsv',
|
243
|
-
'delimiter' => ',',
|
244
|
-
'label_delimiter' => '%',
|
245
|
-
'include_time_key' => 'true', # default time_key 'time' and default time format (iso8601: 2016-06-24T15:57:38) at localtime
|
246
|
-
'include_tag_key' => 'yes', # default tag_key 'tag'
|
247
|
-
}
|
248
|
-
conf = config_element('ROOT', '', hash)
|
249
|
-
@i = DummyO4.new
|
250
|
-
@i.configure(conf)
|
251
|
-
@i.start
|
252
|
-
@i.after_start
|
253
|
-
|
254
|
-
assert_equal 'file', @i.buffer_config[:@type]
|
255
|
-
assert_equal 10, @i.buffer_config.flush_thread_count
|
256
|
-
formatter = @i.f
|
257
|
-
assert{ formatter.is_a? Fluent::Plugin::LabeledTSVFormatter }
|
258
|
-
assert_equal ',', @i.f.delimiter
|
259
|
-
assert_equal '%', @i.f.label_delimiter
|
260
|
-
|
261
|
-
assert !@i.chunk_key_time
|
262
|
-
assert @i.chunk_key_tag
|
263
|
-
assert_equal [], @i.chunk_keys
|
264
|
-
|
265
|
-
t = event_time('2016-06-24 16:05:01') # localtime
|
266
|
-
iso8601str = Time.at(t.to_i).iso8601
|
267
|
-
formatted = @i.f.format('tag.test', t, @i.inject_values_to_record('tag.test', t, {"value" => 1}))
|
268
|
-
assert_equal "value%1,tag%tag.test,time%#{iso8601str}#{@default_newline}", formatted
|
269
|
-
end
|
270
|
-
end
|
271
|
-
|
272
|
-
sub_test_case 'input plugins' do
|
273
|
-
test 'plugin helper converts parameters into plugin configuration parameters for extract and parser' do
|
274
|
-
hash = {
|
275
|
-
'format' => 'ltsv',
|
276
|
-
'delimiter' => ',',
|
277
|
-
'label_delimiter' => '%',
|
278
|
-
'tag_key' => 't2',
|
279
|
-
'time_key' => 't',
|
280
|
-
'time_format' => '%Y-%m-%d.%H:%M:%S.%N',
|
281
|
-
'utc' => 'yes',
|
282
|
-
'types' => 'A integer|B string|C bool',
|
283
|
-
'types_delimiter' => '|',
|
284
|
-
'types_label_delimiter' => ' ',
|
285
|
-
}
|
286
|
-
conf = config_element('ROOT', '', hash)
|
287
|
-
@i = DummyI0.new
|
288
|
-
@i.configure(conf)
|
289
|
-
@i.start
|
290
|
-
@i.after_start
|
291
|
-
|
292
|
-
parser = @i.parser
|
293
|
-
assert{ parser.is_a? Fluent::Plugin::LabeledTSVParser }
|
294
|
-
assert_equal ',', parser.delimiter
|
295
|
-
assert_equal '%', parser.label_delimiter
|
296
|
-
|
297
|
-
events = @i.produce_events("A%1,B%x,C%true,t2%mytag,t%2016-10-20.03:50:11.987654321")
|
298
|
-
assert_equal 1, events.size
|
299
|
-
|
300
|
-
tag, time, record = events.first
|
301
|
-
assert_equal 'mytag', tag
|
302
|
-
assert_equal_event_time event_time("2016-10-20 03:50:11.987654321 +0000"), time
|
303
|
-
assert_equal 3, record.keys.size
|
304
|
-
assert_equal ['A','B','C'], record.keys.sort
|
305
|
-
assert_equal 1, record['A']
|
306
|
-
assert_equal 'x', record['B']
|
307
|
-
assert_equal true, record['C']
|
308
|
-
end
|
309
|
-
|
310
|
-
test 'plugin helper converts parameters into plugin configuration parameters for extract and parser, using numeric time' do
|
311
|
-
hash = {
|
312
|
-
'format' => 'ltsv',
|
313
|
-
'delimiter' => ',',
|
314
|
-
'label_delimiter' => '%',
|
315
|
-
'tag_key' => 't2',
|
316
|
-
'time_key' => 't',
|
317
|
-
'time_type' => 'float',
|
318
|
-
'localtime' => 'yes',
|
319
|
-
}
|
320
|
-
conf = config_element('ROOT', '', hash)
|
321
|
-
@i = DummyI0.new
|
322
|
-
@i.configure(conf)
|
323
|
-
@i.start
|
324
|
-
@i.after_start
|
325
|
-
|
326
|
-
parser = @i.parser
|
327
|
-
assert{ parser.is_a? Fluent::Plugin::LabeledTSVParser }
|
328
|
-
assert_equal ',', parser.delimiter
|
329
|
-
assert_equal '%', parser.label_delimiter
|
330
|
-
end
|
331
|
-
|
332
|
-
test 'plugin helper setups time extraction as unix time (integer from epoch)' do
|
333
|
-
# TODO:
|
334
|
-
end
|
335
|
-
end
|
336
|
-
|
337
|
-
sub_test_case 'parser plugins' do
|
338
|
-
test 'syslog parser parameters' do
|
339
|
-
hash = {
|
340
|
-
'format' => 'syslog',
|
341
|
-
'message_format' => 'rfc5424',
|
342
|
-
'with_priority' => 'true',
|
343
|
-
'rfc5424_time_format' => '%Y'
|
344
|
-
}
|
345
|
-
conf = config_element('ROOT', '', hash)
|
346
|
-
@i = DummyI0.new
|
347
|
-
@i.configure(conf)
|
348
|
-
@i.start
|
349
|
-
@i.after_start
|
350
|
-
|
351
|
-
parser = @i.parser
|
352
|
-
assert_kind_of(Fluent::Plugin::SyslogParser, parser)
|
353
|
-
assert_equal :rfc5424, parser.message_format
|
354
|
-
assert_equal true, parser.with_priority
|
355
|
-
assert_equal '%Y', parser.rfc5424_time_format
|
356
|
-
end
|
357
|
-
end
|
358
|
-
end
|
@@ -1,80 +0,0 @@
|
|
1
|
-
require_relative '../helper'
|
2
|
-
require 'fluent/plugin_helper/event_emitter'
|
3
|
-
require 'fluent/plugin/base'
|
4
|
-
require 'flexmock/test_unit'
|
5
|
-
|
6
|
-
class EventEmitterTest < Test::Unit::TestCase
|
7
|
-
setup do
|
8
|
-
Fluent::Test.setup
|
9
|
-
end
|
10
|
-
|
11
|
-
class Dummy0 < Fluent::Plugin::TestBase
|
12
|
-
end
|
13
|
-
|
14
|
-
class Dummy < Fluent::Plugin::TestBase
|
15
|
-
helpers :event_emitter
|
16
|
-
end
|
17
|
-
|
18
|
-
test 'can be instantiated to be able to emit with router' do
|
19
|
-
d0 = Dummy0.new
|
20
|
-
assert d0.respond_to?(:has_router?)
|
21
|
-
assert !d0.has_router?
|
22
|
-
assert !d0.respond_to?(:router)
|
23
|
-
|
24
|
-
d1 = Dummy.new
|
25
|
-
assert d1.respond_to?(:has_router?)
|
26
|
-
assert d1.has_router?
|
27
|
-
assert d1.respond_to?(:router)
|
28
|
-
d1.stop; d1.shutdown; d1.close; d1.terminate
|
29
|
-
end
|
30
|
-
|
31
|
-
test 'can be configured with valid router' do
|
32
|
-
d1 = Dummy.new
|
33
|
-
assert d1.has_router?
|
34
|
-
assert_nil d1.router
|
35
|
-
|
36
|
-
assert_nothing_raised do
|
37
|
-
d1.configure(config_element())
|
38
|
-
end
|
39
|
-
|
40
|
-
assert d1.router
|
41
|
-
|
42
|
-
d1.shutdown
|
43
|
-
|
44
|
-
assert d1.router
|
45
|
-
|
46
|
-
d1.close
|
47
|
-
|
48
|
-
assert_nil d1.router
|
49
|
-
|
50
|
-
d1.terminate
|
51
|
-
end
|
52
|
-
|
53
|
-
test 'should not have event_emitter_router' do
|
54
|
-
d0 = Dummy0.new
|
55
|
-
assert !d0.respond_to?(:event_emitter_router)
|
56
|
-
end
|
57
|
-
|
58
|
-
test 'should have event_emitter_router' do
|
59
|
-
d = Dummy.new
|
60
|
-
assert d.respond_to?(:event_emitter_router)
|
61
|
-
end
|
62
|
-
|
63
|
-
test 'get router' do
|
64
|
-
router_mock = flexmock('mytest')
|
65
|
-
label_mock = flexmock('mylabel')
|
66
|
-
label_mock.should_receive(:event_router).twice.and_return(router_mock)
|
67
|
-
Fluent::Engine.root_agent.labels['@mytest'] = label_mock
|
68
|
-
|
69
|
-
d = Dummy.new
|
70
|
-
d.configure(config_element('ROOT', '', {'@label' => '@mytest'}))
|
71
|
-
router = d.event_emitter_router("@mytest")
|
72
|
-
assert_equal router_mock, router
|
73
|
-
end
|
74
|
-
|
75
|
-
test 'get root router' do
|
76
|
-
d = Dummy.new
|
77
|
-
router = d.event_emitter_router("@ROOT")
|
78
|
-
assert_equal Fluent::Engine.root_agent.event_router, router
|
79
|
-
end
|
80
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
require_relative '../helper'
|
2
|
-
require 'fluent/plugin_helper/event_loop'
|
3
|
-
require 'fluent/plugin/base'
|
4
|
-
|
5
|
-
class EventLoopTest < Test::Unit::TestCase
|
6
|
-
class Dummy < Fluent::Plugin::TestBase
|
7
|
-
helpers :event_loop
|
8
|
-
def configure(conf)
|
9
|
-
super
|
10
|
-
@_event_loop_run_timeout = 0.1
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
test 'can be instantiated to be able to create event loop' do
|
15
|
-
d1 = Dummy.new
|
16
|
-
assert d1.respond_to?(:event_loop_attach)
|
17
|
-
assert d1.respond_to?(:event_loop_running?)
|
18
|
-
assert d1.respond_to?(:_event_loop)
|
19
|
-
assert d1._event_loop
|
20
|
-
assert !d1.event_loop_running?
|
21
|
-
end
|
22
|
-
|
23
|
-
test 'can be configured' do
|
24
|
-
d1 = Dummy.new
|
25
|
-
assert_nothing_raised do
|
26
|
-
d1.configure(config_element())
|
27
|
-
end
|
28
|
-
assert d1.plugin_id
|
29
|
-
assert d1.log
|
30
|
-
end
|
31
|
-
|
32
|
-
test 'can run event loop by start, stop by shutdown/close and clear by terminate' do
|
33
|
-
d1 = Dummy.new
|
34
|
-
d1.configure(config_element())
|
35
|
-
assert !d1.event_loop_running?
|
36
|
-
|
37
|
-
d1.start
|
38
|
-
d1.event_loop_wait_until_start
|
39
|
-
|
40
|
-
assert d1.event_loop_running?
|
41
|
-
assert_equal 1, d1._event_loop.watchers.size
|
42
|
-
|
43
|
-
d1.shutdown
|
44
|
-
d1.close
|
45
|
-
|
46
|
-
assert !d1.event_loop_running?
|
47
|
-
|
48
|
-
d1.terminate
|
49
|
-
|
50
|
-
assert_nil d1._event_loop
|
51
|
-
end
|
52
|
-
end
|
@@ -1,194 +0,0 @@
|
|
1
|
-
require_relative '../helper'
|
2
|
-
require 'fluent/plugin_helper/extract'
|
3
|
-
require 'fluent/time'
|
4
|
-
|
5
|
-
class ExtractHelperTest < Test::Unit::TestCase
|
6
|
-
class Dummy < Fluent::Plugin::TestBase
|
7
|
-
helpers :extract
|
8
|
-
end
|
9
|
-
|
10
|
-
class Dummy2 < Fluent::Plugin::TestBase
|
11
|
-
helpers :extract
|
12
|
-
config_section :extract do
|
13
|
-
config_set_default :tag_key, 'tag2'
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def config_extract_section(hash = {})
|
18
|
-
config_element('ROOT', '', {}, [config_element('extract', '', hash)])
|
19
|
-
end
|
20
|
-
|
21
|
-
setup do
|
22
|
-
Fluent::Test.setup
|
23
|
-
@d = Dummy.new
|
24
|
-
end
|
25
|
-
|
26
|
-
teardown do
|
27
|
-
if @d
|
28
|
-
@d.stop unless @d.stopped?
|
29
|
-
@d.shutdown unless @d.shutdown?
|
30
|
-
@d.close unless @d.closed?
|
31
|
-
@d.terminate unless @d.terminated?
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
test 'can override default parameters, but not overwrite whole definition' do
|
36
|
-
d = Dummy.new
|
37
|
-
d.configure(config_element())
|
38
|
-
assert_nil d.extract_config
|
39
|
-
|
40
|
-
d = Dummy2.new
|
41
|
-
d.configure(config_element('ROOT', '', {}, [config_element('extract')]))
|
42
|
-
assert d.extract_config
|
43
|
-
assert_equal 'tag2', d.extract_config.tag_key
|
44
|
-
end
|
45
|
-
|
46
|
-
test 'returns nil in default' do
|
47
|
-
@d.configure(config_extract_section())
|
48
|
-
@d.start
|
49
|
-
assert_nil @d.instance_eval{ @_extract_tag_key }
|
50
|
-
assert_nil @d.instance_eval{ @_extract_time_key }
|
51
|
-
assert_nil @d.instance_eval{ @_extract_time_parser }
|
52
|
-
|
53
|
-
record = {"key1" => "value1", "key2" => 2, "tag" => "yay", "time" => Time.now.to_i}
|
54
|
-
|
55
|
-
assert_nil @d.extract_tag_from_record(record)
|
56
|
-
assert_nil @d.extract_time_from_record(record)
|
57
|
-
end
|
58
|
-
|
59
|
-
test 'can be configured as specified' do
|
60
|
-
@d.configure(config_extract_section(
|
61
|
-
"tag_key" => "tag",
|
62
|
-
"time_key" => "time",
|
63
|
-
"time_type" => "unixtime",
|
64
|
-
))
|
65
|
-
|
66
|
-
assert_equal "tag", @d.instance_eval{ @_extract_tag_key }
|
67
|
-
assert_equal "time", @d.instance_eval{ @_extract_time_key }
|
68
|
-
assert_equal :unixtime, @d.instance_eval{ @extract_config.time_type }
|
69
|
-
assert_not_nil @d.instance_eval{ @_extract_time_parser }
|
70
|
-
end
|
71
|
-
|
72
|
-
sub_test_case 'extract_tag_from_record' do
|
73
|
-
test 'returns tag string from specified tag_key field' do
|
74
|
-
@d.configure(config_extract_section("tag_key" => "tag"))
|
75
|
-
@d.start
|
76
|
-
@d.after_start
|
77
|
-
|
78
|
-
tag = @d.extract_tag_from_record({"tag" => "tag.test.code", "message" => "yay!"})
|
79
|
-
assert_equal "tag.test.code", tag
|
80
|
-
end
|
81
|
-
|
82
|
-
test 'returns tag as string by stringifying values from specified key' do
|
83
|
-
@d.configure(config_extract_section("tag_key" => "tag"))
|
84
|
-
@d.start
|
85
|
-
@d.after_start
|
86
|
-
|
87
|
-
tag = @d.extract_tag_from_record({"tag" => 100, "message" => "yay!"})
|
88
|
-
assert_equal "100", tag
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
sub_test_case 'extract_time_from_record' do
|
93
|
-
test 'returns EventTime object from specified time_key field, parsed as float in default' do
|
94
|
-
@d.configure(config_extract_section("time_key" => "t"))
|
95
|
-
@d.start
|
96
|
-
@d.after_start
|
97
|
-
|
98
|
-
# 1473135272 => 2016-09-06 04:14:32 UTC
|
99
|
-
t = @d.extract_time_from_record({"t" => 1473135272.5, "message" => "yay!"})
|
100
|
-
assert_equal_event_time(Fluent::EventTime.new(1473135272, 500_000_000), t)
|
101
|
-
|
102
|
-
t = @d.extract_time_from_record({"t" => "1473135272.5", "message" => "yay!"})
|
103
|
-
assert_equal_event_time(Fluent::EventTime.new(1473135272, 500_000_000), t)
|
104
|
-
end
|
105
|
-
|
106
|
-
test 'returns EventTime object, parsed as unixtime when configured so' do
|
107
|
-
@d.configure(config_extract_section("time_key" => "t", "time_type" => "unixtime"))
|
108
|
-
@d.start
|
109
|
-
@d.after_start
|
110
|
-
|
111
|
-
t = @d.extract_time_from_record({"t" => 1473135272, "message" => "yay!"})
|
112
|
-
assert_equal_event_time(Fluent::EventTime.new(1473135272, 0), t)
|
113
|
-
|
114
|
-
t = @d.extract_time_from_record({"t" => "1473135272", "message" => "yay!"})
|
115
|
-
assert_equal_event_time(Fluent::EventTime.new(1473135272, 0), t)
|
116
|
-
|
117
|
-
t = @d.extract_time_from_record({"t" => 1473135272.5, "message" => "yay!"})
|
118
|
-
assert_equal_event_time(Fluent::EventTime.new(1473135272, 0), t)
|
119
|
-
end
|
120
|
-
|
121
|
-
test 'returns EventTime object, parsed by default time parser of ruby with timezone in data' do
|
122
|
-
t = with_timezone("UTC-02") do
|
123
|
-
@d.configure(config_extract_section("time_key" => "t", "time_type" => "string"))
|
124
|
-
@d.start
|
125
|
-
@d.after_start
|
126
|
-
@d.extract_time_from_record({"t" => "2016-09-06 13:27:01 +0900", "message" => "yay!"})
|
127
|
-
end
|
128
|
-
assert_equal_event_time(event_time("2016-09-06 13:27:01 +0900"), t)
|
129
|
-
end
|
130
|
-
|
131
|
-
test 'returns EventTime object, parsed by default time parser of ruby as localtime' do
|
132
|
-
t = with_timezone("UTC-02") do
|
133
|
-
@d.configure(config_extract_section("time_key" => "t", "time_type" => "string"))
|
134
|
-
@d.start
|
135
|
-
@d.after_start
|
136
|
-
@d.extract_time_from_record({"t" => "2016-09-06 13:27:01", "message" => "yay!"})
|
137
|
-
end
|
138
|
-
assert_equal_event_time(event_time("2016-09-06 13:27:01 +0200"), t)
|
139
|
-
end
|
140
|
-
|
141
|
-
test 'returns EventTime object, parsed as configured time_format with timezone' do
|
142
|
-
t = with_timezone("UTC-02") do
|
143
|
-
@d.configure(config_extract_section("time_key" => "t", "time_type" => "string", "time_format" => "%H:%M:%S, %m/%d/%Y, %z"))
|
144
|
-
@d.start
|
145
|
-
@d.after_start
|
146
|
-
@d.extract_time_from_record({"t" => "13:27:01, 09/06/2016, -0700", "message" => "yay!"})
|
147
|
-
end
|
148
|
-
assert_equal_event_time(event_time("2016-09-06 13:27:01 -0700"), t)
|
149
|
-
end
|
150
|
-
|
151
|
-
test 'returns EventTime object, parsed as configured time_format in localtime without timezone' do
|
152
|
-
t = with_timezone("UTC-02") do
|
153
|
-
@d.configure(config_extract_section("time_key" => "t", "time_type" => "string", "time_format" => "%H:%M:%S, %m/%d/%Y"))
|
154
|
-
@d.start
|
155
|
-
@d.after_start
|
156
|
-
@d.extract_time_from_record({"t" => "13:27:01, 09/06/2016", "message" => "yay!"})
|
157
|
-
end
|
158
|
-
assert_equal_event_time(event_time("2016-09-06 13:27:01 +0200"), t)
|
159
|
-
end
|
160
|
-
|
161
|
-
test 'returns EventTime object, parsed as configured time_format in utc without timezone, localtime: false' do
|
162
|
-
t = with_timezone("UTC-02") do
|
163
|
-
c = config_extract_section("time_key" => "t", "time_type" => "string", "time_format" => "%H:%M:%S, %m/%d/%Y", "localtime" => "false")
|
164
|
-
@d.configure(c)
|
165
|
-
@d.start
|
166
|
-
@d.after_start
|
167
|
-
@d.extract_time_from_record({"t" => "13:27:01, 09/06/2016", "message" => "yay!"})
|
168
|
-
end
|
169
|
-
assert_equal_event_time(event_time("2016-09-06 13:27:01 UTC"), t)
|
170
|
-
end
|
171
|
-
|
172
|
-
test 'returns EventTime object, parsed as configured time_format in utc without timezone, utc: true' do
|
173
|
-
t = with_timezone("UTC-02") do
|
174
|
-
c = config_extract_section("time_key" => "t", "time_type" => "string", "time_format" => "%H:%M:%S, %m/%d/%Y", "utc" => "true")
|
175
|
-
@d.configure(c)
|
176
|
-
@d.start
|
177
|
-
@d.after_start
|
178
|
-
@d.extract_time_from_record({"t" => "13:27:01, 09/06/2016", "message" => "yay!"})
|
179
|
-
end
|
180
|
-
assert_equal_event_time(event_time("2016-09-06 13:27:01 UTC"), t)
|
181
|
-
end
|
182
|
-
|
183
|
-
test 'returns EventTime object, parsed as configured time_format in configured timezone' do
|
184
|
-
t = with_timezone("UTC-02") do
|
185
|
-
c = config_extract_section("time_key" => "t", "time_type" => "string", "time_format" => "%H:%M:%S, %m/%d/%Y", "timezone" => "+09:00")
|
186
|
-
@d.configure(c)
|
187
|
-
@d.start
|
188
|
-
@d.after_start
|
189
|
-
@d.extract_time_from_record({"t" => "13:27:01, 09/06/2016", "message" => "yay!"})
|
190
|
-
end
|
191
|
-
assert_equal_event_time(event_time("2016-09-06 13:27:01 +0900"), t)
|
192
|
-
end
|
193
|
-
end
|
194
|
-
end
|