fluentd 1.15.2-x64-mingw32 → 1.16.0-x64-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/linux-test.yaml +2 -2
  3. data/.github/workflows/macos-test.yaml +2 -2
  4. data/.github/workflows/windows-test.yaml +2 -2
  5. data/CHANGELOG.md +96 -0
  6. data/MAINTAINERS.md +2 -0
  7. data/README.md +0 -1
  8. data/fluentd.gemspec +2 -2
  9. data/lib/fluent/command/fluentd.rb +55 -64
  10. data/lib/fluent/config/yaml_parser/loader.rb +18 -1
  11. data/lib/fluent/daemon.rb +2 -4
  12. data/lib/fluent/file_wrapper.rb +137 -0
  13. data/lib/fluent/log/console_adapter.rb +66 -0
  14. data/lib/fluent/log.rb +35 -5
  15. data/lib/fluent/oj_options.rb +1 -2
  16. data/lib/fluent/plugin/base.rb +5 -7
  17. data/lib/fluent/plugin/buf_file.rb +32 -3
  18. data/lib/fluent/plugin/buf_file_single.rb +32 -3
  19. data/lib/fluent/plugin/buffer/file_chunk.rb +1 -1
  20. data/lib/fluent/plugin/buffer.rb +21 -0
  21. data/lib/fluent/plugin/in_tail.rb +1 -6
  22. data/lib/fluent/plugin/in_tcp.rb +4 -2
  23. data/lib/fluent/plugin/out_file.rb +0 -4
  24. data/lib/fluent/plugin/out_forward/ack_handler.rb +19 -4
  25. data/lib/fluent/plugin/out_forward.rb +2 -2
  26. data/lib/fluent/plugin/out_secondary_file.rb +39 -22
  27. data/lib/fluent/plugin/output.rb +49 -12
  28. data/lib/fluent/plugin_helper/http_server/server.rb +2 -1
  29. data/lib/fluent/supervisor.rb +157 -232
  30. data/lib/fluent/test/driver/base.rb +11 -5
  31. data/lib/fluent/test/driver/filter.rb +4 -0
  32. data/lib/fluent/test/startup_shutdown.rb +6 -8
  33. data/lib/fluent/version.rb +1 -1
  34. data/test/command/test_ctl.rb +1 -1
  35. data/test/command/test_fluentd.rb +168 -22
  36. data/test/command/test_plugin_config_formatter.rb +0 -1
  37. data/test/compat/test_parser.rb +5 -5
  38. data/test/config/test_system_config.rb +0 -8
  39. data/test/log/test_console_adapter.rb +110 -0
  40. data/test/plugin/out_forward/test_ack_handler.rb +39 -0
  41. data/test/plugin/test_base.rb +98 -0
  42. data/test/plugin/test_buf_file.rb +62 -23
  43. data/test/plugin/test_buf_file_single.rb +65 -0
  44. data/test/plugin/test_in_http.rb +2 -3
  45. data/test/plugin/test_in_monitor_agent.rb +2 -3
  46. data/test/plugin/test_in_tail.rb +105 -103
  47. data/test/plugin/test_in_tcp.rb +15 -0
  48. data/test/plugin/test_out_file.rb +3 -2
  49. data/test/plugin/test_out_forward.rb +14 -18
  50. data/test/plugin/test_out_http.rb +1 -0
  51. data/test/plugin/test_output.rb +269 -0
  52. data/test/plugin/test_parser_regexp.rb +1 -6
  53. data/test/plugin_helper/test_http_server_helper.rb +1 -1
  54. data/test/plugin_helper/test_server.rb +10 -5
  55. data/test/test_config.rb +57 -21
  56. data/test/{plugin/test_file_wrapper.rb → test_file_wrapper.rb} +2 -2
  57. data/test/test_formatter.rb +23 -20
  58. data/test/test_log.rb +85 -40
  59. data/test/test_supervisor.rb +300 -283
  60. metadata +15 -24
  61. data/.drone.yml +0 -35
  62. data/.github/workflows/issue-auto-closer.yml +0 -12
  63. data/.github/workflows/stale-actions.yml +0 -22
  64. data/.gitlab-ci.yml +0 -103
  65. data/lib/fluent/plugin/file_wrapper.rb +0 -131
  66. data/test/test_logger_initializer.rb +0 -46
@@ -156,6 +156,19 @@ class TcpInputTest < Test::Unit::TestCase
156
156
  assert_equal hostname, event[2]['host']
157
157
  end
158
158
 
159
+ test "send_keepalive_packet_can_be_enabled" do
160
+ d = create_driver(base_config + %!
161
+ format none
162
+ send_keepalive_packet true
163
+ !)
164
+ assert_true d.instance.send_keepalive_packet
165
+
166
+ d = create_driver(base_config + %!
167
+ format none
168
+ !)
169
+ assert_false d.instance.send_keepalive_packet
170
+ end
171
+
159
172
  test 'source_address_key' do
160
173
  d = create_driver(base_config + %!
161
174
  format none
@@ -213,6 +226,8 @@ class TcpInputTest < Test::Unit::TestCase
213
226
 
214
227
  assert_equal 1, d.instance.log.logs.count { |l| l =~ /anonymous client/ }
215
228
  assert_equal 0, d.events.size
229
+ ensure
230
+ d.instance_shutdown if d&.instance
216
231
  end
217
232
  end
218
233
 
@@ -5,6 +5,7 @@ require 'fileutils'
5
5
  require 'time'
6
6
  require 'timecop'
7
7
  require 'zlib'
8
+ require 'fluent/file_wrapper'
8
9
 
9
10
  class FileOutputTest < Test::Unit::TestCase
10
11
  def setup
@@ -1016,7 +1017,7 @@ class FileOutputTest < Test::Unit::TestCase
1016
1017
 
1017
1018
  test 'returns filepath with index which does not exist yet' do
1018
1019
  5.times do |i|
1019
- File.open(File.join(@tmp, "exist_#{i}.log"), 'a'){|f| } # open(create) and close
1020
+ Fluent::FileWrapper.open(File.join(@tmp, "exist_#{i}.log"), 'a'){|f| } # open(create) and close
1020
1021
  end
1021
1022
  @i.find_filepath_available(File.join(@tmp, "exist_**.log")) do |path|
1022
1023
  assert_equal File.join(@tmp, "exist_5.log"), path
@@ -1025,7 +1026,7 @@ class FileOutputTest < Test::Unit::TestCase
1025
1026
 
1026
1027
  test 'creates lock directory when with_lock is true to exclude operations of other worker process' do
1027
1028
  5.times do |i|
1028
- File.open(File.join(@tmp, "exist_#{i}.log"), 'a')
1029
+ Fluent::FileWrapper.open(File.join(@tmp, "exist_#{i}.log"), 'a')
1029
1030
  end
1030
1031
  Dir.mkdir(File.join(@tmp, "exist_5.log.lock"))
1031
1032
  @i.find_filepath_available(File.join(@tmp, "exist_**.log"), with_lock: true) do |path|
@@ -1331,26 +1331,22 @@ EOL
1331
1331
  d = create_driver(output_conf)
1332
1332
  d.instance_start
1333
1333
 
1334
- begin
1335
- chunk = Fluent::Plugin::Buffer::MemoryChunk.new(Fluent::Plugin::Buffer::Metadata.new(nil, nil, nil))
1336
- mock.proxy(d.instance).socket_create_tcp(TARGET_HOST, @target_port,
1337
- linger_timeout: anything,
1338
- send_timeout: anything,
1339
- recv_timeout: anything,
1340
- connect_timeout: anything) { |sock|
1341
- mock(sock).close.once; sock
1342
- }.twice
1343
-
1344
- target_input_driver.run(timeout: 15) do
1345
- d.run(shutdown: false) do
1346
- node = d.instance.nodes.first
1347
- 2.times do
1348
- node.send_data('test', chunk) rescue nil
1349
- end
1334
+ chunk = Fluent::Plugin::Buffer::MemoryChunk.new(Fluent::Plugin::Buffer::Metadata.new(nil, nil, nil))
1335
+ mock.proxy(d.instance).socket_create_tcp(TARGET_HOST, @target_port,
1336
+ linger_timeout: anything,
1337
+ send_timeout: anything,
1338
+ recv_timeout: anything,
1339
+ connect_timeout: anything) { |sock|
1340
+ mock(sock).close.once; sock
1341
+ }.twice
1342
+
1343
+ target_input_driver.run(timeout: 15) do
1344
+ d.run do
1345
+ node = d.instance.nodes.first
1346
+ 2.times do
1347
+ node.send_data('test', chunk) rescue nil
1350
1348
  end
1351
1349
  end
1352
- ensure
1353
- d.instance_shutdown
1354
1350
  end
1355
1351
  end
1356
1352
  end
@@ -378,6 +378,7 @@ class HTTPOutputTest < Test::Unit::TestCase
378
378
  password hello?
379
379
  </auth>
380
380
  ])
381
+ d.instance.system_config_override(root_dir: TMP_DIR) # Backup files are generated in TMP_DIR.
381
382
  d.run(default_tag: 'test.http', shutdown: false) do
382
383
  test_events.each { |event|
383
384
  d.feed(event)
@@ -803,7 +803,10 @@ class OutputTest < Test::Unit::TestCase
803
803
  end
804
804
 
805
805
  test 'output plugin will call #try_write for plugin supports delayed commit only to flush buffer chunks' do
806
+ tmp_dir = File.join(__dir__, '../tmp/test_output')
807
+
806
808
  i = create_output(:delayed)
809
+ i.system_config_override(root_dir: tmp_dir) # Backup files are generated in `tmp_dir`.
807
810
  try_write_called = false
808
811
  i.register(:try_write){|chunk| try_write_called = true; commit_write(chunk.unique_id) }
809
812
 
@@ -820,6 +823,8 @@ class OutputTest < Test::Unit::TestCase
820
823
  assert try_write_called
821
824
 
822
825
  i.stop; i.before_shutdown; i.shutdown; i.after_shutdown; i.close; i.terminate
826
+ ensure
827
+ FileUtils.rm_rf(tmp_dir)
823
828
  end
824
829
 
825
830
  test '#prefer_delayed_commit (returns false) decides delayed commit is disabled if both are implemented' do
@@ -849,7 +854,10 @@ class OutputTest < Test::Unit::TestCase
849
854
  end
850
855
 
851
856
  test '#prefer_delayed_commit (returns true) decides delayed commit is enabled if both are implemented' do
857
+ tmp_dir = File.join(__dir__, '../tmp/test_output')
858
+
852
859
  i = create_output(:full)
860
+ i.system_config_override(root_dir: tmp_dir) # Backup files are generated in `tmp_dir`.
853
861
  write_called = false
854
862
  try_write_called = false
855
863
  i.register(:write){ |chunk| write_called = true }
@@ -872,6 +880,8 @@ class OutputTest < Test::Unit::TestCase
872
880
  assert try_write_called
873
881
 
874
882
  i.stop; i.before_shutdown; i.shutdown; i.after_shutdown; i.close; i.terminate
883
+ ensure
884
+ FileUtils.rm_rf(tmp_dir)
875
885
  end
876
886
 
877
887
  test 'flush_interval is ignored when flush_mode is not interval' do
@@ -1062,4 +1072,263 @@ class OutputTest < Test::Unit::TestCase
1062
1072
  }
1063
1073
  end
1064
1074
  end
1075
+
1076
+ sub_test_case "actual_flush_thread_count" do
1077
+ data(
1078
+ "Not buffered",
1079
+ {
1080
+ output_type: :sync,
1081
+ config: config_element(),
1082
+ expected: 0,
1083
+ }
1084
+ )
1085
+ data(
1086
+ "Buffered with singile thread",
1087
+ {
1088
+ output_type: :full,
1089
+ config: config_element("ROOT", "", {}, [config_element("buffer", "", {})]),
1090
+ expected: 1,
1091
+ }
1092
+ )
1093
+ data(
1094
+ "Buffered with multiple threads",
1095
+ {
1096
+ output_type: :full,
1097
+ config: config_element("ROOT", "", {}, [config_element("buffer", "", {"flush_thread_count" => 8})]),
1098
+ expected: 8,
1099
+ }
1100
+ )
1101
+ test "actual_flush_thread_count" do |data|
1102
+ o = create_output(data[:output_type])
1103
+ o.configure(data[:config])
1104
+ assert_equal data[:expected], o.actual_flush_thread_count
1105
+ end
1106
+
1107
+ data(
1108
+ "Buffered with single thread",
1109
+ {
1110
+ output_type: :full,
1111
+ config: config_element(
1112
+ "ROOT", "", {},
1113
+ [
1114
+ config_element("buffer", "", {}),
1115
+ config_element("secondary", "", {"@type" => "test", "name" => "test"}),
1116
+ ]
1117
+ ),
1118
+ expected: 1,
1119
+ }
1120
+ )
1121
+ data(
1122
+ "Buffered with multiple threads",
1123
+ {
1124
+ output_type: :full,
1125
+ config: config_element(
1126
+ "ROOT", "", {},
1127
+ [
1128
+ config_element("buffer", "", {"flush_thread_count" => 8}),
1129
+ config_element("secondary", "", {"@type" => "test", "name" => "test"}),
1130
+ ]
1131
+ ),
1132
+ expected: 8,
1133
+ }
1134
+ )
1135
+ test "actual_flush_thread_count for secondary" do |data|
1136
+ primary = create_output(data[:output_type])
1137
+ primary.configure(data[:config])
1138
+ assert_equal data[:expected], primary.secondary.actual_flush_thread_count
1139
+ end
1140
+ end
1141
+
1142
+ sub_test_case "synchronize_path" do
1143
+ def setup
1144
+ Dir.mktmpdir do |lock_dir|
1145
+ ENV['FLUENTD_LOCK_DIR'] = lock_dir
1146
+ yield
1147
+ end
1148
+ end
1149
+
1150
+ def assert_worker_lock(lock_path, expect_locked)
1151
+ # With LOCK_NB set, flock() returns:
1152
+ # * `false` when the file is already locked.
1153
+ # * `0` when the file is not locked.
1154
+ File.open(lock_path, "w") do |f|
1155
+ if expect_locked
1156
+ assert_equal false, f.flock(File::LOCK_EX|File::LOCK_NB)
1157
+ else
1158
+ assert_equal 0, f.flock(File::LOCK_EX|File::LOCK_NB)
1159
+ end
1160
+ end
1161
+ end
1162
+
1163
+ def assert_thread_lock(output_plugin, expect_locked)
1164
+ t = Thread.new do
1165
+ output_plugin.synchronize_path("test") do
1166
+ end
1167
+ end
1168
+ if expect_locked
1169
+ assert_nil t.join(3)
1170
+ else
1171
+ assert_not_nil t.join(3)
1172
+ end
1173
+ end
1174
+
1175
+ data(
1176
+ "Not buffered with single worker",
1177
+ {
1178
+ output_type: :sync,
1179
+ config: config_element(),
1180
+ workers: 1,
1181
+ expect_worker_lock: false,
1182
+ expect_thread_lock: false,
1183
+ }
1184
+ )
1185
+ data(
1186
+ "Not buffered with multiple workers",
1187
+ {
1188
+ output_type: :sync,
1189
+ config: config_element(),
1190
+ workers: 4,
1191
+ expect_worker_lock: true,
1192
+ expect_thread_lock: false,
1193
+ }
1194
+ )
1195
+ data(
1196
+ "Buffered with single thread and single worker",
1197
+ {
1198
+ output_type: :full,
1199
+ config: config_element("ROOT", "", {}, [config_element("buffer", "", {})]),
1200
+ workers: 1,
1201
+ expect_worker_lock: false,
1202
+ expect_thread_lock: false,
1203
+ }
1204
+ )
1205
+ data(
1206
+ "Buffered with multiple threads and single worker",
1207
+ {
1208
+ output_type: :full,
1209
+ config: config_element("ROOT", "", {}, [config_element("buffer", "", {"flush_thread_count" => 8})]),
1210
+ workers: 1,
1211
+ expect_worker_lock: false,
1212
+ expect_thread_lock: true,
1213
+ }
1214
+ )
1215
+ data(
1216
+ "Buffered with single thread and multiple workers",
1217
+ {
1218
+ output_type: :full,
1219
+ config: config_element("ROOT", "", {}, [config_element("buffer", "", {})]),
1220
+ workers: 4,
1221
+ expect_worker_lock: true,
1222
+ expect_thread_lock: false,
1223
+ }
1224
+ )
1225
+ data(
1226
+ "Buffered with multiple threads and multiple workers",
1227
+ {
1228
+ output_type: :full,
1229
+ config: config_element("ROOT", "", {}, [config_element("buffer", "", {"flush_thread_count" => 8})]),
1230
+ workers: 4,
1231
+ expect_worker_lock: true,
1232
+ expect_thread_lock: true,
1233
+ }
1234
+ )
1235
+ test "synchronize_path" do |data|
1236
+ o = create_output(data[:output_type])
1237
+ o.configure(data[:config])
1238
+ o.system_config_override(workers: data[:workers])
1239
+
1240
+ test_lock_name = "test_lock_name"
1241
+ lock_path = o.get_lock_path(test_lock_name)
1242
+
1243
+ o.synchronize_path(test_lock_name) do
1244
+ assert_worker_lock(lock_path, data[:expect_worker_lock])
1245
+ assert_thread_lock(o, data[:expect_thread_lock])
1246
+ end
1247
+
1248
+ assert_worker_lock(lock_path, false)
1249
+ assert_thread_lock(o, false)
1250
+ end
1251
+
1252
+ data(
1253
+ "Buffered with single thread and single worker",
1254
+ {
1255
+ output_type: :full,
1256
+ config: config_element(
1257
+ "ROOT", "", {},
1258
+ [
1259
+ config_element("buffer", "", {}),
1260
+ config_element("secondary", "", {"@type" => "test", "name" => "test"}),
1261
+ ]
1262
+ ),
1263
+ workers: 1,
1264
+ expect_worker_lock: false,
1265
+ expect_thread_lock: false,
1266
+ }
1267
+ )
1268
+ data(
1269
+ "Buffered with multiple threads and single worker",
1270
+ {
1271
+ output_type: :full,
1272
+ config: config_element(
1273
+ "ROOT", "", {},
1274
+ [
1275
+ config_element("buffer", "", {"flush_thread_count" => 8}),
1276
+ config_element("secondary", "", {"@type" => "test", "name" => "test"}),
1277
+ ]
1278
+ ),
1279
+ workers: 1,
1280
+ expect_worker_lock: false,
1281
+ expect_thread_lock: true,
1282
+ }
1283
+ )
1284
+ data(
1285
+ "Buffered with single thread and multiple workers",
1286
+ {
1287
+ output_type: :full,
1288
+ config: config_element(
1289
+ "ROOT", "", {},
1290
+ [
1291
+ config_element("buffer", "", {}),
1292
+ config_element("secondary", "", {"@type" => "test", "name" => "test"}),
1293
+ ]
1294
+ ),
1295
+ workers: 4,
1296
+ expect_worker_lock: true,
1297
+ expect_thread_lock: false,
1298
+ }
1299
+ )
1300
+ data(
1301
+ "Buffered with multiple threads and multiple workers",
1302
+ {
1303
+ output_type: :full,
1304
+ config: config_element(
1305
+ "ROOT", "", {},
1306
+ [
1307
+ config_element("buffer", "", {"flush_thread_count" => 8}),
1308
+ config_element("secondary", "", {"@type" => "test", "name" => "test"}),
1309
+ ]
1310
+ ),
1311
+ workers: 4,
1312
+ expect_worker_lock: true,
1313
+ expect_thread_lock: true,
1314
+ }
1315
+ )
1316
+ test "synchronize_path for secondary" do |data|
1317
+ primary = create_output(data[:output_type])
1318
+ primary.configure(data[:config])
1319
+ secondary = primary.secondary
1320
+ secondary.system_config_override(workers: data[:workers])
1321
+
1322
+ test_lock_name = "test_lock_name"
1323
+ lock_path = secondary.get_lock_path(test_lock_name)
1324
+
1325
+ secondary.synchronize_path(test_lock_name) do
1326
+ assert_worker_lock(lock_path, data[:expect_worker_lock])
1327
+ assert_thread_lock(secondary, data[:expect_thread_lock])
1328
+ end
1329
+
1330
+ assert_worker_lock(lock_path, false)
1331
+ assert_thread_lock(secondary, false)
1332
+ end
1333
+ end
1065
1334
  end
@@ -28,12 +28,7 @@ class RegexpParserTest < ::Test::Unit::TestCase
28
28
  if initialize_conf
29
29
  Fluent::Test::Driver::Parser.new(Fluent::Compat::TextParser::RegexpParser.new(regexp, conf))
30
30
  else
31
- # Fluent::Test::Driver::Parser.new(Fluent::Compat::TextParser::RegexpParser.new(regexp)).configure(conf)
32
- instance = Fluent::Compat::TextParser::RegexpParser.new(regexp)
33
- instance.configure(conf)
34
- d = Struct.new(:instance).new
35
- d.instance = instance
36
- d
31
+ Fluent::Test::Driver::Parser.new(Fluent::Compat::TextParser::RegexpParser.new(regexp)).configure(conf)
37
32
  end
38
33
  end
39
34
 
@@ -127,7 +127,7 @@ class HttpHelperTest < Test::Unit::TestCase
127
127
  end
128
128
 
129
129
  client = Async::HTTP::Client.new(Async::HTTP::Endpoint.parse("https://#{addr}:#{port}", ssl_context: context))
130
- reactor = Async::Reactor.new(nil, logger: NULL_LOGGER)
130
+ reactor = Async::Reactor.new(nil, logger: Fluent::Log::ConsoleAdapter.wrap(NULL_LOGGER))
131
131
 
132
132
  resp = nil
133
133
  error = nil
@@ -16,11 +16,16 @@ class ServerPluginHelperTest < Test::Unit::TestCase
16
16
 
17
17
  setup do
18
18
  @port = unused_port
19
- @socket_manager_path = ServerEngine::SocketManager::Server.generate_path
20
- if @socket_manager_path.is_a?(String) && File.exist?(@socket_manager_path)
21
- FileUtils.rm_f @socket_manager_path
19
+ if Fluent.windows?
20
+ @socket_manager_server = ServerEngine::SocketManager::Server.open
21
+ @socket_manager_path = @socket_manager_server.path
22
+ else
23
+ @socket_manager_path = ServerEngine::SocketManager::Server.generate_path
24
+ if @socket_manager_path.is_a?(String) && File.exist?(@socket_manager_path)
25
+ FileUtils.rm_f @socket_manager_path
26
+ end
27
+ @socket_manager_server = ServerEngine::SocketManager::Server.open(@socket_manager_path)
22
28
  end
23
- @socket_manager_server = ServerEngine::SocketManager::Server.open(@socket_manager_path)
24
29
  ENV['SERVERENGINE_SOCKETMANAGER_PATH'] = @socket_manager_path.to_s
25
30
 
26
31
  @d = Dummy.new
@@ -37,7 +42,7 @@ class ServerPluginHelperTest < Test::Unit::TestCase
37
42
  (@d.terminated? || @d.terminate) rescue nil
38
43
 
39
44
  @socket_manager_server.close
40
- if @socket_manager_server.is_a?(String) && File.exist?(@socket_manager_path)
45
+ if @socket_manager_path.is_a?(String) && File.exist?(@socket_manager_path)
41
46
  FileUtils.rm_f @socket_manager_path
42
47
  end
43
48
  end
data/test/test_config.rb CHANGED
@@ -237,6 +237,63 @@ class ConfigTest < Test::Unit::TestCase
237
237
  ])
238
238
  end
239
239
 
240
+ def test_included_glob
241
+ write_config "#{TMP_DIR}/config.yaml", <<-EOS
242
+ config:
243
+ - !include "include/*.yaml"
244
+ EOS
245
+ write_config "#{TMP_DIR}/include/02_source2.yaml", <<-EOS
246
+ - source:
247
+ $type: dummy
248
+ tag: tag.dummy
249
+ EOS
250
+ write_config "#{TMP_DIR}/include/01_source1.yaml", <<-EOS
251
+ - source:
252
+ $type: tcp
253
+ tag: tag.tcp
254
+ parse:
255
+ $arg:
256
+ - why.parse.section.doesnot.have.arg
257
+ - huh
258
+ $type: none
259
+ EOS
260
+ write_config "#{TMP_DIR}/include/03_match1.yaml", <<-EOS
261
+ - match:
262
+ $tag: tag.*
263
+ $type: stdout
264
+ buffer:
265
+ $type: memory
266
+ flush_interval: 1s
267
+ EOS
268
+ root_conf = read_config("#{TMP_DIR}/config.yaml", use_yaml: true)
269
+ tcp_source_conf = root_conf.elements.first
270
+ dummy_source_conf = root_conf.elements[1]
271
+ parse_tcp_conf = tcp_source_conf.elements.first
272
+ match_conf = root_conf.elements[2]
273
+
274
+ assert_equal(
275
+ [
276
+ 'tcp',
277
+ 'tag.tcp',
278
+ 'none',
279
+ 'why.parse.section.doesnot.have.arg,huh',
280
+ 'dummy',
281
+ 'tag.dummy',
282
+ 'stdout',
283
+ 'tag.*',
284
+ ],
285
+ [
286
+ tcp_source_conf['@type'],
287
+ tcp_source_conf['tag'],
288
+ parse_tcp_conf['@type'],
289
+ parse_tcp_conf.arg,
290
+ dummy_source_conf['@type'],
291
+ dummy_source_conf['tag'],
292
+ match_conf['@type'],
293
+ match_conf.arg,
294
+ ])
295
+ end
296
+
240
297
  def test_check_not_fetchd
241
298
  write_config "#{TMP_DIR}/config_test_not_fetched.yaml", <<-EOS
242
299
  config:
@@ -287,27 +344,6 @@ class ConfigTest < Test::Unit::TestCase
287
344
  File.open(path, "w:#{encoding}:utf-8") {|f| f.write data }
288
345
  end
289
346
 
290
- def test_inline
291
- prepare_config
292
- opts = {
293
- :config_path => "#{TMP_DIR}/config_test_1.conf",
294
- :inline_config => "<source>\n type http\n port 2222\n </source>",
295
- :use_v1_config => false
296
- }
297
- assert_nothing_raised do
298
- Fluent::Supervisor.new(opts)
299
- end
300
- create_warn_dummy_logger
301
- end
302
-
303
- def create_warn_dummy_logger
304
- dl_opts = {}
305
- dl_opts[:log_level] = ServerEngine::DaemonLogger::WARN
306
- logdev = Fluent::Test::DummyLogDevice.new
307
- logger = ServerEngine::DaemonLogger.new(logdev, dl_opts)
308
- $log = Fluent::Log.new(logger)
309
- end
310
-
311
347
  sub_test_case '.build' do
312
348
  test 'read config' do
313
349
  write_config("#{TMP_DIR}/build/config_build.conf", 'key value')
@@ -1,5 +1,5 @@
1
- require_relative '../helper'
2
- require 'fluent/plugin/file_wrapper'
1
+ require_relative 'helper'
2
+ require 'fluent/file_wrapper'
3
3
 
4
4
  class FileWrapperTest < Test::Unit::TestCase
5
5
  TMP_DIR = File.dirname(__FILE__) + "/../tmp/file_wrapper#{ENV['TEST_ENV_NUMBER']}"