- Notifications
You must be signed in to change notification settings - Fork 182
Fix bug where settings for pg-pool were dropped #186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits Select commit Hold shift + click to select a range
87ec3fa
Update README with correct doc links, etc
Amir-61 6ff2537
Fix bug where settings for pg-pool were dropped
2ffb867
Added test. Ran run-tests.
gregdingle 7058807
remove done() calls in test
gregdingle f7a9954
Fix linting errors and unnesssary changes.
dhmlau f6d8821
Fix unit tests
ssh24 fbe3edf
merge in #216
gregdingle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,54 @@ | ||
// Copyright IBM Corp. 2015. All Rights Reserved. | ||
// Node module: loopback-connector-postgresql | ||
// This file is licensed under the Artistic License 2.0. | ||
// License text available at https://opensource.org/licenses/Artistic-2.0 | ||
| ||
'use strict'; | ||
require('./init'); | ||
| ||
var connector = require('..'); | ||
var DataSource = require('loopback-datasource-juggler').DataSource; | ||
var should = require('should'); | ||
| ||
// simple wrapper that uses JSON.parse(JSON.stringify()) as cheap clone | ||
function newConfig(withURL) { | ||
return JSON.parse(JSON.stringify(getDBConfig(withURL))); | ||
} | ||
| ||
describe('initialization', function() { | ||
it('honours user-defined pg-pool settings', function() { | ||
var dataSource = new DataSource(connector, newConfig()); | ||
var pool = dataSource.connector.pg.pool; | ||
pool._factory.max.should.not.equal(999); | ||
| ||
var settings = newConfig(); | ||
settings.max = 999; // non-default value | ||
var dataSource = new DataSource(connector, settings); | ||
var pool = dataSource.connector.pg.pool; | ||
pool._factory.max.should.equal(999); | ||
}); | ||
| ||
it('honours user-defined url settings', function() { | ||
var settings = newConfig(); | ||
| ||
var dataSource = new DataSource(connector, settings); | ||
var clientConfig = dataSource.connector.clientConfig; | ||
should.not.exist(clientConfig.connectionString); | ||
| ||
settings = newConfig(true); | ||
var dataSource = new DataSource(connector, settings); | ||
var clientConfig = dataSource.connector.clientConfig; | ||
clientConfig.connectionString.should.equal(settings.url); | ||
}); | ||
| ||
it('honours multiple user-defined settings', function() { | ||
var urlOnly = {url: newConfig(true).url, max: 999}; | ||
| ||
var dataSource = new DataSource(connector, urlOnly); | ||
var pool = dataSource.connector.pg.pool; | ||
pool._factory.max.should.equal(999); | ||
| ||
var clientConfig = dataSource.connector.clientConfig; | ||
clientConfig.connectionString.should.equal(urlOnly.url); | ||
}); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we delete this comment too? I assume pg pool is handling it correctly now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 76? That is still accurate. Pg-pool expects a different key name than the pg module.