Closed msabramo closed 12 years ago
Good call.
Nice catch @msabramo !
There is another potential problem here. In order to run the tests, I have to run a copy of redis-server
, which isn't too bad, but what if someone else is already running a redis-server
with real data in it? And then they run these tests, then won't the flushdb
wipe out their data?
Perhaps a better approach is to mock out the Redis connection, perhaps using something like https://github.com/locationlabs/mockredis ?
I'm not super knowledgeable about redis - is it possible to force an unused db to be used?
On Mon, Nov 12, 2012 at 11:37 AM, Marc Abramowitz notifications@github.comwrote:
There is another potential problem here. In order to run the tests, I have to run a copy of redis-server, which isn't too bad, but what if someone else is already running a redis-server with real data in it? And then they run these tests, then won't the flushdb wipe out their data?
Perhaps a better approach is to mock out the Redis connection, perhaps using something like https://github.com/locationlabs/mockredis ?
— Reply to this email directly or view it on GitHubhttps://github.com/j2labs/brubeck/pull/92#issuecomment-10294378.
As far as flushing production data or important data you should not be running tests on a production box in hte first place.
However, there may be important dev data from another project. In order to minimize the chance of flushing an existing DB, what about simply running Redis on a non standard port for the tests?
On Mon, Nov 12, 2012 at 11:37 AM, Marc Abramowitz notifications@github.comwrote:
There is another potential problem here. In order to run the tests, I have to run a copy of redis-server, which isn't too bad, but what if someone else is already running a redis-server with real data in it? And then they run these tests, then won't the flushdb wipe out their data?
Perhaps a better approach is to mock out the Redis connection, perhaps using something like https://github.com/locationlabs/mockredis ?
— Reply to this email directly or view it on GitHubhttps://github.com/j2labs/brubeck/pull/92#issuecomment-10294378.
Although it's true that tests shouldn't be run on prod, it would only take a single person to do that to destroy our credibility.
On Mon, Nov 12, 2012 at 11:46 AM, Seth Murphy notifications@github.comwrote:
As far as flushing production data or important data you should not be running tests on a production box in hte first place.
However, there may be important dev data from another project. In order to minimize the chance of flushing an existing DB, what about simply running Redis on a non standard port for the tests?
On Mon, Nov 12, 2012 at 11:37 AM, Marc Abramowitz notifications@github.comwrote:
There is another potential problem here. In order to run the tests, I have to run a copy of redis-server, which isn't too bad, but what if someone else is already running a redis-server with real data in it? And then they run these tests, then won't the flushdb wipe out their data?
Perhaps a better approach is to mock out the Redis connection, perhaps using something like https://github.com/locationlabs/mockredis ?
— Reply to this email directly or view it on GitHub< https://github.com/j2labs/brubeck/pull/92#issuecomment-10294378>.
— Reply to this email directly or view it on GitHubhttps://github.com/j2labs/brubeck/pull/92#issuecomment-10294714.
https://github.com/locationlabs/mockredis looks to be missing functionality that brubeck needs such as the hvals
and reset
commands and its version of pipeline execute
doesn't return a list of values.
What appears to be a better fit is https://github.com/jamesls/fakeredis
Another option is to create a redis.conf
that launches a Redis server in the Brubeck tests directory using a UNIX domain socket. Ideally the tests could even start and stop such a server. Some ideas at https://github.com/mranney/node_redis/issues/204
See https://github.com/j2labs/brubeck/pull/94 for a PR to replace the use of real Redis with fakeredis
.
... start with a clean slate.
Without this, I get the following error on most test runs, because Redis will persist the state from previous runs.