Skip to content

Improve process of running tests locally #261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
maxceem opened this issue Mar 13, 2019 · 5 comments
Closed

Improve process of running tests locally #261

maxceem opened this issue Mar 13, 2019 · 5 comments

Comments

@maxceem
Copy link
Contributor

maxceem commented Mar 13, 2019

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:

  1. 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.

  2. The better way would be to use one instance but create two DBs projectsdb and projectsdb_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?

@vikasrohit
Copy link

If we can do it without publishing the custom image to dockerhub, we should be good to go with this.

@maxceem
Copy link
Contributor Author

maxceem commented Mar 14, 2019

On the second thoughts I decided to go with the first way, as it looks like more comfortable in many ways:

  • we don't have to build a custom image during project setup - which takes time

  • we don't have to support this custom docker image in the future

  • the only one concern I had was regarding usage of system resources by the second PostgreSQL instance. But as per docker stats it is very low, so we will hardly have any issues with it:

    CONTAINER ID        NAME                 CPU %               MEM USAGE / LIMIT     MEM %               NET I/O             BLOCK I/O           PIDS
    c3190d3cc98f        local_db_test_1      0.00%               10.41MiB / 1.952GiB   0.52%               1.32MB / 917kB      1.22MB / 330MB      6
    08009e92d446        local_jsonserver_1   0.00%               35.15MiB / 1.952GiB   1.76%               1.05MB / 15.3kB     766kB / 16.4kB      19
    db57e758bfab        local_esearch_1      0.90%               230.3MiB / 1.952GiB   11.52%              11.8kB / 6.86kB     1.45MB / 434kB      66
    f3c909bee40c        local_db_1           0.00%               14.55MiB / 1.952GiB   0.73%               4.43kB / 3.32kB     4.1kB / 115MB       10
    275d84c7fd53        local_queue_1        0.33%               87.61MiB / 1.952GiB   4.38%               9.51kB / 7.51kB     9.45MB / 688kB      91
    

The PR #263 is raised.

@maxceem
Copy link
Contributor Author

maxceem commented Mar 15, 2019

This is already in DEV, so I'm closing it.

@maxceem maxceem closed this as completed Mar 15, 2019
@maxceem
Copy link
Contributor Author

maxceem commented Mar 15, 2019

Ups, it was in DEV only in my dreams. I've fixed tests in PR so it can be reviewed and merged now #265.

@maxceem maxceem reopened this Mar 15, 2019
@maxceem
Copy link
Contributor Author

maxceem commented May 29, 2019

FYI, has been merged to DEV and I guess to PROD and works well during local development. So this issue may be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants