-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding ability to pass through idle_in_transaction_session_timeout
- Loading branch information
1 parent
69345eb
commit bb8e806
Showing
5 changed files
with
74 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
packages/pg/test/integration/client/idle_in_transaction_session_timeout-tests.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
'use strict' | ||
var helper = require('./test-helper') | ||
var Client = helper.Client | ||
|
||
var suite = new helper.Suite() | ||
|
||
var conInfo = helper.config | ||
|
||
function getConInfo (override) { | ||
return Object.assign({}, conInfo, override ) | ||
} | ||
|
||
function getIdleTransactionSessionTimeout (conf, cb) { | ||
var client = new Client(conf) | ||
client.connect(assert.success(function () { | ||
client.query('SHOW idle_in_transaction_session_timeout', assert.success(function (res) { | ||
var timeout = res.rows[0].idle_in_transaction_session_timeout | ||
cb(timeout) | ||
client.end() | ||
})) | ||
})) | ||
} | ||
|
||
if (!helper.args.native) { // idle_in_transaction_session_timeout is not supported with the native client | ||
suite.test('No default idle_in_transaction_session_timeout ', function (done) { | ||
getConInfo() | ||
getIdleTransactionSessionTimeout({}, function (res) { | ||
assert.strictEqual(res, '0') // 0 = no timeout | ||
done() | ||
}) | ||
}) | ||
|
||
suite.test('idle_in_transaction_session_timeout integer is used', function (done) { | ||
var conf = getConInfo({ | ||
'idle_in_transaction_session_timeout': 3000 | ||
}) | ||
getIdleTransactionSessionTimeout(conf, function (res) { | ||
assert.strictEqual(res, '3s') | ||
done() | ||
}) | ||
}) | ||
|
||
suite.test('idle_in_transaction_session_timeout float is used', function (done) { | ||
var conf = getConInfo({ | ||
'idle_in_transaction_session_timeout': 3000.7 | ||
}) | ||
getIdleTransactionSessionTimeout(conf, function (res) { | ||
assert.strictEqual(res, '3s') | ||
done() | ||
}) | ||
}) | ||
|
||
suite.test('idle_in_transaction_session_timeout string is used', function (done) { | ||
var conf = getConInfo({ | ||
'idle_in_transaction_session_timeout': '3000' | ||
}) | ||
getIdleTransactionSessionTimeout(conf, function (res) { | ||
assert.strictEqual(res, '3s') | ||
done() | ||
}) | ||
}) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters