Skip to content

Commit

Permalink
select failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BuonOmo committed Sep 3, 2024
1 parent 2dd993b commit 9c77340
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ jobs:
done
cat ${{ github.workspace }}/setup.sql | cockroach sql --insecure
- name: Test
run: bundle exec rake test TESTOPTS='--profile=3 --verbose'
run: bundle exec rake test TESTOPTS='--profile=3 --verbose --name="/FixturesResetPkSequenceTest/"'
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ This section intent to help you with a checklist.
- [x] `def column_definitions(`
- [x] `def pk_and_sequence_for(`
- [ ] ...
- Check for setups containing `drop_table` in the test suite.
Especially if you have tons of failure, this is likely the cause.
## Execute only tests that run with a connection
Expand Down
2 changes: 1 addition & 1 deletion test/cases/adapter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_indexes
assert !indexes.first.unique
assert_equal ["firm_id"], indexes.first.columns
ensure
@connection.remove_index(:accounts, name: idx_name) rescue nil
@connection.remove_index(:accounts, name: idx_name, if_exists: true)
end

# This replaces the same test that's been excluded from
Expand Down
2 changes: 1 addition & 1 deletion test/cases/dirty_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_field_named_field
Testings.new.attributes
end
ensure
ActiveRecord::Base.lease_connection.drop_table :testings rescue nil
ActiveRecord::Base.lease_connection.drop_table :testings, if_exists: true
ActiveRecord::Base.clear_cache!
end
end
Expand Down
4 changes: 2 additions & 2 deletions test/cases/fixtures_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def self.name
ActiveRecord::Base.table_name_prefix = old_prefix
ActiveRecord::Base.table_name_suffix = old_suffix

ActiveRecord::Base.lease_connection.drop_table :prefix_other_topics_suffix rescue nil
ActiveRecord::Base.lease_connection.drop_table :prefix_other_topics_suffix, if_exists: true
end

# This replaces the same test that's been excluded from
Expand Down Expand Up @@ -285,7 +285,7 @@ class FixturesResetPkSequenceTest < ActiveRecord::TestCase
# ActiveRecord::TestFixtures#before_setup.
def before_setup
Account.lease_connection.drop_table :accounts, if_exists: true
Account.lease_connection.exec_query("CREATE SEQUENCE IF NOT EXISTS accounts_id_seq")
Account.lease_connection.exec_query("CREATE SEQUENCE IF NOT EXISTS accounts_id_seq")
Account.lease_connection.exec_query("
CREATE TABLE accounts (
id BIGINT PRIMARY KEY DEFAULT nextval('accounts_id_seq'),
Expand Down
2 changes: 1 addition & 1 deletion test/cases/migration/change_schema_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def setup
end

teardown do
connection.drop_table :testings rescue nil
connection.drop_table :testings, if_exists: true
ActiveRecord::Base.primary_key_prefix_type = nil
ActiveRecord::Base.clear_cache!
end
Expand Down
2 changes: 1 addition & 1 deletion test/cases/migration/check_constraint_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Trade < ActiveRecord::Base
end

teardown do
@connection.drop_table "trades", if_exists: true rescue nil
@connection.drop_table "trades", if_exists: true
end

if ActiveRecord::Base.lease_connection.supports_validate_constraints?
Expand Down
4 changes: 2 additions & 2 deletions test/cases/migration/foreign_key_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,8 @@ class CompositeForeignKeyTest < ActiveRecord::TestCase
end

teardown do
@connection.drop_table :astronauts, if_exists: true rescue nil
@connection.drop_table :rockets, if_exists: true rescue nil
@connection.drop_table :astronauts, if_exists: true
@connection.drop_table :rockets, if_exists: true
end

# OVERRIDE: CockroachDB does not quote the table name.
Expand Down
12 changes: 6 additions & 6 deletions test/cases/migration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ class MigrationTest < ActiveRecord::TestCase
@schema_migration.delete_all_versions

%w(things awesome_things prefix_things_suffix p_awesome_things_s).each do |table|
Thing.lease_connection.drop_table(table) rescue nil
Thing.lease_connection.drop_table(table, if_exists: true)
end
Thing.reset_column_information

%w(reminders people_reminders prefix_reminders_suffix).each do |table|
Reminder.lease_connection.drop_table(table) rescue nil
Reminder.lease_connection.drop_table(table, if_exists: true)
end
Reminder.reset_table_name
Reminder.reset_column_information

%w(last_name key bio age height wealth birthday favorite_day
moment_of_truth male administrator funny).each do |column|
Person.lease_connection.remove_column("people", column) rescue nil
Person.lease_connection.remove_column("people", column, if_exists: true)
end
Person.lease_connection.remove_column("people", "first_name") rescue nil
Person.lease_connection.remove_column("people", "middle_name") rescue nil
Person.lease_connection.remove_column("people", "first_name", if_exists: true)
Person.lease_connection.remove_column("people", "middle_name", if_exists: true)
Person.lease_connection.add_column("people", "first_name", :string)
Person.reset_column_information

Expand Down Expand Up @@ -90,7 +90,7 @@ def setup
end

teardown do
Person.lease_connection.drop_table(:delete_me) rescue nil
Person.lease_connection.drop_table(:delete_me, if_exists: true)
end

# Change expected query count from PostgreSQLAdapter to CockroachDBAdapter.
Expand Down

0 comments on commit 9c77340

Please sign in to comment.