fluentd 1.16.5-x86-mingw32 → 1.17.1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +88 -0
- data/README.md +2 -1
- data/Rakefile +1 -1
- data/SECURITY.md +2 -2
- data/fluent.conf +14 -14
- data/lib/fluent/command/binlog_reader.rb +1 -1
- 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/configure_proxy.rb +2 -2
- data/lib/fluent/config/types.rb +1 -1
- data/lib/fluent/config/yaml_parser/parser.rb +4 -0
- data/lib/fluent/configurable.rb +2 -2
- data/lib/fluent/counter/mutex_hash.rb +1 -1
- data/lib/fluent/fluent_log_event_router.rb +0 -2
- data/lib/fluent/log/console_adapter.rb +4 -2
- data/lib/fluent/plugin/buf_file.rb +1 -1
- data/lib/fluent/plugin/buffer/file_chunk.rb +1 -1
- data/lib/fluent/plugin/buffer/file_single_chunk.rb +2 -3
- data/lib/fluent/plugin/filter_parser.rb +26 -8
- data/lib/fluent/plugin/in_exec.rb +14 -2
- data/lib/fluent/plugin/in_http.rb +19 -54
- data/lib/fluent/plugin/in_sample.rb +13 -7
- data/lib/fluent/plugin/in_tail.rb +99 -25
- 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 +137 -13
- data/lib/fluent/plugin/owned_by_mixin.rb +0 -1
- data/lib/fluent/plugin/parser_json.rb +26 -17
- data/lib/fluent/plugin/parser_msgpack.rb +24 -3
- data/lib/fluent/plugin_helper/http_server/server.rb +1 -1
- data/lib/fluent/plugin_helper/metrics.rb +2 -2
- data/lib/fluent/registry.rb +6 -6
- data/lib/fluent/test/output_test.rb +1 -1
- data/lib/fluent/unique_id.rb +1 -1
- data/lib/fluent/version.rb +1 -1
- data/templates/new_gem/fluent-plugin.gemspec.erb +6 -5
- metadata +109 -459
- 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.yml +0 -32
- data/.gitignore +0 -30
- data/Gemfile +0 -9
- data/fluentd.gemspec +0 -54
- 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 -110
- 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/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 -1102
- 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 -3288
- 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 -429
- 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 -35
- 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 -138
- data/test/plugin/test_parser_labeled_tsv.rb +0 -160
- 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 -167
- 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,397 +0,0 @@
|
|
1
|
-
require_relative '../helper'
|
2
|
-
|
3
|
-
require 'pathname'
|
4
|
-
require 'fluent/command/plugin_config_formatter'
|
5
|
-
require 'fluent/plugin/input'
|
6
|
-
require 'fluent/plugin/output'
|
7
|
-
require 'fluent/plugin/filter'
|
8
|
-
require 'fluent/plugin/parser'
|
9
|
-
require 'fluent/plugin/formatter'
|
10
|
-
|
11
|
-
class TestFluentPluginConfigFormatter < Test::Unit::TestCase
|
12
|
-
class FakeInput < ::Fluent::Plugin::Input
|
13
|
-
::Fluent::Plugin.register_input("fake", self)
|
14
|
-
|
15
|
-
desc "path to something"
|
16
|
-
config_param :path, :string
|
17
|
-
end
|
18
|
-
|
19
|
-
class FakeOutput < ::Fluent::Plugin::Output
|
20
|
-
::Fluent::Plugin.register_output("fake", self)
|
21
|
-
|
22
|
-
desc "path to something"
|
23
|
-
config_param :path, :string
|
24
|
-
|
25
|
-
def process(tag, es)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
class FakeFilter < ::Fluent::Plugin::Filter
|
30
|
-
::Fluent::Plugin.register_filter("fake", self)
|
31
|
-
|
32
|
-
desc "path to something"
|
33
|
-
config_param :path, :string
|
34
|
-
|
35
|
-
def filter(tag, time, record)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
class FakeParser < ::Fluent::Plugin::Parser
|
40
|
-
::Fluent::Plugin.register_parser("fake", self)
|
41
|
-
|
42
|
-
desc "path to something"
|
43
|
-
config_param :path, :string
|
44
|
-
|
45
|
-
def parse(text)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
class FakeFormatter < ::Fluent::Plugin::Formatter
|
50
|
-
::Fluent::Plugin.register_formatter("fake", self)
|
51
|
-
|
52
|
-
desc "path to something"
|
53
|
-
config_param :path, :string
|
54
|
-
|
55
|
-
def format(tag, time, record)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
class FakeStorage < ::Fluent::Plugin::Storage
|
60
|
-
::Fluent::Plugin.register_storage('fake', self)
|
61
|
-
|
62
|
-
def get(key)
|
63
|
-
end
|
64
|
-
|
65
|
-
def fetch(key, defval)
|
66
|
-
end
|
67
|
-
|
68
|
-
def put(key, value)
|
69
|
-
end
|
70
|
-
|
71
|
-
def delete(key)
|
72
|
-
end
|
73
|
-
|
74
|
-
def update(key, &block)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
class FakeServiceDiscovery < ::Fluent::Plugin::ServiceDiscovery
|
79
|
-
::Fluent::Plugin.register_sd('fake', self)
|
80
|
-
|
81
|
-
desc "hostname"
|
82
|
-
config_param :hostname, :string
|
83
|
-
end
|
84
|
-
|
85
|
-
class SimpleInput < ::Fluent::Plugin::Input
|
86
|
-
::Fluent::Plugin.register_input("simple", self)
|
87
|
-
helpers :inject, :compat_parameters
|
88
|
-
|
89
|
-
desc "path to something"
|
90
|
-
config_param :path, :string
|
91
|
-
end
|
92
|
-
|
93
|
-
class ComplexOutput < ::Fluent::Plugin::Output
|
94
|
-
::Fluent::Plugin.register_output("complex", self)
|
95
|
-
helpers :inject, :compat_parameters
|
96
|
-
|
97
|
-
config_section :authentication, required: true, multi: false do
|
98
|
-
desc "username"
|
99
|
-
config_param :username, :string
|
100
|
-
desc "password"
|
101
|
-
config_param :password, :string, secret: true
|
102
|
-
end
|
103
|
-
|
104
|
-
config_section :parent do
|
105
|
-
config_section :child do
|
106
|
-
desc "names"
|
107
|
-
config_param :names, :array
|
108
|
-
desc "difficulty"
|
109
|
-
config_param :difficulty, :enum, list: [:easy, :normal, :hard], default: :normal
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
def process(tag, es)
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
class SimpleServiceDiscovery < ::Fluent::Plugin::ServiceDiscovery
|
118
|
-
::Fluent::Plugin.register_sd('simple', self)
|
119
|
-
|
120
|
-
desc "servers"
|
121
|
-
config_param :servers, :array
|
122
|
-
end
|
123
|
-
|
124
|
-
sub_test_case "json" do
|
125
|
-
data(input: [FakeInput, "input"],
|
126
|
-
output: [FakeOutput, "output"],
|
127
|
-
filter: [FakeFilter, "filter"],
|
128
|
-
parser: [FakeParser, "parser"],
|
129
|
-
formatter: [FakeFormatter, "formatter"])
|
130
|
-
test "dumped config should be valid JSON" do |(klass, type)|
|
131
|
-
dumped_config = capture_stdout do
|
132
|
-
FluentPluginConfigFormatter.new(["--format=json", type, "fake"]).call
|
133
|
-
end
|
134
|
-
expected = {
|
135
|
-
path: {
|
136
|
-
desc: "path to something",
|
137
|
-
type: "string",
|
138
|
-
required: true
|
139
|
-
}
|
140
|
-
}
|
141
|
-
assert_equal(expected, JSON.parse(dumped_config, symbolize_names: true)[klass.name.to_sym])
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
sub_test_case "text" do
|
146
|
-
test "input simple" do
|
147
|
-
dumped_config = capture_stdout do
|
148
|
-
FluentPluginConfigFormatter.new(["--format=txt", "input", "simple"]).call
|
149
|
-
end
|
150
|
-
expected = <<TEXT
|
151
|
-
helpers: inject,compat_parameters
|
152
|
-
@log_level: string: (nil)
|
153
|
-
path: string: (nil)
|
154
|
-
TEXT
|
155
|
-
assert_equal(expected, dumped_config)
|
156
|
-
end
|
157
|
-
|
158
|
-
test "output complex" do
|
159
|
-
dumped_config = capture_stdout do
|
160
|
-
FluentPluginConfigFormatter.new(["--format=txt", "output", "complex"]).call
|
161
|
-
end
|
162
|
-
expected = <<TEXT
|
163
|
-
helpers: inject,compat_parameters
|
164
|
-
@log_level: string: (nil)
|
165
|
-
time_as_integer: bool: (false)
|
166
|
-
slow_flush_log_threshold: float: (20.0)
|
167
|
-
<buffer>: optional, single
|
168
|
-
chunk_keys: array: ([])
|
169
|
-
@type: string: ("memory")
|
170
|
-
timekey: time: (nil)
|
171
|
-
timekey_wait: time: (600)
|
172
|
-
timekey_use_utc: bool: (false)
|
173
|
-
timekey_zone: string: ("#{Time.now.strftime('%z')}")
|
174
|
-
flush_at_shutdown: bool: (nil)
|
175
|
-
flush_mode: enum: (:default)
|
176
|
-
flush_interval: time: (60)
|
177
|
-
flush_thread_count: integer: (1)
|
178
|
-
flush_thread_interval: float: (1.0)
|
179
|
-
flush_thread_burst_interval: float: (1.0)
|
180
|
-
delayed_commit_timeout: time: (60)
|
181
|
-
overflow_action: enum: (:throw_exception)
|
182
|
-
retry_forever: bool: (false)
|
183
|
-
retry_timeout: time: (259200)
|
184
|
-
retry_max_times: integer: (nil)
|
185
|
-
retry_secondary_threshold: float: (0.8)
|
186
|
-
retry_type: enum: (:exponential_backoff)
|
187
|
-
retry_wait: time: (1)
|
188
|
-
retry_exponential_backoff_base: float: (2)
|
189
|
-
retry_max_interval: time: (nil)
|
190
|
-
retry_randomize: bool: (true)
|
191
|
-
<secondary>: optional, single
|
192
|
-
@type: string: (nil)
|
193
|
-
<buffer>: optional, single
|
194
|
-
<secondary>: optional, single
|
195
|
-
<authentication>: required, single
|
196
|
-
username: string: (nil)
|
197
|
-
password: string: (nil)
|
198
|
-
<parent>: optional, multiple
|
199
|
-
<child>: optional, multiple
|
200
|
-
names: array: (nil)
|
201
|
-
difficulty: enum: (:normal)
|
202
|
-
TEXT
|
203
|
-
assert_equal(expected, dumped_config)
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
|
-
sub_test_case "markdown" do
|
208
|
-
test "input simple" do
|
209
|
-
dumped_config = capture_stdout do
|
210
|
-
FluentPluginConfigFormatter.new(["--format=markdown", "input", "simple"]).call
|
211
|
-
end
|
212
|
-
expected = <<TEXT
|
213
|
-
## Plugin helpers
|
214
|
-
|
215
|
-
* [inject](https://docs.fluentd.org/v/1.0/plugin-helper-overview/api-plugin-helper-inject)
|
216
|
-
* [compat_parameters](https://docs.fluentd.org/v/1.0/plugin-helper-overview/api-plugin-helper-compat_parameters)
|
217
|
-
|
218
|
-
* See also: [Input Plugin Overview](https://docs.fluentd.org/v/1.0/input#overview)
|
219
|
-
|
220
|
-
## TestFluentPluginConfigFormatter::SimpleInput
|
221
|
-
|
222
|
-
### path (string) (required)
|
223
|
-
|
224
|
-
path to something
|
225
|
-
|
226
|
-
|
227
|
-
TEXT
|
228
|
-
assert_equal(expected, dumped_config)
|
229
|
-
end
|
230
|
-
|
231
|
-
test "input simple (table)" do
|
232
|
-
dumped_config = capture_stdout do
|
233
|
-
FluentPluginConfigFormatter.new(["--format=markdown", "--table", "input", "simple"]).call
|
234
|
-
end
|
235
|
-
expected = <<TEXT
|
236
|
-
## Plugin helpers
|
237
|
-
|
238
|
-
* [inject](https://docs.fluentd.org/v/1.0/plugin-helper-overview/api-plugin-helper-inject)
|
239
|
-
* [compat_parameters](https://docs.fluentd.org/v/1.0/plugin-helper-overview/api-plugin-helper-compat_parameters)
|
240
|
-
|
241
|
-
* See also: [Input Plugin Overview](https://docs.fluentd.org/v/1.0/input#overview)
|
242
|
-
|
243
|
-
## TestFluentPluginConfigFormatter::SimpleInput
|
244
|
-
|
245
|
-
### Configuration
|
246
|
-
|
247
|
-
|parameter|type|description|default|
|
248
|
-
|---|---|---|---|
|
249
|
-
|path|string (required)|path to something||
|
250
|
-
|
251
|
-
TEXT
|
252
|
-
assert_equal(expected, dumped_config)
|
253
|
-
end
|
254
|
-
|
255
|
-
data("abbrev" => "sd",
|
256
|
-
"normal" => "service_discovery")
|
257
|
-
test "service_discovery simple" do |data|
|
258
|
-
plugin_type = data
|
259
|
-
dumped_config = capture_stdout do
|
260
|
-
FluentPluginConfigFormatter.new(["--format=markdown", plugin_type, "simple"]).call
|
261
|
-
end
|
262
|
-
expected = <<TEXT
|
263
|
-
* See also: [ServiceDiscovery Plugin Overview](https://docs.fluentd.org/v/1.0/servicediscovery#overview)
|
264
|
-
|
265
|
-
## TestFluentPluginConfigFormatter::SimpleServiceDiscovery
|
266
|
-
|
267
|
-
### servers (array) (required)
|
268
|
-
|
269
|
-
servers
|
270
|
-
|
271
|
-
|
272
|
-
TEXT
|
273
|
-
assert_equal(expected, dumped_config)
|
274
|
-
end
|
275
|
-
|
276
|
-
|
277
|
-
test "output complex" do
|
278
|
-
dumped_config = capture_stdout do
|
279
|
-
FluentPluginConfigFormatter.new(["--format=markdown", "output", "complex"]).call
|
280
|
-
end
|
281
|
-
expected = <<TEXT
|
282
|
-
## Plugin helpers
|
283
|
-
|
284
|
-
* [inject](https://docs.fluentd.org/v/1.0/plugin-helper-overview/api-plugin-helper-inject)
|
285
|
-
* [compat_parameters](https://docs.fluentd.org/v/1.0/plugin-helper-overview/api-plugin-helper-compat_parameters)
|
286
|
-
|
287
|
-
* See also: [Output Plugin Overview](https://docs.fluentd.org/v/1.0/output#overview)
|
288
|
-
|
289
|
-
## TestFluentPluginConfigFormatter::ComplexOutput
|
290
|
-
|
291
|
-
|
292
|
-
### \\<authentication\\> section (required) (single)
|
293
|
-
|
294
|
-
#### username (string) (required)
|
295
|
-
|
296
|
-
username
|
297
|
-
|
298
|
-
#### password (string) (required)
|
299
|
-
|
300
|
-
password
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
### \\<parent\\> section (optional) (multiple)
|
305
|
-
|
306
|
-
|
307
|
-
#### \\<child\\> section (optional) (multiple)
|
308
|
-
|
309
|
-
##### names (array) (required)
|
310
|
-
|
311
|
-
names
|
312
|
-
|
313
|
-
##### difficulty (enum) (optional)
|
314
|
-
|
315
|
-
difficulty
|
316
|
-
|
317
|
-
Available values: easy, normal, hard
|
318
|
-
|
319
|
-
Default value: `normal`.
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
TEXT
|
325
|
-
assert_equal(expected, dumped_config)
|
326
|
-
end
|
327
|
-
|
328
|
-
test "output complex (table)" do
|
329
|
-
dumped_config = capture_stdout do
|
330
|
-
FluentPluginConfigFormatter.new(["--format=markdown", "--table", "output", "complex"]).call
|
331
|
-
end
|
332
|
-
expected = <<TEXT
|
333
|
-
## Plugin helpers
|
334
|
-
|
335
|
-
* [inject](https://docs.fluentd.org/v/1.0/plugin-helper-overview/api-plugin-helper-inject)
|
336
|
-
* [compat_parameters](https://docs.fluentd.org/v/1.0/plugin-helper-overview/api-plugin-helper-compat_parameters)
|
337
|
-
|
338
|
-
* See also: [Output Plugin Overview](https://docs.fluentd.org/v/1.0/output#overview)
|
339
|
-
|
340
|
-
## TestFluentPluginConfigFormatter::ComplexOutput
|
341
|
-
|
342
|
-
|
343
|
-
### \\<authentication\\> section (required) (single)
|
344
|
-
|
345
|
-
### Configuration
|
346
|
-
|
347
|
-
|parameter|type|description|default|
|
348
|
-
|---|---|---|---|
|
349
|
-
|username|string (required)|username||
|
350
|
-
|password|string (required)|password||
|
351
|
-
|
352
|
-
|
353
|
-
### \\<parent\\> section (optional) (multiple)
|
354
|
-
|
355
|
-
|
356
|
-
#### \\<child\\> section (optional) (multiple)
|
357
|
-
|
358
|
-
### Configuration
|
359
|
-
|
360
|
-
|parameter|type|description|default|
|
361
|
-
|---|---|---|---|
|
362
|
-
|names|array (required)|names||
|
363
|
-
|difficulty|enum (optional)|difficulty (`easy`, `normal`, `hard`)|`normal`|
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
TEXT
|
368
|
-
assert_equal(expected, dumped_config)
|
369
|
-
end
|
370
|
-
end
|
371
|
-
|
372
|
-
sub_test_case "arguments" do
|
373
|
-
data do
|
374
|
-
hash = {}
|
375
|
-
["input", "output", "filter", "parser", "formatter", "storage", "service_discovery"].each do |type|
|
376
|
-
["txt", "json", "markdown"].each do |format|
|
377
|
-
argv = ["--format=#{format}"]
|
378
|
-
[
|
379
|
-
["--verbose", "--compact"],
|
380
|
-
["--verbose"],
|
381
|
-
["--compact"]
|
382
|
-
].each do |options|
|
383
|
-
hash["[#{type}] " + (argv + options).join(" ")] = argv + options + [type, "fake"]
|
384
|
-
end
|
385
|
-
end
|
386
|
-
end
|
387
|
-
hash
|
388
|
-
end
|
389
|
-
test "dump txt" do |argv|
|
390
|
-
capture_stdout do
|
391
|
-
assert_nothing_raised do
|
392
|
-
FluentPluginConfigFormatter.new(argv).call
|
393
|
-
end
|
394
|
-
end
|
395
|
-
end
|
396
|
-
end
|
397
|
-
end
|
@@ -1,109 +0,0 @@
|
|
1
|
-
require_relative '../helper'
|
2
|
-
|
3
|
-
require 'pathname'
|
4
|
-
require 'fluent/command/plugin_generator'
|
5
|
-
|
6
|
-
class TestFluentPluginGenerator < Test::Unit::TestCase
|
7
|
-
TEMP_DIR = "tmp/plugin_generator"
|
8
|
-
setup do
|
9
|
-
FileUtils.mkdir_p(TEMP_DIR)
|
10
|
-
@pwd = Dir.pwd
|
11
|
-
Dir.chdir(TEMP_DIR)
|
12
|
-
end
|
13
|
-
|
14
|
-
teardown do
|
15
|
-
Dir.chdir(@pwd)
|
16
|
-
FileUtils.rm_rf(TEMP_DIR)
|
17
|
-
end
|
18
|
-
|
19
|
-
def stub_git_process(target)
|
20
|
-
stub(target).spawn do |cmd, arg1, arg2|
|
21
|
-
assert_equal %w[git init .], [cmd, arg1, arg2]
|
22
|
-
-1
|
23
|
-
end
|
24
|
-
stub(Process).wait { |pid| assert_equal(pid, -1) }
|
25
|
-
end
|
26
|
-
|
27
|
-
sub_test_case "generate plugin" do
|
28
|
-
data(input: ["input", "in"],
|
29
|
-
output: ["output", "out"],
|
30
|
-
filter: ["filter", "filter"],
|
31
|
-
parser: ["parser", "parser"],
|
32
|
-
formatter: ["formatter", "formatter"],
|
33
|
-
storage: ["storage", "storage"])
|
34
|
-
test "generate plugin" do |(type, part)|
|
35
|
-
generator = FluentPluginGenerator.new([type, "fake"])
|
36
|
-
stub_git_process(generator)
|
37
|
-
capture_stdout do
|
38
|
-
generator.call
|
39
|
-
end
|
40
|
-
plugin_base_dir = Pathname("fluent-plugin-fake")
|
41
|
-
assert { plugin_base_dir.directory? }
|
42
|
-
expected = [
|
43
|
-
"fluent-plugin-fake",
|
44
|
-
"fluent-plugin-fake/Gemfile",
|
45
|
-
"fluent-plugin-fake/LICENSE",
|
46
|
-
"fluent-plugin-fake/README.md",
|
47
|
-
"fluent-plugin-fake/Rakefile",
|
48
|
-
"fluent-plugin-fake/fluent-plugin-fake.gemspec",
|
49
|
-
"fluent-plugin-fake/lib",
|
50
|
-
"fluent-plugin-fake/lib/fluent",
|
51
|
-
"fluent-plugin-fake/lib/fluent/plugin",
|
52
|
-
"fluent-plugin-fake/lib/fluent/plugin/#{part}_fake.rb",
|
53
|
-
"fluent-plugin-fake/test",
|
54
|
-
"fluent-plugin-fake/test/helper.rb",
|
55
|
-
"fluent-plugin-fake/test/plugin",
|
56
|
-
"fluent-plugin-fake/test/plugin/test_#{part}_fake.rb",
|
57
|
-
]
|
58
|
-
actual = plugin_base_dir.find.reject {|f| f.fnmatch("*/.git*") }.map(&:to_s).sort
|
59
|
-
assert_equal(expected, actual)
|
60
|
-
end
|
61
|
-
|
62
|
-
test "no license" do
|
63
|
-
generator = FluentPluginGenerator.new(["--no-license", "filter", "fake"])
|
64
|
-
stub_git_process(generator)
|
65
|
-
capture_stdout do
|
66
|
-
generator.call
|
67
|
-
end
|
68
|
-
assert { !Pathname("fluent-plugin-fake/LICENSE").exist? }
|
69
|
-
assert { Pathname("fluent-plugin-fake/Gemfile").exist? }
|
70
|
-
end
|
71
|
-
|
72
|
-
test "unknown license" do
|
73
|
-
out = capture_stdout do
|
74
|
-
assert_raise(SystemExit) do
|
75
|
-
FluentPluginGenerator.new(["--license=unknown", "filter", "fake"]).call
|
76
|
-
end
|
77
|
-
end
|
78
|
-
assert { out.lines.include?("License: unknown\n") }
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
sub_test_case "unify plugin name" do
|
83
|
-
data("word" => ["fake", "fake"],
|
84
|
-
"underscore" => ["rewrite_tag_filter", "rewrite_tag_filter"],
|
85
|
-
"dash" => ["rewrite-tag-filter", "rewrite_tag_filter"])
|
86
|
-
test "plugin_name" do |(name, plugin_name)|
|
87
|
-
generator = FluentPluginGenerator.new(["filter", name])
|
88
|
-
stub_git_process(generator)
|
89
|
-
stub(Process).wait { |pid| assert_equal(pid, -1) }
|
90
|
-
capture_stdout do
|
91
|
-
generator.call
|
92
|
-
end
|
93
|
-
assert_equal(plugin_name, generator.__send__(:plugin_name))
|
94
|
-
end
|
95
|
-
|
96
|
-
data("word" => ["fake", "fluent-plugin-fake"],
|
97
|
-
"underscore" => ["rewrite_tag_filter", "fluent-plugin-rewrite-tag-filter"],
|
98
|
-
"dash" => ["rewrite-tag-filter", "fluent-plugin-rewrite-tag-filter"])
|
99
|
-
test "gem_name" do |(name, gem_name)|
|
100
|
-
generator = FluentPluginGenerator.new(["output", name])
|
101
|
-
stub_git_process(generator)
|
102
|
-
stub(Process).wait { |pid| assert_equal(pid, -1) }
|
103
|
-
capture_stdout do
|
104
|
-
generator.call
|
105
|
-
end
|
106
|
-
assert_equal(gem_name, generator.__send__(:gem_name))
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
@@ -1,166 +0,0 @@
|
|
1
|
-
require_relative '../helper'
|
2
|
-
|
3
|
-
# these are Fluent::Compat::* in fact
|
4
|
-
require 'fluent/input'
|
5
|
-
require 'fluent/output'
|
6
|
-
require 'fluent/filter'
|
7
|
-
|
8
|
-
class CompatCallsSuperTest < Test::Unit::TestCase
|
9
|
-
class DummyGoodInput < Fluent::Input
|
10
|
-
def configure(conf); super; end
|
11
|
-
def start; super; end
|
12
|
-
def before_shutdown; super; end
|
13
|
-
def shutdown; super; end
|
14
|
-
end
|
15
|
-
class DummyBadInput < Fluent::Input
|
16
|
-
def configure(conf); super; end
|
17
|
-
def start; end
|
18
|
-
def before_shutdown; end
|
19
|
-
def shutdown; end
|
20
|
-
end
|
21
|
-
class DummyGoodOutput < Fluent::Output
|
22
|
-
def configure(conf); super; end
|
23
|
-
def start; super; end
|
24
|
-
def before_shutdown; super; end
|
25
|
-
def shutdown; super; end
|
26
|
-
end
|
27
|
-
class DummyBadOutput < Fluent::Output
|
28
|
-
def configure(conf); super; end
|
29
|
-
def start; end
|
30
|
-
def before_shutdown; end
|
31
|
-
def shutdown; end
|
32
|
-
end
|
33
|
-
class DummyGoodFilter < Fluent::Filter
|
34
|
-
def configure(conf); super; end
|
35
|
-
def filter(tag, time, record); end
|
36
|
-
def start; super; end
|
37
|
-
def before_shutdown; super; end
|
38
|
-
def shutdown; super; end
|
39
|
-
end
|
40
|
-
class DummyBadFilter < Fluent::Filter
|
41
|
-
def configure(conf); super; end
|
42
|
-
def filter(tag, time, record); end
|
43
|
-
def start; end
|
44
|
-
def before_shutdown; end
|
45
|
-
def shutdown; end
|
46
|
-
end
|
47
|
-
|
48
|
-
setup do
|
49
|
-
Fluent::Test.setup
|
50
|
-
end
|
51
|
-
|
52
|
-
sub_test_case 'old API plugin which calls super properly' do
|
53
|
-
test 'Input#start, #before_shutdown and #shutdown calls all superclass methods properly' do
|
54
|
-
i = DummyGoodInput.new
|
55
|
-
i.configure(config_element())
|
56
|
-
assert i.configured?
|
57
|
-
|
58
|
-
i.start
|
59
|
-
assert i.started?
|
60
|
-
|
61
|
-
i.before_shutdown
|
62
|
-
assert i.before_shutdown?
|
63
|
-
|
64
|
-
i.shutdown
|
65
|
-
assert i.shutdown?
|
66
|
-
|
67
|
-
assert i.log.out.logs.empty?
|
68
|
-
end
|
69
|
-
|
70
|
-
test 'Output#start, #before_shutdown and #shutdown calls all superclass methods properly' do
|
71
|
-
i = DummyGoodOutput.new
|
72
|
-
i.configure(config_element())
|
73
|
-
assert i.configured?
|
74
|
-
|
75
|
-
i.start
|
76
|
-
assert i.started?
|
77
|
-
|
78
|
-
i.before_shutdown
|
79
|
-
assert i.before_shutdown?
|
80
|
-
|
81
|
-
i.shutdown
|
82
|
-
assert i.shutdown?
|
83
|
-
|
84
|
-
assert i.log.out.logs.empty?
|
85
|
-
end
|
86
|
-
|
87
|
-
test 'Filter#start, #before_shutdown and #shutdown calls all superclass methods properly' do
|
88
|
-
i = DummyGoodFilter.new
|
89
|
-
i.configure(config_element())
|
90
|
-
assert i.configured?
|
91
|
-
|
92
|
-
i.start
|
93
|
-
assert i.started?
|
94
|
-
|
95
|
-
i.before_shutdown
|
96
|
-
assert i.before_shutdown?
|
97
|
-
|
98
|
-
i.shutdown
|
99
|
-
assert i.shutdown?
|
100
|
-
|
101
|
-
assert i.log.out.logs.empty?
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
sub_test_case 'old API plugin which does not call super' do
|
106
|
-
test 'Input#start, #before_shutdown and #shutdown calls superclass methods forcedly with logs' do
|
107
|
-
i = DummyBadInput.new
|
108
|
-
i.configure(config_element())
|
109
|
-
assert i.configured?
|
110
|
-
|
111
|
-
i.start
|
112
|
-
assert i.started?
|
113
|
-
|
114
|
-
i.before_shutdown
|
115
|
-
assert i.before_shutdown?
|
116
|
-
|
117
|
-
i.shutdown
|
118
|
-
assert i.shutdown?
|
119
|
-
|
120
|
-
logs = i.log.out.logs
|
121
|
-
assert{ logs.any?{|l| l.include?("[warn]: super was not called in #start: called it forcedly plugin=CompatCallsSuperTest::DummyBadInput") } }
|
122
|
-
assert{ logs.any?{|l| l.include?("[warn]: super was not called in #before_shutdown: calling it forcedly plugin=CompatCallsSuperTest::DummyBadInput") } }
|
123
|
-
assert{ logs.any?{|l| l.include?("[warn]: super was not called in #shutdown: calling it forcedly plugin=CompatCallsSuperTest::DummyBadInput") } }
|
124
|
-
end
|
125
|
-
|
126
|
-
test 'Output#start, #before_shutdown and #shutdown calls superclass methods forcedly with logs' do
|
127
|
-
i = DummyBadOutput.new
|
128
|
-
i.configure(config_element())
|
129
|
-
assert i.configured?
|
130
|
-
|
131
|
-
i.start
|
132
|
-
assert i.started?
|
133
|
-
|
134
|
-
i.before_shutdown
|
135
|
-
assert i.before_shutdown?
|
136
|
-
|
137
|
-
i.shutdown
|
138
|
-
assert i.shutdown?
|
139
|
-
|
140
|
-
logs = i.log.out.logs
|
141
|
-
assert{ logs.any?{|l| l.include?("[warn]: super was not called in #start: called it forcedly plugin=CompatCallsSuperTest::DummyBadOutput") } }
|
142
|
-
assert{ logs.any?{|l| l.include?("[warn]: super was not called in #before_shutdown: calling it forcedly plugin=CompatCallsSuperTest::DummyBadOutput") } }
|
143
|
-
assert{ logs.any?{|l| l.include?("[warn]: super was not called in #shutdown: calling it forcedly plugin=CompatCallsSuperTest::DummyBadOutput") } }
|
144
|
-
end
|
145
|
-
|
146
|
-
test 'Filter#start, #before_shutdown and #shutdown calls superclass methods forcedly with logs' do
|
147
|
-
i = DummyBadFilter.new
|
148
|
-
i.configure(config_element())
|
149
|
-
assert i.configured?
|
150
|
-
|
151
|
-
i.start
|
152
|
-
assert i.started?
|
153
|
-
|
154
|
-
i.before_shutdown
|
155
|
-
assert i.before_shutdown?
|
156
|
-
|
157
|
-
i.shutdown
|
158
|
-
assert i.shutdown?
|
159
|
-
|
160
|
-
logs = i.log.out.logs
|
161
|
-
assert{ logs.any?{|l| l.include?("[warn]: super was not called in #start: called it forcedly plugin=CompatCallsSuperTest::DummyBadFilter") } }
|
162
|
-
assert{ logs.any?{|l| l.include?("[warn]: super was not called in #before_shutdown: calling it forcedly plugin=CompatCallsSuperTest::DummyBadFilter") } }
|
163
|
-
assert{ logs.any?{|l| l.include?("[warn]: super was not called in #shutdown: calling it forcedly plugin=CompatCallsSuperTest::DummyBadFilter") } }
|
164
|
-
end
|
165
|
-
end
|
166
|
-
end
|