Sha256: efb399890ea97914c5d9c3b95f09c4da6c3b7d6d29a22e31178cc2598b529874

Contents?: true

Size: 628 Bytes

Versions: 9

Compression:

Stored size: 628 Bytes

Contents

require_relative '../helper'
require 'fluent/test/driver/formatter'
require 'fluent/plugin/formatter_json'

class JsonFormatterTest < ::Test::Unit::TestCase

  def setup
    @time = event_time
  end

  def create_driver(conf = "")
    Fluent::Test::Driver::Formatter.new(Fluent::Plugin::JSONFormatter).configure(conf)
  end

  def tag
    "tag"
  end

  def record
    {'message' => 'awesome'}
  end

  data('oj' => 'oj', 'yajl' => 'yajl')
  def test_format(data)
    d = create_driver('json_parser' => data)
    formatted = d.instance.format(tag, @time, record)

    assert_equal("#{Yajl.dump(record)}\n", formatted)
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
fluentd-0.14.6 test/plugin/test_formatter_json.rb
fluentd-0.14.5-x64-mingw32 test/plugin/test_formatter_json.rb
fluentd-0.14.5-x86-mingw32 test/plugin/test_formatter_json.rb
fluentd-0.14.5 test/plugin/test_formatter_json.rb
fluentd-0.14.4-x64-mingw32 test/plugin/test_formatter_json.rb
fluentd-0.14.4-x86-mingw32 test/plugin/test_formatter_json.rb
fluentd-0.14.4 test/plugin/test_formatter_json.rb
fluentd-0.14.3 test/plugin/test_formatter_json.rb
fluentd-0.14.2 test/plugin/test_formatter_json.rb