From 64eb77e94c09a6b3e53b86fa98a558b3c11f6f1b Mon Sep 17 00:00:00 2001 From: Josh Date: Thu, 31 Aug 2017 08:57:02 -0700 Subject: [PATCH] new test for actual statement timeout --- .../integration/client/statement_timeout-tests.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/integration/client/statement_timeout-tests.js b/test/integration/client/statement_timeout-tests.js index 5574285c6..393e82a19 100644 --- a/test/integration/client/statement_timeout-tests.js +++ b/test/integration/client/statement_timeout-tests.js @@ -59,4 +59,19 @@ if (!helper.args.native) { // statement_timeout is not supported with the native done() }) }) + + suite.test('statement_timeout actually cancels long running queries', function (done) { + var conf = getConInfo({ + 'statement_timeout': '10' // 10ms to keep tests running fast + }) + var client = new Client(conf) + client.connect(assert.success(function () { + client.query('SELECT pg_sleep( 1 )', function ( error ) { + client.end() + assert.strictEqual( error.code, '57014' ) // query_cancelled + done() + }) + })) + }) + }