diff --git a/test/instrumentation/modules/pg/_utils.js b/test/instrumentation/modules/pg/_utils.js index a675157599..1bef25531f 100644 --- a/test/instrumentation/modules/pg/_utils.js +++ b/test/instrumentation/modules/pg/_utils.js @@ -6,7 +6,10 @@ exports.reset = reset exports.loadData = loadData function reset (cb) { - var client = new Client({ database: 'postgres' }) + var client = new Client({ + database: 'postgres', + user: process.env.PGUSER || 'postgres' + }) client.connect(function (err) { if (err) throw err @@ -22,7 +25,10 @@ function reset (cb) { } function loadData (cb) { - var client = new Client({ database: 'test_elastic_apm' }) + var client = new Client({ + database: 'test_elastic_apm', + user: process.env.PGUSER || 'postgres' + }) client.connect(function (err) { if (err) throw err diff --git a/test/instrumentation/modules/pg/knex.js b/test/instrumentation/modules/pg/knex.js index cb6f702112..90ee1b7d33 100644 --- a/test/instrumentation/modules/pg/knex.js +++ b/test/instrumentation/modules/pg/knex.js @@ -134,7 +134,10 @@ function createClient (cb) { setup(function () { knex = Knex({ client: 'pg', - connection: 'postgres:///test_elastic_apm' + connection: { + database: 'test_elastic_apm', + user: process.env.PGUSER || 'postgres' + } }) cb() }) diff --git a/test/instrumentation/modules/pg/pg.js b/test/instrumentation/modules/pg/pg.js index c8132f9ceb..c59adbf7a5 100644 --- a/test/instrumentation/modules/pg/pg.js +++ b/test/instrumentation/modules/pg/pg.js @@ -497,7 +497,8 @@ function assertSpan (t, span, sql) { function createClient (cb) { setup(function () { queryable = new pg.Client({ - database: 'test_elastic_apm' + database: 'test_elastic_apm', + user: process.env.PGUSER || 'postgres' }) queryable.connect(function (err) { if (err) throw err @@ -513,11 +514,15 @@ function createPool (cb) { if (semver.satisfies(pgVersion, '<6.0.0')) { queryable = pg connector = function connector (cb) { - return pg.connect('postgres:///test_elastic_apm', cb) + return pg.connect({ + database: 'test_elastic_apm', + user: process.env.PGUSER || 'postgres' + }, cb) } } else { var pool = new pg.Pool({ - database: 'test_elastic_apm' + database: 'test_elastic_apm', + user: process.env.PGUSER || 'postgres' }) queryable = pool connector = function connector (cb) {