Merge branch 'master' into overviews-work

Conflicts:
	test/acceptance/multilayer.js
This commit is contained in:
Raul Ochoa 2016-01-28 19:48:11 +01:00
commit 81200b72b4
10 changed files with 70 additions and 53 deletions

21
NEWS.md
View File

@ -1,8 +1,25 @@
# Changelog
## 2.19.2
## 2.20.1
Released 2015-mm-dd
Released 2016-mm-dd
## 2.20.0
Released 2016-01-20
Bug fixes:
- Change redis pool name to report with a valid statsd key #363
Improvements:
- Query runner improvements #359
Unsupported:
- Widgets endpoints
- Layer filters
Note: API for unsupported list might change in the future, use at your own peril.
## 2.19.1

View File

@ -21,7 +21,7 @@ var util = require('util');
// @param opts TemplateMap options. Supported elements:
// 'max_user_templates' limit on the number of per-user
//
//
//
function TemplateMaps(redis_pool, opts) {
if (!(this instanceof TemplateMaps)) {
return new TemplateMaps();
@ -41,7 +41,7 @@ function TemplateMaps(redis_pool, opts) {
//
// Map templates are owned by a user that specifies access permissions
// for their instances.
//
//
// We have the following datastores:
//
// 1. User templates: set of per-user map templates
@ -197,7 +197,7 @@ function templateDefaults(template) {
// @param template layergroup template, see
// http://github.com/CartoDB/Windshaft-cartodb/wiki/Template-maps#template-format
//
// @param callback function(err, tpl_id)
// @param callback function(err, tpl_id)
// Return template identifier (only valid for given user)
//
o.addTemplate = function(owner, template, callback) {
@ -296,7 +296,7 @@ o.delTemplate = function(owner, tpl_id, callback) {
// http://github.com/CartoDB/Windshaft-cartodb/wiki/Template-maps#template-format
//
// @param callback function(err)
//
//
o.updTemplate = function(owner, tpl_id, template, callback) {
var self = this;
@ -355,7 +355,7 @@ o.updTemplate = function(owner, tpl_id, template, callback) {
//
// @param callback function(err, tpl_id_list)
// Returns a list of template identifiers
//
//
o.listTemplates = function(owner, callback) {
this._redisCmd('HKEYS', [ this.key_usr_tpl({owner:owner}) ], callback);
};
@ -422,7 +422,7 @@ o.isAuthorized = function(template, authTokens) {
// Only the ones found in the template's placeholders object
// will be used, with missing ones taking default values.
//
// @returns a layergroup configuration
// @returns a layergroup configuration
//
// @throws Error on malformed template or parameter
//
@ -431,7 +431,7 @@ var _reNumber = /^([-+]?[\d\.]?\d+([eE][+-]?\d+)?)$/,
_reCSSColorVal = /^#[0-9a-fA-F]{3,6}$/;
function _replaceVars (str, params) {
//return _.template(str, params); // lazy way, possibly dangerous
//return _.template(str, params); // lazy way, possibly dangerous
// Construct regular expressions for each param
Object.keys(params).forEach(function(k) {
str = str.replace(new RegExp("<%=\\s*" + k + "\\s*%>", "g"), params[k]);

26
npm-shrinkwrap.json generated
View File

@ -1,6 +1,6 @@
{
"name": "windshaft-cartodb",
"version": "2.19.2",
"version": "2.20.0",
"dependencies": {
"body-parser": {
"version": "1.14.2",
@ -8,7 +8,7 @@
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.14.2.tgz",
"dependencies": {
"bytes": {
"version": "2.2.0",
"version": "2.2.1",
"from": "bytes@2.2.0",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-2.2.0.tgz"
},
@ -192,7 +192,7 @@
"dependencies": {
"mime-types": {
"version": "2.1.9",
"from": "mime-types@~2.1.6",
"from": "mime-types@~2.1.8",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.9.tgz",
"dependencies": {
"mime-db": {
@ -365,9 +365,9 @@
}
},
"serve-static": {
"version": "1.10.1",
"version": "1.10.2",
"from": "serve-static@~1.10.0",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.10.1.tgz",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.10.2.tgz",
"dependencies": {
"escape-html": {
"version": "1.0.3",
@ -432,7 +432,7 @@
},
"mime-types": {
"version": "2.1.9",
"from": "mime-types@~2.1.6",
"from": "mime-types@~2.1.8",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.9.tgz",
"dependencies": {
"mime-db": {
@ -568,13 +568,13 @@
"resolved": "https://registry.npmjs.org/request/-/request-2.62.0.tgz",
"dependencies": {
"bl": {
"version": "1.0.0",
"version": "1.0.1",
"from": "bl@~1.0.0",
"resolved": "https://registry.npmjs.org/bl/-/bl-1.0.0.tgz",
"resolved": "https://registry.npmjs.org/bl/-/bl-1.0.1.tgz",
"dependencies": {
"readable-stream": {
"version": "2.0.5",
"from": "readable-stream@~2.0.0",
"from": "readable-stream@~2.0.5",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.5.tgz",
"dependencies": {
"core-util-is": {
@ -645,7 +645,7 @@
},
"mime-types": {
"version": "2.1.9",
"from": "mime-types@~2.1.8",
"from": "mime-types@~2.1.2",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.9.tgz",
"dependencies": {
"mime-db": {
@ -878,9 +878,9 @@
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz"
},
"windshaft": {
"version": "1.6.2",
"from": "https://github.com/CartoDB/Windshaft/tarball/master",
"resolved": "https://github.com/CartoDB/Windshaft/tarball/master",
"version": "1.7.0",
"from": "windshaft@1.7.0",
"resolved": "https://registry.npmjs.org/windshaft/-/windshaft-1.7.0.tgz",
"dependencies": {
"mapnik": {
"version": "1.4.15-cdb6",

View File

@ -1,7 +1,7 @@
{
"private": true,
"name": "windshaft-cartodb",
"version": "2.19.2",
"version": "2.20.1",
"description": "A map tile server for CartoDB",
"keywords": [
"cartodb"
@ -29,7 +29,7 @@
"node-statsd": "~0.0.7",
"underscore" : "~1.6.0",
"dot": "~1.0.2",
"windshaft": "https://github.com/CartoDB/Windshaft/tarball/master",
"windshaft": "1.7.0",
"step": "~0.0.6",
"queue-async": "~1.0.7",
"request": "~2.62.0",

View File

@ -111,6 +111,6 @@ describe('health checks', function () {
done();
});
});
});
});

View File

@ -418,7 +418,7 @@ describe('torque', function() {
assert.response(server, {
url: '/database/windshaft_test/layergroup',
method: 'POST',
headers: {'Content-Type': 'application/json' },
headers: {'Content-Type': 'application/json' },
data: JSON.stringify(layergroup)
}, {}, function(res) { next(null, res); });
},

View File

@ -65,7 +65,7 @@ describe('template_api', function() {
{ options: {
sql: 'select cartodb_id, ST_Translate(the_geom_webmercator, -5e6, 0) as the_geom_webmercator' +
' from test_table limit 2 offset 2',
cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }',
cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }',
cartocss_version: '2.0.2',
interactivity: 'cartodb_id'
} }
@ -326,8 +326,8 @@ describe('template_api', function() {
headers: {host: 'localhost', 'Content-Type': 'application/json' },
data: JSON.stringify(tmpl)
};
assert.response(server, post_request, {}, function(res) {
next(null, res);
assert.response(server, post_request, {}, function(res) {
next(null, res);
});
},
function testCORS() {
@ -338,12 +338,12 @@ describe('template_api', function() {
headers: {host: 'localhost', 'Content-Type': 'application/json' }
},{
status: 200
}, function(res) {
}, function(res) {
var parsed = JSON.parse(res.body);
keysToDelete['map_cfg|' + LayergroupToken.parse(parsed.layergroupid).token] = 0;
keysToDelete['user:localhost:mapviews:global'] = 5;
assert.ok(_.isEqual(parsed.cdn_url, global.environment.serverMetadata.cdn_url));
next(null);
next(null);
});
},
function deleteTemplate(err) {
@ -720,7 +720,7 @@ describe('template_api', function() {
layers: [
{ options: {
sql: "select * from test_table_private_1 LIMIT 0",
cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }',
cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }',
cartocss_version: '2.0.2',
interactivity: 'cartodb_id'
} }
@ -848,7 +848,7 @@ describe('template_api', function() {
},
function checkTile(err, res) {
assert.ifError(err);
assert.equal(res.statusCode, 200,
assert.equal(res.statusCode, 200,
'Unexpected error for authorized instance: ' + res.statusCode + ' -- ' + res.body);
assert.equal(res.headers['content-type'], "image/png");
return null;
@ -869,7 +869,7 @@ describe('template_api', function() {
},
function checkForeignSignerError(err, res) {
assert.ifError(err);
assert.equal(res.statusCode, 403,
assert.equal(res.statusCode, 403,
'Unexpected error for authorized instance: ' + res.statusCode + ' -- ' + res.body);
var parsed = JSON.parse(res.body);
assert.ok(parsed.hasOwnProperty('errors'),
@ -1036,7 +1036,7 @@ describe('template_api', function() {
},
function checkTile_fetchOnRestart(err, res) {
assert.ifError(err);
assert.equal(res.statusCode, 200,
assert.equal(res.statusCode, 200,
'Unexpected error for authorized instance: ' + res.statusCode + ' -- ' + res.body);
assert.equal(res.headers['content-type'], "application/json; charset=utf-8");
var cc = res.headers['x-cache-channel'];
@ -1056,7 +1056,7 @@ describe('template_api', function() {
},
function checkCacheChannel(err, res) {
assert.ifError(err);
assert.equal(res.statusCode, 200,
assert.equal(res.statusCode, 200,
'Unexpected error for authorized instance: ' + res.statusCode + ' -- ' + res.body);
assert.equal(res.headers['content-type'], "application/json; charset=utf-8");
var cc = res.headers['x-cache-channel'];
@ -1112,7 +1112,7 @@ describe('template_api', function() {
layers: [
{ options: {
sql: "select * from test_table_private_1 where cartodb_id in ( 5,6 )",
cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }',
cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }',
cartocss_version: '2.0.2',
attributes: { id:'cartodb_id', columns: ['name', 'address'] }
} }
@ -1224,7 +1224,7 @@ describe('template_api', function() {
},
function checkAttribute(err, res) {
assert.ifError(err);
assert.equal(res.statusCode, 200,
assert.equal(res.statusCode, 200,
'Unexpected error for authorized getAttributes: ' + res.statusCode + ' -- ' + res.body);
assert.equal(res.headers['content-type'], "application/json; charset=utf-8");
return null;
@ -1277,7 +1277,7 @@ describe('template_api', function() {
layers: [
{ options: {
sql: "select * from test_table_private_1 LIMIT 0",
cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }',
cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }',
cartocss_version: '2.0.2',
interactivity: 'cartodb_id'
} }
@ -1347,7 +1347,7 @@ describe('template_api', function() {
layers: [
{ options: {
sql: "select * from test_table_private_1 LIMIT 0",
cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }',
cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }',
cartocss_version: '2.0.2',
interactivity: 'cartodb_id'
} }
@ -1430,7 +1430,7 @@ describe('template_api', function() {
layers: [
{ options: {
sql: "select * from test_table_private_1 LIMIT 0",
cartocss: '#layer { marker-fill: <%= color %>; marker-allow-overlap:true; }',
cartocss: '#layer { marker-fill: <%= color %>; marker-allow-overlap:true; }',
cartocss_version: '2.0.2',
interactivity: 'cartodb_id'
} }
@ -1503,8 +1503,8 @@ describe('template_api', function() {
{ options: {
sql: 'select 1 as cartodb_id, !pixel_height! as h,' +
' ST_Buffer(!bbox!, -32*greatest(!pixel_width!,!pixel_height!)) as the_geom_webmercator',
cartocss: '#layer { polygon-fill:red; }',
cartocss_version: '2.0.1'
cartocss: '#layer { polygon-fill:red; }',
cartocss_version: '2.0.1'
} }
]
};
@ -1516,7 +1516,7 @@ describe('template_api', function() {
};
var statskey = "user:localhost:mapviews";
var redis_stats_client = redis.createClient(global.environment.redis.port);
var template_id; // will be set on template post
var template_id; // will be set on template post
var now = strftime("%Y%m%d", new Date());
var errors = [];
step(
@ -1621,7 +1621,7 @@ describe('template_api', function() {
layers: [
{ options: {
sql: "select * from test_table_private_1 LIMIT 0",
cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }',
cartocss: '#layer { marker-fill:blue; marker-allow-overlap:true; }',
cartocss_version: '2.0.2',
interactivity: 'cartodb_id'
} }

View File

@ -7,8 +7,8 @@ module.exports = function(opts) {
var config = {
redis_pool: {
max: 10,
idleTimeoutMillis: 1,
max: 10,
idleTimeoutMillis: 1,
reapIntervalMillis: 1,
port: global.environment.redis.port
}

View File

@ -72,10 +72,10 @@ if test x"$PREPARE_PGSQL" = xyes; then
createdb -Ttemplate_postgis -EUTF8 "${TEST_DB}" || die "Could not create test database"
cat sql/windshaft.test.sql sql/gadm4.sql |
sed "s/:PUBLICUSER/${PUBLICUSER}/" |
sed "s/:PUBLICPASS/${PUBLICPASS}/" |
sed "s/:TESTUSER/${TESTUSER}/" |
sed "s/:TESTPASS/${TESTPASS}/" |
sed "s/:PUBLICUSER/${PUBLICUSER}/" |
sed "s/:PUBLICPASS/${PUBLICPASS}/" |
sed "s/:TESTUSER/${TESTUSER}/" |
sed "s/:TESTPASS/${TESTPASS}/" |
psql -v ON_ERROR_STOP=1 ${TEST_DB} || exit 1
psql -c "CREATE LANGUAGE plpythonu;" ${TEST_DB}
@ -98,7 +98,7 @@ HMSET rails:users:localhost id ${TESTUSERID} \
SADD rails:users:localhost:map_key 1235
EOF
# A user configured as with cartodb-2.5.0+
# A user configured as with cartodb-2.5.0+
cat <<EOF | redis-cli -p ${REDIS_PORT} -n 5
HMSET rails:users:cartodb250user id ${TESTUSERID} \
database_name "${TEST_DB}" \

View File

@ -30,7 +30,7 @@ describe('req2params', function() {
baseController = new BaseController(authApi, pgConnection);
});
it('can be found in server_options', function(){
assert.ok(_.isFunction(baseController.req2params));
});