elasticsearch-transport 0.4.5 → 0.4.6
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.
@@ -28,7 +28,7 @@ module Elasticsearch
|
|
28
28
|
#
|
29
29
|
def hosts
|
30
30
|
Timeout::timeout(timeout, SnifferTimeoutError) do
|
31
|
-
nodes = transport.perform_request('GET', '
|
31
|
+
nodes = transport.perform_request('GET', '_nodes').body
|
32
32
|
hosts = nodes['nodes'].map do |id,info|
|
33
33
|
if matches = info["#{transport.protocol}_address"].to_s.match(RE_URL)
|
34
34
|
# TODO: Implement lightweight "indifferent access" here
|
@@ -2,7 +2,7 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class Elasticsearch::Transport::ClientIntegrationTest < Elasticsearch::Test::IntegrationTestCase
|
4
4
|
startup do
|
5
|
-
Elasticsearch::Extensions::Test::Cluster.start if ENV['SERVER'] and not Elasticsearch::Extensions::Test::Cluster.running?
|
5
|
+
Elasticsearch::Extensions::Test::Cluster.start(nodes: 2) if ENV['SERVER'] and not Elasticsearch::Extensions::Test::Cluster.running?
|
6
6
|
end
|
7
7
|
|
8
8
|
context "Elasticsearch client" do
|
@@ -48,20 +48,20 @@ class Elasticsearch::Transport::ClientIntegrationTest < Elasticsearch::Test::Int
|
|
48
48
|
setup do
|
49
49
|
@client = Elasticsearch::Client.new \
|
50
50
|
hosts: ["localhost:#{@port}", "localhost:#{@port+1}" ],
|
51
|
-
logger: @logger
|
51
|
+
logger: (ENV['QUIET'] ? nil : @logger)
|
52
52
|
end
|
53
53
|
|
54
54
|
should "rotate nodes" do
|
55
55
|
# Hit node 1
|
56
|
-
response = @client.perform_request 'GET', '
|
56
|
+
response = @client.perform_request 'GET', '_nodes/_local'
|
57
57
|
assert_equal 'node-1', response.body['nodes'].to_a[0][1]['name']
|
58
58
|
|
59
59
|
# Hit node 2
|
60
|
-
response = @client.perform_request 'GET', '
|
60
|
+
response = @client.perform_request 'GET', '_nodes/_local'
|
61
61
|
assert_equal 'node-2', response.body['nodes'].to_a[0][1]['name']
|
62
62
|
|
63
63
|
# Hit node 1
|
64
|
-
response = @client.perform_request 'GET', '
|
64
|
+
response = @client.perform_request 'GET', '_nodes/_local'
|
65
65
|
assert_equal 'node-1', response.body['nodes'].to_a[0][1]['name']
|
66
66
|
end
|
67
67
|
end
|
@@ -71,30 +71,30 @@ class Elasticsearch::Transport::ClientIntegrationTest < Elasticsearch::Test::Int
|
|
71
71
|
@port = (ENV['TEST_CLUSTER_PORT'] || 9250).to_i
|
72
72
|
@client = Elasticsearch::Client.new \
|
73
73
|
hosts: ["localhost:#{@port}", "foobar1"],
|
74
|
-
logger: @logger,
|
74
|
+
logger: (ENV['QUIET'] ? nil : @logger),
|
75
75
|
retry_on_failure: true
|
76
76
|
end
|
77
77
|
|
78
78
|
should "retry the request with next server" do
|
79
79
|
assert_nothing_raised do
|
80
|
-
5.times { @client.perform_request 'GET', '
|
80
|
+
5.times { @client.perform_request 'GET', '_nodes/_local' }
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
84
|
should "raise exception when it cannot get any healthy server" do
|
85
85
|
@client = Elasticsearch::Client.new \
|
86
86
|
hosts: ["localhost:#{@port}", "foobar1", "foobar2", "foobar3"],
|
87
|
-
logger: @logger,
|
87
|
+
logger: (ENV['QUIET'] ? nil : @logger),
|
88
88
|
retry_on_failure: 1
|
89
89
|
|
90
90
|
assert_nothing_raised do
|
91
91
|
# First hit is OK
|
92
|
-
@client.perform_request 'GET', '
|
92
|
+
@client.perform_request 'GET', '_nodes/_local'
|
93
93
|
end
|
94
94
|
|
95
95
|
assert_raise Faraday::Error::ConnectionFailed do
|
96
96
|
# Second hit fails
|
97
|
-
@client.perform_request 'GET', '
|
97
|
+
@client.perform_request 'GET', '_nodes/_local'
|
98
98
|
end
|
99
99
|
end
|
100
100
|
end
|
@@ -103,14 +103,14 @@ class Elasticsearch::Transport::ClientIntegrationTest < Elasticsearch::Test::Int
|
|
103
103
|
setup do
|
104
104
|
@client = Elasticsearch::Client.new \
|
105
105
|
hosts: ["localhost:#{@port}", "foobar1", "foobar2"],
|
106
|
-
logger: @logger,
|
106
|
+
logger: (ENV['QUIET'] ? nil : @logger),
|
107
107
|
reload_on_failure: true
|
108
108
|
end
|
109
109
|
|
110
110
|
should "reload the connections" do
|
111
111
|
assert_equal 3, @client.transport.connections.size
|
112
112
|
assert_nothing_raised do
|
113
|
-
5.times { @client.perform_request 'GET', '
|
113
|
+
5.times { @client.perform_request 'GET', '_nodes/_local' }
|
114
114
|
end
|
115
115
|
assert_equal 2, @client.transport.connections.size
|
116
116
|
end
|
@@ -2,7 +2,7 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class Elasticsearch::Transport::ClientIntegrationTest < Elasticsearch::Test::IntegrationTestCase
|
4
4
|
startup do
|
5
|
-
Elasticsearch::Extensions::Test::Cluster.start if ENV['SERVER'] and not Elasticsearch::Extensions::Test::Cluster.running?
|
5
|
+
Elasticsearch::Extensions::Test::Cluster.start(nodes: 2) if ENV['SERVER'] and not Elasticsearch::Extensions::Test::Cluster.running?
|
6
6
|
end
|
7
7
|
|
8
8
|
context "Transport" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticsearch-transport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-01-
|
12
|
+
date: 2014-01-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|