Skip to content

Commit

Permalink
compatibility tests working
Browse files Browse the repository at this point in the history
  • Loading branch information
BuonOmo committed Sep 2, 2024
1 parent e3af11e commit 2847291
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 28 deletions.
7 changes: 7 additions & 0 deletions test/cases/helper_cockroachdb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,10 @@ def header(stream)
end

ActiveRecord::SchemaDumper.prepend(NoHeaderExt)

# CRDB does not support ALTER COLUMN TYPE inside a transaction
# NOTE: This would be better in an exclude test, however this base
# class is used by a lot of inherited tests. We repeat less here.
class BaseCompatibilityTest < ActiveRecord::TestCase
self.use_transactional_tests = false
end
23 changes: 0 additions & 23 deletions test/cases/migration/compatibility_test.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
exclude :test_pk_and_sequence_for_with_non_standard_primary_key, "The test needs a little rework since the sequence is empty in CRDB"

# NOTE: The expression `do $$ BEGIN RAISE WARNING 'foo'; END; $$` works with PG, not CRDB.
plpgsql_needed = "PL-PGSQL differs in CockroachDB. Not tested yet."
plpgsql_needed = "PL-PGSQL differs in CockroachDB. Not tested yet. See #339"
exclude :test_ignores_warnings_when_behaviour_ignore, plpgsql_needed
exclude :test_logs_warnings_when_behaviour_log, plpgsql_needed
exclude :test_raises_warnings_when_behaviour_raise, plpgsql_needed
Expand Down
19 changes: 15 additions & 4 deletions test/excludes/ActiveRecord/Migration/CompatibilityTest.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
exclude :test_legacy_change_column_with_null_executes_update, "Skipping until we can triage further. See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48"
exclude :test_legacy_add_foreign_key_with_deferrable_true, "CRDB does not support DEFERRABLE constraints"
exclude :test_disable_extension_on_7_0, "CRDB does not support enabling/disabling extensions."
# CRDB does not support ALTER COLUMN TYPE inside a transaction
BaseCompatibilityTest.descendants.each { _1.use_transactional_tests = false }

exclude :test_add_index_errors_on_too_long_name_7_0, "The max length in CRDB is 128, not 64."
exclude :test_create_table_add_index_errors_on_too_long_name_7_0, "The max length in CRDB is 128, not 64."
# exclude :test_add_index_errors_on_too_long_name_7_0, "The max length in CRDB is 128, not 64."
# exclude :test_create_table_add_index_errors_on_too_long_name_7_0, "The max length in CRDB is 128, not 64."

require "support/copy_cat"

CopyCat.copy_methods(self, self,
:test_add_index_errors_on_too_long_name_7_0,
:test_create_table_add_index_errors_on_too_long_name_7_0
) do
def on_sym(node)
return unless node.children[0] == :very_long_column_name_to_test_with

insert_after(node.loc.expression, "_and_actually_way_longer_because_cockroach_is_in_the_128_game")
end
end

0 comments on commit 2847291

Please sign in to comment.