Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I noticed in a build that this test was flaky and causing subsequent tests to fail with a no connection pool error. I don't entirely get why this test was failing, it's not the only one where we remove a connection. When this test fails, `@automatic_reconnect` is `false`. After spending far too much time trying to figure out the combination of tests that break this I decided to fix it by making a brand new connection that we can remove. It's also a more accurate test because we're asserting the connection is actually not `connected?`. Note that I had to use the connection handler to remove the connection because there is an inconsitency in remove_connection on the model. Unfortunately, `NoConnection.remove_connection` will cause `connected?` to fall back to `ActiveRecord::Base` which is contrary to the behavior of all other methods on the active record models. I'm going to send a PR to fix that but for now this should fix the (rare) flaky test for a primary key with no connection. To reproduce I used this seed: `SEED=29535 bundle exec rake test:mysql2`
- Loading branch information