activerecord-cockroachdb-adapter icon indicating copy to clipboard operation
activerecord-cockroachdb-adapter copied to clipboard

[ActiveRecord 5.2 Test Failure] test/cases/adapters/postgresql/bit_string_test.rb

Open alimi opened this issue 5 years ago • 0 comments

Failure:
PostgresqlBitStringTest#test_schema_dumping [/Users/alimi/repos/rails/activerecord/test/cases/adapters/postgresql/bit_string_test.rb:58]:
Expected /t\.bit\s+"a_bit",\s+limit: 8,\s+default: "00000011"$/ to match "# This file is auto-generated from the current state of the database. Instead\n# of editing this file, please use the migrations feature of Active Record to\n# incrementally modify your database, and then regenerate this schema definition.\n#\n# Note that this schema.rb definition is the authoritative source for your\n# database schema. If you need to create the application database on another\n# system, you should be using db:schema:load, not running all the migrations\n# from scratch. The latter is a flawed and unsustainable approach (the more migrations\n# you'll amass, the slower it'll run and the greater likelihood for issues).\n#\n# It's strongly recommended that you check this file into your version control system.\n\nActiveRecord::Schema.define(version: 0) do\n\n  create_table \"postgresql_bit_strings\", force: :cascade do |t|\n    t.bit \"a_bit\", limit: 8\n    t.bit_varying \"a_bit_varying\", limit: 4\n    t.bit \"another_bit\", limit: 1\n    t.bit_varying \"another_bit_varying\"\n  end\n\nend\n".

bin/rails test Users/alimi/repos/rails/activerecord/test/cases/adapters/postgresql/bit_string_test.rb:56

Failure:
PostgresqlBitStringTest#test_default [/Users/alimi/repos/rails/activerecord/test/cases/adapters/postgresql/bit_string_test.rb:49]:
Expected: "00000011"
  Actual: nil

bin/rails test Users/alimi/repos/rails/activerecord/test/cases/adapters/postgresql/bit_string_test.rb:48

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: https://github.com/cockroachdb/activerecord-cockroachdb-adapter/blob/c3cb637bd855b36bbf9e76b7947162054b95022e/test/excludes/ActiveRecord/AdapterTest.rb#L1
  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 https://github.com/cockroachdb/activerecord-cockroachdb-adapter/issues/48.

alimi avatar Apr 17 '20 18:04 alimi