From c718ab64d855415b0168c7b6a6c7cd0ff875cd65 Mon Sep 17 00:00:00 2001 From: Kishan Karunaratne Date: Wed, 11 May 2016 13:46:16 -0700 Subject: [PATCH] [RUBY-162] Integration tests for cluster, session inspect --- integration/session_test.rb | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/integration/session_test.rb b/integration/session_test.rb index 3b1f3c9d4..54bf1c1e2 100644 --- a/integration/session_test.rb +++ b/integration/session_test.rb @@ -830,4 +830,44 @@ def test_can_set_protocol_version_explicitly cluster && cluster.close end + # Test for cluster and session object inspection + # + # test_cluster_session_inspect tests that cluster and session objects can be inspected, and their stored options can + # be retrieved in the inspect string. It first creates a simple cluster and session object with some options defined. + # It then inspects these objects and verifies that the options set are visible in the inspect string. + # + # @since 3.0.0 + # @jira_ticket RUBY-162 + # @expected_result cluster and object options should be visible in the inspect string + # + # @test_category connection + # + def test_cluster_session_inspect + cluster = Cassandra.cluster(hosts: ['127.0.0.1'], consistency: :quorum, page_size: 10) + session = cluster.connect('simplex') + + cluster_inspect = cluster.inspect + assert_match(/name="ruby-driver-.*"/, cluster_inspect) + assert_match(/hosts=\[.* @ip=127\.0\.0\.1>\]/, cluster_inspect) + assert_match(/port=9042/, cluster_inspect) + assert_match(/protocol_version=[1-4]/, cluster_inspect) + assert_match(/keyspaces=\[.* @name=simplex>\]/, cluster_inspect) + assert_match(/load_balancing_policy=#