Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use fake redis properly when preparing test servers

  • Loading branch information...
commit 5f0c3434862d1f76aeb86f1d26394ac637b1eb08 1 parent c0b8608
Evan Tahler authored
Showing with 18 additions and 10 deletions.
  1. +18 −10 helpers/specHelper.js
28 helpers/specHelper.js
View
@@ -131,20 +131,28 @@ specHelper.clearRedis = function(serverID, next){
if(serverID != 0){
next();
}else{
- var redis = require('redis');
- var client = redis.createClient(redisConfig.port, redisConfig.host, redisConfig.options);
- client.on("ready", function (err) {
- client.select(redisConfig.DB, function(){
+ if(toFakeRedis){
+ var redis = require('fakeredis');
+ var client = redis.createClient(redisConfig.port, redisConfig.host, redisConfig.options);
+ redis.fast = true;
+ client.flushdb(function(){
+ next();
+ });
+ }else{
+ var redis = require('redis');
+ var client = redis.createClient(redisConfig.port, redisConfig.host, redisConfig.options);
+ client.on("ready", function (err) {
+ client.select(redisConfig.DB, function(){
client.flushdb(function(){
- // process.stdout.write("[ test redis emptied ] ");
next();
});
+ });
});
- });
- client.on("error", function (err) {
- process.stdout.write("\r\n\r\n!! Redis Error: " + err + "\r\n\r\n");
- process.exit(); // redis is really important...
- });
+ client.on("error", function (err) {
+ process.stdout.write("\r\n\r\n!! Redis Error: " + err + "\r\n\r\n");
+ process.exit(); // redis is really important...
+ });
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.