diff --git a/test/integration/connection/test-helper.js b/test/integration/connection/test-helper.js index 34baedd..42cb8d2 100644 --- a/test/integration/connection/test-helper.js +++ b/test/integration/connection/test-helper.js @@ -8,12 +8,24 @@ var authConnect = function(username, database, callback) { database = helper.args.database; } var connection = new Connection({stream: new net.Stream()}); + connection.on('error', function(error){ + console.log(error); + throw new Error("Connection error"); + }); connection.connect('5432','localhost'); connection.once('connect', function() { connection.startup({ user: username, database: database }); + connection.once('authenticationCleartextPassword', function(){ + connection.password(helper.args.password); + }); + connection.once('authenticationMD5Password', function(msg){ + var inner = Client.md5(helper.args.password+helper.args.user); + var outer = Client.md5(inner + msg.salt.toString('binary')); + connection.password("md5"+outer); + }); callback(connection); }); };