Sha256: 3e6b7d6615362ac7f3853937701c4915b56d36452bd3f2c405d2d35282c19a85

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

require "logstash/devutils/rspec/spec_helper"
require 'manticore'
require 'elasticsearch'

# by default exclude secure_integration tests unless requested
# normal integration specs are already excluded by devutils' spec helper
RSpec.configure do |config|
   config.filter_run_excluding config.exclusion_filter.add(:secure_integration => true)
end

module ESHelper
  def get_host_port
    "127.0.0.1"
  end

  def get_client
    Elasticsearch::Client.new(:hosts => [get_host_port])
  end

  def self.es_version
    RSpec.configuration.filter[:es_version] || ENV['ES_VERSION']
  end

  def self.es_version_satisfies?(*requirement)
    es_version = RSpec.configuration.filter[:es_version] || ENV['ES_VERSION']
    if es_version.nil?
      puts "Info: ES_VERSION environment or 'es_version' tag wasn't set. Returning false to all `es_version_satisfies?` call."
      return false
    end
    es_release_version = Gem::Version.new(es_version).release
    Gem::Requirement.new(requirement).satisfied_by?(es_release_version)
  end
end

RSpec.configure do |config|
  config.include ESHelper
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
logstash-output-amazon_es-7.0-java spec/es_spec_helper.rb
logstash-output-amazon_es-6.4.2-java spec/es_spec_helper.rb
logstash-output-amazon_es-6.4.1-java spec/es_spec_helper.rb
logstash-output-amazon_es-6.4.0-java spec/es_spec_helper.rb