Skip to content
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

Integration tests for docker-compose #281

Open
toddself opened this issue Jun 17, 2019 · 11 comments · May be fixed by #292
Open

Integration tests for docker-compose #281

toddself opened this issue Jun 17, 2019 · 11 comments · May be fixed by #292
Labels
help wanted Extra attention is needed

Comments

@toddself
Copy link
Contributor

We need tests to ensure changes are able to generate packages and that running docker-compose doesn't fail on these changes.

If anyone is interested in working on this that would be great!

@toddself toddself added the help wanted Extra attention is needed label Jun 17, 2019
@nveenjain
Copy link

I would love to work on this issue, would you please just guide me to what should i do?
I'm thinking of writing a test in js which forks docker compose up, and checking it's exit code.
Will this be fine or should I do something else?
PS. I'm new to this project but want to contribute to this awesome initiative..

@zacanger
Copy link
Contributor

zacanger commented Jun 17, 2019

The rest of the tests are running in Docker in Circle, but since these would be testing that the docker-compose setup itself works (and everything running in Docker works together), you'll probably want to use a VM executor: https://circleci.com/docs/2.0/executor-types/

An initial test could probably be as simple as:

  • checkout
  • npm install in all the places
  • run docker-compose up -d
  • run something that verifies all the things are up and didn't crash (maybe hit some endpoints, make sure they work, and check the output of docker ps to make sure all the containers stayed up).

Related, once #204 is in, we should figure out if there's a good way to test that, too. Maybe microk8s + an extra Postgres pod?

@nveenjain
Copy link

After some digginig, I guess, I could use remote docker command for the same
https://circleci.com/docs/2.0/building-docker-images/
Thoughts? If building docker fails, test will fail..

@zacanger
Copy link
Contributor

Yep, those docs are a better example than the link I found, especially the last example. If building the containers fails CI should fail, but I think maybe that should be a separate step, since building containers to push to Docker Hub for production deployment is different than spinning up docker-compose and making sure everything can still talk to everything else.

@toddself
Copy link
Contributor Author

Yeah, we want two things really:

  1. Docker images should build without fail
  2. They should be able to be started with docker-compose and have a working running instance (ideally we'd curl against it to at least give it a litmus check that the server started)

@toddself
Copy link
Contributor Author

Also @nveenjain thank you for coming by and pitching in!

@zacanger
Copy link
Contributor

@toddself do you have Circle access? 1. Docker iamges should build without fail is what this script is for, and my thought was that it should be run on each merge to master and git tag. We'd need a Docker Hub service account credentials added in Circle for that to work.

@toddself
Copy link
Contributor Author

@zacanger I can give it a shot in the am!

@nveenjain
Copy link

nveenjain commented Jun 19, 2019

I'm thinking of creating a new build job

  build:
    docker:
      - image: circleci/node:latest
      - image: circleci/postgres:latest
    steps:
      - checkout
      - setup_remote_docker
      - run: npm install
      - run: 
          name: Docker compose up
          command: |
            set -ex
            docker-compose up -d

Should i send request to every app after we do docker-compose, also if I'm doing anything wrong, please tell, I'm not quite familiar with CircleCI...

@toddself
Copy link
Contributor Author

I don't think you need the postgres container in there -- the docker compose command should cause a postgres container to be spun up automatically.

@zacanger if it requires putting secret creds into circle-ci that could be a problem -- or we would only have to let that test run on master since even if you have creds in the "secure env variables" section, they still need to be decrypted when passed on the command line which can cause cred leakage :(

@zacanger
Copy link
Contributor

Good point. I opened a new issue #291 about this so I don't hijack this issue.

This was referenced Jun 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants