From fd5be086ece5944b2dd5187ceb664fd50b2445ea Mon Sep 17 00:00:00 2001 From: Mantas Masalskis Date: Wed, 14 Jul 2021 14:04:54 +0000 Subject: [PATCH] Maintenance: ElasticSearch 7.8+ supported --- .gitlab/ci/integration/es.yml | 16 ++-------------- lib/search_index_backend.rb | 6 ++++-- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/.gitlab/ci/integration/es.yml b/.gitlab/ci/integration/es.yml index 80b73d9b8..6b0675201 100644 --- a/.gitlab/ci/integration/es.yml +++ b/.gitlab/ci/integration/es.yml @@ -13,26 +13,14 @@ - bundle exec rspec --tag searchindex --tag ~type:system - bundle exec rails test test/integration/report_test.rb -es:6: - <<: *template_integration_es - variables: - ELASTICSEARCH_TAG: '6' - RAILS_ENV: "test" - -es:6.5: - <<: *template_integration_es - variables: - ELASTICSEARCH_TAG: '6.5' - RAILS_ENV: "test" - es:7: <<: *template_integration_es variables: ELASTICSEARCH_TAG: '7' RAILS_ENV: "test" -es:7.0: +es:7.8: <<: *template_integration_es variables: - ELASTICSEARCH_TAG: '7.0' + ELASTICSEARCH_TAG: '7.8.1' RAILS_ENV: "test" diff --git a/lib/search_index_backend.rb b/lib/search_index_backend.rb index 159d0de8c..9275a910f 100644 --- a/lib/search_index_backend.rb +++ b/lib/search_index_backend.rb @@ -20,10 +20,12 @@ info about used search index machine installed_version = response.data.dig('version', 'number') raise "Unable to get elasticsearch version from response: #{response.inspect}" if installed_version.blank? - version_supported = Gem::Version.new(installed_version) < Gem::Version.new('8') + installed_version_parsed = Gem::Version.new(installed_version) + + version_supported = installed_version_parsed < Gem::Version.new('8') raise "Version #{installed_version} of configured elasticsearch is not supported." if !version_supported - version_supported = Gem::Version.new(installed_version) > Gem::Version.new('2.3') + version_supported = installed_version_parsed >= Gem::Version.new('7.8') raise "Version #{installed_version} of configured elasticsearch is not supported." if !version_supported return response.data