diff --git a/lib/cartodb/cartodb_windshaft.js b/lib/cartodb/cartodb_windshaft.js index 86854861..ded52079 100644 --- a/lib/cartodb/cartodb_windshaft.js +++ b/lib/cartodb/cartodb_windshaft.js @@ -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. */ diff --git a/test/acceptance/server.js b/test/acceptance/server.js index dcf590ff..a81662ce 100644 --- a/test/acceptance/server.js +++ b/test/acceptance/server.js @@ -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