@@ -61,11 +61,19 @@ def test_statement_idempotency_on_timeout
6161 session . execute ( 'SELECT * FROM test' , consistency : :one )
6262 end
6363
64- info = session . execute ( 'SELECT * FROM test' , consistency : :one , idempotent : true ) . execution_info
65- assert_equal 1 , info . retries
66- assert_equal 2 , info . hosts . size
67- assert_equal '127.0.0.1' , info . hosts [ 0 ] . ip . to_s
68- assert_equal '127.0.0.2' , info . hosts [ 1 ] . ip . to_s
64+ info = nil
65+ begin
66+ info = session . execute ( 'SELECT * FROM test' , consistency : :one , idempotent : true ) . execution_info
67+ assert_equal 1 , info . retries
68+ assert_equal 2 , info . hosts . size
69+ assert_equal '127.0.0.1' , info . hosts [ 0 ] . ip . to_s
70+ assert_equal '127.0.0.2' , info . hosts [ 1 ] . ip . to_s
71+ rescue Cassandra ::Errors ::ReadTimeoutError => e
72+ # Every once in a while, the test fails with a ReadTimeoutError. Try to report extra info in that case that
73+ # may help us track down the core issue.
74+ info = e . execution_info
75+ assert_equal ( '' , info . inspect , 'Got ReadTimeoutError when statement should have succeeded' )
76+ end
6977 ensure
7078 @@ccm_cluster . unblock_nodes
7179 cluster && cluster . close
@@ -101,14 +109,21 @@ def test_statement_idempotency_on_timeout_no_keyspace_predefined
101109 session . execute ( 'SELECT * FROM simplex.test' , consistency : :one )
102110 end
103111
104- info = session . execute ( 'SELECT * FROM simplex.test' , consistency : :one , idempotent : true ) . execution_info
105- assert_equal 1 , info . retries
106- assert_equal 2 , info . hosts . size
107- assert_equal '127.0.0.1' , info . hosts [ 0 ] . ip . to_s
108- assert_equal '127.0.0.2' , info . hosts [ 1 ] . ip . to_s
112+ info = nil
113+ begin
114+ info = session . execute ( 'SELECT * FROM simplex.test' , consistency : :one , idempotent : true ) . execution_info
115+ assert_equal 1 , info . retries
116+ assert_equal 2 , info . hosts . size
117+ assert_equal '127.0.0.1' , info . hosts [ 0 ] . ip . to_s
118+ assert_equal '127.0.0.2' , info . hosts [ 1 ] . ip . to_s
119+ rescue Cassandra ::Errors ::ReadTimeoutError => e
120+ # Every once in a while, the test fails with a ReadTimeoutError. Try to report extra info in that case that
121+ # may help us track down the core issue.
122+ info = e . execution_info
123+ assert_equal ( '' , info . inspect , 'Got ReadTimeoutError when statement should have succeeded' )
124+ end
109125 ensure
110126 @@ccm_cluster . unblock_nodes
111127 cluster && cluster . close
112128 end
113-
114129end
0 commit comments