elasticsearch 7.5.0 → 7.16.1

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: e03507793a399f034a75f2ad1295ee23eff93ba9ef418f100faa52a0fcc5dddc
4
- data.tar.gz: 3edba11665ca1accdacf81e33528bac29eb71ab41b5bb86b3d89adbf7fc2f026
3
+ metadata.gz: '09e6b06d07bf9c649bd9214313a2a22e9e60f240e6ff6106b58004d7ab1e5634'
4
+ data.tar.gz: f8c0451361d9c6595accbed70e119b4c27132778e077facbde7095279de063e8
5
5
  SHA512:
6
- metadata.gz: '0921118b380f2f697f6637c8e5e66ea27c3f11c4756fc342ee7e9ebe2f4ea6e68db61b8cbb7cea6925e6a0a36c4300c108bce42269117551df6e346b640431ce'
7
- data.tar.gz: ade6181520502700dcad0e720a8e93a7f8e18339eff2e600a72a2f96f301833a9ea55ec63195b6e991c260a33e9ef9e9a6ba44605e27888b4555ad70d117d2b3
6
+ metadata.gz: 45fee5845c4ac6f90e42aaf6ad4efe846f9e4d9d949aa9b947cfb8601032ed9d9f2a51ceff62ce302657635f56285519bf44dc7a25c0fe8113df247a31c2dee2
7
+ data.tar.gz: 65b2c8ba484a54328da3bd26f089e22a305582e764e10a68e50730e88468b045f0ecae234640b55b0b41cda3be378ed6641428b43d7babc7ac5acae8c3e72e40
data/Gemfile CHANGED
@@ -1,6 +1,19 @@
1
- # Licensed to Elasticsearch B.V under one or more agreements.
2
- # Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3
- # See the LICENSE file in the project root for more information
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
4
17
 
5
18
  source 'https://rubygems.org'
6
19
 
data/README.md CHANGED
@@ -86,6 +86,10 @@ Please refer to the specific library documentation for details:
86
86
  [[README]](https://github.com/elasticsearch/elasticsearch-ruby/blob/master/elasticsearch-api/README.md)
87
87
  [[Documentation]](http://rubydoc.info/gems/elasticsearch-api/file/README.markdown)
88
88
 
89
+ ## Development
90
+
91
+ You can run `rake -T` to check the test tasks. Use `COVERAGE=true` before running a test task to check the coverage with Simplecov.
92
+
89
93
  ## License
90
94
 
91
95
  This software is licensed under the [Apache 2 license](./LICENSE).
data/Rakefile CHANGED
@@ -1,42 +1,49 @@
1
- # Licensed to Elasticsearch B.V under one or more agreements.
2
- # Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3
- # See the LICENSE file in the project root for more information
4
-
5
- require "bundler/gem_tasks"
6
-
7
- desc "Run unit tests"
8
- task :test => 'test:unit'
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ require 'bundler/gem_tasks'
19
+
20
+ task(:default) { system 'rake --tasks' }
21
+
22
+ desc 'Run unit tests'
23
+ task test: 'test:spec'
9
24
 
10
25
  # ----- Test tasks ------------------------------------------------------------
26
+ require 'rspec/core/rake_task'
11
27
 
12
- require 'rake/testtask'
13
28
  namespace :test do
14
-
15
- desc "Wait for Elasticsearch to be in a green state"
29
+ desc 'Wait for Elasticsearch to be in a green state'
16
30
  task :wait_for_green do
17
31
  sh '../scripts/wait-cluster.sh'
18
32
  end
19
33
 
20
- Rake::TestTask.new(:unit) do |test|
21
- test.libs << 'lib' << 'test'
22
- test.test_files = FileList["test/unit/**/*_test.rb"]
23
- test.verbose = false
24
- test.warning = false
34
+ RSpec::Core::RakeTask.new(:integration) do |t|
35
+ t.pattern = 'spec/integration/**{,/*/**}/*_spec.rb'
25
36
  end
26
37
 
27
- Rake::TestTask.new(:integration) do |test|
28
- test.deps = [ :wait_for_green ]
29
- test.libs << 'lib' << 'test'
30
- test.test_files = FileList["test/integration/**/*_test.rb"]
31
- test.verbose = false
32
- test.warning = false
38
+ RSpec::Core::RakeTask.new(:unit) do |t|
39
+ t.pattern = 'spec/unit/**{,/*/**}/*_spec.rb'
33
40
  end
34
41
 
35
- Rake::TestTask.new(:all) do |test|
36
- test.libs << 'lib' << 'test'
37
- test.test_files = FileList["test/unit/**/*_test.rb", "test/integration/**/*_test.rb"]
42
+ desc 'Run unit and integration tests'
43
+ task :all do
44
+ Rake::Task['test:unit'].invoke
45
+ Rake::Task['test:integration'].invoke
38
46
  end
39
-
40
47
  end
41
48
 
42
49
  # ----- Documentation tasks ---------------------------------------------------
@@ -1,72 +1,63 @@
1
- # Licensed to Elasticsearch B.V under one or more agreements.
2
- # Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3
- # See the LICENSE file in the project root for more information
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
4
17
 
5
18
  lib = File.expand_path('../lib', __FILE__)
6
19
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
7
20
  require 'elasticsearch/version'
8
21
 
9
22
  Gem::Specification.new do |s|
10
- s.name = "elasticsearch"
23
+ s.name = 'elasticsearch'
11
24
  s.version = Elasticsearch::VERSION
12
- s.authors = ["Karel Minarik"]
13
- s.email = ["karel.minarik@elasticsearch.org"]
14
- s.summary = "Ruby integrations for Elasticsearch"
15
- s.homepage = "http://github.com/elasticsearch/elasticsearch-ruby"
16
- s.license = "Apache-2.0"
17
-
25
+ s.authors = ['Karel Minarik']
26
+ s.email = ['karel.minarik@elasticsearch.org']
27
+ s.summary = 'Ruby integrations for Elasticsearch'
28
+ s.homepage = 'https://www.elastic.co/guide/en/elasticsearch/client/ruby-api/7.16/index.html'
29
+ s.license = 'Apache-2.0'
30
+ s.metadata = {
31
+ 'homepage_uri' => 'https://www.elastic.co/guide/en/elasticsearch/client/ruby-api/7.16/index.html',
32
+ 'changelog_uri' => 'https://github.com/elastic/elasticsearch-ruby/blob/7.16/CHANGELOG.md',
33
+ 'source_code_uri' => 'https://github.com/elastic/elasticsearch-ruby/tree/7.16',
34
+ 'bug_tracker_uri' => 'https://github.com/elastic/elasticsearch-ruby/issues'
35
+ }
18
36
  s.files = `git ls-files`.split($/)
19
37
  s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
38
  s.executables << 'elastic_ruby_console'
21
39
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
22
- s.require_paths = ["lib"]
23
- s.bindir = "bin"
24
-
25
- s.extra_rdoc_files = [ "README.md", "LICENSE" ]
26
- s.rdoc_options = [ "--charset=UTF-8" ]
27
-
28
- s.required_ruby_version = '>= 1.9'
29
-
30
- s.add_dependency "elasticsearch-transport", '7.5.0'
31
- s.add_dependency "elasticsearch-api", '7.5.0'
32
-
33
- s.add_development_dependency "bundler"
34
-
35
- if defined?(RUBY_VERSION) && RUBY_VERSION > '1.9'
36
- s.add_development_dependency "rake", "~> 11.1"
37
- else
38
- s.add_development_dependency "rake", "< 11.0"
39
- end
40
-
41
- if defined?(RUBY_VERSION) && RUBY_VERSION > '1.9'
42
- s.add_development_dependency "elasticsearch-extensions"
43
- end
40
+ s.require_paths = ['lib']
41
+ s.bindir = 'bin'
44
42
 
45
- s.add_development_dependency "ansi"
46
- s.add_development_dependency "shoulda-context"
47
- s.add_development_dependency "mocha"
48
- s.add_development_dependency "yard"
49
- s.add_development_dependency "pry"
43
+ s.extra_rdoc_files = [ 'README.md', 'LICENSE' ]
44
+ s.rdoc_options = [ '--charset=UTF-8' ]
50
45
 
51
- # Prevent unit test failures on Ruby 1.8
52
- if defined?(RUBY_VERSION) && RUBY_VERSION < '1.9'
53
- s.add_development_dependency "test-unit", '~> 2'
54
- s.add_development_dependency "json", '~> 1.8'
55
- end
46
+ s.required_ruby_version = '>= 2.4'
56
47
 
57
- if defined?(RUBY_VERSION) && RUBY_VERSION > '1.9'
58
- s.add_development_dependency "minitest"
59
- s.add_development_dependency "minitest-reporters"
60
- s.add_development_dependency "ruby-prof" unless defined?(JRUBY_VERSION) || defined?(Rubinius)
61
- s.add_development_dependency "require-prof" unless defined?(JRUBY_VERSION) || defined?(Rubinius)
62
- s.add_development_dependency "simplecov", '~> 0.17', '< 0.18'
63
- s.add_development_dependency "simplecov-rcov"
64
- s.add_development_dependency "cane"
65
- end
48
+ s.add_dependency 'elasticsearch-transport', '7.16.1'
49
+ s.add_dependency 'elasticsearch-api', '7.16.1'
66
50
 
67
- if defined?(RUBY_VERSION) && RUBY_VERSION > '2.2'
68
- s.add_development_dependency "test-unit", '~> 2'
69
- end
51
+ s.add_development_dependency 'bundler'
52
+ s.add_development_dependency 'byebug' unless defined?(JRUBY_VERSION) || defined?(Rubinius)
53
+ s.add_development_dependency 'pry'
54
+ s.add_development_dependency 'rake', '~> 13'
55
+ s.add_development_dependency 'require-prof' unless defined?(JRUBY_VERSION) || defined?(Rubinius)
56
+ s.add_development_dependency 'rspec'
57
+ s.add_development_dependency 'ruby-prof' unless defined?(JRUBY_VERSION) || defined?(Rubinius)
58
+ s.add_development_dependency 'simplecov'
59
+ s.add_development_dependency 'webmock'
60
+ s.add_development_dependency 'yard'
70
61
 
71
62
  s.description = <<-DESC.gsub(/^ /, '')
72
63
  Ruby integrations for Elasticsearch (client, API, etc.)
@@ -1,7 +1,20 @@
1
- # Licensed to Elasticsearch B.V under one or more agreements.
2
- # Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3
- # See the LICENSE file in the project root for more information
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
4
17
 
5
18
  module Elasticsearch
6
- VERSION = "7.5.0"
19
+ VERSION = '7.16.1'.freeze
7
20
  end
@@ -1,5 +1,18 @@
1
- # Licensed to Elasticsearch B.V under one or more agreements.
2
- # Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3
- # See the LICENSE file in the project root for more information
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
4
17
 
5
18
  require 'elasticsearch'
data/lib/elasticsearch.rb CHANGED
@@ -1,16 +1,115 @@
1
- # Licensed to Elasticsearch B.V under one or more agreements.
2
- # Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3
- # See the LICENSE file in the project root for more information
4
-
5
- require "elasticsearch/version"
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
6
17
 
18
+ require 'elasticsearch/version'
7
19
  require 'elasticsearch/transport'
8
20
  require 'elasticsearch/api'
9
21
 
10
22
  module Elasticsearch
11
- module Transport
12
- class Client
13
- include Elasticsearch::API
23
+ SECURITY_PRIVILEGES_VALIDATION_WARNING = 'The client is unable to verify that the server is Elasticsearch due to security privileges on the server side. Some functionality may not be compatible if the server is running an unsupported product.'.freeze
24
+ NOT_ELASTICSEARCH_WARNING = 'The client noticed that the server is not Elasticsearch and we do not support this unknown product.'.freeze
25
+ NOT_SUPPORTED_ELASTICSEARCH_WARNING = 'The client noticed that the server is not a supported distribution of Elasticsearch.'.freeze
26
+ YOU_KNOW_FOR_SEARCH = 'You Know, for Search'.freeze
27
+
28
+ class Client
29
+ include Elasticsearch::API
30
+ attr_accessor :transport
31
+
32
+ # See Elasticsearch::Transport::Client for initializer parameters
33
+ def initialize(arguments = {}, &block)
34
+ @verified = false
35
+ @transport = Elasticsearch::Transport::Client.new(arguments, &block)
14
36
  end
37
+
38
+ def method_missing(name, *args, &block)
39
+ if name == :perform_request
40
+ verify_elasticsearch unless @verified
41
+ @transport.perform_request(*args, &block)
42
+ else
43
+ super
44
+ end
45
+ end
46
+
47
+ private
48
+
49
+ def verify_elasticsearch
50
+ begin
51
+ response = elasticsearch_validation_request
52
+ rescue Elasticsearch::Transport::Transport::Errors::Unauthorized,
53
+ Elasticsearch::Transport::Transport::Errors::Forbidden
54
+ @verified = true
55
+ warn(SECURITY_PRIVILEGES_VALIDATION_WARNING)
56
+ return
57
+ end
58
+
59
+ body = if response.headers['content-type'] == 'application/yaml'
60
+ require 'yaml'
61
+ YAML.load(response.body)
62
+ else
63
+ response.body
64
+ end
65
+ version = body.dig('version', 'number')
66
+ verify_with_version_or_header(body, version, response.headers)
67
+ end
68
+
69
+ def verify_with_version_or_header(body, version, headers)
70
+ raise Elasticsearch::UnsupportedProductError if version.nil? || version < '6.0.0'
71
+
72
+ if version == '7.x-SNAPSHOT' || Gem::Version.new(version) >= Gem::Version.new('7.14-SNAPSHOT')
73
+ raise Elasticsearch::UnsupportedProductError unless headers['x-elastic-product'] == 'Elasticsearch'
74
+
75
+ @verified = true
76
+ elsif Gem::Version.new(version) > Gem::Version.new('6.0.0') &&
77
+ Gem::Version.new(version) < Gem::Version.new('7.0.0')
78
+ raise Elasticsearch::UnsupportedProductError unless
79
+ body['tagline'] == YOU_KNOW_FOR_SEARCH
80
+
81
+ @verified = true
82
+ elsif Gem::Version.new(version) >= Gem::Version.new('7.0.0') &&
83
+ Gem::Version.new(version) < Gem::Version.new('7.14-SNAPSHOT')
84
+ raise Elasticsearch::UnsupportedProductError unless body['tagline'] == YOU_KNOW_FOR_SEARCH
85
+ raise Elasticsearch::UnsupportedProductError.new(NOT_SUPPORTED_ELASTICSEARCH_WARNING) unless body.dig('version', 'build_flavor') == 'default'
86
+
87
+ @verified = true
88
+ end
89
+ end
90
+
91
+ def elasticsearch_validation_request
92
+ @transport.perform_request('GET', '/')
93
+ end
94
+ end
95
+
96
+ class UnsupportedProductError < StandardError
97
+ def initialize(message = NOT_ELASTICSEARCH_WARNING)
98
+ super(message)
99
+ end
100
+ end
101
+ end
102
+
103
+ module Elastic
104
+ # If the version is X.X.X.pre/alpha/beta, use X.X.Xp for the meta-header:
105
+ def self.client_meta_version
106
+ regexp = /^([0-9]+\.[0-9]+\.[0-9]+)\.?([a-z0-9.-]+)?$/
107
+ match = Elasticsearch::VERSION.match(regexp)
108
+ return "#{match[1]}p" if match[2]
109
+
110
+ Elasticsearch::VERSION
15
111
  end
112
+
113
+ # Constant for elasticsearch-transport meta-header
114
+ ELASTICSEARCH_SERVICE_VERSION = [:es, client_meta_version].freeze
16
115
  end
@@ -0,0 +1,57 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+ require 'spec_helper'
18
+ require 'logger'
19
+
20
+ context 'Elasticsearch client' do
21
+ let(:logger) { Logger.new($stderr) }
22
+
23
+ let(:client) do
24
+ Elasticsearch::Client.new(
25
+ host: ELASTICSEARCH_URL,
26
+ logger: logger
27
+ )
28
+ end
29
+
30
+ context 'Integrates with elasticsearch API' do
31
+ it 'should perform the API methods' do
32
+ expect do
33
+ # Index a document
34
+ client.index(index: 'test-index', id: '1', body: { title: 'Test' })
35
+
36
+ # Refresh the index
37
+ client.indices.refresh(index: 'test-index')
38
+
39
+ # Search
40
+ response = client.search(index: 'test-index', body: { query: { match: { title: 'test' } } })
41
+
42
+ expect(response['hits']['total']['value']).to eq 1
43
+ expect(response['hits']['hits'][0]['_source']['title']).to eq 'Test'
44
+
45
+ # Delete the index
46
+ client.indices.delete(index: 'test-index')
47
+ end.not_to raise_error
48
+ end
49
+ end
50
+
51
+ context 'Reports the right meta header' do
52
+ it 'Reports es service name and gem version' do
53
+ headers = client.transport.transport.connections.first.connection.headers
54
+ expect(headers['x-elastic-client-meta']).to match Elastic.client_meta_version
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,30 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+ require 'spec_helper'
18
+ require 'logger'
19
+
20
+ describe 'Elasticsearch validation integration' do
21
+ it 'Validates for Elasticsearch > 7.14' do
22
+ client = Elasticsearch::Client.new(
23
+ host: ELASTICSEARCH_URL,
24
+ logger: Logger.new($stderr)
25
+ )
26
+ expect(client.instance_variable_get('@verified')).to be false
27
+ client.count
28
+ expect(client.instance_variable_get('@verified')).to be true
29
+ end
30
+ end
@@ -0,0 +1,26 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ require 'elasticsearch'
19
+ require 'rspec'
20
+
21
+ ELASTICSEARCH_URL = ENV['TEST_ES_SERVER'] || "http://localhost:#{(ENV['PORT'] || 9200)}"
22
+ raise URI::InvalidURIError unless ELASTICSEARCH_URL =~ /\A#{URI::DEFAULT_PARSER.make_regexp}\z/
23
+
24
+ RSpec.configure do |config|
25
+ config.formatter = :documentation
26
+ end