Remove redis keys having in mind last updated time
This commit is contained in:
parent
281320f2c4
commit
7ee2649feb
@ -1,4 +1,4 @@
|
||||
require('../../support/test_helper');
|
||||
var testHelper = require('../../support/test_helper');
|
||||
|
||||
|
||||
var assert = require('../../support/assert');
|
||||
@ -7,6 +7,8 @@ var PortedServerOptions = require('./support/ported_server_options');
|
||||
var http = require('http');
|
||||
var testClient = require('./support/test_client');
|
||||
|
||||
var nock = require('nock');
|
||||
|
||||
var BaseController = require('../../../lib/cartodb/controllers/base');
|
||||
|
||||
function rmdir_recursive_sync(dirname) {
|
||||
@ -33,6 +35,8 @@ describe('external resources', function() {
|
||||
|
||||
var req2paramsFn;
|
||||
before(function(done) {
|
||||
nock.enableNetConnect('127.0.0.1');
|
||||
|
||||
req2paramsFn = BaseController.prototype.req2params;
|
||||
BaseController.prototype.req2params = PortedServerOptions.req2params;
|
||||
// Start a server to test external resources
|
||||
@ -58,8 +62,13 @@ describe('external resources', function() {
|
||||
|
||||
rmdir_recursive_sync(global.environment.millstone.cache_basedir);
|
||||
|
||||
// Close the resources server
|
||||
res_serv.close(done);
|
||||
testHelper.deleteRedisKeys({
|
||||
'user:localhost:mapviews:global': 5
|
||||
}, function() {
|
||||
// Close the resources server
|
||||
res_serv.close(done);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function imageCompareFn(fixture, done) {
|
||||
|
@ -76,9 +76,20 @@ function createLayergroup(layergroupConfig, options, callback) {
|
||||
|
||||
var parsedBody;
|
||||
var layergroupid;
|
||||
if (!options.callbackName) {
|
||||
if (options.callbackName) {
|
||||
global[options.callbackName] = function(layergroup) {
|
||||
layergroupid = layergroup.layergroupid;
|
||||
};
|
||||
// jshint ignore:start
|
||||
eval(res.body);
|
||||
// jshint ignore:end
|
||||
delete global[options.callbackName];
|
||||
} else {
|
||||
parsedBody = JSON.parse(res.body);
|
||||
layergroupid = parsedBody.layergroupid;
|
||||
if (layergroupid) {
|
||||
layergroupid = layergroupid.split(':')[0];
|
||||
}
|
||||
}
|
||||
|
||||
if (layergroupid) {
|
||||
@ -370,7 +381,7 @@ function getGeneric(layergroupConfig, url, expectedResponse, callback) {
|
||||
},
|
||||
function validateTile(err, res) {
|
||||
assert.ok(!err, 'Failed to get tile');
|
||||
var redisKey = 'map_cfg|' + layergroupid;
|
||||
var redisKey = 'map_cfg|' + layergroupid.split(':')[0];
|
||||
|
||||
var img;
|
||||
if (contentType === pngContentType) {
|
||||
@ -455,7 +466,7 @@ function withLayergroup(layergroupConfig, options, callback) {
|
||||
}
|
||||
|
||||
function finish(done) {
|
||||
var redisKey = 'map_cfg|' + layergroupid;
|
||||
var redisKey = 'map_cfg|' + layergroupid.split(':')[0];
|
||||
redisClient.del(redisKey, function (delErr) {
|
||||
return done(delErr);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user