Skip to content

Commit

Permalink
details
Browse files Browse the repository at this point in the history
  • Loading branch information
BuonOmo committed Sep 3, 2024
1 parent 2250ac5 commit 2dd993b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ $:.unshift(File.expand_path("../lib", __dir__))
# require "bundler/setup"
# Bundler.require :development

require "active_record"
require "activerecord-cockroachdb-adapter"
# This allows playing with the rake task as well. Ex:
#
# ActiveRecord::Tasks::DatabaseTasks.
Expand Down
8 changes: 5 additions & 3 deletions test/cases/adapters/postgresql/postgresql_adapter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ def teardown
end

def test_database_exists_returns_false_when_the_database_does_not_exist
config = { database: "non_extant_database", adapter: "cockroachdb" }
assert_not ActiveRecord::ConnectionAdapters::CockroachDBAdapter.database_exists?(config),
"expected database #{config[:database]} to not exist"
[ { database: "non_extant_database", adapter: "postgresql" },
{ database: "non_extant_database", adapter: "cockroachdb" } ].each do |config|
assert_not ActiveRecord::ConnectionAdapters::CockroachDBAdapter.database_exists?(config),
"expected database #{config[:database]} to not exist"
end
end

def test_database_exists_returns_true_when_the_database_exists
Expand Down
3 changes: 3 additions & 0 deletions test/cases/helper_cockroachdb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ def current_adapter?(...)

module LoadSchemaHelperExt
def load_schema
# TODO: Remove this const_set mess once https://github.com/rails/rails/commit/d5c2ff8345c9d23b7326edb2bbe72b6e86a63140
# is part of a rails release.
old_helper = ActiveRecord::TestCase
ActiveRecord.const_set(:TestCase, NoPGSchemaTestCase.new(ActiveRecord::TestCase))
return if ENV['COCKROACH_LOAD_FROM_TEMPLATE']
Expand Down Expand Up @@ -196,6 +198,7 @@ def before_teardown
if ENV['AR_LOG']
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.logger.level = Logger::DEBUG
ActiveRecord::LogSubscriber::IGNORE_PAYLOAD_NAMES.clear
ActiveRecord::Base.logger.formatter = proc { |severity, time, progname, msg|
th = Thread.current[:name]
th = "THREAD=#{th}" if th
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
exclude :test_exec_insert_default_values_quoted_schema_with_returning_disabled_and_no_sequence_name_given, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
exclude :test_expression_index, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
exclude :test_serial_sequence, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
exclude :test_database_exists_returns_false_when_the_database_does_not_exist, "Test is reimplemented to use cockroachdb adapter"
exclude :test_database_exists_returns_false_when_the_database_does_not_exist, "Test is reimplemented to use cockroachdb adapter. Still not working in CI, skip until we can triage further"
exclude :test_database_exists_returns_true_when_the_database_exists, "Test is reimplemented to use cockroachdb adapter"
exclude :test_invalid_index, "The error message differs from PostgreSQL."
exclude :test_partial_index_on_column_named_like_keyword, "CockroachDB adds parentheses around the WHERE definition."
Expand All @@ -20,6 +20,8 @@
exclude :test_pk_and_sequence_for, "The test needs a little rework since the sequence is empty in CRDB"
exclude :test_pk_and_sequence_for_with_non_standard_primary_key, "The test needs a little rework since the sequence is empty in CRDB"

exclude :test_pk_and_sequence_for_with_collision_pg_class_oid, "We cannot DELETE on relation pg_depend in CockroachDB. Skipped for now"

# NOTE: The expression `do $$ BEGIN RAISE WARNING 'foo'; END; $$` works with PG, not CRDB.
plpgsql_needed = "PL-PGSQL differs in CockroachDB. Not tested yet. See #339"
exclude :test_ignores_warnings_when_behaviour_ignore, plpgsql_needed
Expand Down
1 change: 1 addition & 0 deletions test/excludes/PostgresqlRenameTableTest.rb
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
exclude :test_renaming_a_table_also_renames_the_primary_key_index, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
exclude :test_renaming_a_table_also_renames_the_primary_key_sequence, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"

0 comments on commit 2dd993b

Please sign in to comment.