continuous-integrationdocker-composefunctional-testingwebtestconcourse

Concourse CI - how to run functional tests?


we are in the middle of process migrating from Jenkins to Concourse CI and everything was pretty smooth so far. But now I have the issue, that I don't know how to solve. I would like to get any advices from the community.

What I am trying to do is a job that can run integrational or functional (web) tests using Selenium. There are few issues for us:

  1. To run web tests I need to set up the database (and optionally, the searching engine, proxy and etc...) proxy to imitate the production environment as close at possible. Ideally, it should be set up by docker-compose.
  2. This database service should run in parallel of my tests
  3. This database service should not return anything, neither error or success, because it only starts the database and nothing else
  4. My web-tests should not be started until the database is ready
  5. This database service should be stopped when all the web-tests were finished

As you can see, it's pretty non-trivial task. Of course, I can create an big uber-container that contains everything I need, but this is bad solution. Another option is to create a shell-script for that, but this is not flexible enough.

Is there any example how I could implement that or good practices for this issue?

Thanks!


Solution

  • Since version 1.3.0 it appears you can run Docker-compose in a task: https://github.com/concourse/concourse/issues/324

    This appears to work:

    jobs:
      - name: docker-compose
        public: true
        serial: true
        plan:
          - do:
            - task: docker-compose
              timeout: 20m
              privileged: true
              config:
                platform: linux
                image_resource:
                  type: docker-image
                  source: {repository: "mumoshu/dcind", tag: "latest"}
                run:
                  path: sh
                  args:
                    - -exc
                    - |
                      source /docker-lib.sh
                      start_docker
                      docker ps
                      docker-compose version