Skip to content

Commit cba2380

Browse files
authored
Release 0.0.8 (#47)
1 parent 8662a21 commit cba2380

File tree

3 files changed

+32
-19
lines changed

3 files changed

+32
-19
lines changed

redis-cluster-client.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Gem::Specification.new do |s|
44
s.name = 'redis-cluster-client'
55
s.summary = 'A Redis cluster client for Ruby'
6-
s.version = '0.0.7'
6+
s.version = '0.0.8'
77
s.license = 'MIT'
88
s.homepage = 'https://github.com/redis-rb/redis-cluster-client'
99
s.authors = ['Taishi Kasuga']

test/test_against_cluster_broken.rb

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,33 @@ def do_test_a_node_is_down(role, number_of_keys:)
4343
number_of_keys.times { |i| @client.pipelined { |pi| pi.call('SET', "pre-pipelined-#{i}", i) } }
4444
wait_for_replication
4545

46-
kill_a_node(role)
46+
kill_a_node(role, kill_attempts: 10)
4747
wait_for_cluster_to_be_ready(wait_attempts: 10)
4848

4949
assert_equal('PONG', @client.call('PING'), 'Case: PING')
5050
do_assertions_without_pipelining(number_of_keys: number_of_keys)
5151
do_assertions_with_pipelining(number_of_keys: number_of_keys)
5252
end
5353

54-
def kill_a_node(role)
54+
def kill_a_node(role, kill_attempts: 10)
5555
node_key = @node_info.select { |e| e[:role] == role }.sample.fetch(:node_key)
5656
node = @client.send(:find_node, node_key)
5757
refute_nil(node, node_key)
58-
node.call('SHUTDOWN')
59-
rescue ::RedisClient::ConnectionError
60-
# ignore
58+
59+
loop do
60+
break if kill_attempts <= 0
61+
62+
node.call('SHUTDOWN', 'NOSAVE')
63+
rescue ::RedisClient::CommandError => e
64+
raise unless e.message.include?('Errors trying to SHUTDOWN')
65+
rescue ::RedisClient::ConnectionError
66+
break
67+
ensure
68+
kill_attempts -= 1
69+
sleep 3
70+
end
71+
72+
assert_raises(::RedisClient::ConnectionError) { node.call('PING') }
6173
end
6274

6375
def wait_for_cluster_to_be_ready(wait_attempts: 10)

test/test_against_cluster_state.rb

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,20 @@ def new_test_client
102102
end
103103
end
104104

105-
class ScaleRead < TestingWrapper
106-
include Mixin
107-
108-
def new_test_client
109-
config = ::RedisClient::ClusterConfig.new(
110-
nodes: TEST_NODE_URIS,
111-
replica: true,
112-
fixed_hostname: TEST_FIXED_HOSTNAME,
113-
**TEST_GENERIC_OPTIONS
114-
)
115-
::RedisClient::Cluster.new(config)
116-
end
117-
end
105+
# TODO: https://github.com/redis-rb/redis-cluster-client/issues/42
106+
# class ScaleRead < TestingWrapper
107+
# include Mixin
108+
#
109+
# def new_test_client
110+
# config = ::RedisClient::ClusterConfig.new(
111+
# nodes: TEST_NODE_URIS,
112+
# replica: true,
113+
# fixed_hostname: TEST_FIXED_HOSTNAME,
114+
# **TEST_GENERIC_OPTIONS
115+
# )
116+
# ::RedisClient::Cluster.new(config)
117+
# end
118+
# end
118119

119120
class Pooled < TestingWrapper
120121
include Mixin

0 commit comments

Comments
 (0)