fluentd 1.17.0-x64-mingw32 → 1.17.1-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (259) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +46 -0
  3. data/README.md +1 -0
  4. data/SECURITY.md +2 -2
  5. data/fluent.conf +14 -14
  6. data/lib/fluent/command/cap_ctl.rb +4 -4
  7. data/lib/fluent/compat/call_super_mixin.rb +3 -3
  8. data/lib/fluent/compat/propagate_default.rb +4 -4
  9. data/lib/fluent/config/yaml_parser/parser.rb +4 -0
  10. data/lib/fluent/log/console_adapter.rb +4 -2
  11. data/lib/fluent/plugin/in_exec.rb +14 -2
  12. data/lib/fluent/plugin/in_http.rb +1 -1
  13. data/lib/fluent/plugin/in_sample.rb +13 -7
  14. data/lib/fluent/plugin/in_tail.rb +65 -23
  15. data/lib/fluent/plugin/out_copy.rb +1 -1
  16. data/lib/fluent/plugin/out_file.rb +8 -0
  17. data/lib/fluent/plugin/out_http.rb +12 -0
  18. data/lib/fluent/plugin/parser_json.rb +4 -12
  19. data/lib/fluent/plugin_helper/http_server/server.rb +1 -1
  20. data/lib/fluent/version.rb +1 -1
  21. data/templates/new_gem/fluent-plugin.gemspec.erb +6 -5
  22. metadata +25 -472
  23. data/.github/DISCUSSION_TEMPLATE/q-a-japanese.yml +0 -50
  24. data/.github/DISCUSSION_TEMPLATE/q-a.yml +0 -47
  25. data/.github/ISSUE_TEMPLATE/bug_report.yml +0 -71
  26. data/.github/ISSUE_TEMPLATE/config.yml +0 -5
  27. data/.github/ISSUE_TEMPLATE/feature_request.yml +0 -39
  28. data/.github/ISSUE_TEMPLATE.md +0 -17
  29. data/.github/PULL_REQUEST_TEMPLATE.md +0 -14
  30. data/.github/workflows/stale-actions.yml +0 -24
  31. data/.github/workflows/test-ruby-head.yml +0 -31
  32. data/.github/workflows/test.yml +0 -32
  33. data/.gitignore +0 -30
  34. data/Gemfile +0 -9
  35. data/fluentd.gemspec +0 -62
  36. data/test/command/test_binlog_reader.rb +0 -362
  37. data/test/command/test_ca_generate.rb +0 -70
  38. data/test/command/test_cap_ctl.rb +0 -100
  39. data/test/command/test_cat.rb +0 -128
  40. data/test/command/test_ctl.rb +0 -56
  41. data/test/command/test_fluentd.rb +0 -1291
  42. data/test/command/test_plugin_config_formatter.rb +0 -397
  43. data/test/command/test_plugin_generator.rb +0 -109
  44. data/test/compat/test_calls_super.rb +0 -166
  45. data/test/compat/test_parser.rb +0 -92
  46. data/test/config/assertions.rb +0 -42
  47. data/test/config/test_config_parser.rb +0 -551
  48. data/test/config/test_configurable.rb +0 -1784
  49. data/test/config/test_configure_proxy.rb +0 -604
  50. data/test/config/test_dsl.rb +0 -415
  51. data/test/config/test_element.rb +0 -518
  52. data/test/config/test_literal_parser.rb +0 -309
  53. data/test/config/test_plugin_configuration.rb +0 -56
  54. data/test/config/test_section.rb +0 -191
  55. data/test/config/test_system_config.rb +0 -195
  56. data/test/config/test_types.rb +0 -408
  57. data/test/counter/test_client.rb +0 -563
  58. data/test/counter/test_error.rb +0 -44
  59. data/test/counter/test_mutex_hash.rb +0 -179
  60. data/test/counter/test_server.rb +0 -589
  61. data/test/counter/test_store.rb +0 -258
  62. data/test/counter/test_validator.rb +0 -137
  63. data/test/helper.rb +0 -155
  64. data/test/helpers/fuzzy_assert.rb +0 -89
  65. data/test/helpers/process_extenstion.rb +0 -33
  66. data/test/log/test_console_adapter.rb +0 -117
  67. data/test/plugin/data/2010/01/20100102-030405.log +0 -0
  68. data/test/plugin/data/2010/01/20100102-030406.log +0 -0
  69. data/test/plugin/data/2010/01/20100102.log +0 -0
  70. data/test/plugin/data/log/bar +0 -0
  71. data/test/plugin/data/log/foo/bar.log +0 -0
  72. data/test/plugin/data/log/foo/bar2 +0 -0
  73. data/test/plugin/data/log/test.log +0 -0
  74. data/test/plugin/data/log_numeric/01.log +0 -0
  75. data/test/plugin/data/log_numeric/02.log +0 -0
  76. data/test/plugin/data/log_numeric/12.log +0 -0
  77. data/test/plugin/data/log_numeric/14.log +0 -0
  78. data/test/plugin/data/sd_file/config +0 -11
  79. data/test/plugin/data/sd_file/config.json +0 -17
  80. data/test/plugin/data/sd_file/config.yaml +0 -11
  81. data/test/plugin/data/sd_file/config.yml +0 -11
  82. data/test/plugin/data/sd_file/invalid_config.yml +0 -7
  83. data/test/plugin/in_tail/test_fifo.rb +0 -121
  84. data/test/plugin/in_tail/test_io_handler.rb +0 -150
  85. data/test/plugin/in_tail/test_position_file.rb +0 -346
  86. data/test/plugin/out_forward/test_ack_handler.rb +0 -140
  87. data/test/plugin/out_forward/test_connection_manager.rb +0 -145
  88. data/test/plugin/out_forward/test_handshake_protocol.rb +0 -112
  89. data/test/plugin/out_forward/test_load_balancer.rb +0 -106
  90. data/test/plugin/out_forward/test_socket_cache.rb +0 -174
  91. data/test/plugin/test_bare_output.rb +0 -131
  92. data/test/plugin/test_base.rb +0 -247
  93. data/test/plugin/test_buf_file.rb +0 -1314
  94. data/test/plugin/test_buf_file_single.rb +0 -898
  95. data/test/plugin/test_buf_memory.rb +0 -42
  96. data/test/plugin/test_buffer.rb +0 -1493
  97. data/test/plugin/test_buffer_chunk.rb +0 -209
  98. data/test/plugin/test_buffer_file_chunk.rb +0 -871
  99. data/test/plugin/test_buffer_file_single_chunk.rb +0 -611
  100. data/test/plugin/test_buffer_memory_chunk.rb +0 -339
  101. data/test/plugin/test_compressable.rb +0 -87
  102. data/test/plugin/test_file_util.rb +0 -96
  103. data/test/plugin/test_filter.rb +0 -368
  104. data/test/plugin/test_filter_grep.rb +0 -697
  105. data/test/plugin/test_filter_parser.rb +0 -731
  106. data/test/plugin/test_filter_record_transformer.rb +0 -577
  107. data/test/plugin/test_filter_stdout.rb +0 -207
  108. data/test/plugin/test_formatter_csv.rb +0 -136
  109. data/test/plugin/test_formatter_hash.rb +0 -38
  110. data/test/plugin/test_formatter_json.rb +0 -61
  111. data/test/plugin/test_formatter_ltsv.rb +0 -70
  112. data/test/plugin/test_formatter_msgpack.rb +0 -28
  113. data/test/plugin/test_formatter_out_file.rb +0 -116
  114. data/test/plugin/test_formatter_single_value.rb +0 -44
  115. data/test/plugin/test_formatter_tsv.rb +0 -76
  116. data/test/plugin/test_in_debug_agent.rb +0 -49
  117. data/test/plugin/test_in_exec.rb +0 -261
  118. data/test/plugin/test_in_forward.rb +0 -1178
  119. data/test/plugin/test_in_gc_stat.rb +0 -62
  120. data/test/plugin/test_in_http.rb +0 -1124
  121. data/test/plugin/test_in_monitor_agent.rb +0 -922
  122. data/test/plugin/test_in_object_space.rb +0 -66
  123. data/test/plugin/test_in_sample.rb +0 -190
  124. data/test/plugin/test_in_syslog.rb +0 -505
  125. data/test/plugin/test_in_tail.rb +0 -3429
  126. data/test/plugin/test_in_tcp.rb +0 -328
  127. data/test/plugin/test_in_udp.rb +0 -296
  128. data/test/plugin/test_in_unix.rb +0 -181
  129. data/test/plugin/test_input.rb +0 -137
  130. data/test/plugin/test_metadata.rb +0 -89
  131. data/test/plugin/test_metrics.rb +0 -294
  132. data/test/plugin/test_metrics_local.rb +0 -96
  133. data/test/plugin/test_multi_output.rb +0 -204
  134. data/test/plugin/test_out_copy.rb +0 -308
  135. data/test/plugin/test_out_exec.rb +0 -312
  136. data/test/plugin/test_out_exec_filter.rb +0 -606
  137. data/test/plugin/test_out_file.rb +0 -1038
  138. data/test/plugin/test_out_forward.rb +0 -1349
  139. data/test/plugin/test_out_http.rb +0 -557
  140. data/test/plugin/test_out_null.rb +0 -105
  141. data/test/plugin/test_out_relabel.rb +0 -28
  142. data/test/plugin/test_out_roundrobin.rb +0 -146
  143. data/test/plugin/test_out_secondary_file.rb +0 -458
  144. data/test/plugin/test_out_stdout.rb +0 -205
  145. data/test/plugin/test_out_stream.rb +0 -103
  146. data/test/plugin/test_output.rb +0 -1334
  147. data/test/plugin/test_output_as_buffered.rb +0 -2024
  148. data/test/plugin/test_output_as_buffered_backup.rb +0 -363
  149. data/test/plugin/test_output_as_buffered_compress.rb +0 -179
  150. data/test/plugin/test_output_as_buffered_overflow.rb +0 -250
  151. data/test/plugin/test_output_as_buffered_retries.rb +0 -966
  152. data/test/plugin/test_output_as_buffered_secondary.rb +0 -882
  153. data/test/plugin/test_output_as_standard.rb +0 -374
  154. data/test/plugin/test_owned_by.rb +0 -34
  155. data/test/plugin/test_parser.rb +0 -399
  156. data/test/plugin/test_parser_apache.rb +0 -42
  157. data/test/plugin/test_parser_apache2.rb +0 -47
  158. data/test/plugin/test_parser_apache_error.rb +0 -45
  159. data/test/plugin/test_parser_csv.rb +0 -200
  160. data/test/plugin/test_parser_json.rb +0 -244
  161. data/test/plugin/test_parser_labeled_tsv.rb +0 -160
  162. data/test/plugin/test_parser_msgpack.rb +0 -127
  163. data/test/plugin/test_parser_multiline.rb +0 -111
  164. data/test/plugin/test_parser_nginx.rb +0 -88
  165. data/test/plugin/test_parser_none.rb +0 -52
  166. data/test/plugin/test_parser_regexp.rb +0 -284
  167. data/test/plugin/test_parser_syslog.rb +0 -650
  168. data/test/plugin/test_parser_tsv.rb +0 -122
  169. data/test/plugin/test_sd_file.rb +0 -228
  170. data/test/plugin/test_sd_srv.rb +0 -230
  171. data/test/plugin/test_storage.rb +0 -166
  172. data/test/plugin/test_storage_local.rb +0 -335
  173. data/test/plugin/test_string_util.rb +0 -26
  174. data/test/plugin_helper/data/cert/cert-key.pem +0 -27
  175. data/test/plugin_helper/data/cert/cert-with-CRLF.pem +0 -19
  176. data/test/plugin_helper/data/cert/cert-with-no-newline.pem +0 -19
  177. data/test/plugin_helper/data/cert/cert.pem +0 -19
  178. data/test/plugin_helper/data/cert/cert_chains/ca-cert-key.pem +0 -27
  179. data/test/plugin_helper/data/cert/cert_chains/ca-cert.pem +0 -20
  180. data/test/plugin_helper/data/cert/cert_chains/cert-key.pem +0 -27
  181. data/test/plugin_helper/data/cert/cert_chains/cert.pem +0 -40
  182. data/test/plugin_helper/data/cert/empty.pem +0 -0
  183. data/test/plugin_helper/data/cert/generate_cert.rb +0 -125
  184. data/test/plugin_helper/data/cert/with_ca/ca-cert-key-pass.pem +0 -30
  185. data/test/plugin_helper/data/cert/with_ca/ca-cert-key.pem +0 -27
  186. data/test/plugin_helper/data/cert/with_ca/ca-cert-pass.pem +0 -20
  187. data/test/plugin_helper/data/cert/with_ca/ca-cert.pem +0 -20
  188. data/test/plugin_helper/data/cert/with_ca/cert-key-pass.pem +0 -30
  189. data/test/plugin_helper/data/cert/with_ca/cert-key.pem +0 -27
  190. data/test/plugin_helper/data/cert/with_ca/cert-pass.pem +0 -21
  191. data/test/plugin_helper/data/cert/with_ca/cert.pem +0 -21
  192. data/test/plugin_helper/data/cert/without_ca/cert-key-pass.pem +0 -30
  193. data/test/plugin_helper/data/cert/without_ca/cert-key.pem +0 -27
  194. data/test/plugin_helper/data/cert/without_ca/cert-pass.pem +0 -20
  195. data/test/plugin_helper/data/cert/without_ca/cert.pem +0 -20
  196. data/test/plugin_helper/http_server/test_app.rb +0 -65
  197. data/test/plugin_helper/http_server/test_route.rb +0 -32
  198. data/test/plugin_helper/service_discovery/test_manager.rb +0 -93
  199. data/test/plugin_helper/service_discovery/test_round_robin_balancer.rb +0 -21
  200. data/test/plugin_helper/test_cert_option.rb +0 -25
  201. data/test/plugin_helper/test_child_process.rb +0 -862
  202. data/test/plugin_helper/test_compat_parameters.rb +0 -358
  203. data/test/plugin_helper/test_event_emitter.rb +0 -80
  204. data/test/plugin_helper/test_event_loop.rb +0 -52
  205. data/test/plugin_helper/test_extract.rb +0 -194
  206. data/test/plugin_helper/test_formatter.rb +0 -255
  207. data/test/plugin_helper/test_http_server_helper.rb +0 -372
  208. data/test/plugin_helper/test_inject.rb +0 -561
  209. data/test/plugin_helper/test_metrics.rb +0 -137
  210. data/test/plugin_helper/test_parser.rb +0 -264
  211. data/test/plugin_helper/test_record_accessor.rb +0 -238
  212. data/test/plugin_helper/test_retry_state.rb +0 -1006
  213. data/test/plugin_helper/test_server.rb +0 -1895
  214. data/test/plugin_helper/test_service_discovery.rb +0 -165
  215. data/test/plugin_helper/test_socket.rb +0 -146
  216. data/test/plugin_helper/test_storage.rb +0 -542
  217. data/test/plugin_helper/test_thread.rb +0 -164
  218. data/test/plugin_helper/test_timer.rb +0 -130
  219. data/test/scripts/exec_script.rb +0 -32
  220. data/test/scripts/fluent/plugin/formatter1/formatter_test1.rb +0 -7
  221. data/test/scripts/fluent/plugin/formatter2/formatter_test2.rb +0 -7
  222. data/test/scripts/fluent/plugin/formatter_known.rb +0 -8
  223. data/test/scripts/fluent/plugin/out_test.rb +0 -81
  224. data/test/scripts/fluent/plugin/out_test2.rb +0 -80
  225. data/test/scripts/fluent/plugin/parser_known.rb +0 -4
  226. data/test/test_capability.rb +0 -74
  227. data/test/test_clock.rb +0 -164
  228. data/test/test_config.rb +0 -369
  229. data/test/test_configdsl.rb +0 -148
  230. data/test/test_daemonizer.rb +0 -91
  231. data/test/test_engine.rb +0 -203
  232. data/test/test_event.rb +0 -531
  233. data/test/test_event_router.rb +0 -348
  234. data/test/test_event_time.rb +0 -199
  235. data/test/test_file_wrapper.rb +0 -53
  236. data/test/test_filter.rb +0 -121
  237. data/test/test_fluent_log_event_router.rb +0 -99
  238. data/test/test_formatter.rb +0 -369
  239. data/test/test_input.rb +0 -31
  240. data/test/test_log.rb +0 -1076
  241. data/test/test_match.rb +0 -148
  242. data/test/test_mixin.rb +0 -351
  243. data/test/test_msgpack_factory.rb +0 -50
  244. data/test/test_oj_options.rb +0 -55
  245. data/test/test_output.rb +0 -278
  246. data/test/test_plugin.rb +0 -251
  247. data/test/test_plugin_classes.rb +0 -370
  248. data/test/test_plugin_helper.rb +0 -81
  249. data/test/test_plugin_id.rb +0 -119
  250. data/test/test_process.rb +0 -14
  251. data/test/test_root_agent.rb +0 -951
  252. data/test/test_static_config_analysis.rb +0 -177
  253. data/test/test_supervisor.rb +0 -821
  254. data/test/test_test_drivers.rb +0 -136
  255. data/test/test_time_formatter.rb +0 -301
  256. data/test/test_time_parser.rb +0 -362
  257. data/test/test_tls.rb +0 -65
  258. data/test/test_unique_id.rb +0 -47
  259. 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