DRY the tests
This commit is contained in:
14
README.md
14
README.md
@@ -69,7 +69,7 @@ In case you would like to play with out-of-the-box data.
|
||||
|
||||
Run api tests to populate tests dbs (see Tests section)
|
||||
```
|
||||
`docker-compose -f docker-compose-test.yml exec inventaire npm run test-api`
|
||||
docker-compose -f docker-compose.yml -f docker-compose.test.yml up exec inventaire npm run test-api
|
||||
```
|
||||
|
||||
- Replicate `*-tests` dbs documents into `*` dbs
|
||||
@@ -78,9 +78,13 @@ Run api tests to populate tests dbs (see Tests section)
|
||||
`docker-compose exec inventaire npm run replicate-tests-db`
|
||||
```
|
||||
|
||||
## Test environement
|
||||
## Tests
|
||||
|
||||
Start docker-compose-test `docker-compose -f docker-compose-test.yml up`
|
||||
Start services with test environnement with [multiple compose files](https://docs.docker.com/compose/extends/#understanding-multiple-compose-files)
|
||||
|
||||
```
|
||||
docker-compose -f docker-compose.yml -f docker-compose.test.yml up
|
||||
```
|
||||
|
||||
Execute tests script
|
||||
|
||||
@@ -88,8 +92,8 @@ Execute tests script
|
||||
|
||||
or execute directly the test command
|
||||
|
||||
`docker-compose exec inventaire ./node_modules/.bin/mocha --compilers coffee:coffee-script/register --timeout 20000`
|
||||
`docker-compose exec inventaire ./node_modules/.bin/mocha --compilers coffee:coffee-script/register --timeout 20000 /opt/inventaire/path/to/test/file`
|
||||
|
||||
Tip : create a symbolic link on your machine between the inventaire folder and docker working directory on your machine at `/opt/`, in order to autocomplete path to test file to execute
|
||||
|
||||
`sudo ln ~/path/to/inventaire-docker/inventaire /opt -s`
|
||||
`sudo ln ~/path/to/inventaire-docker/inventaire /opt -s`
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
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
|
||||
elasticsearch:
|
||||
image: elasticsearch:2.4
|
||||
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:
|
||||
build:
|
||||
context: ./.
|
||||
dockerfile: Dockerfile.entities-search-engine
|
||||
environment:
|
||||
NODE_ENV: "tests"
|
||||
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
|
||||
working_dir: /opt/entities-search-engine
|
||||
20
docker-compose.test.yml
Normal file
20
docker-compose.test.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
# Use with `docker-compose.yml`. Use the -f option
|
||||
# to specify the list of files. Compose merges files in the
|
||||
# order they’re specified on the command line.
|
||||
# See https://docs.docker.com/compose/extends
|
||||
version: '3'
|
||||
services:
|
||||
couch:
|
||||
volumes:
|
||||
# backup folder when container is removed
|
||||
- './data/couch-test:/usr/local/var/lib/couchdb'
|
||||
inventaire:
|
||||
environment:
|
||||
NODE_ENV: "tests"
|
||||
NODE_APP_INSTANCE: "tests-alt"
|
||||
volumes:
|
||||
- ./utils/config/inventaire-local.coffee:/opt/inventaire/config/local.coffee
|
||||
working_dir: /opt/inventaire
|
||||
entities-search-engine:
|
||||
environment:
|
||||
NODE_ENV: "tests"
|
||||
Reference in New Issue
Block a user