Sha256: 5c0c72248ba372fad82c31789bf0cff7f341ada575c0275e002881cbcc5b9596

Contents?: true

Size: 897 Bytes

Versions: 2

Compression:

Stored size: 897 Bytes

Contents

require 'helper'

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

  CONFIG = %[
    api_key xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    metric_key foo.bar
    protocol http
  ]
  # CONFIG = %[
  #   path #{TMP_DIR}/out_file_test
  #   compress gz
  #   utc
  # ]

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

  def test_configure
    d = create_driver(CONFIG)
    assert_equal d.instance.api_key, 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
    assert_equal d.instance.metric_key, 'foo.bar'
    assert_equal d.instance.protocol, 'http'
  end

  def test_post_metrics
    metric_key = 'foo.bar'
    record = {
      'foo.bar' => '0.01'
    }
    d = create_driver
    p = d.instance.post_metrics(metric_key, record)
    assert_equal p, { 'foo.bar' => 0.01 }
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fluent-plugin-out_hosted_graphite-0.0.2 test/plugin/test_out_hosted_graphite.rb
fluent-plugin-out_hosted_graphite-0.0.1 test/plugin/test_out_hosted_graphite.rb