Sha256: cb09d4e3efa1cceb471b2fcb64b5a0e274d4dcf31d0102d0c9aaf787e64ff945

Contents?: true

Size: 1.15 KB

Versions: 2

Compression:

Stored size: 1.15 KB

Contents

require 'helper'

class NewRelicSummaryTest < Test::Unit::TestCase

  def setup
    Fluent::Test.setup
  end

  CONFIG = %[
    type newrelic_summary
    api_key NEWRELIC_API_KEY
    interval 5
    summary applications
    tag newrelic.summary
  ]

  def create_driver(conf=CONFIG, tag='test')
    Fluent::Test::OutputTestDriver.new(Fluent::NewRelicSummaryInput, tag).configure(conf)
  end

  def test_configuration
    d = create_driver
    assert_equal 'NEWRELIC_API_KEY', d.instance.api_key
    assert_equal 5, d.instance.interval
    assert_equal 'applications', d.instance.summary
    assert_equal 'newrelic.summary', d.instance.tag
  end

  def test_configuration_with_empty_tag
    assert_raise(Fluent::ConfigError) {
      create_driver %[
        type newrelic_summary
        api_key NEWRELIC_API_KEY
        interval 5
        summary applications
        # tag newrelic.summary
      ]
    }
  end

  def test_configuration_with_unknown_summary
    assert_raise(Fluent::ConfigError) {
      create_driver %[
        type newrelic_summary
        api_key NEWRELIC_API_KEY
        interval 5
        summary XXXXXXX
        tag newrelic.summary
      ]
    }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fluent-plugin-newrelic-summary-0.0.2 test/plugin/test_in_newrelic_summary.rb
fluent-plugin-newrelic-summary-0.0.1 test/plugin/test_in_newrelic_summary.rb