diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 161601ac..9f0b4043 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -14,7 +14,8 @@ } }, "pg": { - "version": "2.6.2", + "version": "2.6.2-cdb1", + "from": "git://github.com/CartoDB/node-postgres.git#2.6.2-cdb1", "dependencies": { "generic-pool": { "version": "2.0.3" diff --git a/package.json b/package.json index ef5e95dd..74aa3c52 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "dependencies": { "underscore" : "~1.3.3", "underscore.string": "~1.1.6", - "pg": "~2.6.2", + "pg": "git://github.com/CartoDB/node-postgres.git#2.6.2-cdb1", "express": "~2.5.11", "cartodb-redis": "~0.3.0", "step": "0.0.x", diff --git a/test/acceptance/backend_crash.js b/test/acceptance/backend_crash.js index ae75f882..022dd542 100644 --- a/test/acceptance/backend_crash.js +++ b/test/acceptance/backend_crash.js @@ -26,7 +26,7 @@ suiteSetup(function(done){ }); // See https://github.com/CartoDB/CartoDB-SQL-API/issues/135 -test.skip('does not hang server', function(done){ +test('does not hang server', function(done){ //console.log("settings:"); console.dir(global.settings); var db_host_backup = global.settings.db_host; var db_port_backup = global.settings.db_port; @@ -45,8 +45,31 @@ test.skip('does not hang server', function(done){ }); }, function checkResponse(err, res) { - assert.ok(err); - assert.ok(err.message.match(/hang up/), err); + if ( err ) throw err; + assert.equal(res.statusCode, 400, res.statusCode + ': ' + res.body); + var parsed = JSON.parse(res.body); + assert.ok(parsed.error); + var msg = parsed.error[0]; + assert.ok(msg.match(/unexpected.*end/), msg); + return null; + }, + function sendAnotherQuery() { + var next = this; + assert.response(app, { + url: '/api/v1/sql?q=SELECT+2', + method: 'GET', + headers: {host: 'vizzuality.localhost' } + },{}, function(res, err) { + next(err, res); + }); + }, + function checkResponse(err, res) { + if ( err ) throw err; + assert.equal(res.statusCode, 400, res.statusCode + ': ' + res.body); + var parsed = JSON.parse(res.body); + assert.ok(parsed.error); + var msg = parsed.error[0]; + assert.ok(msg.match(/connect/), msg); return null; }, function finish(err) {