Description
So far to run tests locally during development process we should rebuild and restart the Docker which makes it hard to run tests during development. And if after we want to continue developing we have to it again to switch back to the main DB, and we will also lose any data in our DB. This makes running test during development very time-consuming.
// stop already executing containers if any
docker-compose stop -t 1
// clear the containers
docker-compose rm -f
// re-run the services with build flag
docker-compose up --build
I'm thinking to ask the community to fix this and let us run tests without the necessity of rebuilding the Docker containers by simply running npm run test
.
I see two ways to accomplish it:
-
The simple way would be to add one more instance of postgres in docker-compose but we will have two instances running which is not that good.
-
The better way would be to use one instance but create two DBs
projectsdb
andprojectsdb_test
. Unfortunately, standard postgres image doesn't support creating several DBs so probably we will have to create a custom image with such support for example, as mentioned in this issue.
@vikasrohit what do you think?