Skip to content

Commit a000426

Browse files
committed
Attempt to fix flakey error test
1 parent e469053 commit a000426

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

test/integration/client/query-error-handling-tests.js

+11-9
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,18 @@ test('error during query execution', function() {
2222
query1.on('end', function() {
2323
assert.fail('Query with an error should not emit "end" event')
2424
})
25-
var client2 = new Client(helper.args);
26-
client2.connect(assert.success(function() {
27-
var killIdleQuery = "SELECT " + pidColName + ", (SELECT pg_terminate_backend(" + pidColName + ")) AS killed FROM pg_stat_activity WHERE " + queryColName + " = $1";
28-
client2.query(killIdleQuery, [sleepQuery], assert.calls(function(err, res) {
29-
assert.ifError(err);
30-
assert.equal(res.rows.length, 1);
31-
client2.end();
32-
assert.emits(client2, 'end');
25+
setTimeout(function() {
26+
var client2 = new Client(helper.args);
27+
client2.connect(assert.success(function() {
28+
var killIdleQuery = "SELECT " + pidColName + ", (SELECT pg_terminate_backend(" + pidColName + ")) AS killed FROM pg_stat_activity WHERE " + queryColName + " = $1";
29+
client2.query(killIdleQuery, [sleepQuery], assert.calls(function(err, res) {
30+
assert.ifError(err);
31+
assert.equal(res.rows.length, 1);
32+
client2.end();
33+
assert.emits(client2, 'end');
34+
}));
3335
}));
34-
}));
36+
}, 100)
3537
}));
3638
}));
3739
});

0 commit comments

Comments
 (0)