Skip to content

Commit

Permalink
metrics: Add metrics plugin instance existences checking assertions
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 committed Jul 30, 2021
1 parent 601abda commit 123a5f2
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/plugin/test_bare_output.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ class FluentPluginBareOutputTest::DummyPlugin2 < Fluent::Plugin::BareOutput
test 'can use metrics plugins and fallback methods' do
@p.configure(config_element('ROOT', '', {'@log_level' => 'debug'}))

%w[num_errors_metrics emit_count_metrics emit_size_metrics emit_records_metrics].each do |metric_name|
assert_true @p.instance_variable_get(:"@#{metric_name}").is_a?(Fluent::Plugin::Metrics)
end

assert_equal 0, @p.num_errors
assert_equal 0, @p.emit_count
assert_equal 0, @p.emit_size
Expand Down
4 changes: 4 additions & 0 deletions test/plugin/test_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ class FluentPluginFilterTest::DummyPlugin2 < Fluent::Plugin::Filter
test 'can use metrics plugins and fallback methods' do
@p.configure(config_element('ROOT', '', {'@log_level' => 'debug'}))

%w[emit_size_metrics emit_records_metrics].each do |metric_name|
assert_true @p.instance_variable_get(:"@#{metric_name}").is_a?(Fluent::Plugin::Metrics)
end

assert_equal 0, @p.emit_size
assert_equal 0, @p.emit_records
end
Expand Down
4 changes: 4 additions & 0 deletions test/plugin/test_input.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ class FluentPluginInputTest::DummyPlugin2 < Fluent::Plugin::Input
test 'can use metrics plugins and fallback methods' do
@p.configure(config_element('ROOT', '', {'@log_level' => 'debug'}))

%w[emit_size_metrics emit_records_metrics].each do |metric_name|
assert_true @p.instance_variable_get(:"@#{metric_name}").is_a?(Fluent::Plugin::Metrics)
end

assert_equal 0, @p.emit_size
assert_equal 0, @p.emit_records
end
Expand Down
4 changes: 4 additions & 0 deletions test/plugin/test_multi_output.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ def create_output(type=:multi)
)
@i.configure(conf)

%w[num_errors_metrics emit_count_metrics emit_size_metrics emit_records_metrics].each do |metric_name|
assert_true @i.instance_variable_get(:"@#{metric_name}").is_a?(Fluent::Plugin::Metrics)
end

assert_equal 0, @i.num_errors
assert_equal 0, @i.emit_count
assert_equal 0, @i.emit_size
Expand Down
5 changes: 5 additions & 0 deletions test/plugin/test_output.rb
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ def waiting(seconds)
test 'can use metrics plugins and fallback methods' do
@i.configure(config_element())

%w[num_errors_metrics emit_count_metrics emit_size_metrics emit_records_metrics
write_count_metrics rollback_count_metrics flush_time_count_metrics slow_flush_count_metrics].each do |metric_name|
assert_true @i.instance_variable_get(:"@#{metric_name}").is_a?(Fluent::Plugin::Metrics)
end

assert_equal 0, @i.num_errors
assert_equal 0, @i.emit_count
assert_equal 0, @i.emit_size
Expand Down

0 comments on commit 123a5f2

Please sign in to comment.