ActiveRecord connection leaking to other envs
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
Research direction
Start by reproducing the DATABASE_URL=$PSQL_REMOTE rails c and rspec-with-Spring scenario described in the issue. Read rails_spec.rb and the ActiveRecord::Tasks::DatabaseTasks.check_protected_environments! entry point, then determine whether the safeguard belongs in Spring or rspec-rails. Done means test execution cannot reuse the remote ActiveRecord connection in this setup, with coverage for the reported reproduction.
Written by the indexing model from the issue text.
Description
Hi,
I'm posting this here, but I'm unsure which component is directly responsible for that problem.
I guess that it would be nice to have some guard to prevent this inside rspec-rails/rails itself.
REPLICATION
run console attaching it to remote DB like this:
DATABASE_URL=$PSQL_REMOTE rails c (development env)
then I'm using rspec for running specs, now rspec (using spring) when executing tests is already connected to remote DB instead of local one. Add sth like database cleaner to the stack and you have just wiped remote database.
One safeguard for that could be adding inside rails_spec.rb following line:
ActiveRecord::Tasks::DatabaseTasks.check_protected_environments!
but I imagine that check as something internal to ... (rails? rspec-rails?) so we do not have to add it to all projects.
I'm waiting for your comments here, please point me in the right direction.
- Dominant language
- Ruby
- Stars
- 2.8k
- Forks
- 342
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rails/spring
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 30/100
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 52/100
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 32/100
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 38/100
Similar issues
-
バグ
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
voxpupuli/puppet-epel#186 · 1 comment ·
-
external_created_at is no longer used for the message timestamp since the new message UI (v4.4.0) OpenBug Frontend
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
TheOdinProject/curriculum#31402 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100