add alternate docker-compose file to run tests

This commit is contained in:
Vincent Jumo
2018-09-12 13:48:44 +02:00
parent 876cbbc343
commit aa614b5821
2 changed files with 63 additions and 4 deletions

View File

@@ -63,14 +63,25 @@ for more [info](https://github.com/inventaire/entities-search-engine/blob/master
In case you would like to play with out-of-the-box data.
Run api tests to populate tests dbs:
Run api tests to populate tests dbs (see Tests section)
```
docker-compose exec inventaire npm run test-api
`docker-compose -f docker-compose-test.yml exec inventaire npm run test-api`
```
- Replicate `*-tests` dbs documents into `*` dbs
```
docker-compose exec inventaire npm run replicate-tests-db
`docker-compose exec inventaire npm run replicate-tests-db`
```
## Test environement
Start docker-compose-test `docker-compose -f docker-compose-test.yml up`
Execute tests script
`docker-compose exec inventaire npm run test-api`
or execute directly the test command
`docker-compose exec inventaire ./node_modules/.bin/mocha --compilers coffee:coffee-script/register --timeout 20000`

48
docker-compose-test.yml Normal file
View File

@@ -0,0 +1,48 @@
version: '3'
services:
couch:
image: couchdb:1.7.1
ports:
- "5984:5984"
environment:
COUCHDB_USER: "couchdb"
COUCHDB_PASSWORD: "password"
volumes:
# backup folder when container is removed
- './data/couch-test:/usr/local/var/lib/couchdb'
inventaire:
build:
context: ./.
dockerfile: Dockerfile.inventaire
environment:
NODE_ENV: "tests"
NODE_APP_INSTANCE: "tests-alt"
ports:
- "3006:3006"
volumes:
- ./inventaire:/opt/inventaire
- ./utils/config/inventaire-local.coffee:/opt/inventaire/config/local.coffee
working_dir: /opt/inventaire
depends_on:
- couch
- entities-search-engine
elasticsearch:
image: elasticsearch
environment:
- 'http.host=0.0.0.0'
- 'transport.host=127.0.0.1'
ports :
- '127.0.0.1:9200:9200'
volumes:
- './data/es:/usr/share/elasticsearch/data'
entities-search-engine:
image: node:8
command: 'node_modules/coffee-script/bin/coffee server/server.coffee'
ports:
- "3213:3213"
volumes:
- ./entities-search-engine:/opt/entities-search-engine
- ./utils/config/entities-search-engine-local.coffee:/opt/entities-search-engine/config/local.coffee
links:
- couch
working_dir: /opt/entities-search-engine