You could a database as a service for your tests to run against. You will just need to populate the service with data when you are running the tests.
services keyword defines just another Docker image that is run during your job and is linked to the Docker image that the
image keyword defines. This allows you to access the service image during build time.
The service image can run any application, but the most common use case is to run a database container, e.g.,
mysql . It’s easier and faster to use an existing image and run it as an additional container than install
mysql every time the project is built.
You are not limited to have only database services. You can add as many services you need to
.gitlab-ci.yml or manually modify
config.toml . Any image found at Docker Hub or your private Container Registry can be used as a service.
Services inherit the same DNS servers, search domains, and additional hosts as the CI container itself.
You can see some widely used services examples in the relevant documentation of CI services examples.
An example of using a Postgres service https://docs.gitlab.com/ee/ci/services/postgres.html