2021-01-29 00:20:46 +05:30
---
stage: none
group: unassigned
2021-02-22 17:27:13 +05:30
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
2021-01-29 00:20:46 +05:30
---
2018-03-17 18:26:18 +05:30
# GitLab tests in the Continuous Integration (CI) context
2019-09-30 21:07:59 +05:30
## Test suite parallelization on the CI
2018-03-17 18:26:18 +05:30
Our current CI parallelization setup is as follows:
2019-12-21 20:55:43 +05:30
1. The `retrieve-tests-metadata` job in the `prepare` stage ensures we have a
`knapsack/report-master.json` file:
2021-09-04 01:27:46 +05:30
- The `knapsack/report-master.json` file is fetched from the latest `main` pipeline which runs `update-tests-metadata`
2021-02-22 17:27:13 +05:30
(for now it's the 2-hourly scheduled master pipeline), if it's not here we initialize the file with `{}` .
2019-12-21 20:55:43 +05:30
1. Each `[rspec|rspec-ee] [unit|integration|system|geo] n m` job are run with
`knapsack rspec` and should have an evenly distributed share of tests:
- It works because the jobs have access to the `knapsack/report-master.json`
since the "artifacts from all previous stages are passed by default".
2018-11-20 20:47:30 +05:30
- the jobs set their own report path to
2019-12-21 20:55:43 +05:30
`"knapsack/${TEST_TOOL}_${TEST_LEVEL}_${DATABASE}_${CI_NODE_INDEX}_${CI_NODE_TOTAL}_report.json"` .
2018-11-20 20:47:30 +05:30
- if knapsack is doing its job, test files that are run should be listed under
`Report specs` , not under `Leftover specs` .
2019-12-21 20:55:43 +05:30
1. The `update-tests-metadata` job (which only runs on scheduled pipelines for
[the canonical project ](https://gitlab.com/gitlab-org/gitlab ) takes all the
`knapsack/rspec*_pg_*.json` files and merge them all together into a single
2021-02-22 17:27:13 +05:30
`knapsack/report-master.json` file that is saved as artifact.
2019-12-21 20:55:43 +05:30
2021-02-22 17:27:13 +05:30
After that, the next pipeline uses the up-to-date `knapsack/report-master.json` file.
2018-03-17 18:26:18 +05:30
2019-09-30 21:07:59 +05:30
## Monitoring
2018-03-17 18:26:18 +05:30
2021-09-04 01:27:46 +05:30
The GitLab test suite is [monitored ](../performance.md#rspec-profiling ) for the `main` branch, and any branch
2018-03-17 18:26:18 +05:30
that includes `rspec-profile` in their name.
## CI setup
- Rails logging to `log/test.log` is disabled by default in CI [for
2020-04-22 19:07:51 +05:30
performance reasons](https://jtway.co/speed-up-your-rails-test-suite-by-6-in-1-line-13fedb869ec4). To override this setting, provide the
2018-03-17 18:26:18 +05:30
`RAILS_ENABLE_TEST_LOG` environment variable.
---
[Return to Testing documentation ](index.md )