Skip to content

Commit

Permalink
fix: set an ID option to a cluster config for the compatibility (#403)
Browse files Browse the repository at this point in the history
  • Loading branch information
supercaracal authored Nov 14, 2024
1 parent 415d91a commit ff2969d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/redis_client/cluster_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ClusterConfig
InvalidClientConfigError = Class.new(::RedisClient::Cluster::Error)

attr_reader :command_builder, :client_config, :replica_affinity, :slow_command_timeout,
:connect_with_original_config, :startup_nodes, :max_startup_sample
:connect_with_original_config, :startup_nodes, :max_startup_sample, :id

def initialize( # rubocop:disable Metrics/ParameterLists
nodes: DEFAULT_NODES,
Expand Down Expand Up @@ -60,6 +60,7 @@ def initialize( # rubocop:disable Metrics/ParameterLists
@client_implementation = client_implementation
@slow_command_timeout = slow_command_timeout
@max_startup_sample = max_startup_sample
@id = client_config[:id]
end

def inspect
Expand Down
5 changes: 5 additions & 0 deletions test/redis_client/test_cluster_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,10 @@ def test_client_config_for_node
custom: { foo: 'bar' }
}, config.client_config_for_node('9.9.9.9:9999'))
end

def test_client_config_id
assert_equal('foo-cluster', ::RedisClient::ClusterConfig.new(id: 'foo-cluster').id)
assert_nil(::RedisClient::ClusterConfig.new.id)
end
end
end

0 comments on commit ff2969d

Please sign in to comment.