Sha256: e136857ea65f0d2ba7ef241cc482703ffa89f3e20c36061e3e4e9cbbdabcaac8

Contents?: true

Size: 841 Bytes

Versions: 3

Compression:

Stored size: 841 Bytes

Contents

require 'helper'

class NewrelicMetricsInputTest < Test::Unit::TestCase
  def setup
    Fluent::Test.setup
  end

  def create_driver(conf)
    Fluent::Test::InputTestDriver.new(Fluent::NewrelicMetricsInput).configure(conf)
  end

  def test_configure_full
    d = create_driver %q{
      tag test
      interval 10m
    }

    assert_equal 'test', d.instance.tag
    assert_equal 10 * 60, d.instance.interval
    assert_equal 'hoge', d.instance.instance_variable_get(:@hoge)
  end

  def test_configure_error_when_config_is_empty
    assert_raise(Fluent::ConfigError) do
      create_driver ''
    end
  end

  def test_emit
    d = create_driver

    d.run do
      sleep 2
    end

    emits = d.emits
    assert_equal true, emits.length > 0
    assert_equal "tag1", emits[0].first
    assert_equal ({"k1"=>"ok"}), emits[0].last
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fluent-plugin-newrelic_metrics-0.0.3 test/plugin/test_in_newrelic_metrics.rb
fluent-plugin-newrelic_metrics-0.0.2 test/plugin/test_in_newrelic_metrics.rb
fluent-plugin-newrelic_metrics-0.0.1 test/plugin/test_in_newrelic_metrics.rb