Use Docker image registry and Docker Compose to run cross-project integration tests within single project's pipeline
As a developer with an application composed of many microservices, I need to test a project by running integration tests involving other projects. e.g. a front-end react app depends on a back-end API, which itself depends on several back-end services. We should support running tests that involve all services. With Docker, it is possible to use Docker Compose to spin up a collection of services, each from their own GitLab project, with their own images in the GitLab Container Registry.
- We basically support this already, although we could document it better.
- Triggers and cross-project dependencies might help triggering tests when dependencies change.
- But there are things we can do to make it work well without doing any cross-project triggers. e.g. the front-end app would have a
docker-compose.ymlthat knows how to run all needed integration tests for the front-end; pulling in images for the other services as needed. Any change to the front-end would then do a full integration test with all services. Likewise, the API project would have it's own
docker-compose.ymlthat specified how to do integration tests whenever the API changed. The Docker Compose configurations would likely be very similar, but not necessarily the exact same. There should be some way to share configuration between projects (includes, submodules).
- One advantage of this is that integration test failures would be associated with the project that introduced the change rather than potentially being buried by a false success pipeline that triggers a different project to fail its pipeline.
- The above is easy when changes are isolated to a single project, but what if there are two or more projects that need their changes tested together? Can we use comments in merge requests like "Depends on foo/!1234 (merged)" to know how to test these?
Links / references
- Master issue: gitlab-ee#933 (closed)