Sha256: 34ee4dbe7d764c2965520a946db0e0f350e14b98c109ade0d6451ee44bec80a4

Contents?: true

Size: 411 Bytes

Versions: 3

Compression:

Stored size: 411 Bytes

Contents

module ElasticHelper
  def index_exist?(index_name)
    out, err, status = Open3.capture3("curl -XGET '#{elastic_url}/#{index_name}/'")
    !out.include?('index_not_found_exception')
  end

  def remove_index(index_name)
    system("curl -XDELETE '#{elastic_url}#{index_name}/' > /dev/null 2>&1")
  end

  def elastic_url
    host = ENV['ELASTICSEARCH_HOST'] || 'localhost'
    "http://#{host}:9200/"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gitlab-elasticsearch-git-1.2.0 spec/support/elastic_helper.rb
gitlab-elasticsearch-git-1.1.1 spec/support/elastic_helper.rb
gitlab-elasticsearch-git-1.1.0 spec/support/elastic_helper.rb