rsolr-cloud 1.1.0 → 1.1.1
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/Rakefile +1 -1
- data/lib/rsolr/cloud/connection.rb +0 -2
- data/lib/rsolr/cloud/version.rb +1 -1
- data/rsolr-cloud.gemspec +2 -1
- data/spec/rsolr/cloud/connection_spec.rb +36 -20
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 966f35e6906e7a295a44bc67ff66f68cb1bf49d9
|
4
|
+
data.tar.gz: 81d5df04acb5ba7d857b29cf12b3b5ed79ec068c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03c026b86a0a8b45cbd398a32934f0496a08c51d2b0a02fa4492a96c664e1cbc099eb630db416611dd290ffd04dbd71cdccfdd4b06b34320845aef894f31237c
|
7
|
+
data.tar.gz: 69ab1920f310843110d73e528be2fdb6435c58903139ac0f424a2444fa91c0844d56d76df5fb54c322aa43f8666e476d4fc0f6dc5126fdaf70354fb2ecf0fbc9
|
data/Rakefile
CHANGED
@@ -67,9 +67,7 @@ module RSolr
|
|
67
67
|
@all_urls = {}
|
68
68
|
@leader_urls = {}
|
69
69
|
@collections.each do |name, state|
|
70
|
-
# rubocop:disable SpaceAroundOperators
|
71
70
|
@all_urls[name], @leader_urls[name] = available_urls(name, state)
|
72
|
-
# rubocop:enable SpaceAroundOperators
|
73
71
|
end
|
74
72
|
end
|
75
73
|
end
|
data/lib/rsolr/cloud/version.rb
CHANGED
data/rsolr-cloud.gemspec
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
|
2
3
|
lib = File.expand_path('../lib', __FILE__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'rsolr/cloud/version'
|
@@ -25,5 +26,5 @@ Gem::Specification.new do |spec|
|
|
25
26
|
spec.add_development_dependency 'zk-server', '~> 1.1.7'
|
26
27
|
spec.add_development_dependency 'zk', '~> 1.9.5'
|
27
28
|
spec.add_development_dependency 'rsolr', '~> 1.0.12'
|
28
|
-
spec.add_development_dependency 'rubocop', '~> 0.
|
29
|
+
spec.add_development_dependency 'rubocop', '~> 0.49.0'
|
29
30
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'spec_helper.rb'
|
2
2
|
|
3
|
+
# rubocop:disable Metrics/BlockLength
|
3
4
|
RSpec.describe RSolr::Cloud::Connection do
|
4
5
|
before do
|
5
6
|
@zk_in_solr = ZK.new
|
@@ -17,11 +18,10 @@ RSpec.describe RSolr::Cloud::Connection do
|
|
17
18
|
['192.168.1.21:8983_solr',
|
18
19
|
'192.168.1.22:8983_solr',
|
19
20
|
'192.168.1.23:8983_solr',
|
20
|
-
'192.168.1.24:8983_solr'
|
21
|
-
].each do |node|
|
21
|
+
'192.168.1.24:8983_solr'].each do |node|
|
22
22
|
@zk_in_solr.create("/live_nodes/#{node}", '', mode: :ephemeral)
|
23
23
|
end
|
24
|
-
%w
|
24
|
+
%w[collection1 collection2].each do |collection|
|
25
25
|
@zk_in_solr.create("/collections/#{collection}")
|
26
26
|
json = File.read("spec/files/#{collection}_all_nodes_alive.json")
|
27
27
|
@zk_in_solr.create("/collections/#{collection}/state.json",
|
@@ -39,12 +39,14 @@ RSpec.describe RSolr::Cloud::Connection do
|
|
39
39
|
it 'should configure Net::HTTP with one of active node in select request.' do
|
40
40
|
expect(@subject.instance_variable_get(:@leader_urls)['collection1'].sort).to eq(
|
41
41
|
['http://192.168.1.22:8983/solr/collection1',
|
42
|
-
'http://192.168.1.24:8983/solr/collection1'].sort
|
42
|
+
'http://192.168.1.24:8983/solr/collection1'].sort
|
43
|
+
)
|
43
44
|
expect(@subject.instance_variable_get(:@all_urls)['collection1'].sort).to eq(
|
44
45
|
['http://192.168.1.21:8983/solr/collection1',
|
45
46
|
'http://192.168.1.22:8983/solr/collection1',
|
46
47
|
'http://192.168.1.23:8983/solr/collection1',
|
47
|
-
'http://192.168.1.24:8983/solr/collection1'].sort
|
48
|
+
'http://192.168.1.24:8983/solr/collection1'].sort
|
49
|
+
)
|
48
50
|
expect(Net::HTTP).to receive(:new) do |host, port|
|
49
51
|
expect(host).to be_one_of(['192.168.1.21', '192.168.1.22', '192.168.1.23', '192.168.1.24'])
|
50
52
|
expect(port).to eq(8983)
|
@@ -60,12 +62,14 @@ RSpec.describe RSolr::Cloud::Connection do
|
|
60
62
|
it 'should configure Net::HTTP with one of leader node in update request' do
|
61
63
|
expect(@subject.instance_variable_get(:@leader_urls)['collection1'].sort).to eq(
|
62
64
|
['http://192.168.1.22:8983/solr/collection1',
|
63
|
-
'http://192.168.1.24:8983/solr/collection1'].sort
|
65
|
+
'http://192.168.1.24:8983/solr/collection1'].sort
|
66
|
+
)
|
64
67
|
expect(@subject.instance_variable_get(:@all_urls)['collection1'].sort).to eq(
|
65
68
|
['http://192.168.1.21:8983/solr/collection1',
|
66
69
|
'http://192.168.1.22:8983/solr/collection1',
|
67
70
|
'http://192.168.1.23:8983/solr/collection1',
|
68
|
-
'http://192.168.1.24:8983/solr/collection1'].sort
|
71
|
+
'http://192.168.1.24:8983/solr/collection1'].sort
|
72
|
+
)
|
69
73
|
expect(Net::HTTP).to receive(:new) do |host, port|
|
70
74
|
expect(host).to be_one_of(['192.168.1.22', '192.168.1.24'])
|
71
75
|
expect(port).to eq(8983)
|
@@ -88,22 +92,26 @@ RSpec.describe RSolr::Cloud::Connection do
|
|
88
92
|
File.read('spec/files/collection1_replica_down.json'))
|
89
93
|
expect { @subject.instance_variable_get(:@leader_urls)['collection1'].sort }.to become_soon(
|
90
94
|
['http://192.168.1.22:8983/solr/collection1',
|
91
|
-
'http://192.168.1.24:8983/solr/collection1'].sort
|
95
|
+
'http://192.168.1.24:8983/solr/collection1'].sort
|
96
|
+
)
|
92
97
|
expect { @subject.instance_variable_get(:@all_urls)['collection1'].sort }.to become_soon(
|
93
98
|
['http://192.168.1.22:8983/solr/collection1',
|
94
99
|
'http://192.168.1.23:8983/solr/collection1',
|
95
|
-
'http://192.168.1.24:8983/solr/collection1'].sort
|
100
|
+
'http://192.168.1.24:8983/solr/collection1'].sort
|
101
|
+
)
|
96
102
|
@zk_in_solr.create('/live_nodes/192.168.1.21:8983_solr', mode: :ephemeral)
|
97
103
|
@zk_in_solr.set('/collections/collection1/state.json',
|
98
104
|
File.read('spec/files/collection1_all_nodes_alive.json'))
|
99
105
|
expect { @subject.instance_variable_get(:@leader_urls)['collection1'].sort }.to become_soon(
|
100
106
|
['http://192.168.1.22:8983/solr/collection1',
|
101
|
-
'http://192.168.1.24:8983/solr/collection1'].sort
|
107
|
+
'http://192.168.1.24:8983/solr/collection1'].sort
|
108
|
+
)
|
102
109
|
expect { @subject.instance_variable_get(:@all_urls)['collection1'].sort }.to become_soon(
|
103
110
|
['http://192.168.1.21:8983/solr/collection1',
|
104
111
|
'http://192.168.1.22:8983/solr/collection1',
|
105
112
|
'http://192.168.1.23:8983/solr/collection1',
|
106
|
-
'http://192.168.1.24:8983/solr/collection1'].sort
|
113
|
+
'http://192.168.1.24:8983/solr/collection1'].sort
|
114
|
+
)
|
107
115
|
end
|
108
116
|
|
109
117
|
it 'should remove downed leader node and add recovered node' do
|
@@ -112,22 +120,26 @@ RSpec.describe RSolr::Cloud::Connection do
|
|
112
120
|
File.read('spec/files/collection1_leader_down.json'))
|
113
121
|
expect { @subject.instance_variable_get(:@leader_urls)['collection1'].sort }.to become_soon(
|
114
122
|
['http://192.168.1.23:8983/solr/collection1',
|
115
|
-
'http://192.168.1.24:8983/solr/collection1'].sort
|
123
|
+
'http://192.168.1.24:8983/solr/collection1'].sort
|
124
|
+
)
|
116
125
|
expect { @subject.instance_variable_get(:@all_urls)['collection1'].sort }.to become_soon(
|
117
126
|
['http://192.168.1.21:8983/solr/collection1',
|
118
127
|
'http://192.168.1.23:8983/solr/collection1',
|
119
|
-
'http://192.168.1.24:8983/solr/collection1'].sort
|
128
|
+
'http://192.168.1.24:8983/solr/collection1'].sort
|
129
|
+
)
|
120
130
|
@zk_in_solr.create('/live_nodes/192.168.1.22:8983_solr', mode: :ephemeral)
|
121
131
|
@zk_in_solr.set('/collections/collection1/state.json',
|
122
132
|
File.read('spec/files/collection1_all_nodes_alive.json'))
|
123
133
|
expect { @subject.instance_variable_get(:@leader_urls)['collection1'].sort }.to become_soon(
|
124
134
|
['http://192.168.1.22:8983/solr/collection1',
|
125
|
-
'http://192.168.1.24:8983/solr/collection1'].sort
|
135
|
+
'http://192.168.1.24:8983/solr/collection1'].sort
|
136
|
+
)
|
126
137
|
expect { @subject.instance_variable_get(:@all_urls)['collection1'].sort }.to become_soon(
|
127
138
|
['http://192.168.1.21:8983/solr/collection1',
|
128
139
|
'http://192.168.1.22:8983/solr/collection1',
|
129
140
|
'http://192.168.1.23:8983/solr/collection1',
|
130
|
-
'http://192.168.1.24:8983/solr/collection1'].sort
|
141
|
+
'http://192.168.1.24:8983/solr/collection1'].sort
|
142
|
+
)
|
131
143
|
end
|
132
144
|
|
133
145
|
it 'should remove recovering leader node and add recovered node' do
|
@@ -135,21 +147,25 @@ RSpec.describe RSolr::Cloud::Connection do
|
|
135
147
|
File.read('spec/files/collection1_leader_recovering.json'))
|
136
148
|
expect { @subject.instance_variable_get(:@leader_urls)['collection1'].sort }.to become_soon(
|
137
149
|
['http://192.168.1.23:8983/solr/collection1',
|
138
|
-
'http://192.168.1.24:8983/solr/collection1'].sort
|
150
|
+
'http://192.168.1.24:8983/solr/collection1'].sort
|
151
|
+
)
|
139
152
|
expect { @subject.instance_variable_get(:@all_urls)['collection1'].sort }.to become_soon(
|
140
153
|
['http://192.168.1.21:8983/solr/collection1',
|
141
154
|
'http://192.168.1.23:8983/solr/collection1',
|
142
|
-
'http://192.168.1.24:8983/solr/collection1'].sort
|
155
|
+
'http://192.168.1.24:8983/solr/collection1'].sort
|
156
|
+
)
|
143
157
|
@zk_in_solr.set('/collections/collection1/state.json',
|
144
158
|
File.read('spec/files/collection1_all_nodes_alive.json'))
|
145
159
|
expect { @subject.instance_variable_get(:@leader_urls)['collection1'].sort }.to become_soon(
|
146
160
|
['http://192.168.1.23:8983/solr/collection1',
|
147
|
-
'http://192.168.1.24:8983/solr/collection1'].sort
|
161
|
+
'http://192.168.1.24:8983/solr/collection1'].sort
|
162
|
+
)
|
148
163
|
expect { @subject.instance_variable_get(:@all_urls)['collection1'].sort }.to become_soon(
|
149
164
|
['http://192.168.1.21:8983/solr/collection1',
|
150
165
|
'http://192.168.1.22:8983/solr/collection1',
|
151
166
|
'http://192.168.1.23:8983/solr/collection1',
|
152
|
-
'http://192.168.1.24:8983/solr/collection1'].sort
|
167
|
+
'http://192.168.1.24:8983/solr/collection1'].sort
|
168
|
+
)
|
153
169
|
end
|
154
170
|
|
155
171
|
it 'should add new created collection.' do
|
@@ -173,4 +189,4 @@ RSpec.describe RSolr::Cloud::Connection do
|
|
173
189
|
@zk_in_solr.close if @zk_in_solr
|
174
190
|
@zk.close if @zk
|
175
191
|
end
|
176
|
-
end
|
192
|
+
end # rubocop:enable Metrics/BlockLength
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsolr-cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shintaro Kimura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.
|
117
|
+
version: 0.49.0
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.
|
124
|
+
version: 0.49.0
|
125
125
|
description: The connection adopter supporting SolrCloud for RSolr
|
126
126
|
email:
|
127
127
|
- service@enigmo.co.jp
|
@@ -169,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
169
|
version: '0'
|
170
170
|
requirements: []
|
171
171
|
rubyforge_project:
|
172
|
-
rubygems_version: 2.
|
172
|
+
rubygems_version: 2.6.11
|
173
173
|
signing_key:
|
174
174
|
specification_version: 4
|
175
175
|
summary: The connection adopter supporting SolrCloud for RSolr
|