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

[ActiveRecord 5.2 Test Failure] test/cases/persistence_test.rb #86

Closed
alimi opened this issue Apr 17, 2020 · 0 comments · Fixed by #123
Closed

[ActiveRecord 5.2 Test Failure] test/cases/persistence_test.rb #86

alimi opened this issue Apr 17, 2020 · 0 comments · Fixed by #123

Comments

@alimi
Copy link
Contributor

alimi commented Apr 17, 2020

Error:
PersistenceTest#test_reset_column_information_resets_children:
ActiveRecord::StatementInvalid: PG::ObjectNotInPrerequisiteState: ERROR:  column "foo" in the middle of being added, try again later
: ALTER TABLE "topics" DROP COLUMN "foo"
    /Users/alimi/repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb:75:in `exec'
    /Users/alimi/repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb:75:in `block (2 levels) in execute'
    /Users/alimi/repos/rails/activesupport/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
    /Users/alimi/repos/rails/activesupport/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
    /Users/alimi/repos/rails/activesupport/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
    /Users/alimi/repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb:74:in `block in execute'
    /Users/alimi/repos/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:581:in `block (2 levels) in log'
    /Users/alimi/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
    /Users/alimi/repos/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:580:in `block in log'
    /Users/alimi/repos/rails/activesupport/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
    /Users/alimi/repos/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:571:in `log'
    /Users/alimi/repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb:73:in `execute'
    /Users/alimi/repos/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb:603:in `remove_column'
    /Users/alimi/repos/rails/activerecord/test/cases/persistence_test.rb:1261:in `ensure in test_reset_column_information_resets_children'
    /Users/alimi/repos/rails/activerecord/test/cases/persistence_test.rb:1262:in `test_reset_column_information_resets_children'

bin/rails test Users/alimi/repos/rails/activerecord/test/cases/persistence_test.rb:1247

See the Contributing Guide for instructions on running tests.

If the test isn't valid against CockroachDB

  1. 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 from ActiveRecord::AdapterTest, create test/excludes/ActiveRecord/AdapterTest.rb.
  2. Add an exclude statement to the file with the name of the test to exclude and a description. For example to exclude test_indexes from ActiveRecord::AdapterTest:
    exclude :test_indexes, "Rails transactional tests are being used while making schema changes. See https://www.cockroachlabs.com/docs/stable/online-schema-changes.html#limited-support-for-schema-changes-within-transactions."
  3. 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 the CockroachDB module to avoid name collisions. See test/cases/adapter_test.rb for an example.

See #48.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant