opensearch-ruby 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of opensearch-ruby might be problematic. Click here for more details.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.md +2 -0
- data/Rakefile +12 -6
- data/lib/opensearch/version.rb +1 -1
- data/opensearch.gemspec +2 -2
- data/spec/integration/{client_integration_spec.rb → security_disabled/client_integration_spec.rb} +1 -1
- data/spec/integration/{validation_integration_spec.rb → security_disabled/validation_integration_spec.rb} +1 -1
- data/spec/integration/security_enabled/client_integration_spec.rb +43 -0
- data/spec/integration/security_enabled/validation_integration_spec.rb +40 -0
- data/spec/unit/opensearch_product_validation_spec.rb +5 -5
- data.tar.gz.sig +0 -0
- metadata +14 -10
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d4f98e77ae003dc420b5f08f9fd84c48686595334234292db7892190c53ef86
|
4
|
+
data.tar.gz: e5007d84daddd7a74e236e9c129bd2affbf69fa3865a0a474f0d762c474adff0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a20c390852f61417b2ae5c25e8e01445410ee43614848d409d40d6c85968d947500c313bd7c66fa19b0694dae475273a54e4d133ec5aea01a1068f22d70f0157
|
7
|
+
data.tar.gz: 5f983a021750df743ea48b178f39f1e55ebbe79f66f82f0d9f0ce24d743e32ecb69a3170c0ba8a4d34f7a9994eccdd2271f2c61944dc32961f9434af80a80d25
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -20,6 +20,8 @@ The OpenSearch client for Ruby is compatible with Ruby 1.9 and higher.
|
|
20
20
|
|
21
21
|
The client's API is compatible with OpenSearch's API versions from 1.0.0 till current.
|
22
22
|
|
23
|
+
See [COMPATIBILITY](../COMPATIBILITY.md) for more details.
|
24
|
+
|
23
25
|
## Installation
|
24
26
|
|
25
27
|
Install the package from [Rubygems](https://rubygems.org):
|
data/Rakefile
CHANGED
@@ -35,13 +35,8 @@ task test: 'test:spec'
|
|
35
35
|
require 'rspec/core/rake_task'
|
36
36
|
|
37
37
|
namespace :test do
|
38
|
-
desc 'Wait for OpenSearch to be in a green state'
|
39
|
-
task :wait_for_green do
|
40
|
-
sh '../scripts/wait-cluster.sh'
|
41
|
-
end
|
42
|
-
|
43
38
|
RSpec::Core::RakeTask.new(:integration) do |t|
|
44
|
-
t.pattern = 'spec/integration/**{,/*/**}/*_spec.rb'
|
39
|
+
t.pattern = 'spec/integration/security_disabled/**{,/*/**}/*_spec.rb'
|
45
40
|
end
|
46
41
|
|
47
42
|
RSpec::Core::RakeTask.new(:unit) do |t|
|
@@ -55,6 +50,17 @@ namespace :test do
|
|
55
50
|
end
|
56
51
|
end
|
57
52
|
|
53
|
+
namespace :test_security do
|
54
|
+
RSpec::Core::RakeTask.new(:integration) do |t|
|
55
|
+
t.pattern = 'spec/integration/security_enabled/**{,/*/**}/*_spec.rb'
|
56
|
+
end
|
57
|
+
|
58
|
+
desc 'Run security integration tests'
|
59
|
+
task :all do
|
60
|
+
Rake::Task['test_security:integration'].invoke
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
58
64
|
# ----- Documentation tasks ---------------------------------------------------
|
59
65
|
|
60
66
|
require 'yard'
|
data/lib/opensearch/version.rb
CHANGED
data/opensearch.gemspec
CHANGED
@@ -61,8 +61,8 @@ Gem::Specification.new do |s|
|
|
61
61
|
|
62
62
|
s.required_ruby_version = '>= 2.4'
|
63
63
|
|
64
|
-
s.add_dependency 'opensearch-transport', '
|
65
|
-
s.add_dependency 'opensearch-api', '
|
64
|
+
s.add_dependency 'opensearch-transport', '2.0.0'
|
65
|
+
s.add_dependency 'opensearch-api', '2.0.0'
|
66
66
|
|
67
67
|
s.add_development_dependency 'bundler'
|
68
68
|
s.add_development_dependency 'byebug' unless defined?(JRUBY_VERSION) || defined?(Rubinius)
|
@@ -27,7 +27,7 @@ require 'spec_helper'
|
|
27
27
|
require 'logger'
|
28
28
|
|
29
29
|
describe 'OpenSearch validation integration' do
|
30
|
-
it 'Validates for OpenSearch
|
30
|
+
it 'Validates for OpenSearch' do
|
31
31
|
client = OpenSearch::Client.new(
|
32
32
|
host: OPENSEARCH_URL,
|
33
33
|
logger: Logger.new($stderr)
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
2
|
+
#
|
3
|
+
# The OpenSearch Contributors require contributions made to
|
4
|
+
# this file be licensed under the Apache-2.0 license or a
|
5
|
+
# compatible open source license.
|
6
|
+
#
|
7
|
+
# Modifications Copyright OpenSearch Contributors. See
|
8
|
+
# GitHub history for details.
|
9
|
+
require 'spec_helper'
|
10
|
+
require 'logger'
|
11
|
+
|
12
|
+
context 'OpenSearch client with security plugin enabled' do
|
13
|
+
let(:logger) { Logger.new($stderr) }
|
14
|
+
|
15
|
+
let(:client) do
|
16
|
+
OpenSearch::Client.new(
|
17
|
+
host: OPENSEARCH_URL,
|
18
|
+
logger: logger,
|
19
|
+
transport_options: { ssl: { verify: false } }
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'Integrates with opensearch API' do
|
24
|
+
it 'should perform the API methods' do
|
25
|
+
expect do
|
26
|
+
# Index a document
|
27
|
+
client.index(index: 'test-index', id: '1', body: { title: 'Test' })
|
28
|
+
|
29
|
+
# Refresh the index
|
30
|
+
client.indices.refresh(index: 'test-index')
|
31
|
+
|
32
|
+
# Search
|
33
|
+
response = client.search(index: 'test-index', body: { query: { match: { title: 'test' } } })
|
34
|
+
|
35
|
+
expect(response['hits']['total']['value']).to eq 1
|
36
|
+
expect(response['hits']['hits'][0]['_source']['title']).to eq 'Test'
|
37
|
+
|
38
|
+
# Delete the index
|
39
|
+
client.indices.delete(index: 'test-index')
|
40
|
+
end.not_to raise_error
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
2
|
+
#
|
3
|
+
# The OpenSearch Contributors require contributions made to
|
4
|
+
# this file be licensed under the Apache-2.0 license or a
|
5
|
+
# compatible open source license.
|
6
|
+
#
|
7
|
+
# Modifications Copyright OpenSearch Contributors. See
|
8
|
+
# GitHub history for details.
|
9
|
+
#
|
10
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
11
|
+
# license agreements. See the NOTICE file distributed with
|
12
|
+
# this work for additional information regarding copyright
|
13
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
14
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
15
|
+
# not use this file except in compliance with the License.
|
16
|
+
# You may obtain a copy of the License at
|
17
|
+
#
|
18
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
19
|
+
#
|
20
|
+
# Unless required by applicable law or agreed to in writing,
|
21
|
+
# software distributed under the License is distributed on an
|
22
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
23
|
+
# KIND, either express or implied. See the License for the
|
24
|
+
# specific language governing permissions and limitations
|
25
|
+
# under the License.
|
26
|
+
require 'spec_helper'
|
27
|
+
require 'logger'
|
28
|
+
|
29
|
+
describe 'OpenSearch validation integration with security plugin enabled' do
|
30
|
+
it 'Validates for OpenSearch' do
|
31
|
+
client = OpenSearch::Client.new(
|
32
|
+
host: OPENSEARCH_URL,
|
33
|
+
logger: Logger.new($stderr),
|
34
|
+
transport_options: { ssl: { verify: false } }
|
35
|
+
)
|
36
|
+
expect(client.instance_variable_get('@verified')).to be false
|
37
|
+
client.count
|
38
|
+
expect(client.instance_variable_get('@verified')).to be true
|
39
|
+
end
|
40
|
+
end
|
@@ -84,7 +84,7 @@ describe 'OpenSearch: Validation' do
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
-
context 'When
|
87
|
+
context 'When OpenSearch replies with status 403' do
|
88
88
|
let(:status) { 403 }
|
89
89
|
let(:body) { {}.to_json }
|
90
90
|
|
@@ -105,9 +105,9 @@ describe 'OpenSearch: Validation' do
|
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
108
|
-
context 'When the OpenSearch version is
|
108
|
+
context 'When the OpenSearch version is 2.0.0' do
|
109
109
|
context 'With a valid OpenSearch response' do
|
110
|
-
let(:body) { { 'version' => { 'number' => '
|
110
|
+
let(:body) { { 'version' => { 'number' => '2.0.0', 'distribution' => 'opensearch' } }.to_json }
|
111
111
|
let(:headers) do
|
112
112
|
{
|
113
113
|
'content-type' => 'json'
|
@@ -123,7 +123,7 @@ describe 'OpenSearch: Validation' do
|
|
123
123
|
end
|
124
124
|
|
125
125
|
context 'When the distribution is not present' do
|
126
|
-
let(:body) { { 'version' => { 'number' => '
|
126
|
+
let(:body) { { 'version' => { 'number' => '2.0.0' } }.to_json }
|
127
127
|
it 'Fails validation' do
|
128
128
|
verify_request_stub
|
129
129
|
|
@@ -187,7 +187,7 @@ describe 'OpenSearch: Validation' do
|
|
187
187
|
end
|
188
188
|
|
189
189
|
let(:headers) { { 'content-type' => 'application/yaml'} }
|
190
|
-
let(:body) { "---\nversion:\n number: \"
|
190
|
+
let(:body) { "---\nversion:\n number: \"2.0.0\"\n distribution: \"opensearch\"\n" }
|
191
191
|
|
192
192
|
it 'validates' do
|
193
193
|
verify_request_stub
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opensearch-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jayesh Hathila
|
@@ -33,7 +33,7 @@ cert_chain:
|
|
33
33
|
yXikuH6LEVykA8pgOcB9gKsB2/zMd2ZlSj2monM8Qw9EfB14ZSDTYS8VYuwWCeF0
|
34
34
|
eFmXXk0ufQFKl1Yll7quHkmQ0PzKkvXTpONBT6qPkXE=
|
35
35
|
-----END CERTIFICATE-----
|
36
|
-
date:
|
36
|
+
date: 2022-05-31 00:00:00.000000000 Z
|
37
37
|
dependencies:
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: opensearch-transport
|
@@ -41,28 +41,28 @@ dependencies:
|
|
41
41
|
requirements:
|
42
42
|
- - '='
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
version:
|
44
|
+
version: 2.0.0
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
47
|
version_requirements: !ruby/object:Gem::Requirement
|
48
48
|
requirements:
|
49
49
|
- - '='
|
50
50
|
- !ruby/object:Gem::Version
|
51
|
-
version:
|
51
|
+
version: 2.0.0
|
52
52
|
- !ruby/object:Gem::Dependency
|
53
53
|
name: opensearch-api
|
54
54
|
requirement: !ruby/object:Gem::Requirement
|
55
55
|
requirements:
|
56
56
|
- - '='
|
57
57
|
- !ruby/object:Gem::Version
|
58
|
-
version:
|
58
|
+
version: 2.0.0
|
59
59
|
type: :runtime
|
60
60
|
prerelease: false
|
61
61
|
version_requirements: !ruby/object:Gem::Requirement
|
62
62
|
requirements:
|
63
63
|
- - '='
|
64
64
|
- !ruby/object:Gem::Version
|
65
|
-
version:
|
65
|
+
version: 2.0.0
|
66
66
|
- !ruby/object:Gem::Dependency
|
67
67
|
name: bundler
|
68
68
|
requirement: !ruby/object:Gem::Requirement
|
@@ -228,8 +228,10 @@ files:
|
|
228
228
|
- lib/opensearch.rb
|
229
229
|
- lib/opensearch/version.rb
|
230
230
|
- opensearch.gemspec
|
231
|
-
- spec/integration/client_integration_spec.rb
|
232
|
-
- spec/integration/validation_integration_spec.rb
|
231
|
+
- spec/integration/security_disabled/client_integration_spec.rb
|
232
|
+
- spec/integration/security_disabled/validation_integration_spec.rb
|
233
|
+
- spec/integration/security_enabled/client_integration_spec.rb
|
234
|
+
- spec/integration/security_enabled/validation_integration_spec.rb
|
233
235
|
- spec/spec_helper.rb
|
234
236
|
- spec/unit/opensearch_product_validation_spec.rb
|
235
237
|
- spec/unit/wrapper_gem_spec.rb
|
@@ -261,8 +263,10 @@ signing_key:
|
|
261
263
|
specification_version: 4
|
262
264
|
summary: Ruby integrations for OpenSearch
|
263
265
|
test_files:
|
264
|
-
- spec/integration/client_integration_spec.rb
|
265
|
-
- spec/integration/validation_integration_spec.rb
|
266
|
+
- spec/integration/security_disabled/client_integration_spec.rb
|
267
|
+
- spec/integration/security_disabled/validation_integration_spec.rb
|
268
|
+
- spec/integration/security_enabled/client_integration_spec.rb
|
269
|
+
- spec/integration/security_enabled/validation_integration_spec.rb
|
266
270
|
- spec/spec_helper.rb
|
267
271
|
- spec/unit/opensearch_product_validation_spec.rb
|
268
272
|
- spec/unit/wrapper_gem_spec.rb
|
metadata.gz.sig
CHANGED
Binary file
|