From e27bd6c8645e6ce73f1a3270d47e40c92e16d1e8 Mon Sep 17 00:00:00 2001 From: andsel Date: Fri, 10 Sep 2021 13:49:52 +0200 Subject: [PATCH 1/3] Disable security on Elasticsearch cluster --- .ci/elasticsearch-run.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/elasticsearch-run.sh b/.ci/elasticsearch-run.sh index c2707076..fbc8f862 100755 --- a/.ci/elasticsearch-run.sh +++ b/.ci/elasticsearch-run.sh @@ -2,3 +2,4 @@ set -ex /usr/share/elasticsearch/bin/elasticsearch -Ediscovery.type=single-node -Eaction.destructive_requires_name=false +#/usr/share/elasticsearch/bin/elasticsearch -Expack.security.enabled=false -Ediscovery.type=single-node -Eaction.destructive_requires_name=false From 66184d68c86945f07d9c22c63391b1298463a2fc Mon Sep 17 00:00:00 2001 From: andsel Date: Fri, 10 Sep 2021 14:08:12 +0200 Subject: [PATCH 2/3] Enable SECURE_INTEGRATION for stack version 8 because ES 8 has security enabled by default --- .ci/elasticsearch-run.sh | 1 - .travis.yml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.ci/elasticsearch-run.sh b/.ci/elasticsearch-run.sh index fbc8f862..c2707076 100755 --- a/.ci/elasticsearch-run.sh +++ b/.ci/elasticsearch-run.sh @@ -2,4 +2,3 @@ set -ex /usr/share/elasticsearch/bin/elasticsearch -Ediscovery.type=single-node -Eaction.destructive_requires_name=false -#/usr/share/elasticsearch/bin/elasticsearch -Expack.security.enabled=false -Ediscovery.type=single-node -Eaction.destructive_requires_name=false diff --git a/.travis.yml b/.travis.yml index 6d411079..933bc2cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 From aeb0566274da2db43c91a27a3898045a786f7d6b Mon Sep 17 00:00:00 2001 From: andsel Date: Mon, 13 Sep 2021 15:00:18 +0200 Subject: [PATCH 3/3] Fixes the integration test to effectively bring in the EALSTIC_STACK_VERSION environment variable --- .ci/docker-compose.override.yml | 1 + spec/es_spec_helper.rb | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.ci/docker-compose.override.yml b/.ci/docker-compose.override.yml index 95403cc2..f22fe47e 100644 --- a/.ci/docker-compose.override.yml +++ b/.ci/docker-compose.override.yml @@ -10,6 +10,7 @@ services: environment: - INTEGRATION=${INTEGRATION:-false} - SECURE_INTEGRATION=${SECURE_INTEGRATION:-false} + - ELASTIC_STACK_VERSION=$ELASTIC_STACK_VERSION elasticsearch: build: diff --git a/spec/es_spec_helper.rb b/spec/es_spec_helper.rb index 114f7eea..c0b44b16 100644 --- a/spec/es_spec_helper.rb +++ b/spec/es_spec_helper.rb @@ -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']) 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 @@ -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