Sha256: 16ef968a62abcabd3026a2d285d305fee25c2745c2480cbaffc763e1af64242d
Contents?: true
Size: 1.2 KB
Versions: 2
Compression:
Stored size: 1.2 KB
Contents
require 'helper' class ElasticsearchOutputTest < Test::Unit::TestCase CONFIG_OUT_KEYS = %[ host localhost port 9200 index fluent_es_test ] def setup d = create_driver(CONFIG_OUT_KEYS) @es_client = Elasticsearch::Client.new hosts: ["#{d.instance.host}:#{d.instance.port}"] if @es_client.indices.exists index: d.instance.index @es_client.indices.delete index: d.instance.index # remove the test index end end def create_driver(conf=CONFIG_OUT_KEYS, tag='test-tag') Fluent::Test::BufferedOutputTestDriver.new(Fluent::ElasticsearchOutput, tag).configure(conf) end def test_configure d = create_driver(CONFIG_OUT_KEYS) assert_equal "localhost", d.instance.host assert_equal 9200, d.instance.port assert_equal "fluent_es_test", d.instance.index end def test_indexing d = create_driver(CONFIG_OUT_KEYS) d.emit({"hello" => "world"}) d.emit({"why" => "not"}) d.run # give elasticsearch time to index documents (should be under integration testing?) sleep 2 puts "#{@es_client.search index: d.instance.index}" count_result = @es_client.count index: d.instance.index assert_equal 2, count_result["count"] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fluent-plugin-elasticsearch-ruby-0.0.3 | test/plugin/test_out_elasticsearch.rb |
fluent-plugin-elasticsearch-ruby-0.0.2 | test/plugin/test_out_elasticsearch.rb |