Sha256: 062b70054bd1806cd8114e2b80d96c76746dc4dcb507758954f62071c2513826

Contents?: true

Size: 1.51 KB

Versions: 8

Compression:

Stored size: 1.51 KB

Contents

require_relative './helper'

Elasticsearch = Embulk::Input::Elasticsearch

module Embulk
  class Input::Elasticsearch
    class TestConverter < Test::Unit::TestCase

      def startup
      end

      def shutdown
      end

      sub_test_case "get_sources" do
        def test_normal
          fields = [
            {"name"=>"_id", "type"=>"string", "metadata"=>true},
            {"name"=>"product_id", "type"=>"long"},
            {"name"=>"title", "type"=>"string"}
          ]

          results = {
            "_scroll_id"=>"cXVlcnlUaGVuRmV0Y2g7NTsxNzg3MjE6WlphQ3V0WDNRYmFRcS1QQ3dCb2s5UTsxNzg3MjI6WlphQ3V0WDNRYmFRcS1QQ3dCb2s5UTsxNzg3MjM6WlphQ3V0WDNRYmFRcS1QQ3dCb2s5UTsxNzg3MjU6WlphQ3V0WDNRYmFRcS1QQ3dCb2s5UTsxNzg3MjQ6WlphQ3V0WDNRYmFRcS1QQ3dCb2s5UTswOw==",
            "took"=>41,
            "timed_out"=>false,
            "_shards"=>{"total"=>5, "successful"=>5, "failed"=>0},
            "hits"=>{
              "total"=>1,
              "max_score"=>nil,
              "hits"=>[
                {
                  "_index"=>"test_index",
                  "_type"=>"test_type",
                  "_id"=>"AVTCxiCuNR-BVKOgUB7R",
                  "_score"=>nil,
                  "_source"=>{
                    "title"=>"dummy title",
                    "product_id"=>1
                  },
                  "sort"=>[12534]
                }
              ]
            }
          }
          assert_equal Converter.get_sources(results, fields), [["AVTCxiCuNR-BVKOgUB7R", 1, "dummy title"]]
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
embulk-input-elasticsearch-nosslverify-0.3.9 test/test_converter.rb
embulk-input-elasticsearch-nosslverify-0.3.8 test/test_converter.rb
embulk-input-elasticsearch-nosslverify-0.3.7 test/test_converter.rb
embulk-input-elasticsearch-nosslverify-0.3.6 test/test_converter.rb
embulk-input-elasticsearch-0.3.6 test/test_converter.rb
embulk-input-elasticsearch-0.3.5 test/test_converter.rb
embulk-input-elasticsearch-0.3.4 test/test_converter.rb
embulk-input-elasticsearch-0.3.3 test/test_converter.rb