elasticsearch-transport 1.0.17 → 1.0.18
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edd2a65c4ed276f82bcb814fcaeef9e52b051b8d
|
4
|
+
data.tar.gz: d90638bf86192e4d0c1c6f47c8229bd08868abbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7970770618a8f702964fe26b52ad92dc4fa0fd69b079bb415fee76f8bc1292320ea2f54e94676c9536469afa93a34e3d52b00ea251d2ac79da6094523b879d8
|
7
|
+
data.tar.gz: 017d031ab40353eaa29c6950250e13b92d871b9bbb093d346044f0cca11f1d024888d8d69a684f0c038f0e1bfa51c53a3dfed70a63b5477c2e31cd79debce82b
|
@@ -28,7 +28,12 @@ Gem::Specification.new do |s|
|
|
28
28
|
end
|
29
29
|
|
30
30
|
s.add_development_dependency "bundler", "> 1"
|
31
|
-
|
31
|
+
|
32
|
+
if defined?(RUBY_VERSION) && RUBY_VERSION > '1.9'
|
33
|
+
s.add_development_dependency "rake", "~> 11.1"
|
34
|
+
else
|
35
|
+
s.add_development_dependency "rake", "< 11.0"
|
36
|
+
end
|
32
37
|
|
33
38
|
if defined?(RUBY_VERSION) && RUBY_VERSION > '1.9'
|
34
39
|
s.add_development_dependency "elasticsearch-extensions"
|
@@ -108,7 +108,7 @@ module Elasticsearch
|
|
108
108
|
__close_connections
|
109
109
|
|
110
110
|
new_connections = __build_connections
|
111
|
-
stale_connections = @connections.select { |c| ! new_connections.include?(c) }
|
111
|
+
stale_connections = @connections.all.select { |c| ! new_connections.include?(c) }
|
112
112
|
new_connections = new_connections.reject { |c| @connections.include?(c) }
|
113
113
|
|
114
114
|
@connections.remove(stale_connections)
|
@@ -312,7 +312,7 @@ module Elasticsearch
|
|
312
312
|
__raise_transport_error response
|
313
313
|
end
|
314
314
|
|
315
|
-
json = serializer.load(response.body) if response.headers && response.headers["content-type"] =~ /json/
|
315
|
+
json = serializer.load(response.body) if response.body && !response.body.empty? && response.headers && response.headers["content-type"] =~ /json/
|
316
316
|
took = (json['took'] ? sprintf('%.3fs', json['took']/1000.0) : 'n/a') rescue 'n/a' if logger || tracer
|
317
317
|
|
318
318
|
__log method, path, params, body, url, response, json, took, duration if logger
|
@@ -185,6 +185,17 @@ class Elasticsearch::Transport::Transport::BaseTest < Test::Unit::TestCase
|
|
185
185
|
assert_equal 'FOOBAR', response.body
|
186
186
|
end
|
187
187
|
|
188
|
+
should "not deserialize an empty response body" do
|
189
|
+
@transport.expects(:get_connection).returns(stub_everything :failures => 1)
|
190
|
+
@transport.serializer.expects(:load).never
|
191
|
+
response = @transport.perform_request 'GET', '/' do
|
192
|
+
Elasticsearch::Transport::Transport::Response.new 200, '', {"content-type" => 'application/json'}
|
193
|
+
end
|
194
|
+
|
195
|
+
assert_instance_of Elasticsearch::Transport::Transport::Response, response
|
196
|
+
assert_equal '', response.body
|
197
|
+
end
|
198
|
+
|
188
199
|
should "serialize non-String objects" do
|
189
200
|
@transport.serializer.expects(:dump).times(3)
|
190
201
|
@transport.__convert_to_json({:foo => 'bar'})
|
@@ -504,6 +515,20 @@ class Elasticsearch::Transport::Transport::BaseTest < Test::Unit::TestCase
|
|
504
515
|
assert_equal 2, @transport.connections.size
|
505
516
|
assert_equal old_connection_id, @transport.connections.first.object_id
|
506
517
|
end
|
518
|
+
|
519
|
+
should "remove dead connections" do
|
520
|
+
@transport.__rebuild_connections :hosts => [ { :host => 'node1', :port => 1 },
|
521
|
+
{ :host => 'node2', :port => 2 } ],
|
522
|
+
:options => { :http => {} }
|
523
|
+
assert_equal 2, @transport.connections.size
|
524
|
+
|
525
|
+
@transport.connections[1].dead!
|
526
|
+
|
527
|
+
@transport.__rebuild_connections :hosts => [ { :host => 'node1', :port => 1 } ], :options => { :http => {} }
|
528
|
+
|
529
|
+
assert_equal 1, @transport.connections.size
|
530
|
+
assert_equal 1, @transport.connections.all.size
|
531
|
+
end
|
507
532
|
end
|
508
533
|
|
509
534
|
context "rebuilding connections" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticsearch-transport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karel Minarik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -56,16 +56,16 @@ dependencies:
|
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '11.
|
61
|
+
version: '11.1'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '11.
|
68
|
+
version: '11.1'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: elasticsearch-extensions
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|