Skip to content

Commit 98cc7ef

Browse files
author
Sylvester Chin
committed
Fix test by setting up RedisClient::Cluster::Node
1 parent 4076e77 commit 98cc7ef

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

test/redis_client/cluster/test_command.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@ class RedisClient
77
class Cluster
88
class TestCommand < TestingWrapper
99
def setup
10-
@raw_clients = TEST_NODE_URIS.map { |addr| ::RedisClient.config(url: addr, **TEST_GENERIC_OPTIONS).new_client }
10+
per_node_key = TEST_REDIS_PORTS.map do |port|
11+
[
12+
"#{TEST_REDIS_HOST}:#{port}",
13+
{ host: TEST_REDIS_HOST, port: port }.merge(TEST_GENERIC_OPTIONS)
14+
]
15+
end.to_h
16+
node_info_list = ::RedisClient::Cluster::Node.load_info(per_node_key)
17+
@raw_clients = ::RedisClient::Cluster::Node.new(per_node_key, node_info_list: node_info_list)
18+
@empty_clients = ::RedisClient::Cluster::Node.new([], node_info_list: node_info_list)
1119
end
1220

1321
def teardown
@@ -17,7 +25,7 @@ def teardown
1725
def test_load
1826
[
1927
{ nodes: @raw_clients, error: nil },
20-
{ nodes: [], error: ::RedisClient::Cluster::InitialSetupError },
28+
{ nodes: @empty_clients, error: ::RedisClient::Cluster::InitialSetupError },
2129
{ nodes: [''], error: NoMethodError },
2230
{ nodes: nil, error: ::RedisClient::Cluster::InitialSetupError }
2331
].each_with_index do |c, idx|

0 commit comments

Comments
 (0)