Going red: add test to check the bad behavour of max-age directive when an analysis table is in affected tables of the map

remotes/origin/upgrade-windshaft-5.5.1
Daniel García Aubert 5 years ago
parent 27b76aefd2
commit 6cdb872bb5

51
package-lock.json generated

@ -32,7 +32,7 @@
"resolved": "https://registry.npmjs.org/@carto/mapnik/-/mapnik-3.6.2-carto.15.tgz",
"integrity": "sha512-O6YpFQ8NRJJZjiQJxoS92Hpjci1tvd4SWKxaicG3SuRBqVGY3BKdhChL+6Ck6tRZvW3O577987vVwEnYKALTCA==",
"requires": {
"mapnik-vector-tile": "github:cartodb/mapnik-vector-tile#e7ca5471f9e5de81243e6035e70444321fc0a82f",
"mapnik-vector-tile": "github:cartodb/mapnik-vector-tile#v1.6.1-carto.2",
"nan": "2.14.0",
"node-pre-gyp": "0.13.0"
},
@ -389,7 +389,7 @@
},
"carto": {
"version": "github:cartodb/carto#85881d99dd7fcf2c4e16478b04db67108d27a50c",
"from": "github:cartodb/carto#0.15.1-cdb5",
"from": "github:cartodb/carto#master",
"requires": {
"mapnik-reference": "~6.0.2",
"optimist": "~0.6.0",
@ -417,14 +417,13 @@
"integrity": "sha512-1z3Dk9G8KQlNGurbcmGBvNj8DVCh1Keue9uzyyvB6hKOYzBHMxixAMG0D+8nSsA7oQmWUsx/xkZZ5ZxT9toEHA==",
"requires": {
"debug": "^3.1.0",
"pg": "github:cartodb/node-postgres#5417d7b29b7272ca2e71bb396899ab3f177a9ae6",
"pg": "github:cartodb/node-postgres#6.4.2-cdb2",
"underscore": "~1.6.0"
}
},
"cartodb-query-tables": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/cartodb-query-tables/-/cartodb-query-tables-0.4.0.tgz",
"integrity": "sha512-abhhz2juO1IO9hZvv10WAtgt77UTk2Fc/6BK7pml+0Cnd0HMfDC+XKzfY+r/wEjyEa20IXTc//cPsP0BgevyMw=="
"version": "github:cartodb/node-cartodb-query-tables#7a4e48ce7e1cc7dd8e17b4faec095efa660e6bf1",
"from": "github:cartodb/node-cartodb-query-tables#skip-analysis-tables"
},
"cartodb-redis": {
"version": "2.1.0",
@ -2044,7 +2043,7 @@
"carto": "0.16.3",
"debug": "~3.1.0",
"generic-pool": "~2.2.0",
"millstone": "github:cartodb/millstone#f201885250d2d7ea6c870a1e1060ca6bcfdef186",
"millstone": "github:cartodb/millstone#v0.6.17-carto.2",
"postcss": "~5.2.8",
"postcss-scss": "0.4.0",
"postcss-strip-inline-comments": "0.1.5",
@ -3925,26 +3924,10 @@
"resolved": "https://registry.npmjs.org/torque.js/-/torque.js-3.1.1.tgz",
"integrity": "sha512-kfIrmI7TGqJT/J9DH8Mgvd9VEwcvAtnvyYyqymSN6WZ5L4BaVQEQ+zu5FgLChNAqCaRkqGc7bKp0Hj9A0rempA==",
"requires": {
"carto": "github:cartodb/carto#85881d99dd7fcf2c4e16478b04db67108d27a50c",
"carto": "github:cartodb/carto#master",
"d3": "3.5.17",
"turbo-carto": "^0.21.1",
"turf-jenks": "~1.0.1"
},
"dependencies": {
"carto": {
"version": "github:cartodb/carto#85881d99dd7fcf2c4e16478b04db67108d27a50c",
"from": "github:cartodb/carto#master",
"requires": {
"mapnik-reference": "~6.0.2",
"optimist": "~0.6.0",
"underscore": "1.8.3"
}
},
"underscore": {
"version": "1.8.3",
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz",
"integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI="
}
}
},
"tough-cookie": {
@ -4116,7 +4099,7 @@
"@carto/cartonik": "^0.6.0",
"@carto/mapnik": "3.6.2-carto.15",
"canvas": "^2.4.1",
"carto": "github:cartodb/carto#85881d99dd7fcf2c4e16478b04db67108d27a50c",
"carto": "github:cartodb/carto#0.15.1-cdb5",
"cartodb-psql": "0.13.1",
"debug": "3.1.0",
"grainstore": "^2.0.0",
@ -4126,6 +4109,24 @@
"semver": "5.5.0",
"torque.js": "3.1.1",
"underscore": "1.6.0"
},
"dependencies": {
"carto": {
"version": "github:cartodb/carto#85881d99dd7fcf2c4e16478b04db67108d27a50c",
"from": "github:cartodb/carto#0.15.1-cdb5",
"requires": {
"mapnik-reference": "~6.0.2",
"optimist": "~0.6.0",
"underscore": "1.8.3"
},
"dependencies": {
"underscore": {
"version": "1.8.3",
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz",
"integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI="
}
}
}
}
},
"wordwrap": {

@ -29,7 +29,7 @@
"body-parser": "1.18.3",
"camshaft": "^0.64.0",
"cartodb-psql": "0.13.1",
"cartodb-query-tables": "0.4.0",
"cartodb-query-tables": "github:cartodb/node-cartodb-query-tables#skip-analysis-tables",
"cartodb-redis": "2.1.0",
"debug": "3.1.0",
"dot": "1.1.2",

@ -16,15 +16,23 @@ const defaultLayers = [{
cartocss_version: '2.3.0'
}
}];
function createMapConfig (layers = defaultLayers) {
const defaultDatavies = {};
const defaultAnalyses = [];
function createMapConfig ({
layers = defaultLayers,
dataviews = defaultDatavies,
analyses = defaultAnalyses
} = {}) {
return {
version: '1.8.0',
layers: layers
layers: layers,
dataviews: dataviews || {},
analyses: analyses || []
};
}
describe('cache-control header', function () {
describe.only('cache-control header', function () {
describe('max-age directive', function () {
it('tile from a table which is included in cdb_tablemetada', function (done) {
const ttl = ONE_YEAR_IN_SECONDS;
@ -120,5 +128,46 @@ describe('cache-control header', function () {
testClient.drain(done);
});
});
it('tile from a cached analysis table which is not included in cdb_tablemetada', function (done) {
const ttl = ONE_YEAR_IN_SECONDS;
const mapConfig = createMapConfig({
layers: [{
type: 'cartodb',
options: {
source: {
id: 'HEAD'
},
cartocss: TestClient.CARTOCSS.POINTS,
cartocss_version: '2.3.0'
}
}],
analyses: [{
id: 'HEAD',
type: 'buffer',
params: {
source: {
id: 'source_1',
type: 'source',
params: {
query: 'select * from populated_places_simple_reduced'
}
},
radius: 60000
}
}]
});
const testClient = new TestClient(mapConfig, 1234);
testClient.getTile(0, 0, 0, {}, function (err, res, layergroup) {
if (err) {
return done(err);
}
assert.equal(res.headers['cache-control'], `public,max-age=${ttl}`);
testClient.drain(done);
});
});
});
});

Loading…
Cancel
Save