Use connection configuration consistently in tests

This commit is contained in:
Tom Hughes 2015-12-04 15:28:01 +00:00
parent 1cf2170301
commit 771111eb73
3 changed files with 7 additions and 3 deletions

View File

@ -6,7 +6,11 @@ helper.pg.defaults.poolIdleTimeout = 1000;
helper.pg.connect(helper.config, function(err,client) {
client.query("SELECT pg_backend_pid()", function(err, result) {
var pid = result.rows[0].pg_backend_pid;
exec('psql -c "select pg_terminate_backend('+pid+')" template1', assert.calls(function (error, stdout, stderr) {
var psql = 'psql';
if (helper.args.host) psql = psql+' -h '+helper.args.host;
if (helper.args.port) psql = psql+' -p '+helper.args.port;
if (helper.args.user) psql = psql+' -U '+helper.args.user;
exec(psql+' -c "select pg_terminate_backend('+pid+')" template1', assert.calls(function (error, stdout, stderr) {
assert.isNull(error);
}));
});

View File

@ -1,7 +1,7 @@
var helper = require('../test-helper');
var assert = require('assert');
helper.pg.connect(function(err, client, done) {
helper.pg.connect(helper.config, function(err, client, done) {
if (err) throw err;
var c = 'CREATE TEMP TABLE posts (body TEXT)';

View File

@ -4,7 +4,7 @@ var copyFrom = require('pg-copy-streams').from;
if(helper.args.native) return;
helper.pg.connect(function (err, client, done) {
helper.pg.connect(helper.config, function (err, client, done) {
if (err) throw err;
var c = 'CREATE TEMP TABLE employee (id integer, fname varchar(400), lname varchar(400))';