redis 4.0.1 → 4.8.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 +5 -5
- data/CHANGELOG.md +220 -0
- data/README.md +152 -28
- data/lib/redis/client.rb +171 -107
- data/lib/redis/cluster/command.rb +79 -0
- data/lib/redis/cluster/command_loader.rb +33 -0
- data/lib/redis/cluster/key_slot_converter.rb +72 -0
- data/lib/redis/cluster/node.rb +120 -0
- data/lib/redis/cluster/node_key.rb +31 -0
- data/lib/redis/cluster/node_loader.rb +34 -0
- data/lib/redis/cluster/option.rb +100 -0
- data/lib/redis/cluster/slot.rb +86 -0
- data/lib/redis/cluster/slot_loader.rb +46 -0
- data/lib/redis/cluster.rb +315 -0
- data/lib/redis/commands/bitmaps.rb +63 -0
- data/lib/redis/commands/cluster.rb +45 -0
- data/lib/redis/commands/connection.rb +58 -0
- data/lib/redis/commands/geo.rb +84 -0
- data/lib/redis/commands/hashes.rb +251 -0
- data/lib/redis/commands/hyper_log_log.rb +37 -0
- data/lib/redis/commands/keys.rb +455 -0
- data/lib/redis/commands/lists.rb +290 -0
- data/lib/redis/commands/pubsub.rb +72 -0
- data/lib/redis/commands/scripting.rb +114 -0
- data/lib/redis/commands/server.rb +188 -0
- data/lib/redis/commands/sets.rb +223 -0
- data/lib/redis/commands/sorted_sets.rb +812 -0
- data/lib/redis/commands/streams.rb +382 -0
- data/lib/redis/commands/strings.rb +313 -0
- data/lib/redis/commands/transactions.rb +139 -0
- data/lib/redis/commands.rb +240 -0
- data/lib/redis/connection/command_helper.rb +5 -2
- data/lib/redis/connection/hiredis.rb +7 -5
- data/lib/redis/connection/registry.rb +2 -1
- data/lib/redis/connection/ruby.rb +139 -111
- data/lib/redis/connection/synchrony.rb +17 -10
- data/lib/redis/connection.rb +3 -1
- data/lib/redis/distributed.rb +244 -87
- data/lib/redis/errors.rb +57 -0
- data/lib/redis/hash_ring.rb +15 -14
- data/lib/redis/pipeline.rb +181 -10
- data/lib/redis/subscribe.rb +11 -12
- data/lib/redis/version.rb +3 -1
- data/lib/redis.rb +180 -2716
- metadata +45 -195
- data/.gitignore +0 -16
- data/.travis/Gemfile +0 -13
- data/.travis.yml +0 -73
- data/.yardopts +0 -3
- data/Gemfile +0 -3
- data/benchmarking/logging.rb +0 -71
- data/benchmarking/pipeline.rb +0 -51
- data/benchmarking/speed.rb +0 -21
- data/benchmarking/suite.rb +0 -24
- data/benchmarking/worker.rb +0 -71
- data/bors.toml +0 -14
- data/examples/basic.rb +0 -15
- data/examples/consistency.rb +0 -114
- data/examples/dist_redis.rb +0 -43
- data/examples/incr-decr.rb +0 -17
- data/examples/list.rb +0 -26
- data/examples/pubsub.rb +0 -37
- data/examples/sentinel/sentinel.conf +0 -9
- data/examples/sentinel/start +0 -49
- data/examples/sentinel.rb +0 -41
- data/examples/sets.rb +0 -36
- data/examples/unicorn/config.ru +0 -3
- data/examples/unicorn/unicorn.rb +0 -20
- data/makefile +0 -42
- data/redis.gemspec +0 -42
- data/test/bitpos_test.rb +0 -63
- data/test/blocking_commands_test.rb +0 -40
- data/test/client_test.rb +0 -59
- data/test/command_map_test.rb +0 -28
- data/test/commands_on_hashes_test.rb +0 -19
- data/test/commands_on_hyper_log_log_test.rb +0 -19
- data/test/commands_on_lists_test.rb +0 -18
- data/test/commands_on_sets_test.rb +0 -75
- data/test/commands_on_sorted_sets_test.rb +0 -150
- data/test/commands_on_strings_test.rb +0 -99
- data/test/commands_on_value_types_test.rb +0 -171
- data/test/connection_handling_test.rb +0 -275
- data/test/connection_test.rb +0 -57
- data/test/db/.gitkeep +0 -0
- data/test/distributed_blocking_commands_test.rb +0 -44
- data/test/distributed_commands_on_hashes_test.rb +0 -8
- data/test/distributed_commands_on_hyper_log_log_test.rb +0 -31
- data/test/distributed_commands_on_lists_test.rb +0 -20
- data/test/distributed_commands_on_sets_test.rb +0 -106
- data/test/distributed_commands_on_sorted_sets_test.rb +0 -16
- data/test/distributed_commands_on_strings_test.rb +0 -69
- data/test/distributed_commands_on_value_types_test.rb +0 -93
- data/test/distributed_commands_requiring_clustering_test.rb +0 -162
- data/test/distributed_connection_handling_test.rb +0 -21
- data/test/distributed_internals_test.rb +0 -68
- data/test/distributed_key_tags_test.rb +0 -50
- data/test/distributed_persistence_control_commands_test.rb +0 -24
- data/test/distributed_publish_subscribe_test.rb +0 -90
- data/test/distributed_remote_server_control_commands_test.rb +0 -64
- data/test/distributed_scripting_test.rb +0 -100
- data/test/distributed_sorting_test.rb +0 -18
- data/test/distributed_test.rb +0 -56
- data/test/distributed_transactions_test.rb +0 -30
- data/test/encoding_test.rb +0 -14
- data/test/error_replies_test.rb +0 -57
- data/test/fork_safety_test.rb +0 -60
- data/test/helper.rb +0 -201
- data/test/helper_test.rb +0 -22
- data/test/internals_test.rb +0 -389
- data/test/lint/blocking_commands.rb +0 -150
- data/test/lint/hashes.rb +0 -162
- data/test/lint/hyper_log_log.rb +0 -60
- data/test/lint/lists.rb +0 -143
- data/test/lint/sets.rb +0 -140
- data/test/lint/sorted_sets.rb +0 -316
- data/test/lint/strings.rb +0 -246
- data/test/lint/value_types.rb +0 -130
- data/test/persistence_control_commands_test.rb +0 -24
- data/test/pipelining_commands_test.rb +0 -238
- data/test/publish_subscribe_test.rb +0 -280
- data/test/remote_server_control_commands_test.rb +0 -175
- data/test/scanning_test.rb +0 -407
- data/test/scripting_test.rb +0 -76
- data/test/sentinel_command_test.rb +0 -78
- data/test/sentinel_test.rb +0 -253
- data/test/sorting_test.rb +0 -57
- data/test/ssl_test.rb +0 -69
- data/test/support/connection/hiredis.rb +0 -1
- data/test/support/connection/ruby.rb +0 -1
- data/test/support/connection/synchrony.rb +0 -17
- data/test/support/redis_mock.rb +0 -130
- data/test/support/ssl/gen_certs.sh +0 -31
- data/test/support/ssl/trusted-ca.crt +0 -25
- data/test/support/ssl/trusted-ca.key +0 -27
- data/test/support/ssl/trusted-cert.crt +0 -81
- data/test/support/ssl/trusted-cert.key +0 -28
- data/test/support/ssl/untrusted-ca.crt +0 -26
- data/test/support/ssl/untrusted-ca.key +0 -27
- data/test/support/ssl/untrusted-cert.crt +0 -82
- data/test/support/ssl/untrusted-cert.key +0 -28
- data/test/support/wire/synchrony.rb +0 -24
- data/test/support/wire/thread.rb +0 -5
- data/test/synchrony_driver.rb +0 -85
- data/test/test.conf.erb +0 -9
- data/test/thread_safety_test.rb +0 -60
- data/test/transactions_test.rb +0 -262
- data/test/unknown_commands_test.rb +0 -12
- data/test/url_param_test.rb +0 -136
@@ -1,280 +0,0 @@
|
|
1
|
-
require_relative "helper"
|
2
|
-
|
3
|
-
class TestPublishSubscribe < Test::Unit::TestCase
|
4
|
-
|
5
|
-
include Helper::Client
|
6
|
-
|
7
|
-
class TestError < StandardError
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_subscribe_and_unsubscribe
|
11
|
-
@subscribed = false
|
12
|
-
@unsubscribed = false
|
13
|
-
|
14
|
-
wire = Wire.new do
|
15
|
-
r.subscribe("foo") do |on|
|
16
|
-
on.subscribe do |channel, total|
|
17
|
-
@subscribed = true
|
18
|
-
@t1 = total
|
19
|
-
end
|
20
|
-
|
21
|
-
on.message do |channel, message|
|
22
|
-
if message == "s1"
|
23
|
-
r.unsubscribe
|
24
|
-
@message = message
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
on.unsubscribe do |channel, total|
|
29
|
-
@unsubscribed = true
|
30
|
-
@t2 = total
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
# Wait until the subscription is active before publishing
|
36
|
-
Wire.pass while !@subscribed
|
37
|
-
|
38
|
-
Redis.new(OPTIONS).publish("foo", "s1")
|
39
|
-
|
40
|
-
wire.join
|
41
|
-
|
42
|
-
assert @subscribed
|
43
|
-
assert_equal 1, @t1
|
44
|
-
assert @unsubscribed
|
45
|
-
assert_equal 0, @t2
|
46
|
-
assert_equal "s1", @message
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_psubscribe_and_punsubscribe
|
50
|
-
@subscribed = false
|
51
|
-
@unsubscribed = false
|
52
|
-
|
53
|
-
wire = Wire.new do
|
54
|
-
r.psubscribe("f*") do |on|
|
55
|
-
on.psubscribe do |pattern, total|
|
56
|
-
@subscribed = true
|
57
|
-
@t1 = total
|
58
|
-
end
|
59
|
-
|
60
|
-
on.pmessage do |pattern, channel, message|
|
61
|
-
if message == "s1"
|
62
|
-
r.punsubscribe
|
63
|
-
@message = message
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
on.punsubscribe do |pattern, total|
|
68
|
-
@unsubscribed = true
|
69
|
-
@t2 = total
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
# Wait until the subscription is active before publishing
|
75
|
-
Wire.pass while !@subscribed
|
76
|
-
|
77
|
-
Redis.new(OPTIONS).publish("foo", "s1")
|
78
|
-
|
79
|
-
wire.join
|
80
|
-
|
81
|
-
assert @subscribed
|
82
|
-
assert_equal 1, @t1
|
83
|
-
assert @unsubscribed
|
84
|
-
assert_equal 0, @t2
|
85
|
-
assert_equal "s1", @message
|
86
|
-
end
|
87
|
-
|
88
|
-
def test_pubsub_with_numpat_subcommand
|
89
|
-
target_version("2.8.0") do
|
90
|
-
@subscribed = false
|
91
|
-
wire = Wire.new do
|
92
|
-
r.psubscribe("f*") do |on|
|
93
|
-
on.psubscribe { |channel, total| @subscribed = true }
|
94
|
-
on.pmessage { |pattern, channel, message| r.punsubscribe }
|
95
|
-
end
|
96
|
-
end
|
97
|
-
Wire.pass while !@subscribed
|
98
|
-
redis = Redis.new(OPTIONS)
|
99
|
-
numpat_result = redis.pubsub(:numpat)
|
100
|
-
|
101
|
-
redis.publish("foo", "s1")
|
102
|
-
wire.join
|
103
|
-
|
104
|
-
assert_equal redis.pubsub(:numpat), 0
|
105
|
-
assert_equal numpat_result, 1
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
|
110
|
-
def test_pubsub_with_channels_and_numsub_subcommnads
|
111
|
-
target_version("2.8.0") do
|
112
|
-
@subscribed = false
|
113
|
-
wire = Wire.new do
|
114
|
-
r.subscribe("foo") do |on|
|
115
|
-
on.subscribe { |channel, total| @subscribed = true }
|
116
|
-
on.message { |channel, message| r.unsubscribe }
|
117
|
-
end
|
118
|
-
end
|
119
|
-
Wire.pass while !@subscribed
|
120
|
-
redis = Redis.new(OPTIONS)
|
121
|
-
channels_result = redis.pubsub(:channels)
|
122
|
-
numsub_result = redis.pubsub(:numsub, 'foo', 'boo')
|
123
|
-
|
124
|
-
redis.publish("foo", "s1")
|
125
|
-
wire.join
|
126
|
-
|
127
|
-
assert_equal channels_result, ['foo']
|
128
|
-
assert_equal numsub_result, ['foo', 1, 'boo', 0]
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
def test_subscribe_connection_usable_after_raise
|
133
|
-
@subscribed = false
|
134
|
-
|
135
|
-
wire = Wire.new do
|
136
|
-
begin
|
137
|
-
r.subscribe("foo") do |on|
|
138
|
-
on.subscribe do |channel, total|
|
139
|
-
@subscribed = true
|
140
|
-
end
|
141
|
-
|
142
|
-
on.message do |channel, message|
|
143
|
-
raise TestError
|
144
|
-
end
|
145
|
-
end
|
146
|
-
rescue TestError
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
# Wait until the subscription is active before publishing
|
151
|
-
Wire.pass while !@subscribed
|
152
|
-
|
153
|
-
Redis.new(OPTIONS).publish("foo", "s1")
|
154
|
-
|
155
|
-
wire.join
|
156
|
-
|
157
|
-
assert_equal "PONG", r.ping
|
158
|
-
end
|
159
|
-
|
160
|
-
def test_psubscribe_connection_usable_after_raise
|
161
|
-
@subscribed = false
|
162
|
-
|
163
|
-
wire = Wire.new do
|
164
|
-
begin
|
165
|
-
r.psubscribe("f*") do |on|
|
166
|
-
on.psubscribe do |pattern, total|
|
167
|
-
@subscribed = true
|
168
|
-
end
|
169
|
-
|
170
|
-
on.pmessage do |pattern, channel, message|
|
171
|
-
raise TestError
|
172
|
-
end
|
173
|
-
end
|
174
|
-
rescue TestError
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
# Wait until the subscription is active before publishing
|
179
|
-
Wire.pass while !@subscribed
|
180
|
-
|
181
|
-
Redis.new(OPTIONS).publish("foo", "s1")
|
182
|
-
|
183
|
-
wire.join
|
184
|
-
|
185
|
-
assert_equal "PONG", r.ping
|
186
|
-
end
|
187
|
-
|
188
|
-
def test_subscribe_within_subscribe
|
189
|
-
@channels = []
|
190
|
-
|
191
|
-
wire = Wire.new do
|
192
|
-
r.subscribe("foo") do |on|
|
193
|
-
on.subscribe do |channel, total|
|
194
|
-
@channels << channel
|
195
|
-
|
196
|
-
r.subscribe("bar") if channel == "foo"
|
197
|
-
r.unsubscribe if channel == "bar"
|
198
|
-
end
|
199
|
-
end
|
200
|
-
end
|
201
|
-
|
202
|
-
wire.join
|
203
|
-
|
204
|
-
assert_equal ["foo", "bar"], @channels
|
205
|
-
end
|
206
|
-
|
207
|
-
def test_other_commands_within_a_subscribe
|
208
|
-
assert_raise Redis::CommandError do
|
209
|
-
r.subscribe("foo") do |on|
|
210
|
-
on.subscribe do |channel, total|
|
211
|
-
r.set("bar", "s2")
|
212
|
-
end
|
213
|
-
end
|
214
|
-
end
|
215
|
-
end
|
216
|
-
|
217
|
-
def test_subscribe_without_a_block
|
218
|
-
assert_raise LocalJumpError do
|
219
|
-
r.subscribe("foo")
|
220
|
-
end
|
221
|
-
end
|
222
|
-
|
223
|
-
def test_unsubscribe_without_a_subscribe
|
224
|
-
assert_raise RuntimeError do
|
225
|
-
r.unsubscribe
|
226
|
-
end
|
227
|
-
|
228
|
-
assert_raise RuntimeError do
|
229
|
-
r.punsubscribe
|
230
|
-
end
|
231
|
-
end
|
232
|
-
|
233
|
-
def test_subscribe_past_a_timeout
|
234
|
-
# For some reason, a thread here doesn't reproduce the issue.
|
235
|
-
sleep = %{sleep #{OPTIONS[:timeout] * 2}}
|
236
|
-
publish = %{ruby -rsocket -e 't=TCPSocket.new("127.0.0.1",#{OPTIONS[:port]});t.write("publish foo bar\\r\\n");t.read(4);t.close'}
|
237
|
-
cmd = [sleep, publish].join("; ")
|
238
|
-
|
239
|
-
IO.popen(cmd, "r+") do |pipe|
|
240
|
-
received = false
|
241
|
-
|
242
|
-
r.subscribe "foo" do |on|
|
243
|
-
on.message do |channel, message|
|
244
|
-
received = true
|
245
|
-
r.unsubscribe
|
246
|
-
end
|
247
|
-
end
|
248
|
-
|
249
|
-
assert received
|
250
|
-
end
|
251
|
-
end
|
252
|
-
|
253
|
-
def test_subscribe_with_timeout
|
254
|
-
received = false
|
255
|
-
|
256
|
-
assert_raise Redis::TimeoutError do
|
257
|
-
r.subscribe_with_timeout(1, "foo") do |on|
|
258
|
-
on.message do |channel, message|
|
259
|
-
received = true
|
260
|
-
end
|
261
|
-
end
|
262
|
-
end
|
263
|
-
|
264
|
-
assert !received
|
265
|
-
end
|
266
|
-
|
267
|
-
def test_psubscribe_with_timeout
|
268
|
-
received = false
|
269
|
-
|
270
|
-
assert_raise Redis::TimeoutError do
|
271
|
-
r.psubscribe_with_timeout(1, "f*") do |on|
|
272
|
-
on.message do |channel, message|
|
273
|
-
received = true
|
274
|
-
end
|
275
|
-
end
|
276
|
-
end
|
277
|
-
|
278
|
-
assert !received
|
279
|
-
end
|
280
|
-
end
|
@@ -1,175 +0,0 @@
|
|
1
|
-
require_relative "helper"
|
2
|
-
|
3
|
-
class TestRemoteServerControlCommands < Test::Unit::TestCase
|
4
|
-
|
5
|
-
include Helper::Client
|
6
|
-
|
7
|
-
def test_info
|
8
|
-
keys = [
|
9
|
-
"redis_version",
|
10
|
-
"uptime_in_seconds",
|
11
|
-
"uptime_in_days",
|
12
|
-
"connected_clients",
|
13
|
-
"used_memory",
|
14
|
-
"total_connections_received",
|
15
|
-
"total_commands_processed",
|
16
|
-
]
|
17
|
-
|
18
|
-
info = r.info
|
19
|
-
|
20
|
-
keys.each do |k|
|
21
|
-
msg = "expected #info to include #{k}"
|
22
|
-
assert info.keys.include?(k), msg
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_info_commandstats
|
27
|
-
target_version "2.5.7" do
|
28
|
-
r.config(:resetstat)
|
29
|
-
r.ping
|
30
|
-
|
31
|
-
result = r.info(:commandstats)
|
32
|
-
assert_equal "1", result["ping"]["calls"]
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_monitor_redis_lt_2_5_0
|
37
|
-
return unless version < "2.5.0"
|
38
|
-
|
39
|
-
log = []
|
40
|
-
|
41
|
-
wire = Wire.new do
|
42
|
-
Redis.new(OPTIONS).monitor do |line|
|
43
|
-
log << line
|
44
|
-
break if log.size == 3
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
Wire.pass while log.empty? # Faster than sleep
|
49
|
-
|
50
|
-
r.set "foo", "s1"
|
51
|
-
|
52
|
-
wire.join
|
53
|
-
|
54
|
-
assert log[-1][%q{(db 15) "set" "foo" "s1"}]
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_monitor_redis_gte_2_5_0
|
58
|
-
return unless version >= "2.5.0"
|
59
|
-
|
60
|
-
log = []
|
61
|
-
|
62
|
-
wire = Wire.new do
|
63
|
-
Redis.new(OPTIONS).monitor do |line|
|
64
|
-
log << line
|
65
|
-
break if line =~ /set/
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
Wire.pass while log.empty? # Faster than sleep
|
70
|
-
|
71
|
-
r.set "foo", "s1"
|
72
|
-
|
73
|
-
wire.join
|
74
|
-
|
75
|
-
assert log[-1] =~ /\b15\b.* "set" "foo" "s1"/
|
76
|
-
end
|
77
|
-
|
78
|
-
def test_monitor_returns_value_for_break
|
79
|
-
result = r.monitor do |line|
|
80
|
-
break line
|
81
|
-
end
|
82
|
-
|
83
|
-
assert_equal "OK", result
|
84
|
-
end
|
85
|
-
|
86
|
-
def test_echo
|
87
|
-
assert_equal "foo bar baz\n", r.echo("foo bar baz\n")
|
88
|
-
end
|
89
|
-
|
90
|
-
def test_debug
|
91
|
-
r.set "foo", "s1"
|
92
|
-
|
93
|
-
assert r.debug(:object, "foo").kind_of?(String)
|
94
|
-
end
|
95
|
-
|
96
|
-
def test_object
|
97
|
-
r.lpush "list", "value"
|
98
|
-
|
99
|
-
assert_equal 1, r.object(:refcount, "list")
|
100
|
-
encoding = r.object(:encoding, "list")
|
101
|
-
assert "ziplist" == encoding || "quicklist" == encoding, "Wrong encoding for list"
|
102
|
-
assert r.object(:idletime, "list").kind_of?(Integer)
|
103
|
-
end
|
104
|
-
|
105
|
-
def test_sync
|
106
|
-
redis_mock(:sync => lambda { "+OK" }) do |redis|
|
107
|
-
assert_equal "OK", redis.sync
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
def test_slowlog
|
112
|
-
r.slowlog(:reset)
|
113
|
-
result = r.slowlog(:len)
|
114
|
-
assert_equal 0, result
|
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
|
175
|
-
end
|