Merge pull request #901 from tomhughes/connection
Use connection configuration consistently in tests
This commit is contained in:
commit
76ed97d649
@ -6,7 +6,11 @@ helper.pg.defaults.poolIdleTimeout = 1000;
|
|||||||
helper.pg.connect(helper.config, function(err,client) {
|
helper.pg.connect(helper.config, function(err,client) {
|
||||||
client.query("SELECT pg_backend_pid()", function(err, result) {
|
client.query("SELECT pg_backend_pid()", function(err, result) {
|
||||||
var pid = result.rows[0].pg_backend_pid;
|
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);
|
assert.isNull(error);
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
var helper = require('../test-helper');
|
var helper = require('../test-helper');
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
|
|
||||||
helper.pg.connect(function(err, client, done) {
|
helper.pg.connect(helper.config, function(err, client, done) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
|
|
||||||
var c = 'CREATE TEMP TABLE posts (body TEXT)';
|
var c = 'CREATE TEMP TABLE posts (body TEXT)';
|
||||||
|
@ -4,7 +4,7 @@ var copyFrom = require('pg-copy-streams').from;
|
|||||||
|
|
||||||
if(helper.args.native) return;
|
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;
|
if (err) throw err;
|
||||||
|
|
||||||
var c = 'CREATE TEMP TABLE employee (id integer, fname varchar(400), lname varchar(400))';
|
var c = 'CREATE TEMP TABLE employee (id integer, fname varchar(400), lname varchar(400))';
|
||||||
|
Loading…
Reference in New Issue
Block a user