Skip to content

Commit

Permalink
Skip adding options twice and extend specs
Browse files Browse the repository at this point in the history
  • Loading branch information
Shayon Mukherjee committed Oct 24, 2020
1 parent 52f67d3 commit b16711f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 0 additions & 1 deletion packages/pg/lib/connection-parameters.js
Expand Up @@ -143,7 +143,6 @@ class ConnectionParameters {
add(params, this, 'application_name')
add(params, this, 'fallback_application_name')
add(params, this, 'connect_timeout')
add(params, this, 'options')

addOption(pgOptions, this, 'statement_timeout')
addOption(pgOptions, this, 'idle_in_transaction_session_timeout')
Expand Down
Expand Up @@ -157,6 +157,7 @@ test('libpq connection string building', function () {
port: 888,
host: 'localhost',
database: 'bam',
options: 'foobar',
}
var subject = new ConnectionParameters(config)
subject.getLibpqConnectionString(
Expand All @@ -168,6 +169,7 @@ test('libpq connection string building', function () {
checkForPart(parts, "port='888'")
checkForPart(parts, "hostaddr='127.0.0.1'")
checkForPart(parts, "dbname='bam'")
checkForPart(parts, "options='foobar'")
})
)
})
Expand All @@ -181,13 +183,14 @@ test('libpq connection string building', function () {
database: 'bam',
statement_timeout: 5000,
idle_in_transaction_session_timeout: 5000,
options: '-c geqo=off -c foobar=off',
}
var subject = new ConnectionParameters(config)
subject.getLibpqConnectionString(
assert.calls(function (err, constring) {
assert(!err)
var parts = constring.split(/ (?=([^\']*\'[^\']*\')*[^\']*$)/)
checkForPart(parts, "options='-c statement_timeout=5000 -c idle_in_transaction_session_timeout=5000'")
checkForPart(parts, "options='-c statement_timeout=5000 -c idle_in_transaction_session_timeout=5000 -c geqo=off -c foobar=off'")
})
)
})
Expand Down

0 comments on commit b16711f

Please sign in to comment.