Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Delete failing test

I don't think this is testing anything useful, and the test code is
exceedingly brittle. It is broken since
34c7e73 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.
  • Loading branch information...
commit 79c02e849b94ee680e824828be4ddf029e05ba12 1 parent 0d3cb00
@jonleighton jonleighton authored
Showing with 0 additions and 36 deletions.
  1. +0 −36 activerecord/test/cases/adapters/postgresql/connection_test.rb
View
36 activerecord/test/cases/adapters/postgresql/connection_test.rb
@@ -81,42 +81,6 @@ def test_schema_names_logs_name
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
Please sign in to comment.
Something went wrong with that request. Please try again.