redis 3.3.5 → 4.0.0
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/.travis.yml +36 -52
- data/.travis/Gemfile +3 -1
- data/CHANGELOG.md +8 -6
- data/Gemfile +0 -1
- data/README.md +31 -75
- data/benchmarking/logging.rb +1 -1
- data/bors.toml +14 -0
- data/lib/redis.rb +68 -41
- data/lib/redis/client.rb +12 -8
- data/lib/redis/connection.rb +2 -2
- data/lib/redis/connection/command_helper.rb +2 -8
- data/lib/redis/connection/hiredis.rb +2 -2
- data/lib/redis/connection/ruby.rb +8 -28
- data/lib/redis/connection/synchrony.rb +12 -4
- data/lib/redis/distributed.rb +3 -3
- data/lib/redis/hash_ring.rb +20 -64
- data/lib/redis/pipeline.rb +0 -6
- data/lib/redis/version.rb +1 -1
- data/makefile +42 -0
- data/redis.gemspec +7 -9
- data/test/bitpos_test.rb +13 -19
- data/test/blocking_commands_test.rb +3 -5
- data/test/client_test.rb +1 -1
- data/test/command_map_test.rb +3 -5
- data/test/commands_on_hashes_test.rb +2 -4
- data/test/commands_on_hyper_log_log_test.rb +3 -5
- data/test/commands_on_lists_test.rb +2 -4
- data/test/commands_on_sets_test.rb +2 -4
- data/test/commands_on_sorted_sets_test.rb +17 -4
- data/test/commands_on_strings_test.rb +3 -5
- data/test/commands_on_value_types_test.rb +4 -6
- data/test/connection_handling_test.rb +5 -7
- data/test/distributed_blocking_commands_test.rb +2 -4
- data/test/distributed_commands_on_hashes_test.rb +2 -4
- data/test/distributed_commands_on_hyper_log_log_test.rb +2 -4
- data/test/distributed_commands_on_lists_test.rb +2 -4
- data/test/distributed_commands_on_sets_test.rb +2 -4
- data/test/distributed_commands_on_sorted_sets_test.rb +2 -4
- data/test/distributed_commands_on_strings_test.rb +2 -4
- data/test/distributed_commands_on_value_types_test.rb +2 -4
- data/test/distributed_commands_requiring_clustering_test.rb +1 -3
- data/test/distributed_connection_handling_test.rb +1 -3
- data/test/distributed_internals_test.rb +8 -19
- data/test/distributed_key_tags_test.rb +4 -6
- data/test/distributed_persistence_control_commands_test.rb +1 -3
- data/test/distributed_publish_subscribe_test.rb +1 -3
- data/test/distributed_remote_server_control_commands_test.rb +1 -3
- data/test/distributed_scripting_test.rb +1 -3
- data/test/distributed_sorting_test.rb +1 -3
- data/test/distributed_test.rb +12 -14
- data/test/distributed_transactions_test.rb +1 -3
- data/test/encoding_test.rb +4 -8
- data/test/error_replies_test.rb +2 -4
- data/test/fork_safety_test.rb +1 -6
- data/test/helper.rb +10 -41
- data/test/helper_test.rb +1 -3
- data/test/internals_test.rb +67 -55
- data/test/lint/strings.rb +6 -20
- data/test/lint/value_types.rb +8 -0
- data/test/persistence_control_commands_test.rb +1 -3
- data/test/pipelining_commands_test.rb +4 -8
- data/test/publish_subscribe_test.rb +1 -3
- data/test/remote_server_control_commands_test.rb +60 -3
- data/test/scanning_test.rb +1 -7
- data/test/scripting_test.rb +1 -3
- data/test/sentinel_command_test.rb +1 -3
- data/test/sentinel_test.rb +1 -3
- data/test/sorting_test.rb +1 -3
- data/test/ssl_test.rb +45 -49
- data/test/support/connection/hiredis.rb +1 -1
- data/test/support/connection/ruby.rb +1 -1
- data/test/support/connection/synchrony.rb +1 -1
- data/test/synchrony_driver.rb +6 -9
- data/test/thread_safety_test.rb +1 -3
- data/test/transactions_test.rb +1 -3
- data/test/unknown_commands_test.rb +1 -3
- data/test/url_param_test.rb +44 -46
- metadata +30 -18
- data/Rakefile +0 -87
- data/test/connection_test.rb +0 -57
data/test/lint/strings.rb
CHANGED
@@ -8,18 +8,6 @@ module Lint
|
|
8
8
|
assert_equal "s1", r.get("foo")
|
9
9
|
end
|
10
10
|
|
11
|
-
def test_set_and_get_with_brackets
|
12
|
-
r["foo"] = "s1"
|
13
|
-
|
14
|
-
assert_equal "s1", r["foo"]
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_set_and_get_with_brackets_and_symbol
|
18
|
-
r[:foo] = "s1"
|
19
|
-
|
20
|
-
assert_equal "s1", r[:foo]
|
21
|
-
end
|
22
|
-
|
23
11
|
def test_set_and_get_with_newline_characters
|
24
12
|
r.set("foo", "1\n")
|
25
13
|
|
@@ -35,14 +23,12 @@ module Lint
|
|
35
23
|
end
|
36
24
|
|
37
25
|
def test_set_and_get_with_ascii_characters
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
assert_equal str, r.get("foo")
|
45
|
-
end
|
26
|
+
with_external_encoding("ASCII-8BIT") do
|
27
|
+
(0..255).each do |i|
|
28
|
+
str = "#{i.chr}---#{i.chr}"
|
29
|
+
r.set("foo", str)
|
30
|
+
|
31
|
+
assert_equal str, r.get("foo")
|
46
32
|
end
|
47
33
|
end
|
48
34
|
end
|
data/test/lint/value_types.rb
CHANGED
@@ -93,6 +93,14 @@ module Lint
|
|
93
93
|
assert r.restore("bar", 1000, w)
|
94
94
|
assert_equal ["b", "c", "d"], r.lrange("bar", 0, -1)
|
95
95
|
assert [0, 1].include? r.ttl("bar")
|
96
|
+
|
97
|
+
r.set("bar", "somethingelse")
|
98
|
+
assert_raises(Redis::CommandError) { r.restore("bar", 1000, w) } # ensure by default replace is false
|
99
|
+
assert_raises(Redis::CommandError) { r.restore("bar", 1000, w, :replace => false) }
|
100
|
+
assert_equal "somethingelse", r.get("bar")
|
101
|
+
assert r.restore("bar", 1000, w, :replace => true)
|
102
|
+
assert_equal ["b", "c", "d"], r.lrange("bar", 0, -1)
|
103
|
+
assert [0, 1].include? r.ttl("bar")
|
96
104
|
end
|
97
105
|
end
|
98
106
|
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require File.expand_path("helper", File.dirname(__FILE__))
|
1
|
+
require_relative "helper"
|
4
2
|
|
5
3
|
class TestPipeliningCommands < Test::Unit::TestCase
|
6
4
|
|
@@ -136,9 +134,7 @@ class TestPipeliningCommands < Test::Unit::TestCase
|
|
136
134
|
end
|
137
135
|
|
138
136
|
assert_equal true, @result.is_a?(Redis::Future)
|
139
|
-
|
140
|
-
assert_equal true, @result.is_a?(::BasicObject)
|
141
|
-
end
|
137
|
+
assert_equal true, @result.is_a?(::BasicObject)
|
142
138
|
assert_equal Redis::Future, @result.class
|
143
139
|
end
|
144
140
|
|
@@ -225,7 +221,7 @@ class TestPipeliningCommands < Test::Unit::TestCase
|
|
225
221
|
p2.select 2
|
226
222
|
end
|
227
223
|
|
228
|
-
assert_equal 2, r.
|
224
|
+
assert_equal 2, r._client.db
|
229
225
|
end
|
230
226
|
|
231
227
|
def test_nested_pipeline_select_client_db
|
@@ -237,6 +233,6 @@ class TestPipeliningCommands < Test::Unit::TestCase
|
|
237
233
|
end
|
238
234
|
end
|
239
235
|
|
240
|
-
assert_equal 3, r.
|
236
|
+
assert_equal 3, r._client.db
|
241
237
|
end
|
242
238
|
end
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require File.expand_path("helper", File.dirname(__FILE__))
|
1
|
+
require_relative "helper"
|
4
2
|
|
5
3
|
class TestRemoteServerControlCommands < Test::Unit::TestCase
|
6
4
|
|
@@ -115,4 +113,63 @@ class TestRemoteServerControlCommands < Test::Unit::TestCase
|
|
115
113
|
result = r.slowlog(:len)
|
116
114
|
assert_equal 0, result
|
117
115
|
end
|
116
|
+
|
117
|
+
def test_client
|
118
|
+
assert_equal r.instance_variable_get(:@client), r._client
|
119
|
+
end
|
120
|
+
|
121
|
+
def test_client_list
|
122
|
+
return if version < "2.4.0"
|
123
|
+
|
124
|
+
keys = [
|
125
|
+
"addr",
|
126
|
+
"fd",
|
127
|
+
"name",
|
128
|
+
"age",
|
129
|
+
"idle",
|
130
|
+
"flags",
|
131
|
+
"db",
|
132
|
+
"sub",
|
133
|
+
"psub",
|
134
|
+
"multi",
|
135
|
+
"qbuf",
|
136
|
+
"qbuf-free",
|
137
|
+
"obl",
|
138
|
+
"oll",
|
139
|
+
"omem",
|
140
|
+
"events",
|
141
|
+
"cmd"
|
142
|
+
]
|
143
|
+
|
144
|
+
clients = r.client(:list)
|
145
|
+
clients.each do |client|
|
146
|
+
keys.each do |k|
|
147
|
+
msg = "expected #client(:list) to include #{k}"
|
148
|
+
assert client.keys.include?(k), msg
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
def test_client_kill
|
154
|
+
return if version < "2.6.9"
|
155
|
+
|
156
|
+
r.client(:setname, 'redis-rb')
|
157
|
+
clients = r.client(:list)
|
158
|
+
i = clients.index {|client| client['name'] == 'redis-rb'}
|
159
|
+
assert_equal "OK", r.client(:kill, clients[i]["addr"])
|
160
|
+
|
161
|
+
clients = r.client(:list)
|
162
|
+
i = clients.index {|client| client['name'] == 'redis-rb'}
|
163
|
+
assert_equal nil, i
|
164
|
+
end
|
165
|
+
|
166
|
+
def test_client_getname_and_setname
|
167
|
+
return if version < "2.6.9"
|
168
|
+
|
169
|
+
assert_equal nil, r.client(:getname)
|
170
|
+
|
171
|
+
r.client(:setname, 'redis-rb')
|
172
|
+
name = r.client(:getname)
|
173
|
+
assert_equal 'redis-rb', name
|
174
|
+
end
|
118
175
|
end
|
data/test/scanning_test.rb
CHANGED
data/test/scripting_test.rb
CHANGED
data/test/sentinel_test.rb
CHANGED
data/test/sorting_test.rb
CHANGED
data/test/ssl_test.rb
CHANGED
@@ -1,73 +1,69 @@
|
|
1
|
-
|
1
|
+
require_relative "helper"
|
2
2
|
|
3
|
-
|
4
|
-
require File.expand_path("helper", File.dirname(__FILE__))
|
3
|
+
class SslTest < Test::Unit::TestCase
|
5
4
|
|
6
|
-
|
5
|
+
include Helper::Client
|
7
6
|
|
8
|
-
|
7
|
+
driver(:ruby) do
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
redis = Redis.new(:port => port, :ssl => true, :ssl_params => { :ca_file => ssl_ca_file })
|
15
|
-
assert_equal redis.ping, "PONG"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_unverified_ssl_connection
|
20
|
-
assert_raise(OpenSSL::SSL::SSLError) do
|
21
|
-
RedisMock.start({ :ping => proc { "+PONG" } }, ssl_server_opts("untrusted")) do |port|
|
22
|
-
redis = Redis.new(:port => port, :ssl => true, :ssl_params => { :ca_file => ssl_ca_file })
|
23
|
-
redis.ping
|
24
|
-
end
|
25
|
-
end
|
9
|
+
def test_verified_ssl_connection
|
10
|
+
RedisMock.start({ :ping => proc { "+PONG" } }, ssl_server_opts("trusted")) do |port|
|
11
|
+
redis = Redis.new(:port => port, :ssl => true, :ssl_params => { :ca_file => ssl_ca_file })
|
12
|
+
assert_equal redis.ping, "PONG"
|
26
13
|
end
|
14
|
+
end
|
27
15
|
|
28
|
-
|
29
|
-
|
16
|
+
def test_unverified_ssl_connection
|
17
|
+
assert_raise(OpenSSL::SSL::SSLError) do
|
18
|
+
RedisMock.start({ :ping => proc { "+PONG" } }, ssl_server_opts("untrusted")) do |port|
|
30
19
|
redis = Redis.new(:port => port, :ssl => true, :ssl_params => { :ca_file => ssl_ca_file })
|
31
|
-
|
20
|
+
redis.ping
|
32
21
|
end
|
33
22
|
end
|
23
|
+
end
|
34
24
|
|
25
|
+
def test_ssl_blocking
|
26
|
+
RedisMock.start({}, ssl_server_opts("trusted")) do |port|
|
27
|
+
redis = Redis.new(:port => port, :ssl => true, :ssl_params => { :ca_file => ssl_ca_file })
|
28
|
+
assert_equal redis.set("boom", "a" * 10_000_000), "OK"
|
29
|
+
end
|
35
30
|
end
|
36
31
|
|
37
|
-
|
32
|
+
end
|
33
|
+
|
34
|
+
driver(:hiredis, :synchrony) do
|
38
35
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
end
|
36
|
+
def test_ssl_not_implemented_exception
|
37
|
+
assert_raise(NotImplementedError) do
|
38
|
+
RedisMock.start({ :ping => proc { "+PONG" } }, ssl_server_opts("trusted")) do |port|
|
39
|
+
redis = Redis.new(:port => port, :ssl => true, :ssl_params => { :ca_file => ssl_ca_file })
|
40
|
+
redis.ping
|
45
41
|
end
|
46
42
|
end
|
47
|
-
|
48
43
|
end
|
49
44
|
|
50
|
-
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
51
48
|
|
52
|
-
|
53
|
-
|
54
|
-
|
49
|
+
def ssl_server_opts(prefix)
|
50
|
+
ssl_cert = File.join(cert_path, "#{prefix}-cert.crt")
|
51
|
+
ssl_key = File.join(cert_path, "#{prefix}-cert.key")
|
55
52
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
}
|
53
|
+
{
|
54
|
+
:ssl => true,
|
55
|
+
:ssl_params => {
|
56
|
+
:cert => OpenSSL::X509::Certificate.new(File.read(ssl_cert)),
|
57
|
+
:key => OpenSSL::PKey::RSA.new(File.read(ssl_key))
|
62
58
|
}
|
63
|
-
|
59
|
+
}
|
60
|
+
end
|
64
61
|
|
65
|
-
|
66
|
-
|
67
|
-
|
62
|
+
def ssl_ca_file
|
63
|
+
File.join(cert_path, "trusted-ca.crt")
|
64
|
+
end
|
68
65
|
|
69
|
-
|
70
|
-
|
71
|
-
end
|
66
|
+
def cert_path
|
67
|
+
File.expand_path("../support/ssl/", __FILE__)
|
72
68
|
end
|
73
69
|
end
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
require_relative "../wire/thread"
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
require_relative "../wire/thread"
|
data/test/synchrony_driver.rb
CHANGED
@@ -1,13 +1,10 @@
|
|
1
|
-
|
1
|
+
require "em-synchrony"
|
2
|
+
require "em-synchrony/connection_pool"
|
2
3
|
|
3
|
-
|
4
|
-
|
4
|
+
require_relative "../lib/redis"
|
5
|
+
require_relative "../lib/redis/connection/synchrony"
|
5
6
|
|
6
|
-
|
7
|
-
require 'redis/connection/synchrony'
|
8
|
-
|
9
|
-
|
10
|
-
require File.expand_path("./helper", File.dirname(__FILE__))
|
7
|
+
require_relative "helper"
|
11
8
|
|
12
9
|
PORT = 6381
|
13
10
|
OPTIONS = {:port => PORT, :db => 15}
|
@@ -55,7 +52,7 @@ EM.synchrony do
|
|
55
52
|
assert_equal "s2", r.lpop("foo")
|
56
53
|
assert_equal "s1", r.lpop("foo")
|
57
54
|
|
58
|
-
assert_equal "OK", r.
|
55
|
+
assert_equal "OK", r._client.call(:quit)
|
59
56
|
assert_equal "PONG", r.ping
|
60
57
|
|
61
58
|
|
data/test/thread_safety_test.rb
CHANGED
data/test/transactions_test.rb
CHANGED
data/test/url_param_test.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require File.expand_path("helper", File.dirname(__FILE__))
|
1
|
+
require_relative "helper"
|
4
2
|
|
5
3
|
class TestUrlParam < Test::Unit::TestCase
|
6
4
|
|
@@ -9,104 +7,104 @@ class TestUrlParam < Test::Unit::TestCase
|
|
9
7
|
def test_url_defaults_to_______________
|
10
8
|
redis = Redis.new
|
11
9
|
|
12
|
-
assert_equal "127.0.0.1", redis.
|
13
|
-
assert_equal 6379, redis.
|
14
|
-
assert_equal 0, redis.
|
15
|
-
assert_equal nil, redis.
|
10
|
+
assert_equal "127.0.0.1", redis._client.host
|
11
|
+
assert_equal 6379, redis._client.port
|
12
|
+
assert_equal 0, redis._client.db
|
13
|
+
assert_equal nil, redis._client.password
|
16
14
|
end
|
17
15
|
|
18
16
|
def test_allows_to_pass_in_a_url
|
19
17
|
redis = Redis.new :url => "redis://:secr3t@foo.com:999/2"
|
20
18
|
|
21
|
-
assert_equal "foo.com", redis.
|
22
|
-
assert_equal 999, redis.
|
23
|
-
assert_equal 2, redis.
|
24
|
-
assert_equal "secr3t", redis.
|
19
|
+
assert_equal "foo.com", redis._client.host
|
20
|
+
assert_equal 999, redis._client.port
|
21
|
+
assert_equal 2, redis._client.db
|
22
|
+
assert_equal "secr3t", redis._client.password
|
25
23
|
end
|
26
24
|
|
27
25
|
def test_allows_to_pass_in_a_url_with_string_key
|
28
26
|
redis = Redis.new "url" => "redis://:secr3t@foo.com:999/2"
|
29
27
|
|
30
|
-
assert_equal "foo.com", redis.
|
31
|
-
assert_equal 999, redis.
|
32
|
-
assert_equal 2, redis.
|
33
|
-
assert_equal "secr3t", redis.
|
28
|
+
assert_equal "foo.com", redis._client.host
|
29
|
+
assert_equal 999, redis._client.port
|
30
|
+
assert_equal 2, redis._client.db
|
31
|
+
assert_equal "secr3t", redis._client.password
|
34
32
|
end
|
35
33
|
|
36
34
|
def test_unescape_password_from_url
|
37
35
|
redis = Redis.new :url => "redis://:secr3t%3A@foo.com:999/2"
|
38
36
|
|
39
|
-
assert_equal "secr3t:", redis.
|
37
|
+
assert_equal "secr3t:", redis._client.password
|
40
38
|
end
|
41
39
|
|
42
40
|
def test_unescape_password_from_url_with_string_key
|
43
41
|
redis = Redis.new "url" => "redis://:secr3t%3A@foo.com:999/2"
|
44
42
|
|
45
|
-
assert_equal "secr3t:", redis.
|
43
|
+
assert_equal "secr3t:", redis._client.password
|
46
44
|
end
|
47
45
|
|
48
46
|
def test_does_not_unescape_password_when_explicitly_passed
|
49
47
|
redis = Redis.new :url => "redis://:secr3t%3A@foo.com:999/2", :password => "secr3t%3A"
|
50
48
|
|
51
|
-
assert_equal "secr3t%3A", redis.
|
49
|
+
assert_equal "secr3t%3A", redis._client.password
|
52
50
|
end
|
53
51
|
|
54
52
|
def test_does_not_unescape_password_when_explicitly_passed_with_string_key
|
55
53
|
redis = Redis.new :url => "redis://:secr3t%3A@foo.com:999/2", "password" => "secr3t%3A"
|
56
54
|
|
57
|
-
assert_equal "secr3t%3A", redis.
|
55
|
+
assert_equal "secr3t%3A", redis._client.password
|
58
56
|
end
|
59
57
|
|
60
58
|
def test_override_url_if_path_option_is_passed
|
61
59
|
redis = Redis.new :url => "redis://:secr3t@foo.com/foo:999/2", :path => "/tmp/redis.sock"
|
62
60
|
|
63
|
-
assert_equal "/tmp/redis.sock", redis.
|
64
|
-
assert_equal nil, redis.
|
65
|
-
assert_equal nil, redis.
|
61
|
+
assert_equal "/tmp/redis.sock", redis._client.path
|
62
|
+
assert_equal nil, redis._client.host
|
63
|
+
assert_equal nil, redis._client.port
|
66
64
|
end
|
67
65
|
|
68
66
|
def test_override_url_if_path_option_is_passed_with_string_key
|
69
67
|
redis = Redis.new :url => "redis://:secr3t@foo.com/foo:999/2", "path" => "/tmp/redis.sock"
|
70
68
|
|
71
|
-
assert_equal "/tmp/redis.sock", redis.
|
72
|
-
assert_equal nil, redis.
|
73
|
-
assert_equal nil, redis.
|
69
|
+
assert_equal "/tmp/redis.sock", redis._client.path
|
70
|
+
assert_equal nil, redis._client.host
|
71
|
+
assert_equal nil, redis._client.port
|
74
72
|
end
|
75
73
|
|
76
74
|
def test_overrides_url_if_another_connection_option_is_passed
|
77
75
|
redis = Redis.new :url => "redis://:secr3t@foo.com:999/2", :port => 1000
|
78
76
|
|
79
|
-
assert_equal "foo.com", redis.
|
80
|
-
assert_equal 1000, redis.
|
81
|
-
assert_equal 2, redis.
|
82
|
-
assert_equal "secr3t", redis.
|
77
|
+
assert_equal "foo.com", redis._client.host
|
78
|
+
assert_equal 1000, redis._client.port
|
79
|
+
assert_equal 2, redis._client.db
|
80
|
+
assert_equal "secr3t", redis._client.password
|
83
81
|
end
|
84
82
|
|
85
83
|
def test_overrides_url_if_another_connection_option_is_passed_with_string_key
|
86
84
|
redis = Redis.new :url => "redis://:secr3t@foo.com:999/2", "port" => 1000
|
87
85
|
|
88
|
-
assert_equal "foo.com", redis.
|
89
|
-
assert_equal 1000, redis.
|
90
|
-
assert_equal 2, redis.
|
91
|
-
assert_equal "secr3t", redis.
|
86
|
+
assert_equal "foo.com", redis._client.host
|
87
|
+
assert_equal 1000, redis._client.port
|
88
|
+
assert_equal 2, redis._client.db
|
89
|
+
assert_equal "secr3t", redis._client.password
|
92
90
|
end
|
93
91
|
|
94
92
|
def test_does_not_overrides_url_if_a_nil_option_is_passed
|
95
93
|
redis = Redis.new :url => "redis://:secr3t@foo.com:999/2", :port => nil
|
96
94
|
|
97
|
-
assert_equal "foo.com", redis.
|
98
|
-
assert_equal 999, redis.
|
99
|
-
assert_equal 2, redis.
|
100
|
-
assert_equal "secr3t", redis.
|
95
|
+
assert_equal "foo.com", redis._client.host
|
96
|
+
assert_equal 999, redis._client.port
|
97
|
+
assert_equal 2, redis._client.db
|
98
|
+
assert_equal "secr3t", redis._client.password
|
101
99
|
end
|
102
100
|
|
103
101
|
def test_does_not_overrides_url_if_a_nil_option_is_passed_with_string_key
|
104
102
|
redis = Redis.new :url => "redis://:secr3t@foo.com:999/2", "port" => nil
|
105
103
|
|
106
|
-
assert_equal "foo.com", redis.
|
107
|
-
assert_equal 999, redis.
|
108
|
-
assert_equal 2, redis.
|
109
|
-
assert_equal "secr3t", redis.
|
104
|
+
assert_equal "foo.com", redis._client.host
|
105
|
+
assert_equal 999, redis._client.port
|
106
|
+
assert_equal 2, redis._client.db
|
107
|
+
assert_equal "secr3t", redis._client.password
|
110
108
|
end
|
111
109
|
|
112
110
|
def test_does_not_modify_the_passed_options
|
@@ -122,10 +120,10 @@ class TestUrlParam < Test::Unit::TestCase
|
|
122
120
|
|
123
121
|
redis = Redis.new
|
124
122
|
|
125
|
-
assert_equal "foo.com", redis.
|
126
|
-
assert_equal 999, redis.
|
127
|
-
assert_equal 2, redis.
|
128
|
-
assert_equal "secr3t", redis.
|
123
|
+
assert_equal "foo.com", redis._client.host
|
124
|
+
assert_equal 999, redis._client.port
|
125
|
+
assert_equal 2, redis._client.db
|
126
|
+
assert_equal "secr3t", redis._client.password
|
129
127
|
|
130
128
|
ENV.delete("REDIS_URL")
|
131
129
|
end
|
@@ -133,6 +131,6 @@ class TestUrlParam < Test::Unit::TestCase
|
|
133
131
|
def test_defaults_to_localhost
|
134
132
|
redis = Redis.new(:url => "redis:///")
|
135
133
|
|
136
|
-
assert_equal "127.0.0.1", redis.
|
134
|
+
assert_equal "127.0.0.1", redis._client.host
|
137
135
|
end
|
138
136
|
end
|