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

Add tests to verify the behavior of disable_ddl_transaction #101

Merged
merged 2 commits into from
Jun 14, 2024

Conversation

rkrage
Copy link
Contributor

@rkrage rkrage commented Jun 6, 2024

With recent PRs / conversations around transactional migrations, I figured it would be a good idea to write some basic tests to verify existing behavior. In other tests, we execute test migrations directly which bypasses the transaction logic in AR.


subclass.suppress_messages do
expect(subclass.new.unsafe_pg_ha_migrations_test_method).to eq("sentinel_value")
end
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed a bunch of this in the test output:

-- pg_ha_migrations_test_method(nil)
   -> 0.0001s

Copy link
Contributor

@jcoleman jcoleman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you squash into the two meaningful commits after applying the one suggestion?

aggregate_failures do
expect do
migration_klass.suppress_messages do
ActiveRecord::MigrationContext.new(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add comments explaining that our usually way of testing doesn't invoke ActiveRecord's transaction handingling?

@rkrage rkrage force-pushed the disable-ddl-transaction-tests branch from d9091a3 to b36942f Compare June 14, 2024 16:24
@rkrage
Copy link
Contributor Author

rkrage commented Jun 14, 2024

Can you squash into the two meaningful commits after applying the one suggestion?

Done and done

@rkrage rkrage force-pushed the disable-ddl-transaction-tests branch from b36942f to 51402cb Compare June 14, 2024 16:25
@jcoleman jcoleman merged commit 15ca9e1 into master Jun 14, 2024
91 checks passed
@rkrage rkrage deleted the disable-ddl-transaction-tests branch June 14, 2024 18:14
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 this pull request may close these issues.

None yet

2 participants