fluentd 1.11.2-x64-mingw32 → 1.12.1-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fluentd might be problematic. Click here for more details.

Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +1 -1
  3. data/.github/ISSUE_TEMPLATE/config.yml +5 -0
  4. data/.github/workflows/build.yaml +29 -0
  5. data/.github/workflows/stale-actions.yml +22 -0
  6. data/.travis.yml +22 -2
  7. data/CHANGELOG.md +114 -0
  8. data/README.md +2 -2
  9. data/appveyor.yml +3 -0
  10. data/bin/fluent-cap-ctl +7 -0
  11. data/bin/fluent-ctl +7 -0
  12. data/fluentd.gemspec +8 -8
  13. data/lib/fluent/capability.rb +87 -0
  14. data/lib/fluent/command/ca_generate.rb +6 -3
  15. data/lib/fluent/command/cap_ctl.rb +174 -0
  16. data/lib/fluent/command/ctl.rb +177 -0
  17. data/lib/fluent/command/fluentd.rb +4 -0
  18. data/lib/fluent/command/plugin_config_formatter.rb +17 -2
  19. data/lib/fluent/config/section.rb +1 -1
  20. data/lib/fluent/env.rb +4 -0
  21. data/lib/fluent/log.rb +33 -3
  22. data/lib/fluent/plugin.rb +5 -0
  23. data/lib/fluent/plugin/buffer.rb +27 -57
  24. data/lib/fluent/plugin/buffer/chunk.rb +2 -1
  25. data/lib/fluent/plugin/formatter.rb +24 -0
  26. data/lib/fluent/plugin/formatter_csv.rb +1 -1
  27. data/lib/fluent/plugin/formatter_hash.rb +3 -1
  28. data/lib/fluent/plugin/formatter_json.rb +3 -1
  29. data/lib/fluent/plugin/formatter_ltsv.rb +5 -3
  30. data/lib/fluent/plugin/formatter_out_file.rb +6 -4
  31. data/lib/fluent/plugin/formatter_single_value.rb +4 -2
  32. data/lib/fluent/plugin/formatter_tsv.rb +4 -2
  33. data/lib/fluent/plugin/in_exec.rb +4 -2
  34. data/lib/fluent/plugin/in_http.rb +23 -2
  35. data/lib/fluent/plugin/in_tail.rb +109 -41
  36. data/lib/fluent/plugin/in_tail/position_file.rb +39 -14
  37. data/lib/fluent/plugin/in_tcp.rb +1 -0
  38. data/lib/fluent/plugin/out_http.rb +29 -4
  39. data/lib/fluent/plugin/output.rb +15 -6
  40. data/lib/fluent/plugin/parser_json.rb +5 -2
  41. data/lib/fluent/plugin_helper/http_server/compat/server.rb +1 -1
  42. data/lib/fluent/plugin_helper/inject.rb +4 -1
  43. data/lib/fluent/plugin_helper/retry_state.rb +4 -0
  44. data/lib/fluent/supervisor.rb +162 -51
  45. data/lib/fluent/system_config.rb +4 -2
  46. data/lib/fluent/time.rb +1 -0
  47. data/lib/fluent/version.rb +1 -1
  48. data/lib/fluent/winsvc.rb +22 -4
  49. data/templates/plugin_config_formatter/param.md-table.erb +10 -0
  50. data/test/command/test_binlog_reader.rb +22 -6
  51. data/test/command/test_cap_ctl.rb +100 -0
  52. data/test/command/test_ctl.rb +57 -0
  53. data/test/command/test_fluentd.rb +30 -0
  54. data/test/command/test_plugin_config_formatter.rb +124 -2
  55. data/test/plugin/in_tail/test_position_file.rb +46 -26
  56. data/test/plugin/test_buffer.rb +4 -0
  57. data/test/plugin/test_filter_stdout.rb +6 -1
  58. data/test/plugin/test_formatter_hash.rb +6 -3
  59. data/test/plugin/test_formatter_json.rb +14 -4
  60. data/test/plugin/test_formatter_ltsv.rb +13 -5
  61. data/test/plugin/test_formatter_out_file.rb +35 -14
  62. data/test/plugin/test_formatter_single_value.rb +12 -6
  63. data/test/plugin/test_formatter_tsv.rb +12 -4
  64. data/test/plugin/test_in_exec.rb +18 -0
  65. data/test/plugin/test_in_http.rb +25 -0
  66. data/test/plugin/test_in_tail.rb +433 -30
  67. data/test/plugin/test_out_file.rb +23 -18
  68. data/test/plugin/test_out_http.rb +19 -0
  69. data/test/plugin/test_output.rb +12 -0
  70. data/test/plugin/test_parser_syslog.rb +2 -2
  71. data/test/plugin/test_sd_file.rb +1 -1
  72. data/test/plugin_helper/test_compat_parameters.rb +7 -2
  73. data/test/plugin_helper/test_http_server_helper.rb +8 -1
  74. data/test/plugin_helper/test_inject.rb +42 -0
  75. data/test/plugin_helper/test_server.rb +18 -5
  76. data/test/test_capability.rb +74 -0
  77. data/test/test_formatter.rb +34 -10
  78. data/test/test_log.rb +44 -0
  79. data/test/test_output.rb +6 -1
  80. data/test/test_supervisor.rb +150 -1
  81. metadata +49 -37
@@ -24,10 +24,10 @@ module Fluent
24
24
  SYSTEM_CONFIG_PARAMETERS = [
25
25
  :workers, :root_dir, :log_level,
26
26
  :suppress_repeated_stacktrace, :emit_error_log_interval, :suppress_config_dump,
27
- :log_event_verbose, :ignore_repeated_log_interval,
27
+ :log_event_verbose, :ignore_repeated_log_interval, :ignore_same_log_interval,
28
28
  :without_source, :rpc_endpoint, :enable_get_dump, :process_name,
29
29
  :file_permission, :dir_permission, :counter_server, :counter_client,
30
- :strict_config_value, :enable_msgpack_time_support
30
+ :strict_config_value, :enable_msgpack_time_support, :disable_shared_socket
31
31
  ]
32
32
 
33
33
  config_param :workers, :integer, default: 1
@@ -35,6 +35,7 @@ module Fluent
35
35
  config_param :log_level, :enum, list: [:trace, :debug, :info, :warn, :error, :fatal], default: 'info'
36
36
  config_param :suppress_repeated_stacktrace, :bool, default: nil
37
37
  config_param :ignore_repeated_log_interval, :time, default: nil
38
+ config_param :ignore_same_log_interval, :time, default: nil
38
39
  config_param :emit_error_log_interval, :time, default: nil
39
40
  config_param :suppress_config_dump, :bool, default: nil
40
41
  config_param :log_event_verbose, :bool, default: nil
@@ -44,6 +45,7 @@ module Fluent
44
45
  config_param :process_name, :string, default: nil
45
46
  config_param :strict_config_value, :bool, default: nil
46
47
  config_param :enable_msgpack_time_support, :bool, default: nil
48
+ config_param :disable_shared_socket, :bool, default: nil
47
49
  config_param :file_permission, default: nil do |v|
48
50
  v.to_i(8)
49
51
  end
data/lib/fluent/time.rb CHANGED
@@ -50,6 +50,7 @@ module Fluent
50
50
  def to_int
51
51
  @sec
52
52
  end
53
+ alias :to_i :to_int
53
54
 
54
55
  def to_f
55
56
  @sec + @nsec / 1_000_000_000.0
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Fluent
18
18
 
19
- VERSION = '1.11.2'
19
+ VERSION = '1.12.1'
20
20
 
21
21
  end
data/lib/fluent/winsvc.rb CHANGED
@@ -61,7 +61,6 @@ begin
61
61
  end
62
62
 
63
63
  def service_main
64
-
65
64
  @pid = service_main_start(@service_name)
66
65
  while running?
67
66
  sleep 10
@@ -69,13 +68,32 @@ begin
69
68
  end
70
69
 
71
70
  def service_stop
72
- ev = Win32::Event.open(@service_name)
73
- ev.set
74
- ev.close
71
+ set_event(@service_name)
75
72
  if @pid > 0
76
73
  Process.waitpid(@pid)
77
74
  end
78
75
  end
76
+
77
+ def service_paramchange
78
+ set_event("#{@service_name}_USR2")
79
+ end
80
+
81
+ def service_user_defined_control(code)
82
+ case code
83
+ when 128
84
+ set_event("#{@service_name}_HUP")
85
+ when 129
86
+ set_event("#{@service_name}_USR1")
87
+ end
88
+ end
89
+
90
+ private
91
+
92
+ def set_event(event_name)
93
+ ev = Win32::Event.open(event_name)
94
+ ev.set
95
+ ev.close
96
+ end
79
97
  end
80
98
 
81
99
  FluentdService.new(opts[:service_name]).mainloop
@@ -0,0 +1,10 @@
1
+ <%-
2
+ type = config[:type]
3
+ required_label = config[:required] ? "required" : "optional"
4
+ default = config[:default]
5
+ alias_name = config[:alias]
6
+ deprecated = config[:deprecated]
7
+ obsoleted = config[:obsoleted]
8
+ description = config[:desc]
9
+ -%>
10
+ |<%= name %>|<%= type %> (<%= required_label %>)|<%= description %><%- if type == :enum -%> (<%= config[:list].map{|x| "`#{x}`"}.join(", ") %>)<%- end -%><%- if alias_name -%><br>Alias: <%= alias_name %><%- end -%><%- if deprecated -%><br>Deprecated: <%= deprecated %><%- end -%><%- if obsoleted -%><br>Obsoleted: <%= :obsoleted %><%- end -%>|<%- if default -%>`<%= default %>`<%- end -%>|
@@ -82,6 +82,14 @@ class TestBaseCommand < ::Test::Unit::TestCase
82
82
  end
83
83
 
84
84
  class TestHead < TestBaseCommand
85
+ setup do
86
+ @default_newline = if Fluent.windows?
87
+ "\r\n"
88
+ else
89
+ "\n"
90
+ end
91
+ end
92
+
85
93
  sub_test_case 'initialize' do
86
94
  data(
87
95
  'file is not passed' => %w(),
@@ -138,7 +146,7 @@ class TestHead < TestBaseCommand
138
146
  create_message_packed_file(@file_name, [event_time(@t).to_i] * 6, [@record] * 6)
139
147
  head = BinlogReaderCommand::Head.new(argv)
140
148
  out = capture_stdout { head.call }
141
- assert_equal "2011-01-02T13:14:15+00:00\t#{TMP_DIR}/#{@file_name}\t#{Yajl.dump(@record)}\n" * 5, out
149
+ assert_equal "2011-01-02T13:14:15+00:00\t#{TMP_DIR}/#{@file_name}\t#{Yajl.dump(@record)}#{@default_newline}" * 5, out
142
150
  end
143
151
  end
144
152
 
@@ -149,7 +157,7 @@ class TestHead < TestBaseCommand
149
157
  create_message_packed_file(@file_name, [event_time(@t).to_i] * 6, [@record] * 6)
150
158
  head = BinlogReaderCommand::Head.new(argv)
151
159
  out = capture_stdout { head.call }
152
- assert_equal "2011-01-02T13:14:15+00:00\t#{TMP_DIR}/#{@file_name}\t#{Yajl.dump(@record)}\n", out
160
+ assert_equal "2011-01-02T13:14:15+00:00\t#{TMP_DIR}/#{@file_name}\t#{Yajl.dump(@record)}#{@default_newline}", out
153
161
  end
154
162
  end
155
163
 
@@ -169,7 +177,7 @@ class TestHead < TestBaseCommand
169
177
  create_message_packed_file(@file_name, [event_time(@t).to_i], [@record])
170
178
  head = BinlogReaderCommand::Head.new(argv)
171
179
  out = capture_stdout { head.call }
172
- assert_equal "#{Yajl.dump(@record)}\n", out
180
+ assert_equal "#{Yajl.dump(@record)}#{@default_newline}", out
173
181
  end
174
182
  end
175
183
 
@@ -198,6 +206,14 @@ class TestHead < TestBaseCommand
198
206
  end
199
207
 
200
208
  class TestCat < TestBaseCommand
209
+ setup do
210
+ @default_newline = if Fluent.windows?
211
+ "\r\n"
212
+ else
213
+ "\n"
214
+ end
215
+ end
216
+
201
217
  sub_test_case 'initialize' do
202
218
  data(
203
219
  'file is not passed' => [],
@@ -254,7 +270,7 @@ class TestCat < TestBaseCommand
254
270
  create_message_packed_file(@file_name, [event_time(@t).to_i] * 6, [@record] * 6)
255
271
  head = BinlogReaderCommand::Cat.new(argv)
256
272
  out = capture_stdout { head.call }
257
- assert_equal "2011-01-02T13:14:15+00:00\t#{TMP_DIR}/#{@file_name}\t#{Yajl.dump(@record)}\n" * 6, out
273
+ assert_equal "2011-01-02T13:14:15+00:00\t#{TMP_DIR}/#{@file_name}\t#{Yajl.dump(@record)}#{@default_newline}" * 6, out
258
274
  end
259
275
  end
260
276
 
@@ -265,7 +281,7 @@ class TestCat < TestBaseCommand
265
281
  create_message_packed_file(@file_name, [event_time(@t).to_i] * 6, [@record] * 6)
266
282
  head = BinlogReaderCommand::Cat.new(argv)
267
283
  out = capture_stdout { head.call }
268
- assert_equal "2011-01-02T13:14:15+00:00\t#{TMP_DIR}/#{@file_name}\t#{Yajl.dump(@record)}\n", out
284
+ assert_equal "2011-01-02T13:14:15+00:00\t#{TMP_DIR}/#{@file_name}\t#{Yajl.dump(@record)}#{@default_newline}", out
269
285
  end
270
286
  end
271
287
 
@@ -276,7 +292,7 @@ class TestCat < TestBaseCommand
276
292
  create_message_packed_file(@file_name, [event_time(@t).to_i], [@record])
277
293
  head = BinlogReaderCommand::Cat.new(argv)
278
294
  out = capture_stdout { head.call }
279
- assert_equal "#{Yajl.dump(@record)}\n", out
295
+ assert_equal "#{Yajl.dump(@record)}#{@default_newline}", out
280
296
  end
281
297
  end
282
298
 
@@ -0,0 +1,100 @@
1
+ require_relative '../helper'
2
+
3
+ require 'tempfile'
4
+ require 'fluent/command/cap_ctl'
5
+
6
+ class TestFluentCapCtl < Test::Unit::TestCase
7
+ setup do
8
+ omit "This environment does not handle Linux capability" unless defined?(CapNG)
9
+ end
10
+
11
+ sub_test_case "success" do
12
+ test "clear capability" do
13
+ logs = capture_stdout do
14
+ Fluent::CapCtl.new(["--clear"]).call
15
+ end
16
+ expression = /\AClear capabilities .*\n/m
17
+ assert_match expression, logs
18
+ end
19
+
20
+ test "add capability" do
21
+ logs = capture_stdout do
22
+ Fluent::CapCtl.new(["--add", "dac_override"]).call
23
+ end
24
+ expression = /\AUpdating .* done.\nAdding .*\n/m
25
+ assert_match expression, logs
26
+ end
27
+
28
+ test "drop capability" do
29
+ logs = capture_stdout do
30
+ Fluent::CapCtl.new(["--drop", "chown"]).call
31
+ end
32
+ expression = /\AUpdating .* done.\nDropping .*\n/m
33
+ assert_match expression, logs
34
+ end
35
+
36
+ test "get capability" do
37
+ logs = capture_stdout do
38
+ Fluent::CapCtl.new(["--get"]).call
39
+ end
40
+ expression = /\ACapabilities in .*,\nEffective: .*\nInheritable: .*\nPermitted: .*/m
41
+ assert_match expression, logs
42
+ end
43
+ end
44
+
45
+ sub_test_case "success with file" do
46
+ test "clear capability" do
47
+ logs = capture_stdout do
48
+ Tempfile.create("fluent-cap-") do |tempfile|
49
+ Fluent::CapCtl.new(["--clear-cap", "-f", tempfile.path]).call
50
+ end
51
+ end
52
+ expression = /\AClear capabilities .*\n/m
53
+ assert_match expression, logs
54
+ end
55
+
56
+ test "add capability" do
57
+ logs = capture_stdout do
58
+ Tempfile.create("fluent-cap-") do |tempfile|
59
+ Fluent::CapCtl.new(["--add", "dac_override", "-f", tempfile.path]).call
60
+ end
61
+ end
62
+ expression = /\AUpdating .* done.\nAdding .*\n/m
63
+ assert_match expression, logs
64
+ end
65
+
66
+ test "drop capability" do
67
+ logs = capture_stdout do
68
+ Tempfile.create("fluent-cap-") do |tempfile|
69
+ Fluent::CapCtl.new(["--drop", "chown", "-f", tempfile.path]).call
70
+ end
71
+ end
72
+ expression = /\AUpdating .* done.\nDropping .*\n/m
73
+ assert_match expression, logs
74
+ end
75
+
76
+ test "get capability" do
77
+ logs = capture_stdout do
78
+ Tempfile.create("fluent-cap-") do |tempfile|
79
+ Fluent::CapCtl.new(["--get", "-f", tempfile.path]).call
80
+ end
81
+ end
82
+ expression = /\ACapabilities in .*,\nEffective: .*\nInheritable: .*\nPermitted: .*/m
83
+ assert_match expression, logs
84
+ end
85
+ end
86
+
87
+ sub_test_case "invalid" do
88
+ test "add capability" do
89
+ assert_raise(ArgumentError) do
90
+ Fluent::CapCtl.new(["--add", "nonexitent"]).call
91
+ end
92
+ end
93
+
94
+ test "drop capability" do
95
+ assert_raise(ArgumentError) do
96
+ Fluent::CapCtl.new(["--drop", "invalid"]).call
97
+ end
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,57 @@
1
+ require_relative '../helper'
2
+
3
+ require 'test-unit'
4
+ require 'win32/event' if Fluent.windows?
5
+
6
+ require 'fluent/command/ctl'
7
+
8
+ class TestFluentdCtl < ::Test::Unit::TestCase
9
+ def assert_win32_event(event_name, command, pid_or_svcname)
10
+ command, event_suffix = data
11
+ event = Win32::Event.new(event_name)
12
+ ipc = Win32::Ipc.new(event.handle)
13
+ ret = Win32::Ipc::TIMEOUT
14
+
15
+ wait_thread = Thread.new do
16
+ ret = ipc.wait(1)
17
+ end
18
+ Fluent::Ctl.new([command, pid_or_svcname]).call
19
+ wait_thread.join
20
+ assert_equal(Win32::Ipc::SIGNALED, ret)
21
+ end
22
+
23
+ data("shutdown" => ["shutdown", "TERM", ""],
24
+ "restart" => ["restart", "HUP", "HUP"],
25
+ "flush" => ["flush", "USR1", "USR1"],
26
+ "reload" => ["reload", "USR2", "USR2"])
27
+ def test_commands(data)
28
+ command, signal, event_suffix = data
29
+
30
+ if Fluent.windows?
31
+ event_name = "fluentd_54321"
32
+ event_name << "_#{event_suffix}" unless event_suffix.empty?
33
+ assert_win32_event(event_name, command, "54321")
34
+ else
35
+ got_signal = false
36
+ Signal.trap(signal) do
37
+ got_signal = true
38
+ end
39
+ Fluent::Ctl.new([command, "#{$$}"]).call
40
+ assert_true(got_signal)
41
+ end
42
+ end
43
+
44
+ data("shutdown" => ["shutdown", ""],
45
+ "restart" => ["restart", "HUP"],
46
+ "flush" => ["flush", "USR1"],
47
+ "reload" => ["reload", "USR2"])
48
+ def test_commands_with_winsvcname(data)
49
+ omit "Only for Windows" unless Fluent.windows?
50
+
51
+ command, event_suffix = data
52
+ event_name = "testfluentdwinsvc"
53
+ event_name << "_#{event_suffix}" unless event_suffix.empty?
54
+
55
+ assert_win32_event(event_name, command, "testfluentdwinsvc")
56
+ end
57
+ end
@@ -1065,4 +1065,34 @@ CONF
1065
1065
  "secret xxxxxx", patterns_not_match: ["secret secret0", "secret secret1"])
1066
1066
  end
1067
1067
  end
1068
+
1069
+ sub_test_case 'sahred socket options' do
1070
+ test 'enable shared socket by default' do
1071
+ conf = ""
1072
+ conf_path = create_conf_file('empty.conf', conf)
1073
+ assert File.exist?(conf_path)
1074
+ assert_log_matches(create_cmdline(conf_path),
1075
+ patterns_not_match: ["shared socket for multiple workers is disabled"])
1076
+ end
1077
+
1078
+ test 'disable shared socket by command line option' do
1079
+ conf = ""
1080
+ conf_path = create_conf_file('empty.conf', conf)
1081
+ assert File.exist?(conf_path)
1082
+ assert_log_matches(create_cmdline(conf_path, "--disable-shared-socket"),
1083
+ "shared socket for multiple workers is disabled",)
1084
+ end
1085
+
1086
+ test 'disable shared socket by system config' do
1087
+ conf = <<CONF
1088
+ <system>
1089
+ disable_shared_socket
1090
+ </system>
1091
+ CONF
1092
+ conf_path = create_conf_file('empty.conf', conf)
1093
+ assert File.exist?(conf_path)
1094
+ assert_log_matches(create_cmdline(conf_path, "--disable-shared-socket"),
1095
+ "shared socket for multiple workers is disabled",)
1096
+ end
1097
+ end
1068
1098
  end
@@ -56,6 +56,32 @@ class TestFluentPluginConfigFormatter < Test::Unit::TestCase
56
56
  end
57
57
  end
58
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
+
59
85
  class SimpleInput < ::Fluent::Plugin::Input
60
86
  ::Fluent::Plugin.register_input("simple", self)
61
87
  helpers :inject, :compat_parameters
@@ -88,6 +114,13 @@ class TestFluentPluginConfigFormatter < Test::Unit::TestCase
88
114
  end
89
115
  end
90
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
+
91
124
  sub_test_case "json" do
92
125
  data(input: [FakeInput, "input"],
93
126
  output: [FakeOutput, "output"],
@@ -196,6 +229,52 @@ TEXT
196
229
  assert_equal(expected, dumped_config)
197
230
  end
198
231
 
232
+ test "input simple (table)" do
233
+ dumped_config = capture_stdout do
234
+ FluentPluginConfigFormatter.new(["--format=markdown", "--table", "input", "simple"]).call
235
+ end
236
+ expected = <<TEXT
237
+ ## Plugin helpers
238
+
239
+ * [inject](https://docs.fluentd.org/v/1.0/plugin-helper-overview/api-plugin-helper-inject)
240
+ * [compat_parameters](https://docs.fluentd.org/v/1.0/plugin-helper-overview/api-plugin-helper-compat_parameters)
241
+
242
+ * See also: [Input Plugin Overview](https://docs.fluentd.org/v/1.0/input#overview)
243
+
244
+ ## TestFluentPluginConfigFormatter::SimpleInput
245
+
246
+ ### Configuration
247
+
248
+ |parameter|type|description|default|
249
+ |---|---|---|---|
250
+ |path|string (required)|path to something||
251
+
252
+ TEXT
253
+ assert_equal(expected, dumped_config)
254
+ end
255
+
256
+ data("abbrev" => "sd",
257
+ "normal" => "service_discovery")
258
+ test "service_discovery simple" do |data|
259
+ plugin_type = data
260
+ dumped_config = capture_stdout do
261
+ FluentPluginConfigFormatter.new(["--format=markdown", plugin_type, "simple"]).call
262
+ end
263
+ expected = <<TEXT
264
+ * See also: [ServiceDiscovery Plugin Overview](https://docs.fluentd.org/v/1.0/servicediscovery#overview)
265
+
266
+ ## TestFluentPluginConfigFormatter::SimpleServiceDiscovery
267
+
268
+ ### servers (array) (required)
269
+
270
+ servers
271
+
272
+
273
+ TEXT
274
+ assert_equal(expected, dumped_config)
275
+ end
276
+
277
+
199
278
  test "output complex" do
200
279
  dumped_config = capture_stdout do
201
280
  FluentPluginConfigFormatter.new(["--format=markdown", "output", "complex"]).call
@@ -243,6 +322,49 @@ Default value: `normal`.
243
322
 
244
323
 
245
324
 
325
+ TEXT
326
+ assert_equal(expected, dumped_config)
327
+ end
328
+
329
+ test "output complex (table)" do
330
+ dumped_config = capture_stdout do
331
+ FluentPluginConfigFormatter.new(["--format=markdown", "--table", "output", "complex"]).call
332
+ end
333
+ expected = <<TEXT
334
+ ## Plugin helpers
335
+
336
+ * [inject](https://docs.fluentd.org/v/1.0/plugin-helper-overview/api-plugin-helper-inject)
337
+ * [compat_parameters](https://docs.fluentd.org/v/1.0/plugin-helper-overview/api-plugin-helper-compat_parameters)
338
+
339
+ * See also: [Output Plugin Overview](https://docs.fluentd.org/v/1.0/output#overview)
340
+
341
+ ## TestFluentPluginConfigFormatter::ComplexOutput
342
+
343
+
344
+ ### \\<authentication\\> section (required) (single)
345
+
346
+ ### Configuration
347
+
348
+ |parameter|type|description|default|
349
+ |---|---|---|---|
350
+ |username|string (required)|username||
351
+ |password|string (required)|password||
352
+
353
+
354
+ ### \\<parent\\> section (optional) (multiple)
355
+
356
+
357
+ #### \\<child\\> section (optional) (multiple)
358
+
359
+ ### Configuration
360
+
361
+ |parameter|type|description|default|
362
+ |---|---|---|---|
363
+ |names|array (required)|names||
364
+ |difficulty|enum (optional)|difficulty (`easy`, `normal`, `hard`)|`normal`|
365
+
366
+
367
+
246
368
  TEXT
247
369
  assert_equal(expected, dumped_config)
248
370
  end
@@ -251,7 +373,7 @@ TEXT
251
373
  sub_test_case "arguments" do
252
374
  data do
253
375
  hash = {}
254
- ["input", "output", "filter", "parser", "formatter"].each do |type|
376
+ ["input", "output", "filter", "parser", "formatter", "storage", "service_discovery"].each do |type|
255
377
  ["txt", "json", "markdown"].each do |format|
256
378
  argv = ["--format=#{format}"]
257
379
  [
@@ -259,7 +381,7 @@ TEXT
259
381
  ["--verbose"],
260
382
  ["--compact"]
261
383
  ].each do |options|
262
- hash[(argv + options).join(" ")] = argv + options + [type, "fake"]
384
+ hash["[#{type}] " + (argv + options).join(" ")] = argv + options + [type, "fake"]
263
385
  end
264
386
  end
265
387
  end