search_flip 3.8.0 → 3.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b27a32f7b2d3ccedcdc823cbd8b8682027868e3d74cf1c135404b71dfec5f337
4
- data.tar.gz: 00f45e2024a1ef108a3e8132794c036f2514ae015c13a7e7d3266b9580e44a6b
3
+ metadata.gz: 84f5374ca017b59ee706e4e6e06c9739c18a83395ded6df0628b234d0e129e39
4
+ data.tar.gz: 1f6e1dd1a76f69b8cb552387add7d1dfe2b367739c38a7b9260db0c9954b8e26
5
5
  SHA512:
6
- metadata.gz: 635e6b47c05282a3f55ba35bea4b6a7fa9d4743ca911483c41ce8d994fd5830eea5c80027283f6bcda025722fe46bb42d56ee72e7242d296f569e69b756b44af
7
- data.tar.gz: d754585b03d8d2cd996b7c215b6ac939d9a8c6d6fdcdebc8aaf73143ab5f2b7499925120886ef0dbe2d88caf9eb137317426012a283a6e7050fdac2b1b19ac80
6
+ metadata.gz: 283b816aa7602cb4ffb1c981421e7fb13353158f40de052daec3c6c6700b42ff2b19eeb6accb22b8dcc29cf4589caf8c4a01edd827bc055eb97e16c6ed3ba972
7
+ data.tar.gz: a63de18588ef4b93c38eb7b4bfb91135f73e027f21371ff46c053dfbadb207661008aa5b31d05ac6e62298539e73cdf5c8421bb6aff93f2369f2712724bcd7f8
@@ -39,6 +39,10 @@ jobs:
39
39
  env:
40
40
  discovery.type: single-node
41
41
  plugins.security.disabled: true
42
+ - image: opensearchproject/opensearch:2.13.0
43
+ env:
44
+ discovery.type: single-node
45
+ DISABLE_SECURITY_PLUGIN: true
42
46
  ruby:
43
47
  - 2.7
44
48
  - 3.0
data/CHANGELOG.md CHANGED
@@ -1,7 +1,20 @@
1
1
 
2
2
  # CHANGELOG
3
3
 
4
- ## v3.8.0.
4
+ ## v3.9.0
5
+
6
+ * Allow to configure the elasticsearch version no matter which elasticsearch
7
+ version is actually in use. The version information is needed to support
8
+ version dependent features. Please note that manually configuring the version
9
+ is usually not need as the version by default is determined by sending one
10
+ request to elasticsearch.
11
+
12
+ ```ruby
13
+ SearchFlip::Config[:version] = { number: "8.1.1" }
14
+ SearchFlip::Config[:version] = { number: "2.13", distribution: "opensearch" }
15
+ ```
16
+
17
+ ## v3.8.0
5
18
 
6
19
  * Support Opensearch 1.x and 2.x
7
20
 
data/Gemfile CHANGED
@@ -14,6 +14,6 @@ gem "factory_bot"
14
14
  gem "rake"
15
15
  gem "rspec"
16
16
  gem "rubocop"
17
- gem "sqlite3"
17
+ gem "sqlite3", "~> 1.4"
18
18
  gem "timecop"
19
19
  gem "webmock"
data/README.md CHANGED
@@ -98,6 +98,16 @@ Available config options are:
98
98
  * `auto_refresh` tells SearchFlip to automatically refresh an index after
99
99
  import, index, delete, etc operations. This is e.g. useful for testing, etc.
100
100
  Defaults to false.
101
+ * `version` allows to configure the elasticsearch version no matter which
102
+ elasticsearch version is actually in use. The version information is needed to
103
+ support version dependent features. Please note that manually configuring the
104
+ version is usually not need as the version by default is determined by sending
105
+ one request to elasticsearch.
106
+
107
+ ```ruby
108
+ SearchFlip::Config[:version] = { number: "8.1.1" }
109
+ SearchFlip::Config[:version] = { number: "2.13", distribution: "opensearch" }
110
+ ```
101
111
 
102
112
  ## Usage
103
113
 
@@ -26,7 +26,7 @@ module SearchFlip
26
26
  # @return [String] The Elasticsearch distribution
27
27
 
28
28
  def distribution
29
- @distribution ||= SearchFlip::JSON.parse(version_response.to_s)["version"]["distribution"]
29
+ @distribution ||= SearchFlip::Config.dig(:version, :distribution) || SearchFlip::JSON.parse(version_response.to_s)["version"]["distribution"]
30
30
  end
31
31
 
32
32
  # Queries and returns the Elasticsearch version used.
@@ -37,7 +37,7 @@ module SearchFlip
37
37
  # @return [String] The Elasticsearch version
38
38
 
39
39
  def version
40
- @version ||= SearchFlip::JSON.parse(version_response.to_s)["version"]["number"]
40
+ @version ||= SearchFlip::Config.dig(:version, :number) || SearchFlip::JSON.parse(version_response.to_s)["version"]["number"]
41
41
  end
42
42
 
43
43
  # Queries and returns the Elasticsearch cluster health.
@@ -1,3 +1,3 @@
1
1
  module SearchFlip
2
- VERSION = "3.8.0"
2
+ VERSION = "3.9.0"
3
3
  end
@@ -5,12 +5,28 @@ RSpec.describe SearchFlip::Connection do
5
5
  it "reutrns the distribution" do
6
6
  expect([nil, "opensearch"]).to include(SearchFlip::Connection.new.distribution)
7
7
  end
8
+
9
+ it "returns the distribution from the config when given" do
10
+ SearchFlip::Config[:version] = { distribution: "distribution" }
11
+
12
+ expect(SearchFlip::Connection.new.distribution).to eq("distribution")
13
+ ensure
14
+ SearchFlip::Config.delete(:version)
15
+ end
8
16
  end
9
17
 
10
18
  describe "#version" do
11
19
  it "returns the version" do
12
20
  expect(SearchFlip::Connection.new.version).to match(/\A[0-9.]+\z/)
13
21
  end
22
+
23
+ it "returns the version from the config when given" do
24
+ SearchFlip::Config[:version] = { number: "1.2.3" }
25
+
26
+ expect(SearchFlip::Connection.new.version).to eq("1.2.3")
27
+ ensure
28
+ SearchFlip::Config.delete(:version)
29
+ end
14
30
  end
15
31
 
16
32
  describe "#cluster_health" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: search_flip
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.8.0
4
+ version: 3.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Vetter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-19 00:00:00.000000000 Z
11
+ date: 2024-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie