redis 3.3.5 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/.travis/Gemfile +3 -1
  3. data/.travis.yml +36 -52
  4. data/CHANGELOG.md +18 -4
  5. data/Gemfile +0 -1
  6. data/README.md +31 -75
  7. data/benchmarking/logging.rb +1 -1
  8. data/bors.toml +14 -0
  9. data/lib/redis/client.rb +12 -8
  10. data/lib/redis/connection/command_helper.rb +2 -8
  11. data/lib/redis/connection/hiredis.rb +2 -2
  12. data/lib/redis/connection/ruby.rb +8 -28
  13. data/lib/redis/connection/synchrony.rb +12 -4
  14. data/lib/redis/connection.rb +2 -2
  15. data/lib/redis/distributed.rb +19 -6
  16. data/lib/redis/hash_ring.rb +20 -64
  17. data/lib/redis/pipeline.rb +0 -6
  18. data/lib/redis/version.rb +1 -1
  19. data/lib/redis.rb +89 -40
  20. data/makefile +42 -0
  21. data/redis.gemspec +7 -9
  22. data/test/bitpos_test.rb +13 -19
  23. data/test/blocking_commands_test.rb +3 -5
  24. data/test/client_test.rb +1 -1
  25. data/test/command_map_test.rb +3 -5
  26. data/test/commands_on_hashes_test.rb +2 -4
  27. data/test/commands_on_hyper_log_log_test.rb +3 -5
  28. data/test/commands_on_lists_test.rb +2 -4
  29. data/test/commands_on_sets_test.rb +2 -4
  30. data/test/commands_on_sorted_sets_test.rb +17 -4
  31. data/test/commands_on_strings_test.rb +3 -5
  32. data/test/commands_on_value_types_test.rb +44 -6
  33. data/test/connection_handling_test.rb +5 -7
  34. data/test/distributed_blocking_commands_test.rb +2 -4
  35. data/test/distributed_commands_on_hashes_test.rb +2 -4
  36. data/test/distributed_commands_on_hyper_log_log_test.rb +2 -4
  37. data/test/distributed_commands_on_lists_test.rb +2 -4
  38. data/test/distributed_commands_on_sets_test.rb +27 -4
  39. data/test/distributed_commands_on_sorted_sets_test.rb +2 -4
  40. data/test/distributed_commands_on_strings_test.rb +20 -10
  41. data/test/distributed_commands_on_value_types_test.rb +2 -4
  42. data/test/distributed_commands_requiring_clustering_test.rb +1 -3
  43. data/test/distributed_connection_handling_test.rb +1 -3
  44. data/test/distributed_internals_test.rb +8 -19
  45. data/test/distributed_key_tags_test.rb +4 -6
  46. data/test/distributed_persistence_control_commands_test.rb +1 -3
  47. data/test/distributed_publish_subscribe_test.rb +1 -3
  48. data/test/distributed_remote_server_control_commands_test.rb +1 -3
  49. data/test/distributed_scripting_test.rb +1 -3
  50. data/test/distributed_sorting_test.rb +1 -3
  51. data/test/distributed_test.rb +12 -14
  52. data/test/distributed_transactions_test.rb +1 -3
  53. data/test/encoding_test.rb +4 -8
  54. data/test/error_replies_test.rb +2 -4
  55. data/test/fork_safety_test.rb +1 -6
  56. data/test/helper.rb +10 -41
  57. data/test/helper_test.rb +1 -3
  58. data/test/internals_test.rb +27 -55
  59. data/test/lint/strings.rb +6 -20
  60. data/test/lint/value_types.rb +8 -0
  61. data/test/persistence_control_commands_test.rb +1 -3
  62. data/test/pipelining_commands_test.rb +4 -8
  63. data/test/publish_subscribe_test.rb +1 -3
  64. data/test/remote_server_control_commands_test.rb +60 -3
  65. data/test/scanning_test.rb +1 -7
  66. data/test/scripting_test.rb +1 -3
  67. data/test/sentinel_command_test.rb +1 -3
  68. data/test/sentinel_test.rb +1 -3
  69. data/test/sorting_test.rb +1 -3
  70. data/test/ssl_test.rb +45 -49
  71. data/test/support/connection/hiredis.rb +1 -1
  72. data/test/support/connection/ruby.rb +1 -1
  73. data/test/support/connection/synchrony.rb +1 -1
  74. data/test/synchrony_driver.rb +6 -9
  75. data/test/thread_safety_test.rb +1 -3
  76. data/test/transactions_test.rb +1 -3
  77. data/test/unknown_commands_test.rb +1 -3
  78. data/test/url_param_test.rb +44 -46
  79. metadata +29 -15
  80. data/Rakefile +0 -87
@@ -1,11 +1,8 @@
1
- # encoding: UTF-8
2
-
3
- require File.expand_path("helper", File.dirname(__FILE__))
1
+ require_relative "helper"
4
2
 
5
3
  class TestInternals < Test::Unit::TestCase
6
4
 
7
5
  include Helper::Client
8
- include Helper::Skipable
9
6
 
10
7
  def test_logger
11
8
  r.ping
@@ -45,23 +42,23 @@ class TestInternals < Test::Unit::TestCase
45
42
  end
46
43
 
47
44
  def test_redis_current
48
- assert_equal "127.0.0.1", Redis.current.client.host
49
- assert_equal 6379, Redis.current.client.port
50
- assert_equal 0, Redis.current.client.db
45
+ assert_equal "127.0.0.1", Redis.current._client.host
46
+ assert_equal 6379, Redis.current._client.port
47
+ assert_equal 0, Redis.current._client.db
51
48
 
52
49
  Redis.current = Redis.new(OPTIONS.merge(:port => 6380, :db => 1))
53
50
 
54
51
  t = Thread.new do
55
- assert_equal "127.0.0.1", Redis.current.client.host
56
- assert_equal 6380, Redis.current.client.port
57
- assert_equal 1, Redis.current.client.db
52
+ assert_equal "127.0.0.1", Redis.current._client.host
53
+ assert_equal 6380, Redis.current._client.port
54
+ assert_equal 1, Redis.current._client.db
58
55
  end
59
56
 
60
57
  t.join
61
58
 
62
- assert_equal "127.0.0.1", Redis.current.client.host
63
- assert_equal 6380, Redis.current.client.port
64
- assert_equal 1, Redis.current.client.db
59
+ assert_equal "127.0.0.1", Redis.current._client.host
60
+ assert_equal 6380, Redis.current._client.port
61
+ assert_equal 1, Redis.current._client.db
65
62
  end
66
63
 
67
64
  def test_redis_connected?
@@ -88,7 +85,7 @@ class TestInternals < Test::Unit::TestCase
88
85
  redis = Redis.new(OPTIONS.merge(:tcp_keepalive => keepalive))
89
86
  redis.ping
90
87
 
91
- connection = redis.client.connection
88
+ connection = redis._client.connection
92
89
  actual_keepalive = connection.get_tcp_keepalive
93
90
 
94
91
  [:time, :intvl, :probes].each do |key|
@@ -121,22 +118,10 @@ class TestInternals < Test::Unit::TestCase
121
118
  assert (Time.now - start_time) <= opts[:timeout]
122
119
  end
123
120
 
124
- driver(:ruby) do
125
- def test_write_timeout
126
- return skip("Relies on buffer sizes, might be unreliable")
127
-
128
- server = TCPServer.new("127.0.0.1", 0)
129
- port = server.addr[1]
130
-
131
- # Hacky, but we need the buffer size
132
- val = TCPSocket.new("127.0.0.1", port).getsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF).unpack("i")[0]
133
-
134
- assert_raise(Redis::TimeoutError) do
135
- Timeout.timeout(1) do
136
- redis = Redis.new(:port => port, :timeout => 5, :write_timeout => 0.1)
137
- redis.set("foo", "1" * val*2)
138
- end
139
- end
121
+ def test_missing_socket
122
+ opts = { :path => '/missing.sock' }
123
+ assert_raise Redis::CannotConnectError do
124
+ Redis.new(opts).ping
140
125
  end
141
126
  end
142
127
 
@@ -197,7 +182,7 @@ class TestInternals < Test::Unit::TestCase
197
182
  redis.ping
198
183
  end
199
184
 
200
- assert !redis.client.connected?
185
+ assert !redis._client.connected?
201
186
  end
202
187
  end
203
188
 
@@ -213,7 +198,7 @@ class TestInternals < Test::Unit::TestCase
213
198
  redis.ping
214
199
  end
215
200
 
216
- assert !redis.client.connected?
201
+ assert !redis._client.connected?
217
202
  end
218
203
  end
219
204
 
@@ -226,7 +211,7 @@ class TestInternals < Test::Unit::TestCase
226
211
  end
227
212
  end
228
213
 
229
- assert !redis.client.connected?
214
+ assert !redis._client.connected?
230
215
  end
231
216
  end
232
217
 
@@ -267,14 +252,14 @@ class TestInternals < Test::Unit::TestCase
267
252
 
268
253
  def test_retry_on_write_error_by_default
269
254
  close_on_connection([0]) do |redis|
270
- assert_equal "1", redis.client.call(["x" * 128 * 1024])
255
+ assert_equal "1", redis._client.call(["x" * 128 * 1024])
271
256
  end
272
257
  end
273
258
 
274
259
  def test_retry_on_write_error_when_wrapped_in_with_reconnect_true
275
260
  close_on_connection([0]) do |redis|
276
261
  redis.with_reconnect(true) do
277
- assert_equal "1", redis.client.call(["x" * 128 * 1024])
262
+ assert_equal "1", redis._client.call(["x" * 128 * 1024])
278
263
  end
279
264
  end
280
265
  end
@@ -283,7 +268,7 @@ class TestInternals < Test::Unit::TestCase
283
268
  close_on_connection([0]) do |redis|
284
269
  assert_raise Redis::ConnectionError do
285
270
  redis.with_reconnect(false) do
286
- redis.client.call(["x" * 128 * 1024])
271
+ redis._client.call(["x" * 128 * 1024])
287
272
  end
288
273
  end
289
274
  end
@@ -293,7 +278,7 @@ class TestInternals < Test::Unit::TestCase
293
278
  close_on_connection([0]) do |redis|
294
279
  assert_raise Redis::ConnectionError do
295
280
  redis.without_reconnect do
296
- redis.client.call(["x" * 128 * 1024])
281
+ redis._client.call(["x" * 128 * 1024])
297
282
  end
298
283
  end
299
284
  end
@@ -301,7 +286,7 @@ class TestInternals < Test::Unit::TestCase
301
286
 
302
287
  def test_connecting_to_unix_domain_socket
303
288
  assert_nothing_raised do
304
- Redis.new(OPTIONS.merge(:path => "./test/db/redis.sock")).ping
289
+ Redis.new(OPTIONS.merge(:path => ENV.fetch("SOCKET_PATH"))).ping
305
290
  end
306
291
  end
307
292
 
@@ -323,23 +308,10 @@ class TestInternals < Test::Unit::TestCase
323
308
  def test_client_options
324
309
  redis = Redis.new(OPTIONS.merge(:host => "host", :port => 1234, :db => 1, :scheme => "foo"))
325
310
 
326
- assert_equal "host", redis.client.options[:host]
327
- assert_equal 1234, redis.client.options[:port]
328
- assert_equal 1, redis.client.options[:db]
329
- assert_equal "foo", redis.client.options[:scheme]
330
- end
331
-
332
- def test_does_not_change_self_client_options
333
- redis = Redis.new(OPTIONS.merge(:host => "host", :port => 1234, :db => 1, :scheme => "foo"))
334
- options = redis.client.options
335
-
336
- options[:host] << "new_host"
337
- options[:scheme] << "bar"
338
- options.merge!(:db => 0)
339
-
340
- assert_equal "host", redis.client.options[:host]
341
- assert_equal 1, redis.client.options[:db]
342
- assert_equal "foo", redis.client.options[:scheme]
311
+ assert_equal "host", redis._client.options[:host]
312
+ assert_equal 1234, redis._client.options[:port]
313
+ assert_equal 1, redis._client.options[:db]
314
+ assert_equal "foo", redis._client.options[:scheme]
343
315
  end
344
316
 
345
317
  def test_resolves_localhost
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
- if defined?(Encoding)
39
- with_external_encoding("ASCII-8BIT") do
40
- (0..255).each do |i|
41
- str = "#{i.chr}---#{i.chr}"
42
- r.set("foo", str)
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
@@ -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
- # encoding: UTF-8
2
-
3
- require File.expand_path("helper", File.dirname(__FILE__))
1
+ require_relative "helper"
4
2
 
5
3
  class TestPersistenceControlCommands < Test::Unit::TestCase
6
4
 
@@ -1,6 +1,4 @@
1
- # encoding: UTF-8
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
- if defined?(::BasicObject)
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.client.db
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.client.db
236
+ assert_equal 3, r._client.db
241
237
  end
242
238
  end
@@ -1,6 +1,4 @@
1
- # encoding: UTF-8
2
-
3
- require File.expand_path("helper", File.dirname(__FILE__))
1
+ require_relative "helper"
4
2
 
5
3
  class TestPublishSubscribe < Test::Unit::TestCase
6
4
 
@@ -1,6 +1,4 @@
1
- # encoding: UTF-8
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
@@ -1,10 +1,4 @@
1
- # encoding: UTF-8
2
-
3
- require File.expand_path("helper", File.dirname(__FILE__))
4
-
5
- unless defined?(Enumerator)
6
- Enumerator = Enumerable::Enumerator
7
- end
1
+ require_relative "helper"
8
2
 
9
3
  class TestScanning < Test::Unit::TestCase
10
4
 
@@ -1,6 +1,4 @@
1
- # encoding: UTF-8
2
-
3
- require File.expand_path("helper", File.dirname(__FILE__))
1
+ require_relative "helper"
4
2
 
5
3
  class TestScripting < Test::Unit::TestCase
6
4
 
@@ -1,6 +1,4 @@
1
- # encoding: UTF-8
2
-
3
- require File.expand_path("helper", File.dirname(__FILE__))
1
+ require_relative "helper"
4
2
 
5
3
  class SentinelCommandsTest < Test::Unit::TestCase
6
4
 
@@ -1,6 +1,4 @@
1
- # encoding: UTF-8
2
-
3
- require File.expand_path("helper", File.dirname(__FILE__))
1
+ require_relative "helper"
4
2
 
5
3
  class SentinelTest < Test::Unit::TestCase
6
4
 
data/test/sorting_test.rb CHANGED
@@ -1,6 +1,4 @@
1
- # encoding: UTF-8
2
-
3
- require File.expand_path("helper", File.dirname(__FILE__))
1
+ require_relative "helper"
4
2
 
5
3
  class TestSorting < Test::Unit::TestCase
6
4
 
data/test/ssl_test.rb CHANGED
@@ -1,73 +1,69 @@
1
- # encoding: UTF-8
1
+ require_relative "helper"
2
2
 
3
- if RUBY_VERSION >= "1.9.3"
4
- require File.expand_path("helper", File.dirname(__FILE__))
3
+ class SslTest < Test::Unit::TestCase
5
4
 
6
- class SslTest < Test::Unit::TestCase
5
+ include Helper::Client
7
6
 
8
- include Helper::Client
7
+ driver(:ruby) do
9
8
 
10
- driver(:ruby) do
11
-
12
- def test_verified_ssl_connection
13
- RedisMock.start({ :ping => proc { "+PONG" } }, ssl_server_opts("trusted")) do |port|
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
- def test_ssl_blocking
29
- RedisMock.start({}, ssl_server_opts("trusted")) do |port|
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
- assert_equal redis.set("boom", "a" * 10_000_000), "OK"
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
- driver(:hiredis, :synchrony) do
32
+ end
33
+
34
+ driver(:hiredis, :synchrony) do
38
35
 
39
- def test_ssl_not_implemented_exception
40
- assert_raise(NotImplementedError) do
41
- RedisMock.start({ :ping => proc { "+PONG" } }, ssl_server_opts("trusted")) do |port|
42
- redis = Redis.new(:port => port, :ssl => true, :ssl_params => { :ca_file => ssl_ca_file })
43
- redis.ping
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
- private
45
+ end
46
+
47
+ private
51
48
 
52
- def ssl_server_opts(prefix)
53
- ssl_cert = File.join(cert_path, "#{prefix}-cert.crt")
54
- ssl_key = File.join(cert_path, "#{prefix}-cert.key")
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
- :ssl => true,
58
- :ssl_params => {
59
- :cert => OpenSSL::X509::Certificate.new(File.read(ssl_cert)),
60
- :key => OpenSSL::PKey::RSA.new(File.read(ssl_key))
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
- end
59
+ }
60
+ end
64
61
 
65
- def ssl_ca_file
66
- File.join(cert_path, "trusted-ca.crt")
67
- end
62
+ def ssl_ca_file
63
+ File.join(cert_path, "trusted-ca.crt")
64
+ end
68
65
 
69
- def cert_path
70
- File.expand_path("../support/ssl/", __FILE__)
71
- end
66
+ def cert_path
67
+ File.expand_path("../support/ssl/", __FILE__)
72
68
  end
73
69
  end
@@ -1 +1 @@
1
- require "support/wire/thread"
1
+ require_relative "../wire/thread"
@@ -1 +1 @@
1
- require "support/wire/thread"
1
+ require_relative "../wire/thread"
@@ -1,4 +1,4 @@
1
- require "support/wire/synchrony"
1
+ require_relative "../wire/synchrony"
2
2
 
3
3
  module Helper
4
4
  def around
@@ -1,13 +1,10 @@
1
- # encoding: UTF-8
1
+ require "em-synchrony"
2
+ require "em-synchrony/connection_pool"
2
3
 
3
- require 'em-synchrony'
4
- require 'em-synchrony/connection_pool'
4
+ require_relative "../lib/redis"
5
+ require_relative "../lib/redis/connection/synchrony"
5
6
 
6
- require 'redis'
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.client.call(:quit)
55
+ assert_equal "OK", r._client.call(:quit)
59
56
  assert_equal "PONG", r.ping
60
57
 
61
58
 
@@ -1,6 +1,4 @@
1
- # encoding: UTF-8
2
-
3
- require File.expand_path("helper", File.dirname(__FILE__))
1
+ require_relative "helper"
4
2
 
5
3
  class TestThreadSafety < Test::Unit::TestCase
6
4
 
@@ -1,6 +1,4 @@
1
- # encoding: UTF-8
2
-
3
- require File.expand_path("helper", File.dirname(__FILE__))
1
+ require_relative "helper"
4
2
 
5
3
  class TestTransactions < Test::Unit::TestCase
6
4
 
@@ -1,6 +1,4 @@
1
- # encoding: UTF-8
2
-
3
- require File.expand_path("helper", File.dirname(__FILE__))
1
+ require_relative "helper"
4
2
 
5
3
  class TestUnknownCommands < Test::Unit::TestCase
6
4