1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

Run tests with database in docker #64

This commit is contained in:
Gard Rimestad 2014-12-09 16:36:27 +01:00 committed by Jari Bakken
parent c67b73b5b3
commit 9e949537f6
3 changed files with 16 additions and 0 deletions

View File

@ -49,6 +49,10 @@ http://localhost:4242/features
// Execute tests:
npm test
// Run tests with postgres running in docker:
npm run docker-test
```
### Making a schema change

View File

@ -21,6 +21,7 @@
"build": "./node_modules/.bin/webpack",
"dev": "NODE_ENV=development supervisor --ignore ./node_modules/,./public/js server.js",
"test": "export PORT=4243 ; jest && jshint server.js lib test && jsxhint public/js/**/*.jsx && mocha test test/*.js && npm run coverage",
"docker-test": "export PORT=4243 ; ./scripts/docker-postgres.sh",
"tdd": "mocha --watch test test/*",
"test-bamboo-ci": "mocha test test/*",
"coverage": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec",

11
scripts/docker-postgres.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
export POSTGRES_PASSWORD="uleash"
export DATABASE_URL=postgres://postgres:unleash@127.0.0.1:15432/postgres
HASH=`docker run -p 127.0.0.1:15432:5432 --name unleash-postgres -e POSTGRES_PASSWORD=$POSTGRES_PASSWORD -d postgres:9.3`
npm install
./node_modules/.bin/db-migrate up
npm test
docker stop $HASH
docker rm $HASH