From c5bf4e56cb99947c11197315eb5c86c6bed02083 Mon Sep 17 00:00:00 2001 From: Charmander <~@charmander.me> Date: Mon, 13 Jan 2020 08:57:52 -0800 Subject: [PATCH 1/4] Fix tests skipped because of missing suffixes Mocha will happen eventually! --- .../connection/{dynamic-password.js => dynamic-password-tests.js} | 0 .../unit/client/{set-keepalives.js => set-keepalives-tests.js} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename packages/pg/test/integration/connection/{dynamic-password.js => dynamic-password-tests.js} (100%) rename packages/pg/test/unit/client/{set-keepalives.js => set-keepalives-tests.js} (100%) diff --git a/packages/pg/test/integration/connection/dynamic-password.js b/packages/pg/test/integration/connection/dynamic-password-tests.js similarity index 100% rename from packages/pg/test/integration/connection/dynamic-password.js rename to packages/pg/test/integration/connection/dynamic-password-tests.js diff --git a/packages/pg/test/unit/client/set-keepalives.js b/packages/pg/test/unit/client/set-keepalives-tests.js similarity index 100% rename from packages/pg/test/unit/client/set-keepalives.js rename to packages/pg/test/unit/client/set-keepalives-tests.js From 10f2418eaf4f862f08175407712ab2a94ce9afac Mon Sep 17 00:00:00 2001 From: Charmander <~@charmander.me> Date: Mon, 13 Jan 2020 09:43:10 -0800 Subject: [PATCH 2/4] =?UTF-8?q?Skip=20password=20tests=20when=20they=20can?= =?UTF-8?q?=E2=80=99t=20work?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Will be made more visible when tests are ported to Mocha. --- .../pg/test/integration/connection/dynamic-password-tests.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/pg/test/integration/connection/dynamic-password-tests.js b/packages/pg/test/integration/connection/dynamic-password-tests.js index ebda433c1..20b509533 100644 --- a/packages/pg/test/integration/connection/dynamic-password-tests.js +++ b/packages/pg/test/integration/connection/dynamic-password-tests.js @@ -8,6 +8,11 @@ const Client = pg.Client; const password = process.env.PGPASSWORD || null const sleep = millis => new Promise(resolve => setTimeout(resolve, millis)) +if (!password) { + // skip these tests; no password will be requested + return +} + suite.testAsync('Get password from a sync function', () => { let wasCalled = false function getPassword() { From 225ed49fd9a60e8cdde3067aeda15c8c5c6d477b Mon Sep 17 00:00:00 2001 From: Charmander <~@charmander.me> Date: Mon, 13 Jan 2020 08:43:38 -0800 Subject: [PATCH 3/4] Add testing with a user with a password to CI Should reveal a bug in the password enumerability work, I think. --- .travis.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 03849285a..90917c9be 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ language: node_js dist: bionic -before_script: - - node packages/pg/script/create-test-tables.js pg://postgres@127.0.0.1:5432/postgres +before_script: | + node packages/pg/script/create-test-tables.js postgresql:/// env: - CC=clang CXX=clang++ npm_config_clang=1 PGUSER=postgres PGDATABASE=postgres @@ -17,6 +17,17 @@ addons: matrix: include: + - node_js: lts/erbium + env: + - CC=clang CXX=clang++ npm_config_clang=1 PGUSER=postgres PGDATABASE=postgres PGPASSWORD=test-password + before_script: | + sudo -u postgres sed -i \ + -e '/^local/ s/trust$/peer/' \ + -e '/^host/ s/trust$/md5/' \ + /etc/postgresql/10/main/pg_hba.conf + sudo -u postgres psql -c "ALTER ROLE postgres PASSWORD 'test-password'; SELECT pg_reload_conf()" + node packages/pg/script/create-test-tables.js postgresql:/// + - node_js: lts/carbon addons: postgresql: "9.5" From a7b1bb8473777569072a96cc5c44f8aa6238f2ec Mon Sep 17 00:00:00 2001 From: Charmander <~@charmander.me> Date: Mon, 13 Jan 2020 10:57:36 -0800 Subject: [PATCH 4/4] Explain new CI matrix entry for password authentication [ci skip] --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 90917c9be..61a7a79af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,7 @@ addons: matrix: include: + # Run tests/paths that require password authentication - node_js: lts/erbium env: - CC=clang CXX=clang++ npm_config_clang=1 PGUSER=postgres PGDATABASE=postgres PGPASSWORD=test-password