diff --git a/pkg/cmd/roachtest/tests/ruby_pg_blocklist.go b/pkg/cmd/roachtest/tests/ruby_pg_blocklist.go index c622233fdda9..f44bb7814c8c 100644 --- a/pkg/cmd/roachtest/tests/ruby_pg_blocklist.go +++ b/pkg/cmd/roachtest/tests/ruby_pg_blocklist.go @@ -72,7 +72,6 @@ var rubyPGBlocklist = blocklist{ `PG::Connection multinationalization support handles clearing result in or after set_notice_receiver`: "unknown", `PG::Connection multinationalization support receives properly encoded messages in the notice callbacks`: "unknown", `PG::Connection multinationalization support receives properly encoded text from wait_for_notify`: "unknown", - `PG::Connection multinationalization support respect and convert character encoding of input strings should convert error string to #put_copy_end`: "unknown", `PG::Connection multinationalization support respect and convert character encoding of input strings should convert query string and parameters to #exec_params`: "unknown", `PG::Connection multinationalization support respect and convert character encoding of input strings should convert query string and parameters to #send_query_params`: "unknown", `PG::Connection multinationalization support respect and convert character encoding of input strings should convert strings and parameters to #prepare and #exec_prepared`: "unknown", @@ -111,7 +110,6 @@ var rubyPGBlocklist = blocklist{ `PG::Connection#copy_data gracefully handle SQL statements while in #copy_data for input`: "unknown", `PG::Connection#copy_data gracefully handle SQL statements while in #copy_data for output`: "unknown", `PG::Connection#discard_results returns false on connection failures`: "unknown", - `PG::Connection#inspect should print host, port and user of a fresh connection, but not more`: "unknown", `PG::Connection#inspect should tell about non UTF8 client encoding`: "unknown", `PG::Connection#transaction automatically rolls back a transaction if an exception is raised`: "unknown", `PG::Connection#transaction commits even if the block includes an early break/return`: "unknown", @@ -158,6 +156,7 @@ var rubyPGBlocklist = blocklist{ `running with sync_* methods PG::Connection multinationalization support handles clearing result in or after set_notice_receiver`: "unknown", `running with sync_* methods PG::Connection multinationalization support receives properly encoded messages in the notice callbacks`: "unknown", `running with sync_* methods PG::Connection multinationalization support receives properly encoded text from wait_for_notify`: "unknown", + `running with sync_* methods PG::Connection multinationalization support respect and convert character encoding of input strings should convert error string to #put_copy_end`: "unknown", `running with sync_* methods PG::Connection multinationalization support respect and convert character encoding of input strings should convert query string and parameters to #exec_params`: "unknown", `running with sync_* methods PG::Connection multinationalization support respect and convert character encoding of input strings should convert query string and parameters to #send_query_params`: "unknown", `running with sync_* methods PG::Connection multinationalization support respect and convert character encoding of input strings should convert strings and parameters to #prepare and #exec_prepared`: "unknown", @@ -187,22 +186,15 @@ var rubyPGBlocklist = blocklist{ `running with sync_* methods PG::Connection type casting with default result type map should work with arbitrary number of params in conjunction with type casting`: "unknown", `running with sync_* methods PG::Connection with async established connection provides the server generated error message`: "unknown", `running with sync_* methods PG::Connection with multiple PostgreSQL servers honors target_session_attrs requirements`: "unknown", - `running with sync_* methods PG::Connection#copy_data can handle client errors after all data is consumed in #copy_data for output`: "unknown", `running with sync_* methods PG::Connection#copy_data can handle client errors in #copy_data for input`: "unknown", - `running with sync_* methods PG::Connection#copy_data can handle client errors in #copy_data for output`: "unknown", - `running with sync_* methods PG::Connection#copy_data can handle incomplete #copy_data output queries`: "unknown", `running with sync_* methods PG::Connection#copy_data can handle server errors in #copy_data for input`: "unknown", `running with sync_* methods PG::Connection#copy_data can handle server errors in #copy_data for output`: "unknown", `running with sync_* methods PG::Connection#copy_data can process #copy_data input queries`: "unknown", `running with sync_* methods PG::Connection#copy_data can process #copy_data input queries with lots of data`: "unknown", - `running with sync_* methods PG::Connection#copy_data can process #copy_data output queries`: "unknown", `running with sync_* methods PG::Connection#copy_data doesn't lose client error when #copy_data can not be finished`: "unknown", `running with sync_* methods PG::Connection#copy_data gracefully handle SQL statements while in #copy_data for input`: "unknown", `running with sync_* methods PG::Connection#copy_data gracefully handle SQL statements while in #copy_data for output`: "unknown", - `running with sync_* methods PG::Connection#copy_data should raise an error for non copy statements in #copy_data`: "unknown", - `running with sync_* methods PG::Connection#discard_results discards previous results`: "unknown", `running with sync_* methods PG::Connection#discard_results returns false on connection failures`: "unknown", - `running with sync_* methods PG::Connection#inspect should print host, port and user of a fresh connection, but not more`: "unknown", `running with sync_* methods PG::Connection#inspect should tell about non UTF8 client encoding`: "unknown", `running with sync_* methods PG::Connection#transaction automatically rolls back a transaction if an exception is raised`: "unknown", `running with sync_* methods PG::Connection#transaction commits even if the block includes an early break/return`: "unknown", diff --git a/pkg/cmd/roachtest/tests/ruby_pg_helpers.rb b/pkg/cmd/roachtest/tests/ruby_pg_helpers.rb index d9547ad722c4..efe7fb1fd12b 100644 --- a/pkg/cmd/roachtest/tests/ruby_pg_helpers.rb +++ b/pkg/cmd/roachtest/tests/ruby_pg_helpers.rb @@ -30,6 +30,21 @@ def self::included( mod ) @conninfo = $pg_server.conninfo @unix_socket = $pg_server.unix_socket @conn = $pg_server.connect + + # Find a local port that is not in use + @port_down = @port + 10 + loop do + @port_down = @port_down + 1 + begin + TCPSocket.new("::1", @port_down) + rescue SystemCallError + begin + TCPSocket.new("127.0.0.1", @port_down) + rescue SystemCallError + break + end + end + end end mod.around( :each ) do |example| @@ -52,6 +67,11 @@ def self::included( mod ) end @conn.exit_pipeline_mode end + @conn.setnonblocking false + @conn.type_map_for_results = PG::TypeMapAllStrings.new + @conn.type_map_for_queries = PG::TypeMapAllStrings.new + @conn.encoder_for_put_copy_data = nil + @conn.decoder_for_get_copy_data = nil @conn.exec( 'ROLLBACK' ) unless example.metadata[:without_transaction] end end