elasticsearch-transport 6.8.2 → 7.0.0.pre
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.
- checksums.yaml +4 -4
- data/Gemfile +17 -0
- data/LICENSE.txt +199 -10
- data/README.md +32 -86
- data/Rakefile +23 -4
- data/elasticsearch-transport.gemspec +78 -44
- data/lib/elasticsearch-transport.rb +16 -3
- data/lib/elasticsearch/transport.rb +17 -3
- data/lib/elasticsearch/transport/client.rb +62 -85
- data/lib/elasticsearch/transport/redacted.rb +5 -9
- data/lib/elasticsearch/transport/transport/base.rb +63 -55
- data/lib/elasticsearch/transport/transport/connections/collection.rb +16 -3
- data/lib/elasticsearch/transport/transport/connections/connection.rb +16 -3
- data/lib/elasticsearch/transport/transport/connections/selector.rb +16 -3
- data/lib/elasticsearch/transport/transport/errors.rb +16 -3
- data/lib/elasticsearch/transport/transport/http/curb.rb +18 -5
- data/lib/elasticsearch/transport/transport/http/faraday.rb +18 -5
- data/lib/elasticsearch/transport/transport/http/manticore.rb +17 -4
- data/lib/elasticsearch/transport/transport/loggable.rb +85 -0
- data/lib/elasticsearch/transport/transport/response.rb +16 -3
- data/lib/elasticsearch/transport/transport/serializer/multi_json.rb +16 -3
- data/lib/elasticsearch/transport/transport/sniffer.rb +17 -5
- data/lib/elasticsearch/transport/version.rb +17 -4
- data/spec/elasticsearch/transport/base_spec.rb +8 -187
- data/spec/elasticsearch/transport/client_spec.rb +27 -123
- data/spec/elasticsearch/transport/sniffer_spec.rb +19 -0
- data/spec/spec_helper.rb +2 -4
- data/test/integration/transport_test.rb +18 -5
- data/test/profile/client_benchmark_test.rb +16 -3
- data/test/test_helper.rb +63 -14
- data/test/unit/connection_collection_test.rb +17 -4
- data/test/unit/connection_selector_test.rb +17 -4
- data/test/unit/connection_test.rb +17 -4
- data/test/unit/response_test.rb +18 -5
- data/test/unit/serializer_test.rb +17 -4
- data/test/unit/transport_base_test.rb +21 -8
- data/test/unit/transport_curb_test.rb +17 -4
- data/test/unit/transport_faraday_test.rb +17 -4
- data/test/unit/transport_manticore_test.rb +24 -6
- metadata +67 -76
@@ -229,6 +229,25 @@ describe Elasticsearch::Transport::Transport::Sniffer do
|
|
229
229
|
it 'correctly parses the port' do
|
230
230
|
expect(hosts[0][:port]).to eq('9250')
|
231
231
|
end
|
232
|
+
|
233
|
+
context 'when the address is IPv6' do
|
234
|
+
|
235
|
+
let(:publish_address) do
|
236
|
+
'example.com/[::1]:9250'
|
237
|
+
end
|
238
|
+
|
239
|
+
it 'parses the response' do
|
240
|
+
expect(hosts.size).to eq(1)
|
241
|
+
end
|
242
|
+
|
243
|
+
it 'uses the hostname' do
|
244
|
+
expect(hosts[0][:host]).to eq('example.com')
|
245
|
+
end
|
246
|
+
|
247
|
+
it 'correctly parses the port' do
|
248
|
+
expect(hosts[0][:port]).to eq('9250')
|
249
|
+
end
|
250
|
+
end
|
232
251
|
end
|
233
252
|
|
234
253
|
context 'when the address is IPv6' do
|
data/spec/spec_helper.rb
CHANGED
@@ -1,7 +1,3 @@
|
|
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
1
|
require 'elasticsearch'
|
6
2
|
require 'elasticsearch-transport'
|
7
3
|
require 'logger'
|
@@ -18,6 +14,8 @@ ELASTICSEARCH_HOSTS = if hosts = ENV['TEST_ES_SERVER'] || ENV['ELASTICSEARCH_HOS
|
|
18
14
|
end
|
19
15
|
end.freeze
|
20
16
|
|
17
|
+
TEST_HOST, TEST_PORT = ELASTICSEARCH_HOSTS.first.split(':') if ELASTICSEARCH_HOSTS
|
18
|
+
|
21
19
|
# Are we testing on JRuby?
|
22
20
|
#
|
23
21
|
# @return [ true, false ] Whether JRuby is being used.
|
@@ -1,6 +1,19 @@
|
|
1
|
-
# Licensed to Elasticsearch B.V under one or more
|
2
|
-
#
|
3
|
-
#
|
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 'test_helper'
|
6
19
|
|
@@ -52,7 +65,7 @@ class Elasticsearch::Transport::ClientIntegrationTest < Elasticsearch::Test::Int
|
|
52
65
|
require 'elasticsearch/transport/transport/http/curb'
|
53
66
|
|
54
67
|
transport = Elasticsearch::Transport::Transport::HTTP::Curb.new \
|
55
|
-
:hosts => [ { host: @host, port: @port } ]
|
68
|
+
:hosts => [ { host: @host, port: @port } ] do |curl|
|
56
69
|
curl.verbose = true
|
57
70
|
end
|
58
71
|
|
@@ -65,7 +78,7 @@ class Elasticsearch::Transport::ClientIntegrationTest < Elasticsearch::Test::Int
|
|
65
78
|
require 'elasticsearch/transport/transport/http/curb'
|
66
79
|
|
67
80
|
transport = Elasticsearch::Transport::Transport::HTTP::Curb.new \
|
68
|
-
:hosts => [ { host: @host, port: @port } ]
|
81
|
+
:hosts => [ { host: @host, port: @port } ] do |curl|
|
69
82
|
curl.verbose = true
|
70
83
|
end
|
71
84
|
|
@@ -1,6 +1,19 @@
|
|
1
|
-
# Licensed to Elasticsearch B.V under one or more
|
2
|
-
#
|
3
|
-
#
|
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 'test_helper'
|
6
19
|
|
data/test/test_helper.rb
CHANGED
@@ -1,9 +1,20 @@
|
|
1
|
-
# Licensed to Elasticsearch B.V under one or more
|
2
|
-
#
|
3
|
-
#
|
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
|
-
RUBY_1_8 = defined?(RUBY_VERSION) && RUBY_VERSION < '1.9'
|
6
|
-
JRUBY = defined?(JRUBY_VERSION)
|
7
18
|
|
8
19
|
ELASTICSEARCH_HOSTS = if hosts = ENV['TEST_ES_SERVER'] || ENV['ELASTICSEARCH_HOSTS']
|
9
20
|
hosts.split(',').map do |host|
|
@@ -11,6 +22,11 @@ ELASTICSEARCH_HOSTS = if hosts = ENV['TEST_ES_SERVER'] || ENV['ELASTICSEARCH_HOS
|
|
11
22
|
end
|
12
23
|
end.freeze
|
13
24
|
|
25
|
+
TEST_HOST, TEST_PORT = ELASTICSEARCH_HOSTS.first.split(':') if ELASTICSEARCH_HOSTS
|
26
|
+
|
27
|
+
RUBY_1_8 = defined?(RUBY_VERSION) && RUBY_VERSION < '1.9'
|
28
|
+
JRUBY = defined?(JRUBY_VERSION)
|
29
|
+
|
14
30
|
if RUBY_1_8 and not ENV['BUNDLE_GEMFILE']
|
15
31
|
require 'rubygems'
|
16
32
|
gem 'test-unit'
|
@@ -36,11 +52,12 @@ if defined?(RUBY_VERSION) && RUBY_VERSION > '1.9'
|
|
36
52
|
at_exit { Elasticsearch::Test::IntegrationTestCase.__run_at_exit_hooks }
|
37
53
|
end
|
38
54
|
|
39
|
-
require 'test/unit'
|
40
|
-
require '
|
41
|
-
require '
|
55
|
+
require 'test/unit' if RUBY_1_8
|
56
|
+
require 'minitest/autorun'
|
57
|
+
require 'minitest/reporters'
|
58
|
+
require 'shoulda/context'
|
59
|
+
require 'mocha/minitest'
|
42
60
|
require 'ansi/code'
|
43
|
-
require 'turn' unless ENV["TM_FILEPATH"] || ENV["NOTURN"] || RUBY_1_8
|
44
61
|
|
45
62
|
require 'require-prof' if ENV["REQUIRE_PROF"]
|
46
63
|
require 'elasticsearch-transport'
|
@@ -56,17 +73,49 @@ if defined?(RUBY_VERSION) && RUBY_VERSION > '1.9'
|
|
56
73
|
require 'elasticsearch/extensions/test/profiling' unless JRUBY
|
57
74
|
end
|
58
75
|
|
59
|
-
class
|
60
|
-
def
|
76
|
+
class FixedMinitestSpecReporter < Minitest::Reporters::SpecReporter
|
77
|
+
def before_test(test)
|
78
|
+
last_test = tests.last
|
79
|
+
|
80
|
+
before_suite(test.class) unless last_test
|
81
|
+
|
82
|
+
if last_test && last_test.klass.to_s != test.class.to_s
|
83
|
+
after_suite(last_test.class) if last_test
|
84
|
+
before_suite(test.class)
|
85
|
+
end
|
61
86
|
end
|
87
|
+
end
|
62
88
|
|
63
|
-
|
89
|
+
module Minitest
|
90
|
+
class Test
|
91
|
+
def assert_nothing_raised(*args)
|
92
|
+
begin
|
93
|
+
line = __LINE__
|
94
|
+
yield
|
95
|
+
rescue RuntimeError => e
|
96
|
+
raise MiniTest::Assertion, "Exception raised:\n<#{e.class}>", e.backtrace
|
97
|
+
end
|
98
|
+
true
|
99
|
+
end
|
100
|
+
|
101
|
+
def assert_not_nil(object, msg=nil)
|
102
|
+
msg = message(msg) { "<#{object.inspect}> expected to not be nil" }
|
103
|
+
assert !object.nil?, msg
|
104
|
+
end
|
105
|
+
|
106
|
+
def assert_block(*msgs)
|
107
|
+
assert yield, *msgs
|
108
|
+
end
|
109
|
+
|
110
|
+
alias :assert_raise :assert_raises
|
64
111
|
end
|
65
112
|
end
|
66
113
|
|
114
|
+
Minitest::Reporters.use! FixedMinitestSpecReporter.new
|
115
|
+
|
67
116
|
module Elasticsearch
|
68
117
|
module Test
|
69
|
-
class IntegrationTestCase < ::Test
|
118
|
+
class IntegrationTestCase < Minitest::Test
|
70
119
|
extend Elasticsearch::Extensions::Test::StartupShutdown
|
71
120
|
|
72
121
|
shutdown { Elasticsearch::Extensions::Test::Cluster.stop if ENV['SERVER'] && started? && Elasticsearch::Extensions::Test::Cluster.running? }
|
@@ -75,7 +124,7 @@ module Elasticsearch
|
|
75
124
|
end
|
76
125
|
|
77
126
|
module Test
|
78
|
-
class ProfilingTest < ::Test
|
127
|
+
class ProfilingTest < Minitest::Test
|
79
128
|
extend Elasticsearch::Extensions::Test::StartupShutdown
|
80
129
|
extend Elasticsearch::Extensions::Test::Profiling
|
81
130
|
|
@@ -1,10 +1,23 @@
|
|
1
|
-
# Licensed to Elasticsearch B.V under one or more
|
2
|
-
#
|
3
|
-
#
|
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 'test_helper'
|
6
19
|
|
7
|
-
class Elasticsearch::Transport::Transport::Connections::CollectionTest < Test
|
20
|
+
class Elasticsearch::Transport::Transport::Connections::CollectionTest < Minitest::Test
|
8
21
|
include Elasticsearch::Transport::Transport::Connections
|
9
22
|
|
10
23
|
context "Connection collection" do
|
@@ -1,10 +1,23 @@
|
|
1
|
-
# Licensed to Elasticsearch B.V under one or more
|
2
|
-
#
|
3
|
-
#
|
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 'test_helper'
|
6
19
|
|
7
|
-
class Elasticsearch::Transport::Transport::Connections::SelectorTest < Test
|
20
|
+
class Elasticsearch::Transport::Transport::Connections::SelectorTest < Minitest::Test
|
8
21
|
include Elasticsearch::Transport::Transport::Connections::Selector
|
9
22
|
|
10
23
|
class DummyStrategySelector
|
@@ -1,10 +1,23 @@
|
|
1
|
-
# Licensed to Elasticsearch B.V under one or more
|
2
|
-
#
|
3
|
-
#
|
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 'test_helper'
|
6
19
|
|
7
|
-
class Elasticsearch::Transport::Transport::Connections::ConnectionTest < Test
|
20
|
+
class Elasticsearch::Transport::Transport::Connections::ConnectionTest < Minitest::Test
|
8
21
|
include Elasticsearch::Transport::Transport::Connections
|
9
22
|
|
10
23
|
context "Connection" do
|
data/test/unit/response_test.rb
CHANGED
@@ -1,10 +1,23 @@
|
|
1
|
-
# Licensed to Elasticsearch B.V under one or more
|
2
|
-
#
|
3
|
-
#
|
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 'test_helper'
|
6
19
|
|
7
|
-
class Elasticsearch::Transport::Transport::ResponseTest < Test
|
20
|
+
class Elasticsearch::Transport::Transport::ResponseTest < Minitest::Test
|
8
21
|
context "Response" do
|
9
22
|
|
10
23
|
should "force-encode the body into UTF" do
|
@@ -16,4 +29,4 @@ class Elasticsearch::Transport::Transport::ResponseTest < Test::Unit::TestCase
|
|
16
29
|
end unless RUBY_1_8
|
17
30
|
|
18
31
|
end
|
19
|
-
end
|
32
|
+
end
|
@@ -1,10 +1,23 @@
|
|
1
|
-
# Licensed to Elasticsearch B.V under one or more
|
2
|
-
#
|
3
|
-
#
|
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 'test_helper'
|
6
19
|
|
7
|
-
class Elasticsearch::Transport::Transport::SerializerTest < Test
|
20
|
+
class Elasticsearch::Transport::Transport::SerializerTest < Minitest::Test
|
8
21
|
|
9
22
|
context "Serializer" do
|
10
23
|
|
@@ -1,10 +1,23 @@
|
|
1
|
-
# Licensed to Elasticsearch B.V under one or more
|
2
|
-
#
|
3
|
-
#
|
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 'test_helper'
|
6
19
|
|
7
|
-
class Elasticsearch::Transport::Transport::BaseTest < Test
|
20
|
+
class Elasticsearch::Transport::Transport::BaseTest < Minitest::Test
|
8
21
|
|
9
22
|
class EmptyTransport
|
10
23
|
include Elasticsearch::Transport::Transport::Base
|
@@ -243,7 +256,7 @@ class Elasticsearch::Transport::Transport::BaseTest < Test::Unit::TestCase
|
|
243
256
|
@transport.expects(:get_connection).returns(stub_everything :failures => 1)
|
244
257
|
|
245
258
|
# `block.expects(:call).raises(::Errno::ECONNREFUSED)` fails on Ruby 1.8
|
246
|
-
block = lambda { |a,
|
259
|
+
block = lambda { |a,b| raise ::Errno::ECONNREFUSED }
|
247
260
|
|
248
261
|
assert_raise ::Errno::ECONNREFUSED do
|
249
262
|
@transport.perform_request 'GET', '/', &block
|
@@ -428,7 +441,7 @@ class Elasticsearch::Transport::Transport::BaseTest < Test::Unit::TestCase
|
|
428
441
|
@block = Proc.new { |c, u| puts "ERROR" }
|
429
442
|
@block.expects(:call).returns(Elasticsearch::Transport::Transport::Response.new 500, 'ERROR')
|
430
443
|
|
431
|
-
@transport.expects(:
|
444
|
+
@transport.expects(:__log_response)
|
432
445
|
@transport.logger.expects(:fatal)
|
433
446
|
|
434
447
|
assert_raise Elasticsearch::Transport::Transport::Errors::InternalServerError do
|
@@ -440,7 +453,7 @@ class Elasticsearch::Transport::Transport::BaseTest < Test::Unit::TestCase
|
|
440
453
|
@block = Proc.new { |c, u| puts "ERROR" }
|
441
454
|
@block.expects(:call).returns(Elasticsearch::Transport::Transport::Response.new 500, 'ERROR')
|
442
455
|
|
443
|
-
@transport.expects(:
|
456
|
+
@transport.expects(:__log_response).once
|
444
457
|
@transport.logger.expects(:fatal).never
|
445
458
|
|
446
459
|
# No `BadRequest` error
|
@@ -451,7 +464,7 @@ class Elasticsearch::Transport::Transport::BaseTest < Test::Unit::TestCase
|
|
451
464
|
@block = Proc.new { |c, u| puts "ERROR" }
|
452
465
|
@block.expects(:call).raises(Exception)
|
453
466
|
|
454
|
-
@transport.expects(:
|
467
|
+
@transport.expects(:__log_response).never
|
455
468
|
@transport.logger.expects(:fatal)
|
456
469
|
|
457
470
|
assert_raise(Exception) { @transport.perform_request('POST', '_search', &@block) }
|
@@ -1,6 +1,19 @@
|
|
1
|
-
# Licensed to Elasticsearch B.V under one or more
|
2
|
-
#
|
3
|
-
#
|
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 'test_helper'
|
6
19
|
|
@@ -10,7 +23,7 @@ else
|
|
10
23
|
require 'elasticsearch/transport/transport/http/curb'
|
11
24
|
require 'curb'
|
12
25
|
|
13
|
-
class Elasticsearch::Transport::Transport::HTTP::FaradayTest < Test
|
26
|
+
class Elasticsearch::Transport::Transport::HTTP::FaradayTest < Minitest::Test
|
14
27
|
include Elasticsearch::Transport::Transport::HTTP
|
15
28
|
|
16
29
|
context "Curb transport" do
|