From 79c02e849b94ee680e824828be4ddf029e05ba12 Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Fri, 22 Mar 2013 11:55:17 +0000 Subject: Delete failing test I don't think this is testing anything useful, and the test code is exceedingly brittle. It is broken since 34c7e73c1def1312e59ef1f334586ff2f668246e because the test code makes assumptions about the implementation of PostgreSQLAdapter#active? which are incorrect after the commit. I could fix this test but it would be even more brittle (by stubbing the underlying @connection.connect_poll) and it doesn't test any complex logic. I conclude that it's not worth it. --- .../cases/adapters/postgresql/connection_test.rb | 36 ---------------------- 1 file changed, 36 deletions(-) diff --git a/activerecord/test/cases/adapters/postgresql/connection_test.rb b/activerecord/test/cases/adapters/postgresql/connection_test.rb index c03660957e..6b726ce875 100644 --- a/activerecord/test/cases/adapters/postgresql/connection_test.rb +++ b/activerecord/test/cases/adapters/postgresql/connection_test.rb @@ -81,42 +81,6 @@ module ActiveRecord assert_equal 'SCHEMA', @connection.logged[0][1] end - def test_reconnection_after_simulated_disconnection_with_verify - assert @connection.active? - original_connection_pid = @connection.query('select pg_backend_pid()') - - # Fail with bad connection on next query attempt. - raw_connection = @connection.raw_connection - raw_connection_class = class << raw_connection ; self ; end - raw_connection_class.class_eval <<-CODE, __FILE__, __LINE__ + 1 - def query_fake(*args) - if !( @called ||= false ) - self.stubs(:status).returns(PGconn::CONNECTION_BAD) - @called = true - raise PGError - else - self.unstub(:status) - query_unfake(*args) - end - end - - alias query_unfake query - alias query query_fake - CODE - - begin - @connection.verify! - new_connection_pid = @connection.query('select pg_backend_pid()') - ensure - raw_connection_class.class_eval <<-CODE, __FILE__, __LINE__ + 1 - alias query query_unfake - undef query_fake - CODE - end - - assert_not_equal original_connection_pid, new_connection_pid, "Should have a new underlying connection pid" - end - # Must have with_manual_interventions set to true for this # test to run. # When prompted, restart the PostgreSQL server with the -- cgit v1.2.3