Commit 8f2a6637 authored by Thong Kuah's avatar Thong Kuah

Merge branch '353647-make-gitlab-ci-run-decomposed-only-or-decomposed-by-default' into 'master'

ci: Default to run tests with multiple databases

See merge request gitlab-org/gitlab!82090
parents 91fa22f9 d7545f2a
...@@ -91,6 +91,8 @@ variables: ...@@ -91,6 +91,8 @@ variables:
CHECK_PRECOMPILED_ASSETS: "true" CHECK_PRECOMPILED_ASSETS: "true"
FF_USE_FASTZIP: "true" FF_USE_FASTZIP: "true"
SKIP_FLAKY_TESTS_AUTOMATICALLY: "true" SKIP_FLAKY_TESTS_AUTOMATICALLY: "true"
# Run with decomposed databases by default
DECOMPOSED_DB: "true"
DOCS_REVIEW_APPS_DOMAIN: "178.62.207.141.nip.io" DOCS_REVIEW_APPS_DOMAIN: "178.62.207.141.nip.io"
DOCS_GITLAB_REPO_SUFFIX: "ee" DOCS_GITLAB_REPO_SUFFIX: "ee"
......
...@@ -18,12 +18,14 @@ ...@@ -18,12 +18,14 @@
variables: variables:
RSPEC_TESTS_MAPPING_ENABLED: "true" RSPEC_TESTS_MAPPING_ENABLED: "true"
.decomposed-database: .single-db:
variables: variables:
DECOMPOSED_DB: "true" DECOMPOSED_DB: "false"
.decomposed-database-rspec: .single-db-rspec:
extends: .decomposed-database extends: .single-db
variables:
GITLAB_USE_MODEL_LOAD_BALANCING: "false"
.rspec-base: .rspec-base:
extends: extends:
...@@ -274,11 +276,11 @@ rspec migration pg12 minimal: ...@@ -274,11 +276,11 @@ rspec migration pg12 minimal:
- .minimal-rspec-tests - .minimal-rspec-tests
- .rails:rules:ee-and-foss-migration:minimal - .rails:rules:ee-and-foss-migration:minimal
rspec migration pg12 decomposed: rspec migration pg12 single-db:
extends: extends:
- rspec migration pg12 - rspec migration pg12
- .decomposed-database-rspec - .single-db-rspec
- .rails:rules:decomposed-databases - .rails:rules:single-db
rspec unit pg12: rspec unit pg12:
extends: extends:
...@@ -292,11 +294,11 @@ rspec unit pg12 minimal: ...@@ -292,11 +294,11 @@ rspec unit pg12 minimal:
- .minimal-rspec-tests - .minimal-rspec-tests
- .rails:rules:ee-and-foss-unit:minimal - .rails:rules:ee-and-foss-unit:minimal
rspec unit pg12 decomposed: rspec unit pg12 single-db:
extends: extends:
- rspec unit pg12 - rspec unit pg12
- .decomposed-database-rspec - .single-db-rspec
- .rails:rules:decomposed-databases - .rails:rules:single-db
rspec integration pg12: rspec integration pg12:
extends: extends:
...@@ -310,11 +312,11 @@ rspec integration pg12 minimal: ...@@ -310,11 +312,11 @@ rspec integration pg12 minimal:
- .minimal-rspec-tests - .minimal-rspec-tests
- .rails:rules:ee-and-foss-integration:minimal - .rails:rules:ee-and-foss-integration:minimal
rspec integration pg12 decomposed: rspec integration pg12 single-db:
extends: extends:
- rspec integration pg12 - rspec integration pg12
- .decomposed-database-rspec - .single-db-rspec
- .rails:rules:decomposed-databases - .rails:rules:single-db
rspec system pg12: rspec system pg12:
extends: extends:
...@@ -330,11 +332,11 @@ rspec system pg12 minimal: ...@@ -330,11 +332,11 @@ rspec system pg12 minimal:
- .minimal-rspec-tests - .minimal-rspec-tests
- .rails:rules:ee-and-foss-system:minimal - .rails:rules:ee-and-foss-system:minimal
rspec system pg12 decomposed: rspec system pg12 single-db:
extends: extends:
- rspec system pg12 - rspec system pg12
- .decomposed-database-rspec - .single-db-rspec
- .rails:rules:decomposed-databases - .rails:rules:single-db
# Dedicated job to test DB library code against PG11. # Dedicated job to test DB library code against PG11.
# Note that these are already tested against PG12 in the `rspec unit pg12` / `rspec-ee unit pg12` jobs. # Note that these are already tested against PG12 in the `rspec unit pg12` / `rspec-ee unit pg12` jobs.
...@@ -361,22 +363,25 @@ db:rollback: ...@@ -361,22 +363,25 @@ db:rollback:
- scripts/db_tasks db:migrate VERSION=20210301200959 - scripts/db_tasks db:migrate VERSION=20210301200959
- scripts/db_tasks db:migrate SKIP_SCHEMA_VERSION_CHECK=true - scripts/db_tasks db:migrate SKIP_SCHEMA_VERSION_CHECK=true
db:rollback decomposed: db:rollback single-db:
extends: extends:
- db:rollback - db:rollback
- .decomposed-database - .single-db
- .rails:rules:decomposed-databases - .rails:rules:single-db
db:migrate:reset: db:migrate:reset:
extends: .db-job-base extends: .db-job-base
script: script:
- bundle exec rake db:migrate:reset - bundle exec rake db:migrate:reset
variables:
# FIXME: make this job work with `GITLAB_USE_MODEL_LOAD_BALANCING: true`, see https://gitlab.com/gitlab-org/gitlab/-/issues/355573
GITLAB_USE_MODEL_LOAD_BALANCING: "false"
db:migrate:reset decomposed: db:migrate:reset single-db:
extends: extends:
- db:migrate:reset - db:migrate:reset
- .decomposed-database - .single-db
- .rails:rules:decomposed-databases - .rails:rules:single-db
db:migrate-from-previous-major-version: db:migrate-from-previous-major-version:
extends: .db-job-base extends: .db-job-base
...@@ -385,6 +390,7 @@ db:migrate-from-previous-major-version: ...@@ -385,6 +390,7 @@ db:migrate-from-previous-major-version:
SETUP_DB: "false" SETUP_DB: "false"
PROJECT_TO_CHECKOUT: "gitlab-foss" PROJECT_TO_CHECKOUT: "gitlab-foss"
TAG_TO_CHECKOUT: "v13.12.9" TAG_TO_CHECKOUT: "v13.12.9"
# FIXME: make this job work with `GITLAB_USE_MODEL_LOAD_BALANCING: true`, see https://gitlab.com/gitlab-org/gitlab/-/issues/355573
GITLAB_USE_MODEL_LOAD_BALANCING: "false" GITLAB_USE_MODEL_LOAD_BALANCING: "false"
before_script: before_script:
- !reference [.default-before_script, before_script] - !reference [.default-before_script, before_script]
...@@ -399,11 +405,11 @@ db:migrate-from-previous-major-version: ...@@ -399,11 +405,11 @@ db:migrate-from-previous-major-version:
script: script:
- run_timed_command "scripts/db_tasks db:migrate" - run_timed_command "scripts/db_tasks db:migrate"
db:migrate-from-previous-major-version-decomposed: db:migrate-from-previous-major-version-single-db:
extends: extends:
- db:migrate-from-previous-major-version - db:migrate-from-previous-major-version
- .decomposed-database - .single-db
- .rails:rules:decomposed-databases - .rails:rules:single-db
.db:check-schema-base: .db:check-schema-base:
extends: extends:
...@@ -420,9 +426,9 @@ db:check-schema: ...@@ -420,9 +426,9 @@ db:check-schema:
- db:migrate-from-previous-major-version - db:migrate-from-previous-major-version
- .db:check-schema-base - .db:check-schema-base
db:check-schema-decomposed: db:check-schema-single-db:
extends: extends:
- db:migrate-from-previous-major-version-decomposed - db:migrate-from-previous-major-version-single-db
- .db:check-schema-base - .db:check-schema-base
db:check-migrations: db:check-migrations:
...@@ -434,11 +440,11 @@ db:check-migrations: ...@@ -434,11 +440,11 @@ db:check-migrations:
- scripts/validate_migration_schema - scripts/validate_migration_schema
allow_failure: true allow_failure: true
db:check-migrations-decomposed: db:check-migrations-single-db:
extends: extends:
- db:check-migrations - db:check-migrations
- .decomposed-database - .single-db
- .rails:rules:decomposed-databases - .rails:rules:single-db
db:migrate-non-superuser: db:migrate-non-superuser:
extends: extends:
...@@ -545,11 +551,11 @@ rspec:coverage: ...@@ -545,11 +551,11 @@ rspec:coverage:
- rspec unit pg12 minimal - rspec unit pg12 minimal
- rspec integration pg12 minimal - rspec integration pg12 minimal
- rspec system pg12 minimal - rspec system pg12 minimal
# FOSS/EE decomposed jobs # FOSS/EE single-db jobs
- rspec migration pg12 decomposed - rspec migration pg12 single-db
- rspec unit pg12 decomposed - rspec unit pg12 single-db
- rspec integration pg12 decomposed - rspec integration pg12 single-db
- rspec system pg12 decomposed - rspec system pg12 single-db
# EE jobs # EE jobs
- rspec-ee migration pg12 - rspec-ee migration pg12
- rspec-ee unit pg12 - rspec-ee unit pg12
...@@ -560,11 +566,11 @@ rspec:coverage: ...@@ -560,11 +566,11 @@ rspec:coverage:
- rspec-ee unit pg12 minimal - rspec-ee unit pg12 minimal
- rspec-ee integration pg12 minimal - rspec-ee integration pg12 minimal
- rspec-ee system pg12 minimal - rspec-ee system pg12 minimal
# EE decomposed jobs # EE single-db jobs
- rspec-ee migration pg12 decomposed - rspec-ee migration pg12 single-db
- rspec-ee unit pg12 decomposed - rspec-ee unit pg12 single-db
- rspec-ee integration pg12 decomposed - rspec-ee integration pg12 single-db
- rspec-ee system pg12 decomposed - rspec-ee system pg12 single-db
# Geo jobs # Geo jobs
- rspec-ee unit pg12 geo - rspec-ee unit pg12 geo
- rspec-ee integration pg12 geo - rspec-ee integration pg12 geo
...@@ -578,16 +584,16 @@ rspec:coverage: ...@@ -578,16 +584,16 @@ rspec:coverage:
# As-if-FOSS jobs # As-if-FOSS jobs
- rspec migration pg12-as-if-foss - rspec migration pg12-as-if-foss
- rspec migration pg12-as-if-foss minimal - rspec migration pg12-as-if-foss minimal
- rspec migration pg12-as-if-foss decomposed - rspec migration pg12-as-if-foss single-db
- rspec unit pg12-as-if-foss - rspec unit pg12-as-if-foss
- rspec unit pg12-as-if-foss minimal - rspec unit pg12-as-if-foss minimal
- rspec unit pg12-as-if-foss decomposed - rspec unit pg12-as-if-foss single-db
- rspec integration pg12-as-if-foss - rspec integration pg12-as-if-foss
- rspec integration pg12-as-if-foss minimal - rspec integration pg12-as-if-foss minimal
- rspec integration pg12-as-if-foss decomposed - rspec integration pg12-as-if-foss single-db
- rspec system pg12-as-if-foss - rspec system pg12-as-if-foss
- rspec system pg12-as-if-foss minimal - rspec system pg12-as-if-foss minimal
- rspec system pg12-as-if-foss decomposed - rspec system pg12-as-if-foss single-db
script: script:
- run_timed_command "bundle exec scripts/merge-simplecov" - run_timed_command "bundle exec scripts/merge-simplecov"
coverage: '/LOC \((\d+\.\d+%)\) covered.$/' coverage: '/LOC \((\d+\.\d+%)\) covered.$/'
...@@ -677,11 +683,11 @@ rspec migration pg12-as-if-foss minimal: ...@@ -677,11 +683,11 @@ rspec migration pg12-as-if-foss minimal:
- .minimal-rspec-tests - .minimal-rspec-tests
- .rails:rules:as-if-foss-migration:minimal - .rails:rules:as-if-foss-migration:minimal
rspec migration pg12-as-if-foss decomposed: rspec migration pg12-as-if-foss single-db:
extends: extends:
- rspec migration pg12-as-if-foss - rspec migration pg12-as-if-foss
- .decomposed-database-rspec - .single-db-rspec
- .rails:rules:decomposed-databases - .rails:rules:single-db
rspec unit pg12-as-if-foss: rspec unit pg12-as-if-foss:
extends: extends:
...@@ -695,11 +701,11 @@ rspec unit pg12-as-if-foss minimal: ...@@ -695,11 +701,11 @@ rspec unit pg12-as-if-foss minimal:
- .minimal-rspec-tests - .minimal-rspec-tests
- .rails:rules:as-if-foss-unit:minimal - .rails:rules:as-if-foss-unit:minimal
rspec unit pg12-as-if-foss decomposed: rspec unit pg12-as-if-foss single-db:
extends: extends:
- rspec unit pg12-as-if-foss - rspec unit pg12-as-if-foss
- .decomposed-database-rspec - .single-db-rspec
- .rails:rules:decomposed-databases - .rails:rules:single-db
rspec integration pg12-as-if-foss: rspec integration pg12-as-if-foss:
extends: extends:
...@@ -713,11 +719,11 @@ rspec integration pg12-as-if-foss minimal: ...@@ -713,11 +719,11 @@ rspec integration pg12-as-if-foss minimal:
- .minimal-rspec-tests - .minimal-rspec-tests
- .rails:rules:as-if-foss-integration:minimal - .rails:rules:as-if-foss-integration:minimal
rspec integration pg12-as-if-foss decomposed: rspec integration pg12-as-if-foss single-db:
extends: extends:
- rspec integration pg12-as-if-foss - rspec integration pg12-as-if-foss
- .decomposed-database-rspec - .single-db-rspec
- .rails:rules:decomposed-databases - .rails:rules:single-db
rspec system pg12-as-if-foss: rspec system pg12-as-if-foss:
extends: extends:
...@@ -731,11 +737,11 @@ rspec system pg12-as-if-foss minimal: ...@@ -731,11 +737,11 @@ rspec system pg12-as-if-foss minimal:
- .minimal-rspec-tests - .minimal-rspec-tests
- .rails:rules:as-if-foss-system:minimal - .rails:rules:as-if-foss-system:minimal
rspec system pg12-as-if-foss decomposed: rspec system pg12-as-if-foss single-db:
extends: extends:
- rspec system pg12-as-if-foss - rspec system pg12-as-if-foss
- .decomposed-database-rspec - .single-db-rspec
- .rails:rules:decomposed-databases - .rails:rules:single-db
rspec migration pg12-as-if-jh: rspec migration pg12-as-if-jh:
extends: extends:
...@@ -775,11 +781,11 @@ rspec-ee migration pg12 minimal: ...@@ -775,11 +781,11 @@ rspec-ee migration pg12 minimal:
- .minimal-rspec-tests - .minimal-rspec-tests
- .rails:rules:ee-only-migration:minimal - .rails:rules:ee-only-migration:minimal
rspec-ee migration pg12 decomposed: rspec-ee migration pg12 single-db:
extends: extends:
- rspec-ee migration pg12 - rspec-ee migration pg12
- .decomposed-database-rspec - .single-db-rspec
- .rails:rules:decomposed-databases - .rails:rules:single-db
rspec-ee unit pg12: rspec-ee unit pg12:
extends: extends:
...@@ -793,11 +799,11 @@ rspec-ee unit pg12 minimal: ...@@ -793,11 +799,11 @@ rspec-ee unit pg12 minimal:
- .minimal-rspec-tests - .minimal-rspec-tests
- .rails:rules:ee-only-unit:minimal - .rails:rules:ee-only-unit:minimal
rspec-ee unit pg12 decomposed: rspec-ee unit pg12 single-db:
extends: extends:
- rspec-ee unit pg12 - rspec-ee unit pg12
- .decomposed-database-rspec - .single-db-rspec
- .rails:rules:decomposed-databases - .rails:rules:single-db
rspec-ee integration pg12: rspec-ee integration pg12:
extends: extends:
...@@ -811,11 +817,11 @@ rspec-ee integration pg12 minimal: ...@@ -811,11 +817,11 @@ rspec-ee integration pg12 minimal:
- .minimal-rspec-tests - .minimal-rspec-tests
- .rails:rules:ee-only-integration:minimal - .rails:rules:ee-only-integration:minimal
rspec-ee integration pg12 decomposed: rspec-ee integration pg12 single-db:
extends: extends:
- rspec-ee integration pg12 - rspec-ee integration pg12
- .decomposed-database-rspec - .single-db-rspec
- .rails:rules:decomposed-databases - .rails:rules:single-db
rspec-ee system pg12: rspec-ee system pg12:
extends: extends:
...@@ -829,11 +835,11 @@ rspec-ee system pg12 minimal: ...@@ -829,11 +835,11 @@ rspec-ee system pg12 minimal:
- .minimal-rspec-tests - .minimal-rspec-tests
- .rails:rules:ee-only-system:minimal - .rails:rules:ee-only-system:minimal
rspec-ee system pg12 decomposed: rspec-ee system pg12 single-db:
extends: extends:
- rspec-ee system pg12 - rspec-ee system pg12
- .decomposed-database-rspec - .single-db-rspec
- .rails:rules:decomposed-databases - .rails:rules:single-db
rspec-ee unit pg12 geo: rspec-ee unit pg12 geo:
extends: extends:
......
...@@ -61,8 +61,8 @@ ...@@ -61,8 +61,8 @@
.if-merge-request-labels-run-all-jest: &if-merge-request-labels-run-all-jest .if-merge-request-labels-run-all-jest: &if-merge-request-labels-run-all-jest
if: '$CI_MERGE_REQUEST_LABELS =~ /pipeline:run-all-jest/' if: '$CI_MERGE_REQUEST_LABELS =~ /pipeline:run-all-jest/'
.if-merge-request-labels-run-decomposed: &if-merge-request-labels-run-decomposed .if-merge-request-labels-run-single-db: &if-merge-request-labels-run-single-db
if: '$CI_MERGE_REQUEST_LABELS =~ /pipeline:run-decomposed/' if: '$CI_MERGE_REQUEST_LABELS =~ /pipeline:run-single-db/'
.if-merge-request-labels-run-review-app: &if-merge-request-labels-run-review-app .if-merge-request-labels-run-review-app: &if-merge-request-labels-run-review-app
if: '$CI_MERGE_REQUEST_LABELS =~ /pipeline:run-review-app/' if: '$CI_MERGE_REQUEST_LABELS =~ /pipeline:run-review-app/'
...@@ -907,9 +907,11 @@ ...@@ -907,9 +907,11 @@
- changes: *setup-test-env-patterns - changes: *setup-test-env-patterns
- <<: *if-merge-request-labels-run-all-rspec - <<: *if-merge-request-labels-run-all-rspec
.rails:rules:decomposed-databases: .rails:rules:single-db:
rules: rules:
- <<: *if-merge-request-labels-run-decomposed - <<: *if-merge-request-labels-run-single-db
- <<: *if-merge-request
changes: *db-patterns
- <<: *if-default-branch-schedule-nightly - <<: *if-default-branch-schedule-nightly
.rails:rules:ee-and-foss-migration: .rails:rules:ee-and-foss-migration:
......
# #
# PRODUCTION
#
production:
main:
adapter: postgresql
encoding: unicode
database: gitlabhq_production
username: git
password: "secure password"
host: localhost
ci:
adapter: postgresql
encoding: unicode
database: gitlabhq_production_ci
username: git
password: "secure password"
host: localhost
#
# Development specific # Development specific
# #
development: development:
......
...@@ -194,6 +194,14 @@ We keep track of retried tests in the `$RETRIED_TESTS_REPORT_FILE` file saved as ...@@ -194,6 +194,14 @@ We keep track of retried tests in the `$RETRIED_TESTS_REPORT_FILE` file saved as
See the [experiment issue](https://gitlab.com/gitlab-org/quality/team-tasks/-/issues/1148). See the [experiment issue](https://gitlab.com/gitlab-org/quality/team-tasks/-/issues/1148).
### Single database testing
By default, all tests run with [multiple databases](database/multiple_databases.md).
We also run tests with a single database in nightly scheduled pipelines, and in merge requests that touch database-related files.
If you want to force tests to run with a single database, you can add the `pipeline:run-single-db` label to the merge request.
### Monitoring ### Monitoring
The GitLab test suite is [monitored](performance.md#rspec-profiling) for the `main` branch, and any branch The GitLab test suite is [monitored](performance.md#rspec-profiling) for the `main` branch, and any branch
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment