diff --git a/README.md b/README.md index c9539b2..fb224b9 100644 --- a/README.md +++ b/README.md @@ -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` diff --git a/docker-compose-test.yml b/docker-compose-test.yml new file mode 100644 index 0000000..8a1aaef --- /dev/null +++ b/docker-compose-test.yml @@ -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