Fix lack of response on backend crash
Closes #135 Enables previously failing test Required upgrade of node-postgresql to own fork
This commit is contained in:
parent
3b0d20aa96
commit
f88d33fdb9
3
npm-shrinkwrap.json
generated
3
npm-shrinkwrap.json
generated
@ -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"
|
||||
|
@ -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",
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user