diff --git a/lib/redis_client/cluster_config.rb b/lib/redis_client/cluster_config.rb index b3834bf..18cde27 100644 --- a/lib/redis_client/cluster_config.rb +++ b/lib/redis_client/cluster_config.rb @@ -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, @@ -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 diff --git a/test/redis_client/test_cluster_config.rb b/test/redis_client/test_cluster_config.rb index a745d8c..01d784a 100644 --- a/test/redis_client/test_cluster_config.rb +++ b/test/redis_client/test_cluster_config.rb @@ -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