fluentd 1.15.3-x86-mingw32 → 1.16.2-x86-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.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/bug_report.yaml +1 -0
- data/.github/ISSUE_TEMPLATE/feature_request.yaml +1 -0
- data/.github/workflows/linux-test.yaml +2 -2
- data/.github/workflows/macos-test.yaml +2 -2
- data/.github/workflows/stale-actions.yml +24 -0
- data/.github/workflows/windows-test.yaml +2 -2
- data/CHANGELOG.md +151 -0
- data/CONTRIBUTING.md +1 -1
- data/MAINTAINERS.md +5 -3
- data/README.md +0 -1
- data/SECURITY.md +5 -9
- data/fluentd.gemspec +3 -3
- data/lib/fluent/command/ctl.rb +2 -2
- data/lib/fluent/command/fluentd.rb +55 -53
- data/lib/fluent/command/plugin_config_formatter.rb +1 -1
- data/lib/fluent/config/dsl.rb +1 -1
- data/lib/fluent/config/v1_parser.rb +2 -2
- data/lib/fluent/counter/server.rb +1 -1
- data/lib/fluent/counter/validator.rb +3 -3
- data/lib/fluent/daemon.rb +2 -4
- data/lib/fluent/engine.rb +1 -1
- data/lib/fluent/event.rb +8 -4
- data/lib/fluent/log/console_adapter.rb +66 -0
- data/lib/fluent/log.rb +44 -5
- data/lib/fluent/match.rb +1 -1
- data/lib/fluent/msgpack_factory.rb +6 -1
- data/lib/fluent/plugin/base.rb +6 -8
- data/lib/fluent/plugin/buf_file.rb +32 -3
- data/lib/fluent/plugin/buf_file_single.rb +32 -3
- data/lib/fluent/plugin/buffer/file_chunk.rb +1 -1
- data/lib/fluent/plugin/buffer.rb +21 -0
- data/lib/fluent/plugin/filter_record_transformer.rb +1 -1
- data/lib/fluent/plugin/in_forward.rb +1 -1
- data/lib/fluent/plugin/in_http.rb +8 -8
- data/lib/fluent/plugin/in_sample.rb +1 -1
- data/lib/fluent/plugin/in_tail/position_file.rb +32 -18
- data/lib/fluent/plugin/in_tail.rb +58 -24
- data/lib/fluent/plugin/in_tcp.rb +47 -2
- data/lib/fluent/plugin/out_exec_filter.rb +2 -2
- data/lib/fluent/plugin/out_forward/ack_handler.rb +19 -4
- data/lib/fluent/plugin/out_forward.rb +2 -2
- data/lib/fluent/plugin/out_secondary_file.rb +39 -22
- data/lib/fluent/plugin/output.rb +50 -13
- data/lib/fluent/plugin/parser_json.rb +1 -1
- data/lib/fluent/plugin_helper/event_loop.rb +2 -2
- data/lib/fluent/plugin_helper/http_server/server.rb +2 -1
- data/lib/fluent/plugin_helper/record_accessor.rb +1 -1
- data/lib/fluent/plugin_helper/server.rb +8 -0
- data/lib/fluent/plugin_helper/thread.rb +3 -3
- data/lib/fluent/plugin_id.rb +1 -1
- data/lib/fluent/supervisor.rb +157 -251
- data/lib/fluent/test/driver/base.rb +11 -5
- data/lib/fluent/test/driver/filter.rb +4 -0
- data/lib/fluent/test/startup_shutdown.rb +6 -8
- data/lib/fluent/version.rb +1 -1
- data/templates/new_gem/test/helper.rb.erb +0 -1
- data/test/command/test_ctl.rb +1 -1
- data/test/command/test_fluentd.rb +137 -6
- data/test/command/test_plugin_config_formatter.rb +0 -1
- data/test/compat/test_parser.rb +5 -5
- data/test/config/test_system_config.rb +0 -8
- data/test/log/test_console_adapter.rb +110 -0
- data/test/plugin/in_tail/test_position_file.rb +31 -1
- data/test/plugin/out_forward/test_ack_handler.rb +39 -0
- data/test/plugin/test_base.rb +99 -1
- data/test/plugin/test_buf_file.rb +62 -23
- data/test/plugin/test_buf_file_single.rb +65 -0
- data/test/plugin/test_buffer_chunk.rb +11 -0
- data/test/plugin/test_in_forward.rb +9 -9
- data/test/plugin/test_in_http.rb +2 -3
- data/test/plugin/test_in_monitor_agent.rb +2 -3
- data/test/plugin/test_in_tail.rb +379 -0
- data/test/plugin/test_in_tcp.rb +87 -2
- data/test/plugin/test_in_udp.rb +28 -0
- data/test/plugin/test_in_unix.rb +2 -2
- data/test/plugin/test_multi_output.rb +1 -1
- data/test/plugin/test_out_exec_filter.rb +2 -2
- data/test/plugin/test_out_file.rb +2 -2
- data/test/plugin/test_out_forward.rb +14 -18
- data/test/plugin/test_out_http.rb +1 -0
- data/test/plugin/test_output.rb +281 -12
- data/test/plugin/test_output_as_buffered.rb +44 -44
- data/test/plugin/test_output_as_buffered_compress.rb +32 -18
- data/test/plugin/test_output_as_buffered_retries.rb +1 -1
- data/test/plugin/test_output_as_buffered_secondary.rb +2 -2
- data/test/plugin/test_parser_regexp.rb +1 -6
- data/test/plugin_helper/test_child_process.rb +2 -2
- data/test/plugin_helper/test_http_server_helper.rb +1 -1
- data/test/plugin_helper/test_server.rb +60 -6
- data/test/test_config.rb +0 -21
- data/test/test_formatter.rb +23 -20
- data/test/test_log.rb +108 -36
- data/test/test_msgpack_factory.rb +32 -0
- data/test/test_supervisor.rb +287 -279
- metadata +15 -21
- data/.drone.yml +0 -35
- data/.gitlab-ci.yml +0 -103
- data/test/test_logger_initializer.rb +0 -46
data/test/plugin/test_base.rb
CHANGED
@@ -108,7 +108,7 @@ class BaseTest < Test::Unit::TestCase
|
|
108
108
|
@p.extend m
|
109
109
|
assert_equal [], logger.logs
|
110
110
|
|
111
|
-
ret = @p.string_safe_encoding("abc\xff.\x01f"){|s| s.split(
|
111
|
+
ret = @p.string_safe_encoding("abc\xff.\x01f"){|s| s.split(".") }
|
112
112
|
assert_equal ['abc?', "\u0001f"], ret
|
113
113
|
assert_equal 1, logger.logs.size
|
114
114
|
assert{ logger.logs.first.include?("invalid byte sequence is replaced in ") }
|
@@ -146,4 +146,102 @@ class BaseTest < Test::Unit::TestCase
|
|
146
146
|
end
|
147
147
|
end
|
148
148
|
end
|
149
|
+
|
150
|
+
test '`ArgumentError` when `conf` is not `Fluent::Config::Element`' do
|
151
|
+
assert_raise ArgumentError.new('BUG: type of conf must be Fluent::Config::Element, but Hash is passed.') do
|
152
|
+
@p.configure({})
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
sub_test_case 'system_config.workers value after configure' do
|
157
|
+
def assert_system_config_workers_value(data)
|
158
|
+
conf = config_element()
|
159
|
+
conf.set_target_worker_ids(data[:target_worker_ids])
|
160
|
+
@p.configure(conf)
|
161
|
+
assert{ @p.system_config.workers == data[:expected] }
|
162
|
+
end
|
163
|
+
|
164
|
+
def stub_supervisor_mode
|
165
|
+
stub(Fluent::Engine).supervisor_mode { true }
|
166
|
+
stub(Fluent::Engine).worker_id { -1 }
|
167
|
+
end
|
168
|
+
|
169
|
+
sub_test_case 'with <system> workers 3 </system>' do
|
170
|
+
setup do
|
171
|
+
system_config = Fluent::SystemConfig.new
|
172
|
+
system_config.workers = 3
|
173
|
+
stub(Fluent::Engine).system_config { system_config }
|
174
|
+
end
|
175
|
+
|
176
|
+
data(
|
177
|
+
'without <worker> directive',
|
178
|
+
{
|
179
|
+
target_worker_ids: [],
|
180
|
+
expected: 3
|
181
|
+
},
|
182
|
+
keep: true
|
183
|
+
)
|
184
|
+
data(
|
185
|
+
'with <worker 0>',
|
186
|
+
{
|
187
|
+
target_worker_ids: [0],
|
188
|
+
expected: 1
|
189
|
+
},
|
190
|
+
keep: true
|
191
|
+
)
|
192
|
+
data(
|
193
|
+
'with <worker 0-1>',
|
194
|
+
{
|
195
|
+
target_worker_ids: [0, 1],
|
196
|
+
expected: 2
|
197
|
+
},
|
198
|
+
keep: true
|
199
|
+
)
|
200
|
+
data(
|
201
|
+
'with <worker 0-2>',
|
202
|
+
{
|
203
|
+
target_worker_ids: [0, 1, 2],
|
204
|
+
expected: 3
|
205
|
+
},
|
206
|
+
keep: true
|
207
|
+
)
|
208
|
+
|
209
|
+
test 'system_config.workers value after configure' do
|
210
|
+
assert_system_config_workers_value(data)
|
211
|
+
end
|
212
|
+
|
213
|
+
test 'system_config.workers value after configure with supervisor_mode' do
|
214
|
+
stub_supervisor_mode
|
215
|
+
assert_system_config_workers_value(data)
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
sub_test_case 'without <system> directive' do
|
220
|
+
data(
|
221
|
+
'without <worker> directive',
|
222
|
+
{
|
223
|
+
target_worker_ids: [],
|
224
|
+
expected: 1
|
225
|
+
},
|
226
|
+
keep: true
|
227
|
+
)
|
228
|
+
data(
|
229
|
+
'with <worker 0>',
|
230
|
+
{
|
231
|
+
target_worker_ids: [0],
|
232
|
+
expected: 1
|
233
|
+
},
|
234
|
+
keep: true
|
235
|
+
)
|
236
|
+
|
237
|
+
test 'system_config.workers value after configure' do
|
238
|
+
assert_system_config_workers_value(data)
|
239
|
+
end
|
240
|
+
|
241
|
+
test 'system_config.workers value after configure with supervisor_mode' do
|
242
|
+
stub_supervisor_mode
|
243
|
+
assert_system_config_workers_value(data)
|
244
|
+
end
|
245
|
+
end
|
246
|
+
end
|
149
247
|
end
|
@@ -1151,15 +1151,13 @@ class FileBufferTest < Test::Unit::TestCase
|
|
1151
1151
|
|
1152
1152
|
sub_test_case 'there are existing broken file chunks' do
|
1153
1153
|
setup do
|
1154
|
+
@id_output = 'backup_test'
|
1154
1155
|
@bufdir = File.expand_path('../../tmp/broken_buffer_file', __FILE__)
|
1155
|
-
FileUtils.
|
1156
|
+
FileUtils.rm_rf @bufdir rescue nil
|
1157
|
+
FileUtils.mkdir_p @bufdir
|
1156
1158
|
@bufpath = File.join(@bufdir, 'broken_test.*.log')
|
1157
1159
|
|
1158
1160
|
Fluent::Test.setup
|
1159
|
-
@d = FluentPluginFileBufferTest::DummyOutputPlugin.new
|
1160
|
-
@p = Fluent::Plugin::FileBuffer.new
|
1161
|
-
@p.owner = @d
|
1162
|
-
@p.configure(config_element('buffer', '', {'path' => @bufpath}))
|
1163
1161
|
end
|
1164
1162
|
|
1165
1163
|
teardown do
|
@@ -1171,12 +1169,12 @@ class FileBufferTest < Test::Unit::TestCase
|
|
1171
1169
|
@p.close unless @p.closed?
|
1172
1170
|
@p.terminate unless @p.terminated?
|
1173
1171
|
end
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1172
|
+
end
|
1173
|
+
|
1174
|
+
def setup_plugins(buf_conf)
|
1175
|
+
@d = FluentPluginFileBufferTest::DummyOutputPlugin.new
|
1176
|
+
@d.configure(config_element('ROOT', '', {'@id' => @id_output}, [config_element('buffer', '', buf_conf)]))
|
1177
|
+
@p = @d.buffer
|
1180
1178
|
end
|
1181
1179
|
|
1182
1180
|
def create_first_chunk(mode)
|
@@ -1232,44 +1230,85 @@ class FileBufferTest < Test::Unit::TestCase
|
|
1232
1230
|
assert { logs.any? { |log| log.include?(msg) } }
|
1233
1231
|
end
|
1234
1232
|
|
1235
|
-
test '#resume
|
1236
|
-
|
1233
|
+
test '#resume backups staged empty chunk' do
|
1234
|
+
setup_plugins({'path' => @bufpath})
|
1235
|
+
c1id, p1 = create_first_chunk('b')
|
1237
1236
|
File.open(p1, 'wb') { |f| } # create staged empty chunk file
|
1238
1237
|
c2id, _ = create_second_chunk('b')
|
1239
1238
|
|
1240
|
-
@
|
1239
|
+
Fluent::SystemConfig.overwrite_system_config('root_dir' => @bufdir) do
|
1240
|
+
@p.start
|
1241
|
+
end
|
1242
|
+
|
1241
1243
|
compare_staged_chunk(@p.stage, c2id, '2016-04-17 14:01:00 -0700', 3, :staged)
|
1242
1244
|
compare_log(@p, 'staged file chunk is empty')
|
1245
|
+
assert { not File.exist?(p1) }
|
1246
|
+
assert { File.exist?("#{@bufdir}/backup/worker0/#{@id_output}/#{@d.dump_unique_id_hex(c1id)}.log") }
|
1243
1247
|
end
|
1244
1248
|
|
1245
|
-
test '#resume
|
1249
|
+
test '#resume backups staged broken metadata' do
|
1250
|
+
setup_plugins({'path' => @bufpath})
|
1246
1251
|
c1id, _ = create_first_chunk('b')
|
1247
|
-
|
1252
|
+
c2id, p2 = create_second_chunk('b')
|
1248
1253
|
File.open(p2 + '.meta', 'wb') { |f| f.write("\0" * 70) } # create staged broken meta file
|
1249
1254
|
|
1250
|
-
@
|
1255
|
+
Fluent::SystemConfig.overwrite_system_config('root_dir' => @bufdir) do
|
1256
|
+
@p.start
|
1257
|
+
end
|
1258
|
+
|
1251
1259
|
compare_staged_chunk(@p.stage, c1id, '2016-04-17 14:00:00 -0700', 4, :staged)
|
1252
1260
|
compare_log(@p, 'staged meta file is broken')
|
1261
|
+
assert { not File.exist?(p2) }
|
1262
|
+
assert { File.exist?("#{@bufdir}/backup/worker0/#{@id_output}/#{@d.dump_unique_id_hex(c2id)}.log") }
|
1253
1263
|
end
|
1254
1264
|
|
1255
|
-
test '#resume
|
1256
|
-
|
1265
|
+
test '#resume backups enqueued empty chunk' do
|
1266
|
+
setup_plugins({'path' => @bufpath})
|
1267
|
+
c1id, p1 = create_first_chunk('q')
|
1257
1268
|
File.open(p1, 'wb') { |f| } # create enqueued empty chunk file
|
1258
1269
|
c2id, _ = create_second_chunk('q')
|
1259
1270
|
|
1260
|
-
@
|
1271
|
+
Fluent::SystemConfig.overwrite_system_config('root_dir' => @bufdir) do
|
1272
|
+
@p.start
|
1273
|
+
end
|
1274
|
+
|
1261
1275
|
compare_queued_chunk(@p.queue, c2id, 3, :queued)
|
1262
1276
|
compare_log(@p, 'enqueued file chunk is empty')
|
1277
|
+
assert { not File.exist?(p1) }
|
1278
|
+
assert { File.exist?("#{@bufdir}/backup/worker0/#{@id_output}/#{@d.dump_unique_id_hex(c1id)}.log") }
|
1263
1279
|
end
|
1264
1280
|
|
1265
|
-
test '#resume
|
1281
|
+
test '#resume backups enqueued broken metadata' do
|
1282
|
+
setup_plugins({'path' => @bufpath})
|
1266
1283
|
c1id, _ = create_first_chunk('q')
|
1267
|
-
|
1284
|
+
c2id, p2 = create_second_chunk('q')
|
1268
1285
|
File.open(p2 + '.meta', 'wb') { |f| f.write("\0" * 70) } # create enqueued broken meta file
|
1269
1286
|
|
1270
|
-
@
|
1287
|
+
Fluent::SystemConfig.overwrite_system_config('root_dir' => @bufdir) do
|
1288
|
+
@p.start
|
1289
|
+
end
|
1290
|
+
|
1271
1291
|
compare_queued_chunk(@p.queue, c1id, 4, :queued)
|
1272
1292
|
compare_log(@p, 'enqueued meta file is broken')
|
1293
|
+
assert { not File.exist?(p2) }
|
1294
|
+
assert { File.exist?("#{@bufdir}/backup/worker0/#{@id_output}/#{@d.dump_unique_id_hex(c2id)}.log") }
|
1295
|
+
end
|
1296
|
+
|
1297
|
+
test '#resume throws away broken chunk with disable_chunk_backup' do
|
1298
|
+
setup_plugins({'path' => @bufpath, 'disable_chunk_backup' => true})
|
1299
|
+
c1id, _ = create_first_chunk('b')
|
1300
|
+
c2id, p2 = create_second_chunk('b')
|
1301
|
+
File.open(p2 + '.meta', 'wb') { |f| f.write("\0" * 70) } # create staged broken meta file
|
1302
|
+
|
1303
|
+
Fluent::SystemConfig.overwrite_system_config('root_dir' => @bufdir) do
|
1304
|
+
@p.start
|
1305
|
+
end
|
1306
|
+
|
1307
|
+
compare_staged_chunk(@p.stage, c1id, '2016-04-17 14:00:00 -0700', 4, :staged)
|
1308
|
+
compare_log(@p, 'staged meta file is broken')
|
1309
|
+
compare_log(@p, 'disable_chunk_backup is true')
|
1310
|
+
assert { not File.exist?(p2) }
|
1311
|
+
assert { not File.exist?("#{@bufdir}/backup/worker0/#{@id_output}/#{@d.dump_unique_id_hex(c2id)}.log") }
|
1273
1312
|
end
|
1274
1313
|
end
|
1275
1314
|
end
|
@@ -830,4 +830,69 @@ class FileSingleBufferTest < Test::Unit::TestCase
|
|
830
830
|
assert_equal :queued, queue[0].state
|
831
831
|
end
|
832
832
|
end
|
833
|
+
|
834
|
+
sub_test_case 'there are existing broken file chunks' do
|
835
|
+
setup do
|
836
|
+
FileUtils.rm_rf(@bufdir) rescue nil
|
837
|
+
FileUtils.mkdir_p(@bufdir)
|
838
|
+
end
|
839
|
+
|
840
|
+
teardown do
|
841
|
+
return unless @p
|
842
|
+
|
843
|
+
@p.stop unless @p.stopped?
|
844
|
+
@p.before_shutdown unless @p.before_shutdown?
|
845
|
+
@p.shutdown unless @p.shutdown?
|
846
|
+
@p.after_shutdown unless @p.after_shutdown?
|
847
|
+
@p.close unless @p.closed?
|
848
|
+
@p.terminate unless @p.terminated?
|
849
|
+
end
|
850
|
+
|
851
|
+
test '#resume backups empty chunk' do
|
852
|
+
id_output = 'backup_test'
|
853
|
+
@d = create_driver(%[
|
854
|
+
@id #{id_output}
|
855
|
+
<buffer tag>
|
856
|
+
@type file_single
|
857
|
+
path #{PATH}
|
858
|
+
</buffer>
|
859
|
+
])
|
860
|
+
@p = @d.instance.buffer
|
861
|
+
|
862
|
+
c1id = Fluent::UniqueId.generate
|
863
|
+
p1 = File.join(@bufdir, "fsb.foo.b#{Fluent::UniqueId.hex(c1id)}.buf")
|
864
|
+
File.open(p1, 'wb') { |f| } # create empty chunk file
|
865
|
+
|
866
|
+
Fluent::SystemConfig.overwrite_system_config('root_dir' => @bufdir) do
|
867
|
+
@p.start
|
868
|
+
end
|
869
|
+
|
870
|
+
assert { not File.exist?(p1) }
|
871
|
+
assert { File.exist?("#{@bufdir}/backup/worker0/#{id_output}/#{@d.instance.dump_unique_id_hex(c1id)}.log") }
|
872
|
+
end
|
873
|
+
|
874
|
+
test '#resume throws away broken chunk with disable_chunk_backup' do
|
875
|
+
id_output = 'backup_test'
|
876
|
+
@d = create_driver(%[
|
877
|
+
@id #{id_output}
|
878
|
+
<buffer tag>
|
879
|
+
@type file_single
|
880
|
+
path #{PATH}
|
881
|
+
disable_chunk_backup true
|
882
|
+
</buffer>
|
883
|
+
])
|
884
|
+
@p = @d.instance.buffer
|
885
|
+
|
886
|
+
c1id = Fluent::UniqueId.generate
|
887
|
+
p1 = File.join(@bufdir, "fsb.foo.b#{Fluent::UniqueId.hex(c1id)}.buf")
|
888
|
+
File.open(p1, 'wb') { |f| } # create empty chunk file
|
889
|
+
|
890
|
+
Fluent::SystemConfig.overwrite_system_config('root_dir' => @bufdir) do
|
891
|
+
@p.start
|
892
|
+
end
|
893
|
+
|
894
|
+
assert { not File.exist?(p1) }
|
895
|
+
assert { not File.exist?("#{@bufdir}/backup/worker0/#{id_output}/#{@d.instance.dump_unique_id_hex(c1id)}.log") }
|
896
|
+
end
|
897
|
+
end
|
833
898
|
end
|
@@ -57,6 +57,17 @@ class BufferChunkTest < Test::Unit::TestCase
|
|
57
57
|
assert chunk.respond_to?(:msgpack_each)
|
58
58
|
end
|
59
59
|
|
60
|
+
test 'unpacker arg is not implemented for ChunkMessagePackEventStreamer' do
|
61
|
+
meta = Object.new
|
62
|
+
chunk = Fluent::Plugin::Buffer::Chunk.new(meta)
|
63
|
+
chunk.extend Fluent::ChunkMessagePackEventStreamer
|
64
|
+
|
65
|
+
unpacker = Fluent::MessagePackFactory.thread_local_msgpack_unpacker
|
66
|
+
|
67
|
+
assert_raise(NotImplementedError){ chunk.each(unpacker: unpacker) }
|
68
|
+
assert_raise(NotImplementedError){ chunk.msgpack_each(unpacker: unpacker) }
|
69
|
+
end
|
70
|
+
|
60
71
|
test 'some methods raise ArgumentError with an option of `compressed: :gzip` and without extending Compressble`' do
|
61
72
|
meta = Object.new
|
62
73
|
chunk = Fluent::Plugin::Buffer::Chunk.new(meta)
|
@@ -367,7 +367,7 @@ class ForwardInputTest < Test::Unit::TestCase
|
|
367
367
|
end
|
368
368
|
|
369
369
|
logs = d.instance.log.out.logs
|
370
|
-
assert{ logs.
|
370
|
+
assert{ logs.count{|line| line =~ /skip invalid event/ } == 2 }
|
371
371
|
|
372
372
|
d.instance_shutdown
|
373
373
|
end
|
@@ -593,10 +593,10 @@ class ForwardInputTest < Test::Unit::TestCase
|
|
593
593
|
|
594
594
|
# check log
|
595
595
|
logs = d.instance.log.logs
|
596
|
-
assert_equal 1, logs.
|
596
|
+
assert_equal 1, logs.count{|line|
|
597
597
|
line =~ / \[warn\]: Input chunk size is larger than 'chunk_size_warn_limit':/ &&
|
598
598
|
line =~ / tag="test.tag" host="#{LOCALHOST_HOSTNAME}" limit=16777216 size=16777501/
|
599
|
-
}
|
599
|
+
}, "large chunk warning is not logged"
|
600
600
|
|
601
601
|
d.instance_shutdown
|
602
602
|
end
|
@@ -619,10 +619,10 @@ class ForwardInputTest < Test::Unit::TestCase
|
|
619
619
|
|
620
620
|
# check log
|
621
621
|
logs = d.instance.log.logs
|
622
|
-
assert_equal 1, logs.
|
622
|
+
assert_equal 1, logs.count{ |line|
|
623
623
|
line =~ / \[warn\]: Input chunk size is larger than 'chunk_size_warn_limit':/ &&
|
624
624
|
line =~ / tag="test.tag" host="#{LOCALHOST_HOSTNAME}" limit=16777216 size=16777501/
|
625
|
-
}
|
625
|
+
}, "large chunk warning is not logged"
|
626
626
|
|
627
627
|
d.instance_shutdown
|
628
628
|
end
|
@@ -653,10 +653,10 @@ class ForwardInputTest < Test::Unit::TestCase
|
|
653
653
|
|
654
654
|
# check log
|
655
655
|
logs = d.instance.log.logs
|
656
|
-
assert_equal 1, logs.
|
656
|
+
assert_equal 1, logs.count{|line|
|
657
657
|
line =~ / \[warn\]: Input chunk size is larger than 'chunk_size_limit', dropped:/ &&
|
658
658
|
line =~ / tag="test.tag" host="#{LOCALHOST_HOSTNAME}" limit=33554432 size=33554989/
|
659
|
-
}
|
659
|
+
}, "large chunk warning is not logged"
|
660
660
|
|
661
661
|
d.instance_shutdown
|
662
662
|
end
|
@@ -676,9 +676,9 @@ class ForwardInputTest < Test::Unit::TestCase
|
|
676
676
|
|
677
677
|
# check log
|
678
678
|
logs = d.instance.log.logs
|
679
|
-
assert_equal 1, logs.
|
679
|
+
assert_equal 1, logs.count{|line|
|
680
680
|
line =~ / \[warn\]: incoming chunk is broken: host="#{LOCALHOST_HOSTNAME}" msg=#{data.inspect}/
|
681
|
-
}
|
681
|
+
}, "should not accept broken chunk"
|
682
682
|
|
683
683
|
d.instance_shutdown
|
684
684
|
end
|
data/test/plugin/test_in_http.rb
CHANGED
@@ -7,9 +7,8 @@ require 'timecop'
|
|
7
7
|
class HttpInputTest < Test::Unit::TestCase
|
8
8
|
class << self
|
9
9
|
def startup
|
10
|
-
|
11
|
-
|
12
|
-
ENV['SERVERENGINE_SOCKETMANAGER_PATH'] = socket_manager_path.to_s
|
10
|
+
@server = ServerEngine::SocketManager::Server.open
|
11
|
+
ENV['SERVERENGINE_SOCKETMANAGER_PATH'] = @server.path.to_s
|
13
12
|
end
|
14
13
|
|
15
14
|
def shutdown
|
@@ -355,14 +355,13 @@ EOC
|
|
355
355
|
|
356
356
|
test "fluentd opts" do
|
357
357
|
d = create_driver
|
358
|
-
opts = Fluent::Supervisor.default_options
|
359
358
|
|
360
359
|
filepath = nil
|
361
360
|
begin
|
362
361
|
FileUtils.mkdir_p(CONFIG_DIR)
|
363
362
|
filepath = File.expand_path('fluentd.conf', CONFIG_DIR)
|
364
363
|
FileUtils.touch(filepath)
|
365
|
-
s = Fluent::Supervisor.new(
|
364
|
+
s = Fluent::Supervisor.new({config_path: filepath})
|
366
365
|
s.configure
|
367
366
|
ensure
|
368
367
|
FileUtils.rm_r(CONFIG_DIR) rescue _
|
@@ -502,7 +501,7 @@ EOC
|
|
502
501
|
v.puts(conf)
|
503
502
|
end
|
504
503
|
|
505
|
-
@supervisor = Fluent::Supervisor.new(
|
504
|
+
@supervisor = Fluent::Supervisor.new({config_path: @filepath})
|
506
505
|
@supervisor.configure
|
507
506
|
ensure
|
508
507
|
FileUtils.rm_r(CONFIG_DIR) rescue _
|