fluentd 1.8.1-x86-mingw32 → 1.9.0-x86-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.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +14 -58
- data/.travis.yml +2 -17
- data/CHANGELOG.md +39 -0
- data/Gemfile +1 -4
- data/README.md +2 -6
- data/fluentd.gemspec +6 -6
- data/lib/fluent/command/cat.rb +1 -3
- data/lib/fluent/command/plugin_generator.rb +2 -1
- data/lib/fluent/config.rb +19 -0
- data/lib/fluent/config/literal_parser.rb +13 -8
- data/lib/fluent/config/v1_parser.rb +5 -3
- data/lib/fluent/engine.rb +60 -9
- data/lib/fluent/ext_monitor_require.rb +28 -0
- data/lib/fluent/load.rb +1 -1
- data/lib/fluent/msgpack_factory.rb +16 -4
- data/lib/fluent/plugin/base.rb +5 -0
- data/lib/fluent/plugin/buf_file.rb +10 -6
- data/lib/fluent/plugin/buf_file_single.rb +10 -6
- data/lib/fluent/plugin/buffer.rb +40 -22
- data/lib/fluent/plugin/buffer/chunk.rb +1 -1
- data/lib/fluent/plugin/in_http.rb +9 -9
- data/lib/fluent/plugin/in_tail.rb +8 -6
- data/lib/fluent/plugin/out_http.rb +2 -2
- data/lib/fluent/plugin/output.rb +2 -2
- data/lib/fluent/plugin/parser.rb +6 -0
- data/lib/fluent/plugin_helper/http_server.rb +0 -1
- data/lib/fluent/plugin_helper/record_accessor.rb +0 -8
- data/lib/fluent/plugin_helper/server.rb +6 -21
- data/lib/fluent/plugin_id.rb +9 -4
- data/lib/fluent/static_config_analysis.rb +194 -0
- data/lib/fluent/supervisor.rb +103 -28
- data/lib/fluent/system_config.rb +2 -1
- data/lib/fluent/test/driver/base.rb +4 -3
- data/lib/fluent/variable_store.rb +40 -0
- data/lib/fluent/version.rb +1 -1
- data/test/config/test_config_parser.rb +19 -16
- data/test/config/test_system_config.rb +6 -4
- data/test/plugin/test_in_exec.rb +9 -9
- data/test/plugin/test_in_forward.rb +10 -11
- data/test/plugin/test_in_http.rb +35 -3
- data/test/plugin/test_in_object_space.rb +3 -7
- data/test/plugin/test_out_exec_filter.rb +28 -45
- data/test/plugin/test_out_forward.rb +2 -2
- data/test/plugin/test_out_http.rb +8 -2
- data/test/plugin/test_output.rb +3 -3
- data/test/plugin/test_output_as_buffered.rb +1 -1
- data/test/plugin/test_output_as_buffered_overflow.rb +1 -1
- data/test/plugin/test_output_as_buffered_secondary.rb +2 -2
- data/test/plugin_helper/test_child_process.rb +45 -56
- data/test/plugin_helper/test_server.rb +13 -0
- data/test/plugin_helper/test_timer.rb +11 -13
- data/test/test_config.rb +27 -5
- data/test/test_engine.rb +203 -0
- data/test/test_output.rb +2 -2
- data/test/test_static_config_analysis.rb +177 -0
- data/test/test_supervisor.rb +18 -80
- data/test/test_test_drivers.rb +4 -3
- data/test/test_variable_store.rb +65 -0
- metadata +40 -27
- data/.gitlab/cicd-template.yaml +0 -10
- data/Vagrantfile +0 -17
data/lib/fluent/system_config.rb
CHANGED
@@ -27,7 +27,7 @@ module Fluent
|
|
27
27
|
:log_event_verbose,
|
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
|
30
|
+
:strict_config_value, :enable_msgpack_time_support
|
31
31
|
]
|
32
32
|
|
33
33
|
config_param :workers, :integer, default: 1
|
@@ -42,6 +42,7 @@ module Fluent
|
|
42
42
|
config_param :enable_get_dump, :bool, default: nil
|
43
43
|
config_param :process_name, :string, default: nil
|
44
44
|
config_param :strict_config_value, :bool, default: nil
|
45
|
+
config_param :enable_msgpack_time_support, :bool, default: nil
|
45
46
|
config_param :file_permission, default: nil do |v|
|
46
47
|
v.to_i(8)
|
47
48
|
end
|
@@ -22,6 +22,7 @@ require 'fluent/clock'
|
|
22
22
|
require 'serverengine/socket_manager'
|
23
23
|
require 'fileutils'
|
24
24
|
require 'timeout'
|
25
|
+
require 'logger'
|
25
26
|
|
26
27
|
module Fluent
|
27
28
|
module Test
|
@@ -135,16 +136,16 @@ module Fluent
|
|
135
136
|
# same with above
|
136
137
|
end
|
137
138
|
|
138
|
-
def instance_shutdown
|
139
|
+
def instance_shutdown(log: Logger.new($stdout))
|
139
140
|
instance_hook_before_stopped
|
140
141
|
|
141
142
|
show_errors_if_exists = ->(label, block){
|
142
143
|
begin
|
143
144
|
block.call
|
144
145
|
rescue => e
|
145
|
-
|
146
|
+
log.error "unexpected error while #{label}, #{e.class}:#{e.message}"
|
146
147
|
e.backtrace.each do |bt|
|
147
|
-
|
148
|
+
log.error "\t#{bt}"
|
148
149
|
end
|
149
150
|
end
|
150
151
|
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
#
|
2
|
+
# Fluentd
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
module Fluent
|
18
|
+
# VariableStore provides all pluigns with the way to shared variable without using class variable
|
19
|
+
# it's for safe reloading mechanism
|
20
|
+
class VariableStore
|
21
|
+
@data = {}
|
22
|
+
|
23
|
+
class << self
|
24
|
+
def fetch_or_build(namespace, default_value: {})
|
25
|
+
@data[namespace] ||= default_value
|
26
|
+
end
|
27
|
+
|
28
|
+
def try_to_reset
|
29
|
+
@data, old = {}, @data
|
30
|
+
|
31
|
+
begin
|
32
|
+
yield
|
33
|
+
rescue
|
34
|
+
@data = old
|
35
|
+
raise
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/fluent/version.rb
CHANGED
@@ -362,55 +362,56 @@ module Fluent::Config
|
|
362
362
|
# port from test_config.rb
|
363
363
|
sub_test_case '@include parsing' do
|
364
364
|
TMP_DIR = File.dirname(__FILE__) + "/tmp/v1_config#{ENV['TEST_ENV_NUMBER']}"
|
365
|
+
TMP_DIR_WITH_SPACES = File.dirname(__FILE__) + "/tmp/folder with spaces/v1_config#{ENV['TEST_ENV_NUMBER']}"
|
365
366
|
|
366
367
|
def write_config(path, data)
|
367
368
|
FileUtils.mkdir_p(File.dirname(path))
|
368
369
|
File.open(path, "w") { |f| f.write data }
|
369
370
|
end
|
370
371
|
|
371
|
-
def prepare_config
|
372
|
-
write_config "#{
|
372
|
+
def prepare_config(tmp_dir)
|
373
|
+
write_config "#{tmp_dir}/config_test_1.conf", %[
|
373
374
|
k1 root_config
|
374
375
|
include dir/config_test_2.conf #
|
375
|
-
@include #{
|
376
|
-
include file://#{
|
376
|
+
@include #{tmp_dir}/config_test_4.conf
|
377
|
+
include file://#{tmp_dir}/config_test_5.conf
|
377
378
|
@include config.d/*.conf
|
378
379
|
]
|
379
|
-
write_config "#{
|
380
|
+
write_config "#{tmp_dir}/dir/config_test_2.conf", %[
|
380
381
|
k2 relative_path_include
|
381
382
|
@include ../config_test_3.conf
|
382
383
|
]
|
383
|
-
write_config "#{
|
384
|
+
write_config "#{tmp_dir}/config_test_3.conf", %[
|
384
385
|
k3 relative_include_in_included_file
|
385
386
|
]
|
386
|
-
write_config "#{
|
387
|
+
write_config "#{tmp_dir}/config_test_4.conf", %[
|
387
388
|
k4 absolute_path_include
|
388
389
|
]
|
389
|
-
write_config "#{
|
390
|
+
write_config "#{tmp_dir}/config_test_5.conf", %[
|
390
391
|
k5 uri_include
|
391
392
|
]
|
392
|
-
write_config "#{
|
393
|
+
write_config "#{tmp_dir}/config.d/config_test_6.conf", %[
|
393
394
|
k6 wildcard_include_1
|
394
395
|
<elem1 name>
|
395
396
|
include normal_parameter
|
396
397
|
</elem1>
|
397
398
|
]
|
398
|
-
write_config "#{
|
399
|
+
write_config "#{tmp_dir}/config.d/config_test_7.conf", %[
|
399
400
|
k7 wildcard_include_2
|
400
401
|
]
|
401
|
-
write_config "#{
|
402
|
+
write_config "#{tmp_dir}/config.d/config_test_8.conf", %[
|
402
403
|
<elem2 name>
|
403
404
|
@include ../dir/config_test_9.conf
|
404
405
|
</elem2>
|
405
406
|
]
|
406
|
-
write_config "#{
|
407
|
+
write_config "#{tmp_dir}/dir/config_test_9.conf", %[
|
407
408
|
k9 embedded
|
408
409
|
<elem3 name>
|
409
410
|
nested nested_value
|
410
411
|
include hoge
|
411
412
|
</elem3>
|
412
413
|
]
|
413
|
-
write_config "#{
|
414
|
+
write_config "#{tmp_dir}/config.d/00_config_test_8.conf", %[
|
414
415
|
k8 wildcard_include_3
|
415
416
|
<elem4 name>
|
416
417
|
include normal_parameter
|
@@ -418,9 +419,11 @@ module Fluent::Config
|
|
418
419
|
]
|
419
420
|
end
|
420
421
|
|
421
|
-
|
422
|
-
|
423
|
-
|
422
|
+
data("TMP_DIR without spaces" => TMP_DIR,
|
423
|
+
"TMP_DIR with spaces" => TMP_DIR_WITH_SPACES)
|
424
|
+
test 'parses @include / include correctly' do |data|
|
425
|
+
prepare_config(data)
|
426
|
+
c = read_config("#{data}/config_test_1.conf")
|
424
427
|
assert_equal('root_config', c['k1'])
|
425
428
|
assert_equal('relative_path_include', c['k2'])
|
426
429
|
assert_equal('relative_include_in_included_file', c['k3'])
|
@@ -68,7 +68,7 @@ module Fluent::Config
|
|
68
68
|
EOS
|
69
69
|
s = FakeSupervisor.new
|
70
70
|
sc = Fluent::SystemConfig.new(conf)
|
71
|
-
sc.overwrite_variables(s.for_system_config)
|
71
|
+
sc.overwrite_variables(**s.for_system_config)
|
72
72
|
assert_equal(1, sc.workers)
|
73
73
|
assert_nil(sc.root_dir)
|
74
74
|
assert_equal(Fluent::Log::LEVEL_INFO, sc.log_level)
|
@@ -76,6 +76,7 @@ module Fluent::Config
|
|
76
76
|
assert_nil(sc.emit_error_log_interval)
|
77
77
|
assert_nil(sc.suppress_config_dump)
|
78
78
|
assert_nil(sc.without_source)
|
79
|
+
assert_nil(sc.enable_msgpack_time_support)
|
79
80
|
assert_equal(:text, sc.log.format)
|
80
81
|
assert_equal('%Y-%m-%d %H:%M:%S %z', sc.log.time_format)
|
81
82
|
end
|
@@ -89,6 +90,7 @@ module Fluent::Config
|
|
89
90
|
'suppress_config_dump' => ['suppress_config_dump', true],
|
90
91
|
'without_source' => ['without_source', true],
|
91
92
|
'strict_config_value' => ['strict_config_value', true],
|
93
|
+
'enable_msgpack_time_support' => ['enable_msgpack_time_support', true],
|
92
94
|
)
|
93
95
|
test "accepts parameters" do |(k, v)|
|
94
96
|
conf = parse_text(<<-EOS)
|
@@ -98,7 +100,7 @@ module Fluent::Config
|
|
98
100
|
EOS
|
99
101
|
s = FakeSupervisor.new
|
100
102
|
sc = Fluent::SystemConfig.new(conf)
|
101
|
-
sc.overwrite_variables(s.for_system_config)
|
103
|
+
sc.overwrite_variables(**s.for_system_config)
|
102
104
|
if k == 'log_level'
|
103
105
|
assert_equal(Fluent::Log::LEVEL_ERROR, sc.__send__(k))
|
104
106
|
else
|
@@ -117,7 +119,7 @@ module Fluent::Config
|
|
117
119
|
EOS
|
118
120
|
s = FakeSupervisor.new
|
119
121
|
sc = Fluent::SystemConfig.new(conf)
|
120
|
-
sc.overwrite_variables(s.for_system_config)
|
122
|
+
sc.overwrite_variables(**s.for_system_config)
|
121
123
|
assert_equal(:json, sc.log.format)
|
122
124
|
assert_equal('%Y', sc.log.time_format)
|
123
125
|
end
|
@@ -136,7 +138,7 @@ module Fluent::Config
|
|
136
138
|
EOS
|
137
139
|
s = FakeSupervisor.new(log_level: level)
|
138
140
|
sc = Fluent::SystemConfig.new(conf)
|
139
|
-
sc.overwrite_variables(s.for_system_config)
|
141
|
+
sc.overwrite_variables(**s.for_system_config)
|
140
142
|
assert_equal(level, sc.log_level)
|
141
143
|
end
|
142
144
|
end
|
data/test/plugin/test_in_exec.rb
CHANGED
@@ -28,7 +28,7 @@ class ExecInputTest < Test::Unit::TestCase
|
|
28
28
|
|
29
29
|
TSV_CONFIG = %[
|
30
30
|
command ruby #{SCRIPT_PATH} "#{TEST_TIME}" 0
|
31
|
-
run_interval
|
31
|
+
run_interval 0.3
|
32
32
|
<parse>
|
33
33
|
@type tsv
|
34
34
|
keys time, tag, k1
|
@@ -43,7 +43,7 @@ class ExecInputTest < Test::Unit::TestCase
|
|
43
43
|
|
44
44
|
JSON_CONFIG = %[
|
45
45
|
command ruby #{SCRIPT_PATH} #{TEST_UNIX_TIME.to_i} 1
|
46
|
-
run_interval
|
46
|
+
run_interval 0.3
|
47
47
|
<parse>
|
48
48
|
@type json
|
49
49
|
</parse>
|
@@ -56,7 +56,7 @@ class ExecInputTest < Test::Unit::TestCase
|
|
56
56
|
|
57
57
|
MSGPACK_CONFIG = %[
|
58
58
|
command ruby #{SCRIPT_PATH} #{TEST_UNIX_TIME.to_i} 2
|
59
|
-
run_interval
|
59
|
+
run_interval 0.3
|
60
60
|
<parse>
|
61
61
|
@type msgpack
|
62
62
|
</parse>
|
@@ -70,7 +70,7 @@ class ExecInputTest < Test::Unit::TestCase
|
|
70
70
|
# here document for not de-quoting backslashes
|
71
71
|
REGEXP_CONFIG = %[
|
72
72
|
command ruby #{SCRIPT_PATH} "#{TEST_TIME}" 3
|
73
|
-
run_interval
|
73
|
+
run_interval 0.3
|
74
74
|
tag regex_tag
|
75
75
|
] + <<'EOC'
|
76
76
|
<parse>
|
@@ -143,7 +143,7 @@ EOC
|
|
143
143
|
time_key time
|
144
144
|
tag_key tag
|
145
145
|
time_format %Y-%m-%d %H:%M:%S
|
146
|
-
run_interval
|
146
|
+
run_interval 0.3
|
147
147
|
]
|
148
148
|
|
149
149
|
JSON_CONFIG_COMPAT = %[
|
@@ -151,7 +151,7 @@ EOC
|
|
151
151
|
format json
|
152
152
|
tag_key tag
|
153
153
|
time_key time
|
154
|
-
run_interval
|
154
|
+
run_interval 0.3
|
155
155
|
]
|
156
156
|
|
157
157
|
MSGPACK_CONFIG_COMPAT = %[
|
@@ -159,14 +159,14 @@ EOC
|
|
159
159
|
format msgpack
|
160
160
|
tag_key tagger
|
161
161
|
time_key datetime
|
162
|
-
run_interval
|
162
|
+
run_interval 0.3
|
163
163
|
]
|
164
164
|
|
165
165
|
REGEXP_CONFIG_COMPAT = %[
|
166
166
|
command ruby #{SCRIPT_PATH} "#{TEST_TIME}" 3
|
167
167
|
format /(?<time>[^\\\]]*) (?<message>[^ ]*)/
|
168
168
|
tag regex_tag
|
169
|
-
run_interval
|
169
|
+
run_interval 0.3
|
170
170
|
]
|
171
171
|
|
172
172
|
sub_test_case 'with traditional configuration' do
|
@@ -235,7 +235,7 @@ EOC
|
|
235
235
|
d.run(expect_emits: 2, timeout: 10)
|
236
236
|
|
237
237
|
assert{ d.events.length > 0 }
|
238
|
-
d.events.
|
238
|
+
d.events.each {|event|
|
239
239
|
assert_equal_event_time(time, event[1])
|
240
240
|
assert_equal [tag, time, record], event
|
241
241
|
}
|
@@ -231,10 +231,9 @@ class ForwardInputTest < Test::Unit::TestCase
|
|
231
231
|
["tag2", time_i, {"a"=>2}],
|
232
232
|
]
|
233
233
|
|
234
|
-
d.run(expect_records: records.length, timeout: 20) do
|
234
|
+
d.run(expect_records: records.length, timeout: 20, shutdown: true) do
|
235
235
|
records.each {|tag, _time, record|
|
236
236
|
send_data [tag, _time, record].to_json + "\n"
|
237
|
-
sleep 1
|
238
237
|
}
|
239
238
|
end
|
240
239
|
|
@@ -727,7 +726,7 @@ class ForwardInputTest < Test::Unit::TestCase
|
|
727
726
|
events.each {|tag, _time, record|
|
728
727
|
op = { 'chunk' => Base64.encode64(record.object_id.to_s) }
|
729
728
|
expected_acks << op['chunk']
|
730
|
-
send_data
|
729
|
+
send_data([tag, _time, record, op].to_msgpack, try_to_receive_response: true, response_timeout: 1, **options)
|
731
730
|
}
|
732
731
|
end
|
733
732
|
|
@@ -769,7 +768,7 @@ class ForwardInputTest < Test::Unit::TestCase
|
|
769
768
|
}
|
770
769
|
op = { 'chunk' => Base64.encode64(entries.object_id.to_s) }
|
771
770
|
expected_acks << op['chunk']
|
772
|
-
send_data
|
771
|
+
send_data(["tag1", entries, op].to_msgpack, try_to_receive_response: true, response_timeout: 1, **options)
|
773
772
|
end
|
774
773
|
|
775
774
|
assert_equal events, d.events
|
@@ -809,7 +808,7 @@ class ForwardInputTest < Test::Unit::TestCase
|
|
809
808
|
}
|
810
809
|
op = { 'chunk' => Base64.encode64(entries.object_id.to_s) }
|
811
810
|
expected_acks << op['chunk']
|
812
|
-
send_data
|
811
|
+
send_data(["tag1", entries, op].to_msgpack, try_to_receive_response: true, response_timeout: 1, **options)
|
813
812
|
end
|
814
813
|
|
815
814
|
assert_equal events, d.events
|
@@ -849,7 +848,7 @@ class ForwardInputTest < Test::Unit::TestCase
|
|
849
848
|
events.each {|tag, _time, record|
|
850
849
|
op = { 'chunk' => Base64.encode64(record.object_id.to_s) }
|
851
850
|
expected_acks << op['chunk']
|
852
|
-
send_data
|
851
|
+
send_data([tag, _time, record, op].to_json, try_to_receive_response: true, response_timeout: 1, **options)
|
853
852
|
}
|
854
853
|
end
|
855
854
|
|
@@ -885,7 +884,7 @@ class ForwardInputTest < Test::Unit::TestCase
|
|
885
884
|
|
886
885
|
d.run(expect_records: events.size, timeout: 20) do
|
887
886
|
events.each {|tag, _time, record|
|
888
|
-
send_data
|
887
|
+
send_data([tag, _time, record].to_msgpack, try_to_receive_response: true, response_timeout: 1, **options)
|
889
888
|
}
|
890
889
|
end
|
891
890
|
|
@@ -922,7 +921,7 @@ class ForwardInputTest < Test::Unit::TestCase
|
|
922
921
|
events.each {|tag, _time, record|
|
923
922
|
entries << [_time, record]
|
924
923
|
}
|
925
|
-
send_data
|
924
|
+
send_data(["tag1", entries].to_msgpack, try_to_receive_response: true, response_timeout: 1, **options)
|
926
925
|
end
|
927
926
|
|
928
927
|
assert_equal events, d.events
|
@@ -958,7 +957,7 @@ class ForwardInputTest < Test::Unit::TestCase
|
|
958
957
|
events.each {|tag, _time, record|
|
959
958
|
[_time, record].to_msgpack(entries)
|
960
959
|
}
|
961
|
-
send_data
|
960
|
+
send_data(["tag1", entries].to_msgpack, try_to_receive_response: true, response_timeout: 1, **options)
|
962
961
|
end
|
963
962
|
|
964
963
|
assert_equal events, d.events
|
@@ -994,7 +993,7 @@ class ForwardInputTest < Test::Unit::TestCase
|
|
994
993
|
|
995
994
|
d.run(expect_records: events.size, timeout: 20) do
|
996
995
|
events.each {|tag, _time, record|
|
997
|
-
send_data
|
996
|
+
send_data([tag, _time, record].to_json, try_to_receive_response: true, response_timeout: 1, **options)
|
998
997
|
}
|
999
998
|
end
|
1000
999
|
|
@@ -1016,7 +1015,7 @@ class ForwardInputTest < Test::Unit::TestCase
|
|
1016
1015
|
# nil: socket read timeout
|
1017
1016
|
def read_data(io, timeout, &block)
|
1018
1017
|
res = ''
|
1019
|
-
select_timeout =
|
1018
|
+
select_timeout = 0.5
|
1020
1019
|
clock_id = Process::CLOCK_MONOTONIC_RAW rescue Process::CLOCK_MONOTONIC
|
1021
1020
|
timeout_at = Process.clock_gettime(clock_id) + timeout
|
1022
1021
|
begin
|
data/test/plugin/test_in_http.rb
CHANGED
@@ -208,6 +208,38 @@ class HttpInputTest < Test::Unit::TestCase
|
|
208
208
|
assert_equal_event_time time, d.events[1][1]
|
209
209
|
end
|
210
210
|
|
211
|
+
def test_exact_match_for_expect
|
212
|
+
d = create_driver(CONFIG)
|
213
|
+
records = [{ "a" => 1}, { "a" => 2 }]
|
214
|
+
tag = "tag1"
|
215
|
+
res_codes = []
|
216
|
+
|
217
|
+
d.run(expect_records: 0, timeout: 5) do
|
218
|
+
res = post("/#{tag}", { "json" => records.to_json }, { 'Expect' => 'something' })
|
219
|
+
res_codes << res.code
|
220
|
+
end
|
221
|
+
assert_equal ["417"], res_codes
|
222
|
+
end
|
223
|
+
|
224
|
+
def test_exact_match_for_expect_with_other_header
|
225
|
+
d = create_driver(CONFIG)
|
226
|
+
|
227
|
+
records = [{ "a" => 1}, { "a" => 2 }]
|
228
|
+
tag = "tag1"
|
229
|
+
res_codes = []
|
230
|
+
|
231
|
+
d.run(expect_records: 2, timeout: 5) do
|
232
|
+
res = post("/#{tag}", { "json" => records.to_json, 'x-envoy-expected-rq-timeout-ms' => 4 })
|
233
|
+
res_codes << res.code
|
234
|
+
end
|
235
|
+
assert_equal ["200"], res_codes
|
236
|
+
|
237
|
+
assert_equal "tag1", d.events[0][0]
|
238
|
+
assert_equal 1, d.events[0][2]["a"]
|
239
|
+
assert_equal "tag1", d.events[1][0]
|
240
|
+
assert_equal 2, d.events[1][2]["a"]
|
241
|
+
end
|
242
|
+
|
211
243
|
def test_multi_json_with_add_remote_addr
|
212
244
|
d = create_driver(CONFIG + "add_remote_addr true")
|
213
245
|
time = event_time("2011-01-02 13:14:15 UTC")
|
@@ -446,7 +478,7 @@ class HttpInputTest < Test::Unit::TestCase
|
|
446
478
|
assert_equal_event_time time, d.events[0][1]
|
447
479
|
assert_equal_event_time time, d.events[1][1]
|
448
480
|
end
|
449
|
-
|
481
|
+
|
450
482
|
def test_msgpack
|
451
483
|
d = create_driver
|
452
484
|
time = event_time("2011-01-02 13:14:15 UTC")
|
@@ -716,7 +748,7 @@ class HttpInputTest < Test::Unit::TestCase
|
|
716
748
|
end
|
717
749
|
end
|
718
750
|
end
|
719
|
-
|
751
|
+
|
720
752
|
def test_cors_allowed_exclude_empty_string
|
721
753
|
d = create_driver(CONFIG + 'cors_allow_origins ["", "http://*.foo.com"]')
|
722
754
|
|
@@ -736,7 +768,7 @@ class HttpInputTest < Test::Unit::TestCase
|
|
736
768
|
end
|
737
769
|
end
|
738
770
|
end
|
739
|
-
|
771
|
+
|
740
772
|
def test_cors_allowed_wildcard_preflight_for_subdomain
|
741
773
|
d = create_driver(CONFIG + 'cors_allow_origins ["http://*.foo.com"]')
|
742
774
|
|