test/plugin/test_out_mackerel.rb in fluent-plugin-mackerel-0.0.8 vs test/plugin/test_out_mackerel.rb in fluent-plugin-mackerel-0.0.9
- old
+ new
@@ -67,10 +67,25 @@
hostid xyz
metrics_name a-${[1]}-b.${out_key}
out_keys val1,val2
]
+ CONFIG_BUFFER_LIMIT_DEFAULT = %[
+ type mackerel
+ service xyz
+ api_key 123456
+ out_keys val1,val2,val3
+ ]
+
+ CONFIG_BUFFER_LIMIT_IGNORE = %[
+ type mackerel
+ service xyz
+ api_key 123456
+ out_keys val1,val2,val3
+ buffer_chunk_limit 1k
+ ]
+
def create_driver(conf = CONFIG, tag='test')
Fluent::Test::BufferedOutputTestDriver.new(Fluent::MackerelOutput, tag).configure(conf)
end
def test_configure
@@ -105,9 +120,16 @@
assert_equal d.instance.instance_variable_get(:@flush_interval), 60
d = create_driver(CONFIG_OUT_KEY_PATTERN)
assert_match d.instance.instance_variable_get(:@out_key_pattern), "val1"
assert_no_match d.instance.instance_variable_get(:@out_key_pattern), "foo"
+
+ d = create_driver(CONFIG_BUFFER_LIMIT_DEFAULT)
+ assert_equal d.instance.instance_variable_get(:@buffer_chunk_limit), Fluent::MackerelOutput::MAX_BUFFER_CHUNK_LIMIT
+ assert_equal d.instance.instance_variable_get(:@buffer_queue_limit), 4096
+
+ d = create_driver(CONFIG_BUFFER_LIMIT_IGNORE)
+ assert_equal d.instance.instance_variable_get(:@buffer_chunk_limit), Fluent::MackerelOutput::MAX_BUFFER_CHUNK_LIMIT
end
def test_write
d = create_driver()
mock(d.instance.mackerel).post_metrics([