Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix various tests #333

Merged
merged 5 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ group :development, :test do

# Gems used by the ActiveRecord test suite
gem "bcrypt", "~> 3.1.18"
gem "mocha", "~> 1.14.0"
gem "sqlite3", "~> 1.4.4"

gem "minitest", "~> 5.15.0"
Expand Down
6 changes: 0 additions & 6 deletions lib/active_record/connection_adapters/cockroachdb_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,6 @@ def supports_deferrable_constraints?
# @crdb_version = version_num.to_i
# end

def self.database_exists?(config)
!!ActiveRecord::Base.cockroachdb_connection(config)
rescue ActiveRecord::NoDatabaseError
false
end

def initialize(...)
super

Expand Down
9 changes: 4 additions & 5 deletions test/cases/connection_adapters/type_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ module CockroachDB
module ConnectionAdapters
class TypeTest < ActiveRecord::TestCase
fixtures :accounts
class SqliteModel < ActiveRecord::Base
class FakeModel < ActiveRecord::Base
establish_connection(
adapter: "sqlite3",
database: "tmp/some"
adapter: "fake"
)
end
def test_type_can_be_used_with_various_db
Expand All @@ -19,8 +18,8 @@ def test_type_can_be_used_with_various_db
ActiveRecord::Type.adapter_name_from(Account)
)
assert_equal(
:sqlite3,
ActiveRecord::Type.adapter_name_from(SqliteModel)
:fake,
ActiveRecord::Type.adapter_name_from(FakeModel)
)
end
end
Expand Down
16 changes: 14 additions & 2 deletions test/excludes/ActiveRecord/PostgresqlTransactionNestedTest.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
exclude :test_deadlock_raises_Deadlocked_inside_nested_SavepointTransaction, "Causes CI to hand. Skip while debugging."
exclude :test_unserializable_transaction_raises_SerializationFailure_inside_nested_SavepointTransaction, "Causes CI to hand. Skip while debugging."

# > In CRDB SERIALIZABLE, reads block on in-progress writes for
# > as long as those writes are in progress. However, PG does
# > not have this "read block on write" behavior, and so rather
# > than allowing the left-hand-side to execute, it must instead
# > abort that transaction. Both are valid ways to implement SERIALIZABLE.
#
# See discussion: https://github.com/cockroachdb/activerecord-cockroachdb-adapter/pull/333
message = "SERIALIZABLE transactions are different in CockroachDB."

exclude :test_deadlock_raises_Deadlocked_inside_nested_SavepointTransaction, message
exclude :test_unserializable_transaction_raises_SerializationFailure_inside_nested_SavepointTransaction, message
exclude :test_SerializationFailure_inside_nested_SavepointTransaction_is_recoverable, message
exclude :test_deadlock_inside_nested_SavepointTransaction_is_recoverable, message
2 changes: 2 additions & 0 deletions test/excludes/AttributeMethodsTest.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# TODO: Rails 7.2 remove this exclusion
exclude "test_#undefine_attribute_methods_undefines_alias_attribute_methods", "The test will be fixed in 7.2 (https://github.com/rails/rails/commit/a0993f81d0450a191da1ee35282f60fc2899135c)"
Loading