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

Test: Running test destroys my local Redis data #755

Open
mishina2228 opened this issue Sep 23, 2022 · 0 comments
Open

Test: Running test destroys my local Redis data #755

mishina2228 opened this issue Sep 23, 2022 · 0 comments

Comments

@mishina2228
Copy link
Contributor

This project uses Redis on localhost:6379 for testing now.
But I use it in the development of other Rails app as well.
I was wondering why the data disappeared for a while, but it was due to the following part:

setup do
Resque::Scheduler.quiet = true
Resque.data_store.redis.flushall
end

I checked what they are doing in Resque and they have Redis on localhost:9736 for testing.
https://github.com/resque/resque/blob/daf45bbbaf87411d27c0eb1df44ce463746cf5c8/test/test_helper.rb#L32-L33

# start our own redis when the tests start,
# kill it when they end

https://github.com/resque/resque/blob/daf45bbbaf87411d27c0eb1df44ce463746cf5c8/test/test_helper.rb#L73-L75

  puts "Starting redis for testing at localhost:9736..."
  `redis-server #{$dir}/redis-test.conf`
  Resque.redis = 'localhost:9736'

I think it is a good idea to take this same approach.

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

No branches or pull requests

1 participant