makara 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +11 -0
- data/.github/workflows/CI.yml +88 -0
- data/.rspec +1 -1
- data/.rubocop.yml +15 -0
- data/.rubocop_todo.yml +670 -0
- data/CHANGELOG.md +14 -6
- data/Gemfile +1 -16
- data/README.md +2 -1
- data/Rakefile +1 -1
- data/gemfiles/activerecord_5.2.gemfile +8 -0
- data/gemfiles/activerecord_6.0.gemfile +8 -0
- data/gemfiles/activerecord_6.1.gemfile +8 -0
- data/gemfiles/activerecord_head.gemfile +6 -0
- data/lib/active_record/connection_adapters/jdbcmysql_makara_adapter.rb +4 -18
- data/lib/active_record/connection_adapters/jdbcpostgresql_makara_adapter.rb +4 -18
- data/lib/active_record/connection_adapters/makara_abstract_adapter.rb +3 -31
- data/lib/active_record/connection_adapters/makara_jdbcmysql_adapter.rb +4 -18
- data/lib/active_record/connection_adapters/makara_jdbcpostgresql_adapter.rb +4 -18
- data/lib/active_record/connection_adapters/makara_mysql2_adapter.rb +4 -20
- data/lib/active_record/connection_adapters/makara_postgis_adapter.rb +4 -19
- data/lib/active_record/connection_adapters/makara_postgresql_adapter.rb +4 -20
- data/lib/active_record/connection_adapters/mysql2_makara_adapter.rb +4 -20
- data/lib/active_record/connection_adapters/postgresql_makara_adapter.rb +4 -20
- data/lib/makara.rb +0 -2
- data/lib/makara/cache.rb +0 -2
- data/lib/makara/config_parser.rb +5 -14
- data/lib/makara/connection_wrapper.rb +24 -27
- data/lib/makara/context.rb +1 -0
- data/lib/makara/cookie.rb +1 -0
- data/lib/makara/error_handler.rb +0 -9
- data/lib/makara/errors/all_connections_blacklisted.rb +0 -2
- data/lib/makara/errors/blacklist_connection.rb +0 -2
- data/lib/makara/errors/blacklisted_while_in_transaction.rb +0 -2
- data/lib/makara/errors/invalid_shard.rb +1 -3
- data/lib/makara/errors/makara_error.rb +0 -1
- data/lib/makara/errors/no_connections_available.rb +0 -2
- data/lib/makara/logging/logger.rb +0 -4
- data/lib/makara/logging/subscriber.rb +0 -2
- data/lib/makara/middleware.rb +1 -2
- data/lib/makara/pool.rb +2 -7
- data/lib/makara/proxy.rb +25 -27
- data/lib/makara/railtie.rb +0 -2
- data/lib/makara/strategies/abstract.rb +1 -0
- data/lib/makara/strategies/priority_failover.rb +2 -0
- data/lib/makara/strategies/round_robin.rb +1 -3
- data/lib/makara/strategies/shard_aware.rb +0 -2
- data/lib/makara/version.rb +1 -3
- data/makara.gemspec +24 -5
- data/spec/active_record/connection_adapters/makara_abstract_adapter_error_handling_spec.rb +1 -6
- data/spec/active_record/connection_adapters/makara_abstract_adapter_spec.rb +0 -9
- data/spec/active_record/connection_adapters/makara_mysql2_adapter_spec.rb +9 -22
- data/spec/active_record/connection_adapters/makara_postgis_adapter_spec.rb +2 -10
- data/spec/active_record/connection_adapters/makara_postgresql_adapter_spec.rb +7 -20
- data/spec/cache_spec.rb +0 -1
- data/spec/config_parser_spec.rb +54 -56
- data/spec/connection_wrapper_spec.rb +1 -2
- data/spec/cookie_spec.rb +1 -1
- data/spec/middleware_spec.rb +1 -1
- data/spec/pool_spec.rb +3 -16
- data/spec/proxy_spec.rb +0 -4
- data/spec/spec_helper.rb +5 -1
- data/spec/strategies/priority_failover_spec.rb +3 -4
- data/spec/strategies/round_robin_spec.rb +4 -8
- data/spec/strategies/shard_aware_spec.rb +4 -5
- data/spec/support/deep_dup.rb +1 -1
- data/spec/support/helpers.rb +5 -5
- data/spec/support/mock_objects.rb +1 -4
- data/spec/support/mysql2_database.yml +2 -2
- data/spec/support/mysql2_database_with_custom_errors.yml +2 -2
- data/spec/support/pool_extensions.rb +0 -3
- data/spec/support/postgis_schema.rb +1 -1
- data/spec/support/postgresql_database.yml +0 -2
- data/spec/support/proxy_extensions.rb +1 -3
- data/spec/support/schema.rb +1 -1
- data/spec/support/user.rb +1 -2
- metadata +156 -20
- data/.travis.yml +0 -131
- data/gemfiles/ar-head.gemfile +0 -24
- data/gemfiles/ar30.gemfile +0 -36
- data/gemfiles/ar31.gemfile +0 -36
- data/gemfiles/ar32.gemfile +0 -36
- data/gemfiles/ar40.gemfile +0 -24
- data/gemfiles/ar41.gemfile +0 -24
- data/gemfiles/ar42.gemfile +0 -24
- data/gemfiles/ar50.gemfile +0 -24
- data/gemfiles/ar51.gemfile +0 -24
- data/gemfiles/ar52.gemfile +0 -24
- data/gemfiles/ar60.gemfile +0 -24
@@ -2,7 +2,6 @@ require 'spec_helper'
|
|
2
2
|
require 'active_record/connection_adapters/makara_abstract_adapter'
|
3
3
|
|
4
4
|
describe ActiveRecord::ConnectionAdapters::MakaraAbstractAdapter::ErrorHandler do
|
5
|
-
|
6
5
|
let(:handler){ described_class.new }
|
7
6
|
let(:proxy) { FakeAdapter.new(config(1,1)) }
|
8
7
|
let(:connection){ proxy.master_pool.connections.first }
|
@@ -60,9 +59,8 @@ describe ActiveRecord::ConnectionAdapters::MakaraAbstractAdapter::ErrorHandler d
|
|
60
59
|
end
|
61
60
|
|
62
61
|
describe 'custom errors' do
|
63
|
-
|
64
62
|
let(:config_path) { File.join(File.expand_path('../../../', __FILE__), 'support', 'mysql2_database_with_custom_errors.yml') }
|
65
|
-
let(:config) { YAML.
|
63
|
+
let(:config) { YAML.load(ERB.new(File.read(config_path)).result)['test'] }
|
66
64
|
let(:handler){ described_class.new }
|
67
65
|
let(:proxy) { FakeAdapter.new(config) }
|
68
66
|
let(:connection){ proxy.master_pool.connections.first }
|
@@ -85,8 +83,5 @@ describe ActiveRecord::ConnectionAdapters::MakaraAbstractAdapter::ErrorHandler d
|
|
85
83
|
end
|
86
84
|
}.to raise_error(Makara::Errors::BlacklistConnection)
|
87
85
|
end
|
88
|
-
|
89
86
|
end
|
90
|
-
|
91
|
-
|
92
87
|
end
|
@@ -2,7 +2,6 @@ require 'spec_helper'
|
|
2
2
|
require 'active_record/connection_adapters/makara_abstract_adapter'
|
3
3
|
|
4
4
|
describe ActiveRecord::ConnectionAdapters::MakaraAbstractAdapter do
|
5
|
-
|
6
5
|
let(:klass){ FakeAdapter }
|
7
6
|
|
8
7
|
{
|
@@ -38,15 +37,12 @@ describe ActiveRecord::ConnectionAdapters::MakaraAbstractAdapter do
|
|
38
37
|
'select pg_advisory_lock(12345)' => true,
|
39
38
|
'select pg_advisory_unlock(12345)' => true
|
40
39
|
}.each do |sql, should_go_to_master|
|
41
|
-
|
42
40
|
it "determines that \"#{sql}\" #{should_go_to_master ? 'requires' : 'does not require'} master" do
|
43
41
|
proxy = klass.new(config(1,1))
|
44
42
|
expect(proxy.master_for?(sql)).to eq(should_go_to_master)
|
45
43
|
end
|
46
|
-
|
47
44
|
end
|
48
45
|
|
49
|
-
|
50
46
|
{
|
51
47
|
"SET @@things" => true,
|
52
48
|
"INSERT INTO wisdom ('The truth will set you free.')" => false,
|
@@ -61,7 +57,6 @@ describe ActiveRecord::ConnectionAdapters::MakaraAbstractAdapter do
|
|
61
57
|
max_treats IS NULL
|
62
58
|
} => false
|
63
59
|
}.each do |sql, should_send_to_all_connections|
|
64
|
-
|
65
60
|
it "determines that \"#{sql}\" #{should_send_to_all_connections ? 'should' : 'should not'} be sent to all underlying connections" do
|
66
61
|
proxy = klass.new(config(1,1))
|
67
62
|
proxy.master_pool.connections.each{|con| expect(con).to receive(:execute).with(sql).once}
|
@@ -75,7 +70,6 @@ describe ActiveRecord::ConnectionAdapters::MakaraAbstractAdapter do
|
|
75
70
|
|
76
71
|
proxy.execute(sql)
|
77
72
|
end
|
78
|
-
|
79
73
|
end
|
80
74
|
|
81
75
|
{
|
@@ -108,12 +102,9 @@ describe ActiveRecord::ConnectionAdapters::MakaraAbstractAdapter do
|
|
108
102
|
max_treats IS NULL
|
109
103
|
} => true
|
110
104
|
}.each do |sql,should_stick|
|
111
|
-
|
112
105
|
it "should #{should_stick ? 'stick' : 'not stick'} to master if handling sql like \"#{sql}\"" do
|
113
106
|
proxy = klass.new(config(0,0))
|
114
107
|
expect(proxy.would_stick?(sql)).to eq(should_stick)
|
115
108
|
end
|
116
|
-
|
117
109
|
end
|
118
|
-
|
119
110
|
end
|
@@ -2,12 +2,10 @@ require 'spec_helper'
|
|
2
2
|
require 'active_record/connection_adapters/mysql2_adapter'
|
3
3
|
|
4
4
|
describe 'MakaraMysql2Adapter' do
|
5
|
-
|
6
|
-
let(:db_username){ ENV['TRAVIS'] ? 'travis' : 'root' }
|
7
|
-
|
8
5
|
let(:config){
|
9
|
-
|
10
|
-
|
6
|
+
file = File.expand_path('spec/support/mysql2_database.yml')
|
7
|
+
hash = YAML.load(ERB.new(File.read(file)).result)
|
8
|
+
hash['test']
|
11
9
|
}
|
12
10
|
|
13
11
|
let(:connection) { ActiveRecord::Base.connection }
|
@@ -18,7 +16,6 @@ describe 'MakaraMysql2Adapter' do
|
|
18
16
|
end
|
19
17
|
|
20
18
|
context "unconnected" do
|
21
|
-
|
22
19
|
it 'should allow a connection to be established' do
|
23
20
|
establish_connection(config)
|
24
21
|
expect(ActiveRecord::Base.connection).to be_instance_of(ActiveRecord::ConnectionAdapters::MakaraMysql2Adapter)
|
@@ -56,7 +53,6 @@ describe 'MakaraMysql2Adapter' do
|
|
56
53
|
expect{
|
57
54
|
connection.execute('SET @t1 = 1')
|
58
55
|
}.to raise_error(Makara::Errors::NoConnectionsAvailable)
|
59
|
-
|
60
56
|
end
|
61
57
|
|
62
58
|
context "unconnect afterwards" do
|
@@ -84,8 +80,7 @@ describe 'MakaraMysql2Adapter' do
|
|
84
80
|
load(File.dirname(__FILE__) + '/../../support/schema.rb')
|
85
81
|
change_context
|
86
82
|
|
87
|
-
allow(ActiveRecord::Base).to receive(:mysql2_connection) do
|
88
|
-
config[:username] = db_username
|
83
|
+
allow(ActiveRecord::Base).to receive(:mysql2_connection) do
|
89
84
|
original_method.call(config)
|
90
85
|
end
|
91
86
|
|
@@ -102,18 +97,15 @@ describe 'MakaraMysql2Adapter' do
|
|
102
97
|
ActiveRecord::Base.remove_connection
|
103
98
|
end
|
104
99
|
end
|
105
|
-
|
106
100
|
end
|
107
101
|
|
108
102
|
context 'with the connection established and schema loaded' do
|
109
|
-
|
110
103
|
before do
|
111
104
|
establish_connection(config)
|
112
105
|
load(File.dirname(__FILE__) + '/../../support/schema.rb')
|
113
106
|
change_context
|
114
107
|
end
|
115
108
|
|
116
|
-
|
117
109
|
it 'should have one master and two slaves' do
|
118
110
|
expect(connection.master_pool.connection_count).to eq(1)
|
119
111
|
expect(connection.slave_pool.connection_count).to eq(2)
|
@@ -159,17 +151,14 @@ describe 'MakaraMysql2Adapter' do
|
|
159
151
|
end
|
160
152
|
|
161
153
|
it 'should send exists? to slave' do
|
162
|
-
next if ActiveRecord::VERSION::MAJOR == 3 && ActiveRecord::VERSION::MINOR == 0 # query doesn't work?
|
163
|
-
|
164
154
|
allow_any_instance_of(Makara::Strategies::RoundRobin).to receive(:single_one?){ true }
|
165
155
|
Test::User.exists? # flush other (schema) things that need to happen
|
166
|
-
|
156
|
+
|
167
157
|
con = connection.slave_pool.connections.first
|
168
|
-
|
169
|
-
expect(
|
170
|
-
|
171
|
-
|
172
|
-
end
|
158
|
+
expect(con).to receive(:exec_query) do |query|
|
159
|
+
expect(query).to match(/SELECT\s+1\s*(AS one)?\s+FROM .?users.?\s+LIMIT\s+.?1/)
|
160
|
+
end.once.and_call_original
|
161
|
+
|
173
162
|
Test::User.exists?
|
174
163
|
end
|
175
164
|
|
@@ -198,7 +187,6 @@ describe 'MakaraMysql2Adapter' do
|
|
198
187
|
}.to raise_error(Makara::Errors::AllConnectionsBlacklisted)
|
199
188
|
end
|
200
189
|
end
|
201
|
-
|
202
190
|
end
|
203
191
|
|
204
192
|
describe 'transaction support' do
|
@@ -256,5 +244,4 @@ describe 'MakaraMysql2Adapter' do
|
|
256
244
|
it_behaves_like 'a transaction supporter'
|
257
245
|
end
|
258
246
|
end
|
259
|
-
|
260
247
|
end
|
@@ -1,16 +1,12 @@
|
|
1
1
|
# RGeo doesn't play well with JRuby and to avoid complicated test setup
|
2
2
|
# we're only testing ActiveRecord version ~> 4.2
|
3
|
-
# also rgeo only works on 2.1+
|
4
3
|
|
5
|
-
rmajor, rminor, rpatch = RUBY_VERSION.split(/[^\d]/)[0..2].map(&:to_i)
|
6
4
|
require 'active_record'
|
7
5
|
|
8
6
|
# TODO: test this in AR 5+ ?
|
9
|
-
|
10
7
|
if RUBY_ENGINE == 'ruby' &&
|
11
8
|
ActiveRecord::VERSION::MAJOR == 4 &&
|
12
|
-
ActiveRecord::VERSION::MINOR >= 2
|
13
|
-
(rmajor > 2 || (rmajor == 2 && rminor >= 1))
|
9
|
+
ActiveRecord::VERSION::MINOR >= 2
|
14
10
|
|
15
11
|
require 'spec_helper'
|
16
12
|
require 'rgeo'
|
@@ -18,12 +14,8 @@ if RUBY_ENGINE == 'ruby' &&
|
|
18
14
|
require 'active_record/connection_adapters/postgis_adapter'
|
19
15
|
|
20
16
|
describe 'MakaraPostgisAdapter' do
|
21
|
-
let(:db_username){ ENV['TRAVIS'] ? 'postgres' : `whoami`.chomp }
|
22
|
-
|
23
17
|
let(:config) do
|
24
|
-
|
25
|
-
base['username'] = db_username
|
26
|
-
base
|
18
|
+
YAML.load_file(File.expand_path('spec/support/postgis_database.yml'))['test']
|
27
19
|
end
|
28
20
|
|
29
21
|
let(:connection) { ActiveRecord::Base.connection }
|
@@ -3,13 +3,8 @@ require 'active_record/connection_adapters/postgresql_adapter'
|
|
3
3
|
require 'active_record/errors'
|
4
4
|
|
5
5
|
describe 'MakaraPostgreSQLAdapter' do
|
6
|
-
|
7
|
-
let(:db_username){ ENV['TRAVIS'] ? 'postgres' : `whoami`.chomp }
|
8
|
-
|
9
6
|
let(:config) do
|
10
|
-
|
11
|
-
base['username'] = db_username
|
12
|
-
base
|
7
|
+
YAML.load_file(File.expand_path('spec/support/postgresql_database.yml'))['test']
|
13
8
|
end
|
14
9
|
|
15
10
|
let(:connection) { ActiveRecord::Base.connection }
|
@@ -19,21 +14,18 @@ describe 'MakaraPostgreSQLAdapter' do
|
|
19
14
|
change_context
|
20
15
|
end
|
21
16
|
|
22
|
-
|
23
17
|
it 'should allow a connection to be established' do
|
24
18
|
establish_connection(config)
|
25
19
|
expect(ActiveRecord::Base.connection).to be_instance_of(ActiveRecord::ConnectionAdapters::MakaraPostgreSQLAdapter)
|
26
20
|
end
|
27
21
|
|
28
22
|
context 'with the connection established and schema loaded' do
|
29
|
-
|
30
23
|
before do
|
31
24
|
establish_connection(config)
|
32
25
|
load(File.dirname(__FILE__) + '/../../support/schema.rb')
|
33
26
|
change_context
|
34
27
|
end
|
35
28
|
|
36
|
-
|
37
29
|
it 'should have one master and two slaves' do
|
38
30
|
expect(connection.master_pool.connection_count).to eq(1)
|
39
31
|
expect(connection.slave_pool.connection_count).to eq(2)
|
@@ -74,18 +66,15 @@ describe 'MakaraPostgreSQLAdapter' do
|
|
74
66
|
end
|
75
67
|
|
76
68
|
it 'should send exists? to slave' do
|
77
|
-
next if ActiveRecord::VERSION::MAJOR == 3 && ActiveRecord::VERSION::MINOR == 0 # query doesn't work?
|
78
|
-
|
79
69
|
allow_any_instance_of(Makara::Strategies::RoundRobin).to receive(:single_one?){ true }
|
80
70
|
Test::User.exists? # flush other (schema) things that need to happen
|
81
|
-
|
71
|
+
|
82
72
|
con = connection.slave_pool.connections.first
|
83
|
-
|
84
|
-
|
85
|
-
expect(
|
86
|
-
|
87
|
-
|
88
|
-
end
|
73
|
+
|
74
|
+
expect(con).to receive(:exec_query) do |query|
|
75
|
+
expect(query).to match(/SELECT\s+1\s*(AS one)?\s+FROM .?users.?\s+LIMIT\s+.?1/)
|
76
|
+
end.once.and_call_original
|
77
|
+
|
89
78
|
Test::User.exists?
|
90
79
|
end
|
91
80
|
|
@@ -194,7 +183,6 @@ describe 'MakaraPostgreSQLAdapter' do
|
|
194
183
|
end
|
195
184
|
|
196
185
|
context 'with two activerecord connection pools' do
|
197
|
-
|
198
186
|
before :each do
|
199
187
|
class Model1 < ActiveRecord::Base
|
200
188
|
end
|
@@ -204,7 +192,6 @@ describe 'MakaraPostgreSQLAdapter' do
|
|
204
192
|
|
205
193
|
Model1.establish_connection(config)
|
206
194
|
Model2.establish_connection(config)
|
207
|
-
|
208
195
|
end
|
209
196
|
|
210
197
|
it 'should not leak raw connection into activerecord pool' do
|
data/spec/cache_spec.rb
CHANGED
data/spec/config_parser_spec.rb
CHANGED
@@ -1,21 +1,20 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Makara::ConfigParser do
|
4
|
-
|
5
4
|
let(:config){
|
6
5
|
{
|
7
|
-
:
|
8
|
-
:
|
9
|
-
:
|
6
|
+
top_level: 'value',
|
7
|
+
makara: {
|
8
|
+
connections: [
|
10
9
|
{
|
11
|
-
:
|
12
|
-
:
|
10
|
+
role: 'master',
|
11
|
+
name: 'themaster'
|
13
12
|
},
|
14
13
|
{
|
15
|
-
:
|
14
|
+
name: 'slave1'
|
16
15
|
},
|
17
16
|
{
|
18
|
-
:
|
17
|
+
name: 'slave2'
|
19
18
|
}
|
20
19
|
]
|
21
20
|
}
|
@@ -25,27 +24,27 @@ describe Makara::ConfigParser do
|
|
25
24
|
context '::merge_and_resolve_default_url_config' do
|
26
25
|
let(:config_without_url) do
|
27
26
|
{
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:
|
31
|
-
:
|
32
|
-
:
|
33
|
-
:
|
34
|
-
:
|
35
|
-
:
|
36
|
-
:
|
37
|
-
:
|
27
|
+
master_ttl: 5,
|
28
|
+
blacklist_duration: 30,
|
29
|
+
sticky: true,
|
30
|
+
adapter: 'mysql2_makara',
|
31
|
+
encoding: 'utf8',
|
32
|
+
host: 'localhost',
|
33
|
+
database: 'db_name',
|
34
|
+
username: 'db_username',
|
35
|
+
password: 'db_password',
|
36
|
+
port: 3306
|
38
37
|
}
|
39
38
|
end
|
40
39
|
|
41
40
|
let(:config_with_url) do
|
42
41
|
{
|
43
|
-
:
|
44
|
-
:
|
45
|
-
:
|
46
|
-
:
|
47
|
-
:
|
48
|
-
:
|
42
|
+
master_ttl: 5,
|
43
|
+
blacklist_duration: 30,
|
44
|
+
sticky: true,
|
45
|
+
adapter: 'mysql2_makara',
|
46
|
+
encoding: 'utf8',
|
47
|
+
url: 'mysql2://db_username:db_password@localhost:3306/db_name'
|
49
48
|
}
|
50
49
|
end
|
51
50
|
|
@@ -76,12 +75,11 @@ describe Makara::ConfigParser do
|
|
76
75
|
ENV['DATABASE_URL'] = database_url
|
77
76
|
end
|
78
77
|
end
|
79
|
-
|
80
78
|
end
|
81
79
|
|
82
80
|
it 'should provide a default proxy id based on the recursively sorted config' do
|
83
81
|
parsera = described_class.new(config)
|
84
|
-
parserb = described_class.new(config.merge(:
|
82
|
+
parserb = described_class.new(config.merge(other: 'value'))
|
85
83
|
parserc = described_class.new(config)
|
86
84
|
|
87
85
|
expect(parsera.id).not_to eq(parserb.id)
|
@@ -113,27 +111,27 @@ describe Makara::ConfigParser do
|
|
113
111
|
parser = described_class.new(config)
|
114
112
|
expect(parser.master_configs).to eq([
|
115
113
|
{
|
116
|
-
:
|
117
|
-
:
|
118
|
-
:
|
119
|
-
:
|
120
|
-
:
|
114
|
+
name: 'themaster',
|
115
|
+
top_level: 'value',
|
116
|
+
sticky: true,
|
117
|
+
blacklist_duration: 30,
|
118
|
+
master_ttl: 5
|
121
119
|
}
|
122
120
|
])
|
123
121
|
expect(parser.slave_configs).to eq([
|
124
122
|
{
|
125
|
-
:
|
126
|
-
:
|
127
|
-
:
|
128
|
-
:
|
129
|
-
:
|
123
|
+
name: 'slave1',
|
124
|
+
top_level: 'value',
|
125
|
+
sticky: true,
|
126
|
+
blacklist_duration: 30,
|
127
|
+
master_ttl: 5
|
130
128
|
},
|
131
129
|
{
|
132
|
-
:
|
133
|
-
:
|
134
|
-
:
|
135
|
-
:
|
136
|
-
:
|
130
|
+
name: 'slave2',
|
131
|
+
top_level: 'value',
|
132
|
+
sticky: true,
|
133
|
+
blacklist_duration: 30,
|
134
|
+
master_ttl: 5
|
137
135
|
}
|
138
136
|
])
|
139
137
|
end
|
@@ -146,27 +144,27 @@ describe Makara::ConfigParser do
|
|
146
144
|
parser = described_class.new(config)
|
147
145
|
expect(parser.master_configs).to eq([
|
148
146
|
{
|
149
|
-
:
|
150
|
-
:
|
151
|
-
:
|
152
|
-
:
|
153
|
-
:
|
147
|
+
name: 'themaster',
|
148
|
+
top_level: 'value',
|
149
|
+
sticky: true,
|
150
|
+
blacklist_duration: 456,
|
151
|
+
master_ttl: 5
|
154
152
|
}
|
155
153
|
])
|
156
154
|
expect(parser.slave_configs).to eq([
|
157
155
|
{
|
158
|
-
:
|
159
|
-
:
|
160
|
-
:
|
161
|
-
:
|
162
|
-
:
|
156
|
+
name: 'slave1',
|
157
|
+
top_level: 'slave value',
|
158
|
+
sticky: true,
|
159
|
+
blacklist_duration: 123,
|
160
|
+
master_ttl: 5
|
163
161
|
},
|
164
162
|
{
|
165
|
-
:
|
166
|
-
:
|
167
|
-
:
|
168
|
-
:
|
169
|
-
:
|
163
|
+
name: 'slave2',
|
164
|
+
top_level: 'value',
|
165
|
+
sticky: true,
|
166
|
+
blacklist_duration: 123,
|
167
|
+
master_ttl: 5
|
170
168
|
}
|
171
169
|
])
|
172
170
|
end
|