Remove redis keys after each test

This commit is contained in:
Raul Ochoa 2015-09-25 16:16:51 +02:00
parent fea970f434
commit 0827124492

View File

@ -1,11 +1,11 @@
require('../../support/test_helper'); var testHelper = require('../../support/test_helper');
var assert = require('../../support/assert'); var assert = require('../../support/assert');
var redis = require('redis');
var cartodbServer = require('../../../lib/cartodb/server'); var cartodbServer = require('../../../lib/cartodb/server');
var ServerOptions = require('./support/ported_server_options'); var ServerOptions = require('./support/ported_server_options');
var BaseController = require('../../../lib/cartodb/controllers/base'); var BaseController = require('../../../lib/cartodb/controllers/base');
var LayergroupToken = require('../../../lib/cartodb/models/layergroup_token');
describe('torque boundary points', function() { describe('torque boundary points', function() {
@ -26,15 +26,16 @@ describe('torque boundary points', function() {
}); });
afterEach(function(done) { afterEach(function(done) {
var redisKey = 'map_cfg|' + layergroupIdToDelete; var keysToDelete = {
redis_client.del(redisKey, function () { 'user:localhost:mapviews:global': 5
done(); };
}); var mapKey = 'map_cfg|' + LayergroupToken.parse(layergroupIdToDelete).token;
keysToDelete[mapKey] = 0;
testHelper.deleteRedisKeys(keysToDelete, done);
}); });
var server = cartodbServer(ServerOptions); var server = cartodbServer(ServerOptions);
server.setMaxListeners(0); server.setMaxListeners(0);
var redis_client = redis.createClient(ServerOptions.redis.port);
var boundaryPointsMapConfig = { var boundaryPointsMapConfig = {
version: '1.1.0', version: '1.1.0',