Skip to content

Commit 64eb77e

Browse files
Joshbrianc
Josh
authored andcommitted
new test for actual statement timeout
1 parent 175b688 commit 64eb77e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/integration/client/statement_timeout-tests.js

+15
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,19 @@ if (!helper.args.native) { // statement_timeout is not supported with the native
5959
done()
6060
})
6161
})
62+
63+
suite.test('statement_timeout actually cancels long running queries', function (done) {
64+
var conf = getConInfo({
65+
'statement_timeout': '10' // 10ms to keep tests running fast
66+
})
67+
var client = new Client(conf)
68+
client.connect(assert.success(function () {
69+
client.query('SELECT pg_sleep( 1 )', function ( error ) {
70+
client.end()
71+
assert.strictEqual( error.code, '57014' ) // query_cancelled
72+
done()
73+
})
74+
}))
75+
})
76+
6277
}

0 commit comments

Comments
 (0)