activerecord-cockroachdb-adapter
activerecord-cockroachdb-adapter copied to clipboard
[ActiveRecord 5.2 Test Failure] test/cases/adapters/postgresql/referential_integrity_test.rb
Failure:
PostgreSQLReferentialIntegrityTest#test_only_catch_active_record_errors_others_bubble_up [/Users/alimi/repos/rails/activerecord/test/cases/adapters/postgresql/referential_integrity_test.rb:103]:
ArgumentError expected but nothing was raised.
bin/rails test Users/alimi/repos/rails/activerecord/test/cases/adapters/postgresql/referential_integrity_test.rb:100
Failure:
PostgreSQLReferentialIntegrityTest#test_should_reraise_invalid_foreign_key_exception_and_show_warning [/Users/alimi/repos/rails/activerecord/test/cases/adapters/postgresql/referential_integrity_test.rb:58]:
Expected /WARNING: Rails was not able to disable referential integrity/ to match "".
bin/rails test Users/alimi/repos/rails/activerecord/test/cases/adapters/postgresql/referential_integrity_test.rb:47
See the Contributing Guide for instructions on running tests.
If the test isn't valid against CockroachDB
- Add a ruby file to
test/excludes
that matches the name of the test class if one doesn't already exist. For example to exclude a test fromActiveRecord::AdapterTest
, createtest/excludes/ActiveRecord/AdapterTest.rb
. - Add an exclude statement to the file with the name of the test to exclude and a description. For example to exclude
test_indexes
fromActiveRecord::AdapterTest
: https://github.com/cockroachdb/activerecord-cockroachdb-adapter/blob/c3cb637bd855b36bbf9e76b7947162054b95022e/test/excludes/ActiveRecord/AdapterTest.rb#L1 - Finally, if the test can run against CockroachDB with a few changes, add it to
test/cases
. Everything from the ActiveRecord test suite will be available, so a lot of the excluded test can be copied over. Namespace the test under theCockroachDB
module to avoid name collisions. Seetest/cases/adapter_test.rb
for an example.
See https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48.
Any update on this failing test?
For me to convince our organisation to switch over to cockroachdb, it would be very helpful if most ActiveRecord tests where passing. Maybe this one isn't a big problem in practice, but the fact that a test named "referential integrity" isn't passing is somewhat alarming.
Hi @sandstrom I'll respond to this and the other comments collectively here. Most of these failing tests are due to the way the ActiveRecord sets up its tests. They do a lot of schema changes in transactions which has limited support in CockroachDB and can cause test failures even if the feature being tested works. In a lot of cases, a new test was written specifically for CockroachDB that passes. In other cases (referential integrity being one) some customization needed to be done in the adapter because of the differences between CockroachDB and Postgres, so the normal ActiveRecord test failed, but the Cockroach specific tests pass.
That being said, I will try to go through some of these issues and test which ones are still problematic at some point soon.
@keithdoggett Thanks for the update, sounds good!
It's great that this repo has seen good progress in the past year. A solid ActiveRecord adapter will greatly increase the chances that we can switch over to CockroachDB.