Adds check for surrogate key headers in template instances
p.s. it fixes instantiate template with params test
This commit is contained in:
parent
272e8cd221
commit
0abd6a2293
@ -5,6 +5,7 @@ var querystring = require('querystring');
|
|||||||
var semver = require('semver');
|
var semver = require('semver');
|
||||||
var Step = require('step');
|
var Step = require('step');
|
||||||
var strftime = require('strftime');
|
var strftime = require('strftime');
|
||||||
|
var NamedMapsCacheEntry = require(__dirname + '/../../lib/cartodb/cache/model/named_maps_entry');
|
||||||
var SQLAPIEmu = require(__dirname + '/../support/SQLAPIEmu.js');
|
var SQLAPIEmu = require(__dirname + '/../support/SQLAPIEmu.js');
|
||||||
var redis_stats_db = 5;
|
var redis_stats_db = 5;
|
||||||
|
|
||||||
@ -1590,6 +1591,7 @@ suite('template_api:postgres=' + cdbQueryTablesFromPostgresEnabledValue, functio
|
|||||||
assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
||||||
// See https://github.com/CartoDB/Windshaft-cartodb/issues/176
|
// See https://github.com/CartoDB/Windshaft-cartodb/issues/176
|
||||||
helper.checkCache(res);
|
helper.checkCache(res);
|
||||||
|
helper.checkSurrogateKey(res, new NamedMapsCacheEntry('localhost', template_acceptance_open.name).key());
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
function finish(err) {
|
function finish(err) {
|
||||||
@ -1605,10 +1607,9 @@ suite('template_api:postgres=' + cdbQueryTablesFromPostgresEnabledValue, functio
|
|||||||
version: '0.0.1',
|
version: '0.0.1',
|
||||||
name: 'acceptance_open_jsonp_params',
|
name: 'acceptance_open_jsonp_params',
|
||||||
auth: { method: 'open' },
|
auth: { method: 'open' },
|
||||||
/*
|
|
||||||
placeholders: {
|
placeholders: {
|
||||||
color: { type: "css_color", default: "red" }
|
color: { type: "css_color", default: "red" }
|
||||||
},*/
|
},
|
||||||
layergroup: {
|
layergroup: {
|
||||||
version: '1.0.0',
|
version: '1.0.0',
|
||||||
layers: [
|
layers: [
|
||||||
@ -1661,9 +1662,11 @@ suite('template_api:postgres=' + cdbQueryTablesFromPostgresEnabledValue, functio
|
|||||||
function checkInstanciation(err, res)
|
function checkInstanciation(err, res)
|
||||||
{
|
{
|
||||||
if ( err ) throw err;
|
if ( err ) throw err;
|
||||||
|
console.log(err, res.body, res.headers);
|
||||||
assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
assert.equal(res.statusCode, 200, res.statusCode + ': ' + res.body);
|
||||||
// See https://github.com/CartoDB/Windshaft-cartodb/issues/176
|
// See https://github.com/CartoDB/Windshaft-cartodb/issues/176
|
||||||
helper.checkNoCache(res);
|
helper.checkCache(res);
|
||||||
|
helper.checkSurrogateKey(res, new NamedMapsCacheEntry('localhost', template_acceptance_open.name).key());
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
function finish(err) {
|
function finish(err) {
|
||||||
@ -1845,6 +1848,7 @@ suite('template_api:postgres=' + cdbQueryTablesFromPostgresEnabledValue, functio
|
|||||||
assert.ok(parsed.hasOwnProperty('layergroupid'),
|
assert.ok(parsed.hasOwnProperty('layergroupid'),
|
||||||
"Missing 'layergroupid' from response body: " + res.body);
|
"Missing 'layergroupid' from response body: " + res.body);
|
||||||
layergroupid = parsed.layergroupid;
|
layergroupid = parsed.layergroupid;
|
||||||
|
helper.checkSurrogateKey(res, new NamedMapsCacheEntry('localhost', template_acceptance2.name).key());
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
function updateTemplate(err, res)
|
function updateTemplate(err, res)
|
||||||
@ -1889,6 +1893,7 @@ suite('template_api:postgres=' + cdbQueryTablesFromPostgresEnabledValue, functio
|
|||||||
assert.ok(parsed.hasOwnProperty('layergroupid'),
|
assert.ok(parsed.hasOwnProperty('layergroupid'),
|
||||||
"Missing 'layergroupid' from response body: " + res.body);
|
"Missing 'layergroupid' from response body: " + res.body);
|
||||||
assert.ok(layergroupid != parsed.layergroupid);
|
assert.ok(layergroupid != parsed.layergroupid);
|
||||||
|
helper.checkSurrogateKey(res, new NamedMapsCacheEntry('localhost', template_acceptance2.name).key());
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
function finish(err) {
|
function finish(err) {
|
||||||
|
@ -50,10 +50,16 @@ function checkCache(res) {
|
|||||||
assert.ok(res.headers.hasOwnProperty('last-modified'));
|
assert.ok(res.headers.hasOwnProperty('last-modified'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkSurrogateKey(res, expectedKey) {
|
||||||
|
assert.ok(res.headers.hasOwnProperty('surrogate-key'));
|
||||||
|
assert.equal(res.headers['surrogate-key'], expectedKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
lzma_compress_to_base64: lzma_compress_to_base64,
|
lzma_compress_to_base64: lzma_compress_to_base64,
|
||||||
checkNoCache: checkNoCache,
|
checkNoCache: checkNoCache,
|
||||||
|
checkSurrogateKey: checkSurrogateKey,
|
||||||
checkCache: checkCache
|
checkCache: checkCache
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user