Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .ci/docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ services:
environment:
- INTEGRATION=${INTEGRATION:-false}
- SECURE_INTEGRATION=${SECURE_INTEGRATION:-false}
- ELASTIC_STACK_VERSION=$ELASTIC_STACK_VERSION
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for reviewer: without this the ENV['ELASTIC_STACK_VERSION'] in Ruby code sees an empty String


elasticsearch:
build:
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ env:
- INTEGRATION=true ELASTIC_STACK_VERSION=6.x
- INTEGRATION=true ELASTIC_STACK_VERSION=7.x
- INTEGRATION=true ELASTIC_STACK_VERSION=7.x SNAPSHOT=true
- INTEGRATION=true ELASTIC_STACK_VERSION=8.x SNAPSHOT=true
- SECURE_INTEGRATION=true INTEGRATION=true ELASTIC_STACK_VERSION=8.x SNAPSHOT=true
- SECURE_INTEGRATION=true INTEGRATION=true ELASTIC_STACK_VERSION=7.x
11 changes: 10 additions & 1 deletion spec/es_spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def self.es_version
end

def self.es_version_satisfies?(*requirement)
es_version = RSpec.configuration.filter[:es_version] || ENV['ES_VERSION'] || ENV['ELASTIC_STACK_VERSION']
es_version = nilify(RSpec.configuration.filter[:es_version]) || nilify(ENV['ES_VERSION']) || nilify(ENV['ELASTIC_STACK_VERSION'])
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for reviewer: if the single part of the concatenated || operator is an empty string then the result is that empty string. So if in the ENV there is a ES_VERSION but it's empty and the same for the first particle then the es_version assume the "" instead of the version of ELASTIC_STACK_VERSION

if es_version.nil?
puts "Info: ES_VERSION, ELASTIC_STACK_VERSION or 'es_version' tag wasn't set. Returning false to all `es_version_satisfies?` call."
return false
Expand All @@ -89,6 +89,15 @@ def self.es_version_satisfies?(*requirement)
Gem::Requirement.new(requirement).satisfied_by?(es_release_version)
end

private
def self.nilify(str)
if str.nil?
return str
end
str.empty? ? nil : str
end

public
def clean(client)
client.indices.delete_template(:name => "*")
client.indices.delete_index_template(:name => "logstash*") rescue nil
Expand Down