Sha256: f55872d44bae941951cc475d146f99611c49cfd1277ff72fb02ac5a2a8d73627

Contents?: true

Size: 1.67 KB

Versions: 5

Compression:

Stored size: 1.67 KB

Contents

require 'test_helper'
require 'pathname'

require 'elasticsearch/extensions/test/cluster'

class Elasticsearch::Extensions::TestClusterIntegrationTest < Elasticsearch::Test::IntegrationTestCase
  context "The Test::Cluster" do
    PATH_TO_BUILDS = if ENV['PATH_TO_BUILDS']
      Pathname(ENV['PATH_TO_BUILDS'])
    else
      Pathname(File.expand_path('../../../../../../tmp/builds', __FILE__))
    end

    unless PATH_TO_BUILDS.exist?
      puts "Path to builds doesn't exist, skipping TestClusterIntegrationTest"
      exit(0)
    end

    @builds = begin
      PATH_TO_BUILDS.entries.reject { |f| f.to_s =~ /^\./ }.sort
    rescue Errno::ENOENT
      []
    end

    STDOUT.puts %Q|Builds: \n#{@builds.map { |b| "  * #{b}"}.join("\n")}| unless ENV['QUIET']

    @builds.each do |build|
      should "start and stop #{build.to_s}" do
        puts ("----- #{build.to_s} " + "-"*(80-7-build.to_s.size)).to_s.ansi(:bold)
        begin
          Elasticsearch::Extensions::Test::Cluster.start \
            command: PATH_TO_BUILDS.join(build.join('bin/elasticsearch')).to_s,
            port: 9260,
            cluster_name: 'elasticsearch-ext-integration-test',
            path_data: '/tmp/elasticsearch-ext-integration-test'

          # Index some data to create the data directory
          client = Elasticsearch::Client.new host: "localhost:9260"
          client.index index: 'test1', type: 'd', id: 1, body: { title: 'TEST' }
        ensure
          Elasticsearch::Extensions::Test::Cluster.stop \
            command: PATH_TO_BUILDS.join(build.join('bin/elasticsearch')).to_s,
            port: 9260,
            cluster_name: 'elasticsearch-ext-integration-test'
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
elasticsearch-extensions-0.0.31 test/test/cluster/integration/cluster_test.rb
elasticsearch-extensions-0.0.30 test/test/cluster/integration/cluster_test.rb
elasticsearch-extensions-0.0.29 test/test/cluster/integration/cluster_test.rb
elasticsearch-extensions-0.0.28 test/test/cluster/integration/cluster_test.rb
elasticsearch-extensions-0.0.27 test/test/cluster/integration/cluster_test.rb