@@ -838,7 +838,7 @@ def test_can_set_protocol_version_explicitly
838838 #
839839 # @since 3.0.0
840840 # @jira_ticket RUBY-162
841- # @expected_result cluster and object options should be visible in the inspect string
841+ # @expected_result cluster and session options should be visible in the inspect string
842842 #
843843 # @test_category connection
844844 #
@@ -872,4 +872,33 @@ def test_cluster_session_inspect
872872 assert_match ( /@payload=nil/ , session_inspect )
873873 end
874874
875+ # Test for cluster options retrieval
876+ #
877+ # test_can_retrieve_cluster_options tests that cluster objects' options can be retrieved. It first creates a simple
878+ # cluster object with some options defined. It then inspects this object and verifies that the options set can be
879+ # retrieved.
880+ #
881+ # @since 3.1.0
882+ # @jira_ticket RUBY-250
883+ # @expected_result cluster options should be retrieved from the cluster object
884+ #
885+ # @test_category connection
886+ #
887+ def test_can_retrieve_cluster_options
888+ setup_schema
889+
890+ cluster = Cassandra . cluster ( hosts : [ '127.0.0.1' ] , consistency : :quorum )
891+ assert_match ( /ruby-driver-.*/ , cluster . name )
892+ assert_equal '127.0.0.1' , cluster . hosts . first . ip . to_s
893+ assert_equal 9042 , cluster . port
894+ assert_includes [ 1 , 2 , 3 , 4 ] , cluster . protocol_version
895+ refute_nil cluster . keyspaces
896+
897+ execution_profile = cluster . execution_profiles [ '__DEFAULT_EXECUTION_PROFILE__' ]
898+ refute_nil execution_profile
899+ assert_equal Cassandra ::LoadBalancing ::Policies ::TokenAware , execution_profile . load_balancing_policy . class
900+ assert_equal Cassandra ::Retry ::Policies ::Default , execution_profile . retry_policy . class
901+ assert_equal :quorum , execution_profile . consistency
902+ assert_equal 12 , execution_profile . timeout
903+ end
875904end
0 commit comments