From 406b8d8268d5e4f8a92049f0fca635e1ff4cfe9e Mon Sep 17 00:00:00 2001 From: ivaosthu Date: Mon, 7 Nov 2016 14:44:19 +0100 Subject: [PATCH] Allow tests to be executed in docker. Not everyone wants to install postgres locally just to run our tests. Added a small script which allows the developer to run test via docker instead: npm run test:docker closes #146 --- packages/unleash-api/package.json | 1 + packages/unleash-api/scripts/docker-postgres.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/unleash-api/package.json b/packages/unleash-api/package.json index eb6e0dbcad..99b823f840 100644 --- a/packages/unleash-api/package.json +++ b/packages/unleash-api/package.json @@ -40,6 +40,7 @@ "test": "export PORT=4243 ; mocha --recursive test && npm run test:coverage", "test:unit": "mocha test/unit/**/*.js ", "test:ci": "npm run db-migrate && npm run test", + "test:docker": "./scripts/docker-postgres.sh", "test:watch": "mocha --watch test test/*", "test:pg-virtualenv": "pg_virtualenv npm run test:pg-virtualenv-chai", "test:pg-virtualenv-chain": "export TEST_DATABASE_URL=postgres://$PGUSER:$PGPASSWORD@localhost:$PGPORT/postgres ; npm run db-migrate-testdb && npm test", diff --git a/packages/unleash-api/scripts/docker-postgres.sh b/packages/unleash-api/scripts/docker-postgres.sh index f89ae9b238..a9ddf21e14 100755 --- a/packages/unleash-api/scripts/docker-postgres.sh +++ b/packages/unleash-api/scripts/docker-postgres.sh @@ -22,7 +22,7 @@ do done -export TEST_DATABASE_URL=postgres://postgres:unleash@$database_host:$PGPORT/postgres +export TEST_DATABASE_URL=postgres://postgres:$POSTGRES_PASSWORD@$database_host:$PGPORT/postgres npm install DATABASE_URL=$TEST_DATABASE_URL ./node_modules/.bin/db-migrate up