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/migration_test.rb #85

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

[ActiveRecord 5.2 Test Failure] test/cases/migration_test.rb #85

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

Comments

@alimi
Copy link
Contributor

alimi commented Apr 17, 2020

Failure:
MigrationTest#test_migrator_one_up_with_unavailable_lock_using_run [/Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:690]:
ActiveRecord::ConcurrentMigrationError expected but nothing was raised.

bin/rails test Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:676

Failure:
MigrationTest#test_with_advisory_lock_raises_the_right_error_when_it_fails_to_release_lock [/Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:702]:
ActiveRecord::ConcurrentMigrationError expected but nothing was raised.

bin/rails test Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:697

Failure:
MigrationTest#test_create_table_with_query [/Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:526]:
Expected: 1
  Actual: 2

bin/rails test Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:521

Failure:
MigrationTest#test_add_table_with_decimals [/Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:196]:
Expected 0.6e10 to be a kind of Integer, not BigDecimal.

bin/rails test Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:170

Failure:
MigrationTest#test_migrator_one_up_with_unavailable_lock [/Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:669]:
ActiveRecord::ConcurrentMigrationError expected but nothing was raised.

bin/rails test Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:655

Failure:
MigrationTest#test_create_table_with_query_from_relation [/Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:537]:
Expected: 1
  Actual: 2

bin/rails test Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:532

Failure:
BulkAlterTableMigrationsTest#test_removing_columns [/Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:836]:
Expected false to be truthy.

bin/rails test Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:822

Error:
BulkAlterTableMigrationsTest#test_adding_indexes:
RuntimeError: need an expected query count for CockroachDBAdapter
    /Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:852:in `block in test_adding_indexes'
    /Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:851:in `fetch'
    /Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:851:in `test_adding_indexes'

bin/rails test Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:840

Error:
BulkAlterTableMigrationsTest#test_changing_columns:
RuntimeError: need an expected query count for CockroachDBAdapter
    /Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:914:in `block in test_changing_columns'
    /Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:913:in `fetch'
    /Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:913:in `test_changing_columns'

bin/rails test Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:900

Error:
BulkAlterTableMigrationsTest#test_adding_multiple_columns:
RuntimeError: need an expected query count for CockroachDBAdapter
    /Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:803:in `block in test_adding_multiple_columns'
    /Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:802:in `fetch'
    /Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:802:in `test_adding_multiple_columns'

bin/rails test Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:797

Failure:
BulkAlterTableMigrationsTest#test_removing_index [/Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:877]:
Expected nil to be truthy.

bin/rails test Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:871

Error:
ExplicitlyNamedIndexMigrationTest#test_drop_index_by_name:
ArgumentError: No indexes found on values with the options provided.
    /Users/alimi/repos/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb:1246:in `index_name_for_remove'
    /Users/alimi/repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb:485:in `remove_index'
    /Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:777:in `block in test_drop_index_by_name'
    /Users/alimi/repos/rails/activesupport/lib/active_support/testing/assertions.rb:32:in `assert_nothing_raised'
    /Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:775:in `test_drop_index_by_name'

bin/rails test Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:769

Error:
ReservedWordsMigrationTest#test_drop_index_from_table_named_values:
ArgumentError: No indexes found on values with the options provided.
    /Users/alimi/repos/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb:1246:in `index_name_for_remove'
    /Users/alimi/repos/rails/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb:485:in `remove_index'
    /Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:761:in `block in test_drop_index_from_table_named_values'
    /Users/alimi/repos/rails/activesupport/lib/active_support/testing/assertions.rb:32:in `assert_nothing_raised'
    /Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:759:in `test_drop_index_from_table_named_values'

bin/rails test Users/alimi/repos/rails/activerecord/test/cases/migration_test.rb:753

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