Skip to content

Commit

Permalink
Remove no connection primary key test
Browse files Browse the repository at this point in the history
This test was added in b3407c8
at a time when Rails was reading the `primary_keys` off a hash stored on
`connection`. We no longer do that in Active Record so this test isn't
really necessary. I'm removing it because it was flaky. I attempted to
fix it in #48473 but realized today it's not testing the same thing it
was before. After discussing it with Matthew, I've decided to remove it.
  • Loading branch information
eileencodes committed Jun 15, 2023
1 parent 8a4543d commit d31cb46
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions activerecord/test/cases/primary_keys_test.rb
Expand Up @@ -270,31 +270,6 @@ def test_serial_with_unquoted_sequence_name
end
end

class PrimaryKeyWithNoConnectionTest < ActiveRecord::TestCase
class NoConnection < ActiveRecord::Base
self.abstract_class = true
self.primary_key = "foo"
end

self.use_transactional_tests = false

unless in_memory_db?
def test_set_primary_key_with_no_connection
NoConnection.establish_connection :arunit
# execute to fully establish a connection
NoConnection.connection.execute("SELECT 1")

assert NoConnection.connected?
assert_equal "foo", NoConnection.primary_key

ActiveRecord::Base.connection_handler.remove_connection_pool("PrimaryKeyWithNoConnectionTest::NoConnection")
assert_nil NoConnection.connected?

assert_equal "foo", NoConnection.primary_key
end
end
end

class PrimaryKeyWithAutoIncrementTest < ActiveRecord::TestCase
self.use_transactional_tests = false

Expand Down

0 comments on commit d31cb46

Please sign in to comment.