redis 4.1.0.beta1 → 4.1.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.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -2
  3. data/README.md +45 -0
  4. data/lib/redis.rb +497 -20
  5. data/lib/redis/client.rb +14 -6
  6. data/lib/redis/cluster.rb +1 -0
  7. data/lib/redis/cluster/command_loader.rb +2 -0
  8. data/lib/redis/cluster/node_loader.rb +2 -0
  9. data/lib/redis/cluster/option.rb +1 -0
  10. data/lib/redis/cluster/slot_loader.rb +2 -0
  11. data/lib/redis/distributed.rb +3 -4
  12. data/lib/redis/version.rb +1 -1
  13. metadata +20 -243
  14. data/.gitignore +0 -19
  15. data/.travis.yml +0 -61
  16. data/.travis/Gemfile +0 -18
  17. data/.yardopts +0 -3
  18. data/Gemfile +0 -8
  19. data/benchmarking/logging.rb +0 -71
  20. data/benchmarking/pipeline.rb +0 -51
  21. data/benchmarking/speed.rb +0 -21
  22. data/benchmarking/suite.rb +0 -24
  23. data/benchmarking/worker.rb +0 -71
  24. data/bin/build +0 -71
  25. data/bors.toml +0 -14
  26. data/examples/basic.rb +0 -15
  27. data/examples/consistency.rb +0 -114
  28. data/examples/dist_redis.rb +0 -43
  29. data/examples/incr-decr.rb +0 -17
  30. data/examples/list.rb +0 -26
  31. data/examples/pubsub.rb +0 -37
  32. data/examples/sentinel.rb +0 -41
  33. data/examples/sentinel/start +0 -49
  34. data/examples/sets.rb +0 -36
  35. data/examples/unicorn/config.ru +0 -3
  36. data/examples/unicorn/unicorn.rb +0 -20
  37. data/makefile +0 -74
  38. data/redis.gemspec +0 -42
  39. data/test/bitpos_test.rb +0 -63
  40. data/test/blocking_commands_test.rb +0 -40
  41. data/test/client_test.rb +0 -76
  42. data/test/cluster_abnormal_state_test.rb +0 -38
  43. data/test/cluster_blocking_commands_test.rb +0 -15
  44. data/test/cluster_client_internals_test.rb +0 -77
  45. data/test/cluster_client_key_hash_tags_test.rb +0 -88
  46. data/test/cluster_client_options_test.rb +0 -147
  47. data/test/cluster_client_pipelining_test.rb +0 -59
  48. data/test/cluster_client_replicas_test.rb +0 -36
  49. data/test/cluster_client_slots_test.rb +0 -94
  50. data/test/cluster_client_transactions_test.rb +0 -71
  51. data/test/cluster_commands_on_cluster_test.rb +0 -165
  52. data/test/cluster_commands_on_connection_test.rb +0 -40
  53. data/test/cluster_commands_on_geo_test.rb +0 -74
  54. data/test/cluster_commands_on_hashes_test.rb +0 -11
  55. data/test/cluster_commands_on_hyper_log_log_test.rb +0 -17
  56. data/test/cluster_commands_on_keys_test.rb +0 -134
  57. data/test/cluster_commands_on_lists_test.rb +0 -15
  58. data/test/cluster_commands_on_pub_sub_test.rb +0 -101
  59. data/test/cluster_commands_on_scripting_test.rb +0 -56
  60. data/test/cluster_commands_on_server_test.rb +0 -221
  61. data/test/cluster_commands_on_sets_test.rb +0 -39
  62. data/test/cluster_commands_on_sorted_sets_test.rb +0 -35
  63. data/test/cluster_commands_on_streams_test.rb +0 -196
  64. data/test/cluster_commands_on_strings_test.rb +0 -15
  65. data/test/cluster_commands_on_transactions_test.rb +0 -41
  66. data/test/cluster_commands_on_value_types_test.rb +0 -14
  67. data/test/command_map_test.rb +0 -28
  68. data/test/commands_on_geo_test.rb +0 -116
  69. data/test/commands_on_hashes_test.rb +0 -7
  70. data/test/commands_on_hyper_log_log_test.rb +0 -7
  71. data/test/commands_on_lists_test.rb +0 -7
  72. data/test/commands_on_sets_test.rb +0 -7
  73. data/test/commands_on_sorted_sets_test.rb +0 -7
  74. data/test/commands_on_strings_test.rb +0 -7
  75. data/test/commands_on_value_types_test.rb +0 -207
  76. data/test/connection_handling_test.rb +0 -275
  77. data/test/connection_test.rb +0 -57
  78. data/test/distributed_blocking_commands_test.rb +0 -52
  79. data/test/distributed_commands_on_hashes_test.rb +0 -21
  80. data/test/distributed_commands_on_hyper_log_log_test.rb +0 -26
  81. data/test/distributed_commands_on_lists_test.rb +0 -19
  82. data/test/distributed_commands_on_sets_test.rb +0 -105
  83. data/test/distributed_commands_on_sorted_sets_test.rb +0 -59
  84. data/test/distributed_commands_on_strings_test.rb +0 -79
  85. data/test/distributed_commands_on_value_types_test.rb +0 -129
  86. data/test/distributed_commands_requiring_clustering_test.rb +0 -162
  87. data/test/distributed_connection_handling_test.rb +0 -21
  88. data/test/distributed_internals_test.rb +0 -68
  89. data/test/distributed_key_tags_test.rb +0 -50
  90. data/test/distributed_persistence_control_commands_test.rb +0 -24
  91. data/test/distributed_publish_subscribe_test.rb +0 -90
  92. data/test/distributed_remote_server_control_commands_test.rb +0 -64
  93. data/test/distributed_scripting_test.rb +0 -100
  94. data/test/distributed_sorting_test.rb +0 -18
  95. data/test/distributed_test.rb +0 -56
  96. data/test/distributed_transactions_test.rb +0 -30
  97. data/test/encoding_test.rb +0 -14
  98. data/test/error_replies_test.rb +0 -57
  99. data/test/fork_safety_test.rb +0 -60
  100. data/test/helper.rb +0 -344
  101. data/test/helper_test.rb +0 -22
  102. data/test/internals_test.rb +0 -395
  103. data/test/lint/blocking_commands.rb +0 -174
  104. data/test/lint/hashes.rb +0 -203
  105. data/test/lint/hyper_log_log.rb +0 -74
  106. data/test/lint/lists.rb +0 -159
  107. data/test/lint/sets.rb +0 -282
  108. data/test/lint/sorted_sets.rb +0 -497
  109. data/test/lint/strings.rb +0 -348
  110. data/test/lint/value_types.rb +0 -130
  111. data/test/persistence_control_commands_test.rb +0 -24
  112. data/test/pipelining_commands_test.rb +0 -246
  113. data/test/publish_subscribe_test.rb +0 -280
  114. data/test/remote_server_control_commands_test.rb +0 -175
  115. data/test/scanning_test.rb +0 -407
  116. data/test/scripting_test.rb +0 -76
  117. data/test/sentinel_command_test.rb +0 -78
  118. data/test/sentinel_test.rb +0 -253
  119. data/test/sorting_test.rb +0 -57
  120. data/test/ssl_test.rb +0 -69
  121. data/test/support/cluster/orchestrator.rb +0 -199
  122. data/test/support/connection/hiredis.rb +0 -1
  123. data/test/support/connection/ruby.rb +0 -1
  124. data/test/support/connection/synchrony.rb +0 -17
  125. data/test/support/redis_mock.rb +0 -130
  126. data/test/support/ssl/gen_certs.sh +0 -31
  127. data/test/support/ssl/trusted-ca.crt +0 -25
  128. data/test/support/ssl/trusted-ca.key +0 -27
  129. data/test/support/ssl/trusted-cert.crt +0 -81
  130. data/test/support/ssl/trusted-cert.key +0 -28
  131. data/test/support/ssl/untrusted-ca.crt +0 -26
  132. data/test/support/ssl/untrusted-ca.key +0 -27
  133. data/test/support/ssl/untrusted-cert.crt +0 -82
  134. data/test/support/ssl/untrusted-cert.key +0 -28
  135. data/test/support/wire/synchrony.rb +0 -24
  136. data/test/support/wire/thread.rb +0 -5
  137. data/test/synchrony_driver.rb +0 -85
  138. data/test/test.conf.erb +0 -9
  139. data/test/thread_safety_test.rb +0 -60
  140. data/test/transactions_test.rb +0 -272
  141. data/test/unknown_commands_test.rb +0 -12
  142. data/test/url_param_test.rb +0 -136
@@ -1,57 +0,0 @@
1
- require_relative "helper"
2
-
3
- class TestConnection < Test::Unit::TestCase
4
-
5
- include Helper::Client
6
-
7
- def test_provides_a_meaningful_inspect
8
- assert_equal "#<Redis client v#{Redis::VERSION} for redis://127.0.0.1:#{PORT}/15>", r.inspect
9
- end
10
-
11
- def test_connection_information
12
- assert_equal "127.0.0.1", r.connection.fetch(:host)
13
- assert_equal 6381, r.connection.fetch(:port)
14
- assert_equal 15, r.connection.fetch(:db)
15
- assert_equal "127.0.0.1:6381", r.connection.fetch(:location)
16
- assert_equal "redis://127.0.0.1:6381/15", r.connection.fetch(:id)
17
- end
18
-
19
- def test_default_id_with_host_and_port
20
- redis = Redis.new(OPTIONS.merge(:host => "host", :port => "1234", :db => 0))
21
- assert_equal "redis://host:1234/0", redis.connection.fetch(:id)
22
- end
23
-
24
- def test_default_id_with_host_and_port_and_explicit_scheme
25
- redis = Redis.new(OPTIONS.merge(:host => "host", :port => "1234", :db => 0, :scheme => "foo"))
26
- assert_equal "redis://host:1234/0", redis.connection.fetch(:id)
27
- end
28
-
29
- def test_default_id_with_path
30
- redis = Redis.new(OPTIONS.merge(:path => "/tmp/redis.sock", :db => 0))
31
- assert_equal "redis:///tmp/redis.sock/0", redis.connection.fetch(:id)
32
- end
33
-
34
- def test_default_id_with_path_and_explicit_scheme
35
- redis = Redis.new(OPTIONS.merge(:path => "/tmp/redis.sock", :db => 0, :scheme => "foo"))
36
- assert_equal "redis:///tmp/redis.sock/0", redis.connection.fetch(:id)
37
- end
38
-
39
- def test_override_id
40
- redis = Redis.new(OPTIONS.merge(:id => "test"))
41
- assert_equal "test", redis.connection.fetch(:id)
42
- end
43
-
44
- def test_id_inside_multi
45
- redis = Redis.new(OPTIONS)
46
- id = nil
47
- connection_id = nil
48
-
49
- redis.multi do
50
- id = redis.id
51
- connection_id = redis.connection.fetch(:id)
52
- end
53
-
54
- assert_equal "redis://127.0.0.1:6381/15", id
55
- assert_equal "redis://127.0.0.1:6381/15", connection_id
56
- end
57
- end
@@ -1,52 +0,0 @@
1
- require_relative "helper"
2
- require_relative "lint/blocking_commands"
3
-
4
- class TestDistributedBlockingCommands < Test::Unit::TestCase
5
-
6
- include Helper::Distributed
7
- include Lint::BlockingCommands
8
-
9
- def test_blpop_raises
10
- assert_raises(Redis::Distributed::CannotDistribute) do
11
- r.blpop(["foo", "bar"])
12
- end
13
- end
14
-
15
- def test_blpop_raises_with_old_prototype
16
- assert_raises(Redis::Distributed::CannotDistribute) do
17
- r.blpop("foo", "bar", 0)
18
- end
19
- end
20
-
21
- def test_brpop_raises
22
- assert_raises(Redis::Distributed::CannotDistribute) do
23
- r.brpop(["foo", "bar"])
24
- end
25
- end
26
-
27
- def test_brpop_raises_with_old_prototype
28
- assert_raises(Redis::Distributed::CannotDistribute) do
29
- r.brpop("foo", "bar", 0)
30
- end
31
- end
32
-
33
- def test_brpoplpush_raises
34
- assert_raises(Redis::Distributed::CannotDistribute) do
35
- r.brpoplpush("foo", "bar")
36
- end
37
- end
38
-
39
- def test_brpoplpush_raises_with_old_prototype
40
- assert_raises(Redis::Distributed::CannotDistribute) do
41
- r.brpoplpush("foo", "bar", 0)
42
- end
43
- end
44
-
45
- def test_bzpopmin
46
- # Not implemented yet
47
- end
48
-
49
- def test_bzpopmax
50
- # Not implemented yet
51
- end
52
- end
@@ -1,21 +0,0 @@
1
- require_relative 'helper'
2
- require_relative 'lint/hashes'
3
-
4
- class TestDistributedCommandsOnHashes < Test::Unit::TestCase
5
- include Helper::Distributed
6
- include Lint::Hashes
7
-
8
- def test_hscan
9
- # Not implemented yet
10
- end
11
-
12
- def test_hstrlen
13
- # Not implemented yet
14
- end
15
-
16
- def test_mapped_hmget_in_a_pipeline_returns_hash
17
- assert_raise(Redis::Distributed::CannotDistribute) do
18
- super
19
- end
20
- end
21
- end
@@ -1,26 +0,0 @@
1
- require_relative 'helper'
2
- require_relative 'lint/hyper_log_log'
3
-
4
- class TestDistributedCommandsOnHyperLogLog < Test::Unit::TestCase
5
- include Helper::Distributed
6
- include Lint::HyperLogLog
7
-
8
- def test_pfmerge
9
- target_version '2.8.9' do
10
- assert_raise Redis::Distributed::CannotDistribute do
11
- super
12
- end
13
- end
14
- end
15
-
16
- def test_pfcount_multiple_keys_diff_nodes
17
- target_version '2.8.9' do
18
- assert_raise Redis::Distributed::CannotDistribute do
19
- r.pfadd 'foo', 's1'
20
- r.pfadd 'bar', 's2'
21
-
22
- assert r.pfcount('res', 'foo', 'bar')
23
- end
24
- end
25
- end
26
- end
@@ -1,19 +0,0 @@
1
- require_relative 'helper'
2
- require_relative 'lint/lists'
3
-
4
- class TestDistributedCommandsOnLists < Test::Unit::TestCase
5
- include Helper::Distributed
6
- include Lint::Lists
7
-
8
- def test_rpoplpush
9
- assert_raise Redis::Distributed::CannotDistribute do
10
- r.rpoplpush('foo', 'bar')
11
- end
12
- end
13
-
14
- def test_brpoplpush
15
- assert_raise Redis::Distributed::CannotDistribute do
16
- r.brpoplpush('foo', 'bar', timeout: 1)
17
- end
18
- end
19
- end
@@ -1,105 +0,0 @@
1
- require_relative 'helper'
2
- require_relative 'lint/sets'
3
-
4
- class TestDistributedCommandsOnSets < Test::Unit::TestCase
5
- include Helper::Distributed
6
- include Lint::Sets
7
-
8
- def test_smove
9
- assert_raise Redis::Distributed::CannotDistribute do
10
- r.sadd 'foo', 's1'
11
- r.sadd 'bar', 's2'
12
-
13
- r.smove('foo', 'bar', 's1')
14
- end
15
- end
16
-
17
- def test_sinter
18
- assert_raise Redis::Distributed::CannotDistribute do
19
- r.sadd 'foo', 's1'
20
- r.sadd 'foo', 's2'
21
- r.sadd 'bar', 's2'
22
-
23
- r.sinter('foo', 'bar')
24
- end
25
- end
26
-
27
- def test_sinterstore
28
- assert_raise Redis::Distributed::CannotDistribute do
29
- r.sadd 'foo', 's1'
30
- r.sadd 'foo', 's2'
31
- r.sadd 'bar', 's2'
32
-
33
- r.sinterstore('baz', 'foo', 'bar')
34
- end
35
- end
36
-
37
- def test_sunion
38
- assert_raise Redis::Distributed::CannotDistribute do
39
- r.sadd 'foo', 's1'
40
- r.sadd 'foo', 's2'
41
- r.sadd 'bar', 's2'
42
- r.sadd 'bar', 's3'
43
-
44
- r.sunion('foo', 'bar')
45
- end
46
- end
47
-
48
- def test_sunionstore
49
- assert_raise Redis::Distributed::CannotDistribute do
50
- r.sadd 'foo', 's1'
51
- r.sadd 'foo', 's2'
52
- r.sadd 'bar', 's2'
53
- r.sadd 'bar', 's3'
54
-
55
- r.sunionstore('baz', 'foo', 'bar')
56
- end
57
- end
58
-
59
- def test_sdiff
60
- assert_raise Redis::Distributed::CannotDistribute do
61
- r.sadd 'foo', 's1'
62
- r.sadd 'foo', 's2'
63
- r.sadd 'bar', 's2'
64
- r.sadd 'bar', 's3'
65
-
66
- r.sdiff('foo', 'bar')
67
- end
68
- end
69
-
70
- def test_sdiffstore
71
- assert_raise Redis::Distributed::CannotDistribute do
72
- r.sadd 'foo', 's1'
73
- r.sadd 'foo', 's2'
74
- r.sadd 'bar', 's2'
75
- r.sadd 'bar', 's3'
76
-
77
- r.sdiffstore('baz', 'foo', 'bar')
78
- end
79
- end
80
-
81
- def test_sscan
82
- assert_nothing_raised do
83
- r.sadd 'foo', 's1'
84
- r.sadd 'foo', 's2'
85
- r.sadd 'bar', 's2'
86
- r.sadd 'bar', 's3'
87
-
88
- cursor, vals = r.sscan 'foo', 0
89
- assert_equal '0', cursor
90
- assert_equal %w[s1 s2], vals.sort
91
- end
92
- end
93
-
94
- def test_sscan_each
95
- assert_nothing_raised do
96
- r.sadd 'foo', 's1'
97
- r.sadd 'foo', 's2'
98
- r.sadd 'bar', 's2'
99
- r.sadd 'bar', 's3'
100
-
101
- vals = r.sscan_each('foo').to_a
102
- assert_equal %w[s1 s2], vals.sort
103
- end
104
- end
105
- end
@@ -1,59 +0,0 @@
1
- require_relative 'helper'
2
- require_relative 'lint/sorted_sets'
3
-
4
- class TestDistributedCommandsOnSortedSets < Test::Unit::TestCase
5
- include Helper::Distributed
6
- include Lint::SortedSets
7
-
8
- def test_zinterstore
9
- assert_raise(Redis::Distributed::CannotDistribute) { super }
10
- end
11
-
12
- def test_zinterstore_with_aggregate
13
- assert_raise(Redis::Distributed::CannotDistribute) { super }
14
- end
15
-
16
- def test_zinterstore_with_weights
17
- assert_raise(Redis::Distributed::CannotDistribute) { super }
18
- end
19
-
20
- def test_zlexcount
21
- # Not implemented yet
22
- end
23
-
24
- def test_zpopmax
25
- # Not implemented yet
26
- end
27
-
28
- def test_zpopmin
29
- # Not implemented yet
30
- end
31
-
32
- def test_zrangebylex
33
- # Not implemented yet
34
- end
35
-
36
- def test_zremrangebylex
37
- # Not implemented yet
38
- end
39
-
40
- def test_zrevrangebylex
41
- # Not implemented yet
42
- end
43
-
44
- def test_zscan
45
- # Not implemented yet
46
- end
47
-
48
- def test_zunionstore
49
- assert_raise(Redis::Distributed::CannotDistribute) { super }
50
- end
51
-
52
- def test_zunionstore_with_aggregate
53
- assert_raise(Redis::Distributed::CannotDistribute) { super }
54
- end
55
-
56
- def test_zunionstore_with_weights
57
- assert_raise(Redis::Distributed::CannotDistribute) { super }
58
- end
59
- end
@@ -1,79 +0,0 @@
1
- require_relative "helper"
2
- require_relative "lint/strings"
3
-
4
- class TestDistributedCommandsOnStrings < Test::Unit::TestCase
5
-
6
- include Helper::Distributed
7
- include Lint::Strings
8
-
9
- def test_mget
10
- r.set("foo", "s1")
11
- r.set("bar", "s2")
12
-
13
- assert_equal ["s1", "s2"] , r.mget("foo", "bar")
14
- assert_equal ["s1", "s2", nil], r.mget("foo", "bar", "baz")
15
- end
16
-
17
- def test_mget_mapped
18
- r.set("foo", "s1")
19
- r.set("bar", "s2")
20
-
21
- response = r.mapped_mget("foo", "bar")
22
-
23
- assert_equal "s1", response["foo"]
24
- assert_equal "s2", response["bar"]
25
-
26
- response = r.mapped_mget("foo", "bar", "baz")
27
-
28
- assert_equal "s1", response["foo"]
29
- assert_equal "s2", response["bar"]
30
- assert_equal nil , response["baz"]
31
- end
32
-
33
- def test_mset
34
- assert_raise Redis::Distributed::CannotDistribute do
35
- r.mset(:foo, "s1", :bar, "s2")
36
- end
37
- end
38
-
39
- def test_mset_mapped
40
- assert_raise Redis::Distributed::CannotDistribute do
41
- r.mapped_mset(:foo => "s1", :bar => "s2")
42
- end
43
- end
44
-
45
- def test_msetnx
46
- assert_raise Redis::Distributed::CannotDistribute do
47
- r.set("foo", "s1")
48
- r.msetnx(:foo, "s2", :bar, "s3")
49
- end
50
- end
51
-
52
- def test_msetnx_mapped
53
- assert_raise Redis::Distributed::CannotDistribute do
54
- r.set("foo", "s1")
55
- r.mapped_msetnx(:foo => "s2", :bar => "s3")
56
- end
57
- end
58
-
59
- def test_bitop
60
- target_version "2.5.10" do
61
- assert_raise Redis::Distributed::CannotDistribute do
62
- r.set("foo", "a")
63
- r.set("bar", "b")
64
-
65
- r.bitop(:and, "foo&bar", "foo", "bar")
66
- end
67
- end
68
- end
69
-
70
- def test_mapped_mget_in_a_pipeline_returns_hash
71
- assert_raise Redis::Distributed::CannotDistribute do
72
- super
73
- end
74
- end
75
-
76
- def test_bitfield
77
- # Not implemented yet
78
- end
79
- end
@@ -1,129 +0,0 @@
1
- require_relative "helper"
2
- require_relative "lint/value_types"
3
-
4
- class TestDistributedCommandsOnValueTypes < Test::Unit::TestCase
5
-
6
- include Helper::Distributed
7
- include Lint::ValueTypes
8
-
9
- def test_del
10
- r.set "foo", "s1"
11
- r.set "bar", "s2"
12
- r.set "baz", "s3"
13
-
14
- assert_equal ["bar", "baz", "foo"], r.keys("*").sort
15
-
16
- assert_equal 1, r.del("foo")
17
-
18
- assert_equal ["bar", "baz"], r.keys("*").sort
19
-
20
- assert_equal 2, r.del("bar", "baz")
21
-
22
- assert_equal [], r.keys("*").sort
23
- end
24
-
25
- def test_del_with_array_argument
26
- r.set "foo", "s1"
27
- r.set "bar", "s2"
28
- r.set "baz", "s3"
29
-
30
- assert_equal ["bar", "baz", "foo"], r.keys("*").sort
31
-
32
- assert_equal 1, r.del(["foo"])
33
-
34
- assert_equal ["bar", "baz"], r.keys("*").sort
35
-
36
- assert_equal 2, r.del(["bar", "baz"])
37
-
38
- assert_equal [], r.keys("*").sort
39
- end
40
-
41
- def test_unlink
42
- target_version "4.0.0" do
43
- r.set "foo", "s1"
44
- r.set "bar", "s2"
45
- r.set "baz", "s3"
46
-
47
- assert_equal ["bar", "baz", "foo"], r.keys("*").sort
48
-
49
- assert_equal 1, r.unlink("foo")
50
-
51
- assert_equal ["bar", "baz"], r.keys("*").sort
52
-
53
- assert_equal 2, r.unlink("bar", "baz")
54
-
55
- assert_equal [], r.keys("*").sort
56
- end
57
- end
58
-
59
- def test_unlink_with_array_argument
60
- target_version "4.0.0" do
61
- r.set "foo", "s1"
62
- r.set "bar", "s2"
63
- r.set "baz", "s3"
64
-
65
- assert_equal ["bar", "baz", "foo"], r.keys("*").sort
66
-
67
- assert_equal 1, r.unlink(["foo"])
68
-
69
- assert_equal ["bar", "baz"], r.keys("*").sort
70
-
71
- assert_equal 2, r.unlink(["bar", "baz"])
72
-
73
- assert_equal [], r.keys("*").sort
74
- end
75
- end
76
-
77
- def test_randomkey
78
- assert_raise Redis::Distributed::CannotDistribute do
79
- r.randomkey
80
- end
81
- end
82
-
83
- def test_rename
84
- assert_raise Redis::Distributed::CannotDistribute do
85
- r.set("foo", "s1")
86
- r.rename "foo", "bar"
87
- end
88
-
89
- assert_equal "s1", r.get("foo")
90
- assert_equal nil, r.get("bar")
91
- end
92
-
93
- def test_renamenx
94
- assert_raise Redis::Distributed::CannotDistribute do
95
- r.set("foo", "s1")
96
- r.rename "foo", "bar"
97
- end
98
-
99
- assert_equal "s1", r.get("foo")
100
- assert_equal nil , r.get("bar")
101
- end
102
-
103
- def test_dbsize
104
- assert_equal [0], r.dbsize
105
-
106
- r.set("foo", "s1")
107
-
108
- assert_equal [1], r.dbsize
109
- end
110
-
111
- def test_flushdb
112
- r.set("foo", "s1")
113
- r.set("bar", "s2")
114
-
115
- assert_equal [2], r.dbsize
116
-
117
- r.flushdb
118
-
119
- assert_equal [0], r.dbsize
120
- end
121
-
122
- def test_migrate
123
- r.set("foo", "s1")
124
-
125
- assert_raise Redis::Distributed::CannotDistribute do
126
- r.migrate("foo", {})
127
- end
128
- end
129
- end