Add Windshaft-cartodb version to the /version route

This commit is contained in:
Sandro Santilli
2012-10-08 17:26:12 +02:00
parent 20dca2e8f8
commit ab8cb5bbb3
2 changed files with 37 additions and 0 deletions

View File

@@ -26,6 +26,14 @@ var CartodbWindshaft = function(serverOptions) {
// boot
var ws = new Windshaft.Server(serverOptions);
// Override getVersion to include cartodb-specific versions
var wsversion = ws.getVersion;
ws.getVersion = function() {
var version = wsversion();
version.windshaft_cartodb = require('../../package.json').version;
return version;
}
/**
* Helper to allow access to the layer to be used in the maps infowindow popup.
*/

View File

@@ -33,6 +33,35 @@ suite('server', function() {
}, function() { done(); });
});
/////////////////////////////////////////////////////////////////////////////////
//
// GET VERSION
//
/////////////////////////////////////////////////////////////////////////////////
test("get call to server returns 200", function(done){
assert.response(server, {
url: '/version',
method: 'GET'
},{
status: 200
}, function(res) {
var parsed = JSON.parse(res.body);
assert.ok(parsed.hasOwnProperty('windshaft_cartodb'), "No 'windshaft_cartodb' version in " + parsed);
console.log("Windshaft-cartodb: " + parsed.windshaft_cartodb);
assert.ok(parsed.hasOwnProperty('windshaft'), "No 'windshaft' version in " + parsed);
console.log("Windshaft: " + parsed.windshaft);
assert.ok(parsed.hasOwnProperty('grainstore'), "No 'grainstore' version in " + parsed);
console.log("Grainstore: " + parsed.grainstore);
assert.ok(parsed.hasOwnProperty('node_mapnik'), "No 'node_mapnik' version in " + parsed);
console.log("Node-mapnik: " + parsed.node_mapnik);
assert.ok(parsed.hasOwnProperty('mapnik'), "No 'mapnik' version in " + parsed);
console.log("Mapnik: " + parsed.mapnik);
// TODO: check actual versions ?
done();
});
});
/////////////////////////////////////////////////////////////////////////////////
//
// GET STYLE