1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
|
include:
- local: .gitlab/ci/global.gitlab-ci.yml
- local: .gitlab/ci/rules.gitlab-ci.yml
.rules:dont-interrupt:
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
allow_failure: true
- if: $CI_MERGE_REQUEST_IID
when: manual
allow_failure: true
#######################
# rspec job base specs
.rails-job-base:
extends:
- .default-retry
- .default-before_script
- .ruby-cache
.base-script:
script:
- source ./scripts/rspec_helpers.sh
# Only install knapsack after bundle install! Otherwise oddly some native
# gems could not be found under some circumstance. No idea why, hours wasted.
- run_timed_command "gem install knapsack --no-document"
- section_start "gitaly-test-spawn" "Spawning Gitaly"; scripts/gitaly-test-spawn; section_end "gitaly-test-spawn" # Do not use 'bundle exec' here
- export RSPEC_SKIPPED_TESTS_REPORT_PATH="rspec/skipped_tests-${CI_JOB_ID}.txt"
- export RSPEC_RETRIED_TESTS_REPORT_PATH="rspec/retried_tests-${CI_JOB_ID}.txt"
- tooling/bin/create_job_metrics_file || true
.no-redis-cluster:
variables:
USE_REDIS_CLUSTER: "false"
.clusterwide-db:
variables:
CLUSTERWIDE_DB: "true"
.single-db:
variables:
DECOMPOSED_DB: "false"
.single-db-ci-connection:
extends: .single-db
variables:
CI_CONNECTION_DB: "true"
.single-db-rspec:
extends: .single-db
.single-db-ci-connection-rspec:
extends: .single-db-ci-connection
.praefect-with-db:
variables:
GITALY_PRAEFECT_WITH_DB: '1'
.rspec-base-needs:
needs:
- job: "clone-gitlab-repo"
optional: true # Optional so easier to switch in between
- job: "setup-test-env"
- job: "retrieve-tests-metadata"
.rspec-base:
extends:
- .rails-job-base
- .base-artifacts
- .repo-from-artifacts
stage: test
variables:
RUBY_GC_MALLOC_LIMIT: 67108864
RUBY_GC_MALLOC_LIMIT_MAX: 134217728
RECORD_DEPRECATIONS: "true"
GEO_SECONDARY_PROXY: 0
SUCCESSFULLY_RETRIED_TEST_EXIT_CODE: 137
EVENT_PROF: "sql.active_record"
needs:
- !reference [.rspec-base-needs, needs]
- job: "compile-test-assets"
- job: "detect-tests"
optional: true
script:
- !reference [.base-script, script]
# We need to exclude background migration because unit tests run with
# spec/lib, yet background migration tests are also sitting there,
# and they should run on their own jobs so we don't need to run them
# in unit tests again.
- rspec_parallelized_job "--fail-fast=${RSPEC_FAIL_FAST_THRESHOLD} --tag ~quarantine --tag ~level:background_migration --tag ~click_house --tag ~real_ai_request"
after_script:
- echo -e "\e[0Ksection_start:`date +%s`:report_results_section[collapsed=true]\r\e[0KReport results"
- bundle exec gem list gitlab_quality-test_tooling
- |
if [ "$CREATE_RAILS_TEST_FAILURE_ISSUES" == "true" ]; then
bundle exec relate-failure-issue \
--token "${TEST_FAILURES_PROJECT_TOKEN}" \
--project "gitlab-org/gitlab" \
--input-files "rspec/rspec-*.json" \
--exclude-labels-for-search "QA,rspec:slow test" \
--system-log-files "log" \
--related-issues-file "rspec/${CI_JOB_ID}-failed-test-issues.json";
fi
if [ "$CREATE_RAILS_SLOW_TEST_ISSUES" == "true" ]; then
bundle exec slow-test-issues \
--token "${TEST_FAILURES_PROJECT_TOKEN}" \
--project "gitlab-org/gitlab" \
--input-files "rspec/rspec-*.json" \
--related-issues-file "rspec/${CI_JOB_ID}-slow-test-issues.json";
fi
if [ "$ADD_SLOW_TEST_NOTE_TO_MERGE_REQUEST" == "true" ]; then
bundle exec slow-test-merge-request-report-note \
--token "${TEST_SLOW_NOTE_PROJECT_TOKEN}" \
--project "gitlab-org/gitlab" \
--input-files "rspec/rspec-*.json" \
--merge_request_iid "$CI_MERGE_REQUEST_IID";
fi
- echo -e "\e[0Ksection_end:`date +%s`:report_results_section\r\e[0K"
- tooling/bin/push_job_metrics || true
allow_failure:
exit_codes: !reference [.rspec-base, variables, SUCCESSFULLY_RETRIED_TEST_EXIT_CODE]
.base-artifacts:
artifacts:
expire_in: 31d
when: always
paths:
- auto_explain/
- coverage/
- crystalball/
- deprecations/
- knapsack/
- rspec/
- tmp/capybara/
- log/*.log
reports:
junit: "rspec/rspec-*.xml"
.rspec-base-migration:
script:
- !reference [.base-script, script]
- rspec_parallelized_job "--fail-fast=${RSPEC_FAIL_FAST_THRESHOLD} --tag ~quarantine --tag ~zoekt --tag ~click_house"
after_script:
- !reference [.rspec-base, after_script]
.rspec-base-pg13:
extends:
- .rspec-base
- .use-pg13
.rspec-base-pg14:
extends:
- .rspec-base
- .use-pg14
.rspec-base-pg14-clickhouse23:
extends:
- .rspec-base
- .use-pg14-clickhouse23
script:
- cp config/click_house.yml.example config/click_house.yml
- 'sed -i "s|url:.*$|url: http://clickhouse:8123|g" config/click_house.yml'
- !reference [.base-script, script]
- rspec_parallelized_job "--fail-fast=${RSPEC_FAIL_FAST_THRESHOLD} --tag click_house"
.rspec-base-pg14-as-if-foss:
extends:
- .rspec-base
- .as-if-foss
- .use-pg14
needs:
- !reference [.rspec-base-needs, needs]
- job: "compile-test-assets as-if-foss"
- job: "detect-tests"
optional: true
.rspec-base-pg15:
extends:
- .rspec-base
- .use-pg15
.rspec-ee-base-pg13:
extends:
- .rspec-base
- .use-pg13-es7-ee
.rspec-ee-base-pg13-es8:
extends:
- .rspec-base
- .use-pg13-es8-ee
- .rails:rules:run-search-tests
.rspec-ee-base-pg13-opensearch1:
extends:
- .rspec-base
- .use-pg13-opensearch1-ee
- .rails:rules:run-search-tests
.rspec-ee-base-pg13-opensearch2:
extends:
- .rspec-base
- .use-pg13-opensearch2-ee
- .rails:rules:run-search-tests
.rspec-ee-base-pg14:
extends:
- .rspec-base
- .use-pg14-es7-ee
.rspec-ee-base-pg14-es8:
extends:
- .rspec-base
- .use-pg14-es8-ee
- .rails:rules:run-search-tests
.rspec-ee-base-pg14-opensearch1:
extends:
- .rspec-base
- .use-pg14-opensearch1-ee
- .rails:rules:run-search-tests
.rspec-ee-base-pg14-opensearch2:
extends:
- .rspec-base
- .use-pg14-opensearch2-ee
- .rails:rules:run-search-tests
.rspec-ee-base-pg15:
extends:
- .rspec-base
- .use-pg15-es7-ee
.rspec-ee-base-pg15-es8:
extends:
- .rspec-base
- .use-pg15-es8-ee
- .rails:rules:run-search-tests
.rspec-ee-base-pg15-opensearch1:
extends:
- .rspec-base
- .use-pg15-opensearch1-ee
- .rails:rules:run-search-tests
.rspec-ee-base-pg15-opensearch2:
extends:
- .rspec-base
- .use-pg15-opensearch2-ee
- .rails:rules:run-search-tests
.db-job-base:
extends:
- .rails-job-base
- .rails:rules:ee-and-foss-migration
- .use-pg14
stage: test
needs: ["setup-test-env"]
# rspec job base specs
######################
############################
# rspec job parallel configs
# Adjusting these parallel job counts has an impact on the
# rspec:artifact-collector jobs in .gitlab/ci/rails.gitlab-ci.yml
# Please double-check and adjust accordingly
.rspec-migration-parallel:
parallel: 8
.rspec-background-migration-parallel:
parallel: 4
.rspec-ee-migration-parallel:
parallel: 2
.rspec-ee-background-migration-parallel:
parallel: 2
.rspec-unit-parallel:
parallel: 28
.rspec-ee-unit-parallel:
parallel: 18
.rspec-integration-parallel:
parallel: 12
.rspec-ee-integration-parallel:
parallel: 6
.rspec-system-parallel:
parallel: 28
.rspec-ee-system-parallel:
parallel: 10
# Optimizations to distribute CI time more evenly across the CI/CD pipeline
#
# See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/133976 for more info
# Giving 4 jobs to `rspec-ee unit pg14`
.rspec-unit-pg14-parallel:
parallel: 24
# Receiving 4 jobs from `rspec unit pg14`
.rspec-ee-unit-pg14-parallel:
parallel: 22
# Giving 2 jobs to `rspec-ee system pg14`
.rspec-system-parallel-pg14:
parallel: 26
# Receiving 2 jobs from `rspec system pg14`
.rspec-ee-system-parallel-pg14:
parallel: 12
# Adding 4 jobs, as those needs to be a bit faster.
.rspec-migration-parallel-pg14:
parallel: 12
# Adding 2 jobs, as those needs to be a bit faster.
.rspec-migration-parallel-pg14-as-if-foss:
parallel: 10
# Giving 1 job to `rspec integration pg14`
.rspec-ee-integration-parallel-pg14:
parallel: 5
# Receiving 1 job from `rspec-ee integration pg14`
.rspec-integration-parallel-pg14:
parallel: 13
# rspec job parallel configs
############################
|