gitlab-qa 9.1.2 → 10.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.gitlab-ci.yml +106 -149
  3. data/.simplecov +9 -0
  4. data/Gemfile.lock +15 -1
  5. data/README.md +5 -4
  6. data/docs/what_tests_can_be_run.md +73 -35
  7. data/gitlab-qa.gemspec +3 -0
  8. data/lib/gitlab/qa/component/base.rb +8 -1
  9. data/lib/gitlab/qa/component/gitaly.rb +1 -1
  10. data/lib/gitlab/qa/component/gitlab.rb +2 -2
  11. data/lib/gitlab/qa/component/mock_server.rb +13 -0
  12. data/lib/gitlab/qa/report/gitlab_issue_client.rb +1 -1
  13. data/lib/gitlab/qa/report/relate_failure_issue.rb +95 -17
  14. data/lib/gitlab/qa/report/report_as_issue.rb +1 -1
  15. data/lib/gitlab/qa/runtime/env.rb +17 -4
  16. data/lib/gitlab/qa/runtime/omnibus_configurations/decomposition_multiple_db.rb +1 -1
  17. data/lib/gitlab/qa/scenario/test/integration/oauth.rb +68 -0
  18. data/lib/gitlab/qa/scenario/test/omnibus/update_from_previous.rb +3 -2
  19. data/lib/gitlab/qa/version.rb +1 -1
  20. data/scripts/build-package-and-test-env +15 -0
  21. metadata +47 -47
  22. data/.gitlab/ci/jobs/airgapped.gitlab-ci.yml +0 -23
  23. data/.gitlab/ci/jobs/base.gitlab-ci.yml +0 -273
  24. data/.gitlab/ci/jobs/chaos.gitlab-ci.yml +0 -22
  25. data/.gitlab/ci/jobs/cloud_activation.gitlab-ci.yml +0 -24
  26. data/.gitlab/ci/jobs/custom_parallel.gitlab-ci.yml +0 -21
  27. data/.gitlab/ci/jobs/decomposition_multiple_db.gitlab-ci.yml +0 -27
  28. data/.gitlab/ci/jobs/decomposition_single_db.gitlab-ci.yml +0 -25
  29. data/.gitlab/ci/jobs/ee_previous_to_ce_update.gitlab-ci.yml +0 -18
  30. data/.gitlab/ci/jobs/elasticsearch.gitlab-ci.yml +0 -20
  31. data/.gitlab/ci/jobs/geo.gitlab-ci.yml +0 -18
  32. data/.gitlab/ci/jobs/gitaly_cluster.gitlab-ci.yml +0 -41
  33. data/.gitlab/ci/jobs/gitlab_pages.gitlab-ci.yml +0 -19
  34. data/.gitlab/ci/jobs/group_saml.gitlab-ci.yml +0 -20
  35. data/.gitlab/ci/jobs/instance.gitlab-ci.yml +0 -55
  36. data/.gitlab/ci/jobs/instance_saml.gitlab-ci.yml +0 -41
  37. data/.gitlab/ci/jobs/integrations.gitlab-ci.yml +0 -14
  38. data/.gitlab/ci/jobs/jira.gitlab-ci.yml +0 -41
  39. data/.gitlab/ci/jobs/large_setup.gitlab-ci.yml +0 -19
  40. data/.gitlab/ci/jobs/ldap_no_server.gitlab-ci.yml +0 -20
  41. data/.gitlab/ci/jobs/ldap_no_tls.gitlab-ci.yml +0 -41
  42. data/.gitlab/ci/jobs/ldap_tls.gitlab-ci.yml +0 -41
  43. data/.gitlab/ci/jobs/mattermost.gitlab-ci.yml +0 -41
  44. data/.gitlab/ci/jobs/metrics.gitlab-ci.yml +0 -41
  45. data/.gitlab/ci/jobs/mtls.gitlab-ci.yml +0 -19
  46. data/.gitlab/ci/jobs/object_storage.gitlab-ci.yml +0 -49
  47. data/.gitlab/ci/jobs/object_storage_aws.gitlab-ci.yml +0 -25
  48. data/.gitlab/ci/jobs/object_storage_gcs.gitlab-ci.yml +0 -23
  49. data/.gitlab/ci/jobs/object_storage_registry_tls.gitlab-ci.yml +0 -41
  50. data/.gitlab/ci/jobs/omnibus_image.gitlab-ci.yml +0 -15
  51. data/.gitlab/ci/jobs/omnibus_upgrade.gitlab-ci.yml +0 -28
  52. data/.gitlab/ci/jobs/opensearch.gitlab-ci.yml +0 -20
  53. data/.gitlab/ci/jobs/packages.gitlab-ci.yml +0 -25
  54. data/.gitlab/ci/jobs/praefect.gitlab-ci.yml +0 -71
  55. data/.gitlab/ci/jobs/registry.gitlab-ci.yml +0 -41
  56. data/.gitlab/ci/jobs/registry_with_cdn.gitlab-ci.yml +0 -55
  57. data/.gitlab/ci/jobs/relative_url.gitlab-ci.yml +0 -65
  58. data/.gitlab/ci/jobs/repository_storage.gitlab-ci.yml +0 -41
  59. data/.gitlab/ci/jobs/sanity_framework.gitlab-ci.yml +0 -24
  60. data/.gitlab/ci/jobs/service_ping_disabled.gitlab-ci.yml +0 -19
  61. data/.gitlab/ci/jobs/smtp.gitlab-ci.yml +0 -19
  62. data/.gitlab/ci/jobs/staging.gitlab-ci.yml +0 -10
  63. data/.gitlab/ci/jobs/update.gitlab-ci.yml +0 -60
  64. data/.gitlab/ci/rules.gitlab-ci.yml +0 -183
  65. data/lib/gitlab/qa/scenario/test/omnibus/update.rb +0 -72
  66. data/scripts/generate-qa-jobs.rb +0 -99
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58f719bee0e55a8a1fc5b3f32a63d060c53f6fbffe9455c716f379910688d7f2
4
- data.tar.gz: c6a6dd6e340a90fe4cbf1681b47c3458c05f6120c7bc02f7fac7d124200da233
3
+ metadata.gz: 14c426ca85861845164d12c2bfe65ba51aeb3791d383920ce872b9066f7d50ca
4
+ data.tar.gz: 33e80bd2dd23bc1949018fe46f70bb892fecf0a9789f0365e0ccef6c01334267
5
5
  SHA512:
6
- metadata.gz: aee127d159eed0e7ace711cbe1a96fe64c9cdd2a2cf63464973cca072ae31fb471143fb13fe07c2b585bb6404b17b890568a33a87bc372aa4019e9fc63fc0861
7
- data.tar.gz: 3dd64f65b35ae21b26a7f6cab90b7fe3d12cd6d063b76a982fa1ffc44e08fbbb38ef4086c4c5d33e4ab5182ea39b4ad39ee2f7cfac15126f4b5e54d8e0922f7a
6
+ metadata.gz: 560b02f9b0a4321cb1b7be3c1e482f73a306b4c171bcc0bff4c6527fdd9fdabd68fb33ee042a4033cd047f3a23e8e5d84ae8017936ed6885cfd1de0c0c3eb646
7
+ data.tar.gz: 149bfc867c9913c3af4865964e12ba21d96509eaf0d4c1feb2bcf8c19c3d7da1933a68fa790bb41724ae824f4090f818d4240d5562a532e1fd2461a50138d21c
data/.gitlab-ci.yml CHANGED
@@ -1,188 +1,145 @@
1
+ .cache: &cache
2
+ key:
3
+ prefix: $RUBY_VERSION
4
+ files:
5
+ - Gemfile.lock
6
+ - gitlab-qa.gemspec
7
+ paths:
8
+ - vendor/ruby
9
+
10
+ include:
11
+ - project: 'gitlab-org/quality/pipeline-common'
12
+ file:
13
+ - '/ci/gem-release.yml'
14
+ - '/ci/danger-review.yml'
15
+
1
16
  stages:
2
17
  - check
3
- - generate
4
- - triggers
18
+ - test
19
+ - qa
5
20
  - deploy
6
21
 
7
22
  default:
8
- image: registry.gitlab.com/gitlab-org/gitlab-build-images/debian-bullseye-ruby-${RUBY_VERSION}:bundler-2.3
23
+ image: ${CI_REGISTRY}/gitlab-org/gitlab-build-images/debian-bullseye-ruby-${RUBY_VERSION}:bundler-2.3
9
24
  tags:
10
25
  - gitlab-org
11
26
  cache:
12
- key:
13
- files:
14
- - Gemfile.lock
15
- - gitlab-qa.gemspec
16
- prefix: $RUBY_VERSION
17
- paths:
18
- - vendor/ruby
27
+ <<: *cache
28
+ policy: pull
19
29
  before_script:
20
- - bundle version
21
- - bundle config path vendor
22
- - bundle install --jobs=$(nproc) --retry=3 --quiet && bundle check
23
- - export LANG=C.UTF-8
30
+ - bundle install
24
31
 
25
32
  workflow:
26
33
  rules:
27
34
  # For merge requests, create a pipeline.
28
35
  - if: '$CI_MERGE_REQUEST_IID'
29
- variables:
30
- ALLURE_JOB_NAME: gitlab-qa
31
36
  # For the default branch, create a pipeline (this includes on schedules, pushes, merges, etc.).
32
- - if: '$CI_COMMIT_BRANCH == "master"'
33
- variables:
34
- ALLURE_JOB_NAME: gitlab-qa
35
- # For triggers from GitLab MR pipelines (and pipelines from other projects), create a pipeline
36
- - if: '$CI_PIPELINE_SOURCE == "pipeline"'
37
- variables:
38
- ALLURE_JOB_NAME: package-and-qa
37
+ - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
39
38
  # For tags, create a pipeline.
40
39
  - if: '$CI_COMMIT_TAG'
41
40
  # When using Run pipeline button in the GitLab UI, from the project’s CI/CD > Pipelines section, create a pipeline.
42
41
  - if: '$CI_PIPELINE_SOURCE == "web"'
43
42
 
44
43
  variables:
45
- RUBY_VERSION: "2.7"
44
+ RUBY_VERSION: "3.0"
45
+ BUNDLE_PATH: vendor
46
+ BUNDLE_SILENCE_ROOT_WARNING: "true"
47
+ BUNDLE_SUPPRESS_INSTALL_USING_MESSAGES: "true"
48
+
49
+ package-and-test-env:
50
+ image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/alpine:latest
51
+ stage: .pre
52
+ variables:
53
+ BUILD_ENV: build.env
54
+ cache: []
55
+ before_script: []
56
+ script:
57
+ - scripts/build-package-and-test-env
58
+ artifacts:
59
+ reports:
60
+ dotenv: $BUILD_ENV
61
+ rules:
62
+ - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
63
+ changes:
64
+ - Gemfile.lock
65
+ variables:
66
+ UPDATE_QA_CACHE: "true"
67
+ - if: '$CI_MERGE_REQUEST_IID'
68
+ changes:
69
+ - Gemfile.lock
70
+ variables:
71
+ UPDATE_QA_CACHE: "true"
72
+ - when: always
73
+ variables:
74
+ UPDATE_QA_CACHE: "false"
75
+
76
+ cache-gems:
77
+ stage: .pre
78
+ script:
79
+ - echo "Cached gems!"
80
+ cache:
81
+ <<: *cache
82
+ policy: pull-push
83
+ when: on_success
84
+ rules:
85
+ - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
86
+ changes:
87
+ - Gemfile.lock
88
+ - if: '$CI_MERGE_REQUEST_IID'
89
+ changes:
90
+ - Gemfile.lock
46
91
 
47
- .check-base:
92
+ danger-review:
93
+ image: ${CI_REGISTRY}/gitlab-org/gitlab-build-images/debian-bullseye-ruby-${RUBY_VERSION}:bundler-2.4
48
94
  stage: check
49
- parallel:
50
- matrix:
51
- - RUBY_VERSION: ["2.7", "3.0"]
95
+ needs:
96
+ - job: cache-gems
97
+ optional: true
52
98
 
53
99
  rubocop:
54
- extends: .check-base
100
+ stage: check
101
+ needs:
102
+ - job: cache-gems
103
+ optional: true
55
104
  script:
56
105
  - bundle exec rubocop --color
57
106
 
58
107
  rspec:
59
- extends: .check-base
108
+ stage: test
109
+ needs:
110
+ - job: cache-gems
111
+ optional: true
112
+ coverage: /LOC \((\d{1,3}\.\d{1,2})\%\)/
60
113
  script:
61
114
  - bundle exec rspec --force-color
62
-
63
- prepare:
64
- stage: generate
65
- extends: .rules:never-on-version-change-or-tag
66
- script:
67
- - |
68
- if [[ $TOP_UPSTREAM_SOURCE_PROJECT == "gitlab-org/gitlab" && -n $TOP_UPSTREAM_SOURCE_SHA ]]; then
69
- export QA_IMAGE_TAG=${TOP_UPSTREAM_SOURCE_SHA}
70
- else
71
- export QA_IMAGE_TAG=master
72
- fi
73
- - 'echo "QA_IMAGE_TAG=$QA_IMAGE_TAG" >> prep_vars.env'
74
- - 'echo $QA_IMAGE_TAG'
75
115
  artifacts:
76
116
  reports:
77
- dotenv: prep_vars.env
78
- paths:
79
- - prep_vars.env
117
+ coverage_report:
118
+ coverage_format: cobertura
119
+ path: coverage/coverage.xml
80
120
 
81
- generate-jobs:
82
- stage: generate
83
- extends: .rules:never-on-version-change-or-tag
84
- image:
85
- name: $CI_REGISTRY/gitlab-org/gitlab/gitlab-ee-qa:$QA_IMAGE_TAG
86
- entrypoint: [ "" ]
87
- variables:
88
- QA_EXPORT_TEST_METRICS: "false"
121
+ package-and-test:
122
+ stage: qa
89
123
  needs:
90
- - prepare
91
- before_script:
92
- - cd /home/gitlab/qa
93
- script:
94
- # Generate count example files
95
- - bundle exec bin/qa Test::Instance::All http://dummy.test --count-examples-only -- $QA_TESTS
96
- - bundle exec bin/qa Test::Integration::Mattermost http://dummy.test --mattermost-address http://mattermost.test --count-examples-only -- $QA_TESTS
97
- - bundle exec bin/qa Test::Integration::ServicePingDisabled http://dummy.test --count-examples-only -- $QA_TESTS
98
- - bundle exec bin/qa QA::EE::Scenario::Test::Geo --count-examples-only --primary-address http://dummy1.test --primary-name gitlab-primary --secondary-address http://dummy2.test --secondary-name gitlab-secondary --without-setup
99
- - bundle exec bin/qa Test::Integration::LDAPNoTLS http://dummy.test --count-examples-only -- $QA_TESTS
100
- - bundle exec bin/qa Test::Integration::LDAPTLS http://dummy.test --count-examples-only -- $QA_TESTS
101
- - bundle exec bin/qa Test::Integration::LDAPNoServer http://dummy.test --count-examples-only -- $QA_TESTS
102
- - bundle exec bin/qa Test::Integration::InstanceSAML http://dummy.test --count-examples-only -- $QA_TESTS
103
- - bundle exec bin/qa QA::EE::Scenario::Test::Integration::GroupSAML http://dummy.test --count-examples-only -- $QA_TESTS
104
- - bundle exec bin/qa Test::Integration::RegistryTLS http://dummy.test --count-examples-only -- $QA_TESTS
105
- - bundle exec bin/qa Test::Integration::Registry http://dummy.test --count-examples-only -- $QA_TESTS
106
- - bundle exec bin/qa QA::EE::Scenario::Test::Integration::Elasticsearch http://dummy.test --count-examples-only -- $QA_TESTS
107
- - bundle exec bin/qa Test::Integration::SMTP http://dummy.test --count-examples-only -- $QA_TESTS
108
- - bundle exec bin/qa Test::Integration::RegistryWithCDN http://dummy.test --count-examples-only -- $QA_TESTS
109
- - bundle exec bin/qa Test::Instance::All http://dummy.test --count-examples-only -- $QA_TESTS --tag repository_storage
110
- - bundle exec bin/qa Test::Instance::All http://dummy.test --count-examples-only -- $QA_TESTS --tag packages
111
- - bundle exec bin/qa Test::Instance::All http://dummy.test --count-examples-only -- $QA_TESTS --tag integrations
112
- - bundle exec bin/qa Test::Instance::All http://dummy.test --count-examples-only -- $QA_TESTS --tag gitlab_pages
113
- - bundle exec bin/qa Test::Instance::All http://dummy.test --count-examples-only -- $QA_TESTS --tag mtls
114
- - bundle exec bin/qa Test::Instance::All http://dummy.test --count-examples-only -- $QA_TESTS --tag jira
115
- - bundle exec bin/qa Test::Instance::All http://dummy.test --count-examples-only -- $QA_TESTS --tag can_use_large_setup
116
- - bundle exec bin/qa Test::Instance::All http://dummy.test --count-examples-only -- $QA_TESTS --tag cloud_activation
117
- - bundle exec bin/qa Test::Instance::All http://dummy.test --count-examples-only -- $QA_TESTS --tag object_storage
118
- - bundle exec bin/qa Test::Instance::All http://dummy.test --count-examples-only -- $QA_TESTS --tag metrics
119
- - cp -r no_of_examples $CI_PROJECT_DIR
120
-
121
- # TOP_UPSTREAM_DEFAULT_BRANCH is the default branch name of the original project that triggered a pipeline in this project.
122
- - 'export TOP_UPSTREAM_DEFAULT_BRANCH=${TOP_UPSTREAM_DEFAULT_BRANCH:=master} && echo "TOP_UPSTREAM_DEFAULT_BRANCH=$TOP_UPSTREAM_DEFAULT_BRANCH" >> variables.env'
123
- - 'echo "RELEASE=$RELEASE" >> variables.env'
124
- - 'echo "GITLAB_QA_OPTIONS=$GITLAB_QA_OPTIONS" >> variables.env'
125
- - 'echo "QA_TESTS=$QA_TESTS" >> variables.env'
126
- - 'echo "KNAPSACK_GENERATE_REPORT=$KNAPSACK_GENERATE_REPORT" >> variables.env'
127
- - 'echo "TOP_UPSTREAM_SOURCE_JOB=$TOP_UPSTREAM_SOURCE_JOB" >> variables.env'
128
- - 'echo "TOP_UPSTREAM_SOURCE_REF=$TOP_UPSTREAM_SOURCE_REF" >> variables.env'
129
- - 'echo "DISABLE_RELATING_FAILURE_ISSUES=$DISABLE_RELATING_FAILURE_ISSUES" >> variables.env'
130
- - 'echo "TOP_UPSTREAM_SOURCE_PROJECT=$TOP_UPSTREAM_SOURCE_PROJECT" >> variables.env'
131
- - 'echo "TOP_UPSTREAM_SOURCE_SHA=$TOP_UPSTREAM_SOURCE_SHA" >> variables.env'
132
- - 'echo "NOTIFY_CHANNEL=$NOTIFY_CHANNEL" >> variables.env'
133
- - 'echo "QA_IMAGE=$QA_IMAGE" >> variables.env'
134
- - 'echo "EE_LICENSE=$EE_LICENSE" >> variables.env'
135
- - 'echo "TOP_UPSTREAM_MERGE_REQUEST_IID=$TOP_UPSTREAM_MERGE_REQUEST_IID" >> variables.env'
136
- - 'echo "ALLURE_JOB_NAME=$ALLURE_JOB_NAME" >> variables.env'
137
- - mv variables.env $CI_PROJECT_DIR
138
-
139
- - cd $CI_PROJECT_DIR
140
- - ./scripts/generate-qa-jobs.rb
141
- - cat generated-qa-jobs.yml
142
- artifacts:
143
- reports:
144
- dotenv: variables.env
145
- paths:
146
- - generated-qa-jobs.yml
147
- - variables.env
148
- - no_of_examples
149
- expire_in: 2 days
150
-
151
- trigger-generated-jobs:
152
- stage: triggers
153
- extends: .rules:never-on-version-change-or-tag
154
- needs: [ generate-jobs ]
124
+ - package-and-test-env
155
125
  variables:
156
- # Variables used in rules also need to be passed down using the `variables` section in addition to dotenv file
157
- # due to this bug: https://gitlab.com/gitlab-org/gitlab/-/issues/352828. For other variables, duplicate declaration here is needed
158
- # as well due to not using `needs` and `artifacts: true` in child pipelines.
159
- RELEASE: $RELEASE
160
- GITLAB_QA_OPTIONS: $GITLAB_QA_OPTIONS
161
- QA_TESTS: $QA_TESTS
162
- KNAPSACK_GENERATE_REPORT: $KNAPSACK_GENERATE_REPORT
163
- TOP_UPSTREAM_SOURCE_JOB: $TOP_UPSTREAM_SOURCE_JOB
164
- TOP_UPSTREAM_SOURCE_REF: $TOP_UPSTREAM_SOURCE_REF
165
- TOP_UPSTREAM_DEFAULT_BRANCH: $TOP_UPSTREAM_DEFAULT_BRANCH
166
- DISABLE_RELATING_FAILURE_ISSUES: $DISABLE_RELATING_FAILURE_ISSUES
167
- TOP_UPSTREAM_SOURCE_PROJECT: $TOP_UPSTREAM_SOURCE_PROJECT
168
- TOP_UPSTREAM_SOURCE_SHA: $TOP_UPSTREAM_SOURCE_SHA
169
- NOTIFY_CHANNEL: $NOTIFY_CHANNEL
170
- QA_IMAGE: $QA_IMAGE
171
- EE_LICENSE: $EE_LICENSE
172
- TOP_UPSTREAM_MERGE_REQUEST_IID: $TOP_UPSTREAM_MERGE_REQUEST_IID
173
- ALLURE_JOB_NAME: $ALLURE_JOB_NAME
126
+ RELEASE: EE
127
+ RUN_WITH_BUNDLE: "true"
128
+ SKIP_OMNIBUS_TRIGGER: "true"
129
+ SKIP_REPORT_IN_ISSUES: "true"
130
+ ALLURE_JOB_NAME: gitlab-qa
131
+ UPDATE_QA_CACHE: $UPDATE_QA_CACHE
132
+ GITLAB_QA_CACHE_KEY: $GITLAB_QA_CACHE_KEY
133
+ inherit:
134
+ variables:
135
+ - RUBY_VERSION
136
+ when: manual
174
137
  trigger:
175
138
  strategy: depend
139
+ forward:
140
+ yaml_variables: true
141
+ pipeline_variables: true
176
142
  include:
177
- - artifact: generated-qa-jobs.yml
178
- job: generate-jobs
179
-
180
- include:
181
- - local: .gitlab/ci/rules.gitlab-ci.yml
182
- - project: 'gitlab-org/quality/pipeline-common'
183
- file:
184
- - '/ci/gem-release.yml'
185
- - '/ci/danger-review.yml'
186
-
187
- danger-review:
188
- stage: check
143
+ - project: gitlab-org/gitlab
144
+ ref: master
145
+ file: .gitlab/ci/package-and-test/main.gitlab-ci.yml
data/.simplecov ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "simplecov-cobertura"
4
+
5
+ SimpleCov.configure do
6
+ formatter SimpleCov::Formatter::CoberturaFormatter
7
+ enable_coverage :branch
8
+ add_filter ["/spec/", "/vendor/"]
9
+ end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-qa (9.1.2)
4
+ gitlab-qa (10.0.0)
5
5
  activesupport (~> 6.1)
6
6
  gitlab (~> 4.18.0)
7
7
  http (~> 5.0)
@@ -55,6 +55,7 @@ GEM
55
55
  danger
56
56
  gitlab (~> 4.2, >= 4.2.0)
57
57
  diff-lcs (1.5.0)
58
+ docile (1.4.0)
58
59
  domain_name (0.5.20190701)
59
60
  unf (>= 0.0.5, < 1.0.0)
60
61
  e2mmap (0.1.0)
@@ -199,6 +200,15 @@ GEM
199
200
  sawyer (0.9.2)
200
201
  addressable (>= 2.3.5)
201
202
  faraday (>= 0.17.3, < 3)
203
+ simplecov (0.22.0)
204
+ docile (~> 1.1)
205
+ simplecov-html (~> 0.11)
206
+ simplecov_json_formatter (~> 0.1)
207
+ simplecov-cobertura (2.1.0)
208
+ rexml
209
+ simplecov (~> 0.19)
210
+ simplecov-html (0.12.3)
211
+ simplecov_json_formatter (0.1.4)
202
212
  solargraph (0.47.2)
203
213
  backport (~> 1.2)
204
214
  benchmark
@@ -219,6 +229,7 @@ GEM
219
229
  unicode-display_width (>= 1.1.1, < 3)
220
230
  thor (1.2.1)
221
231
  tilt (2.0.11)
232
+ timecop (0.9.6)
222
233
  tzinfo (2.0.5)
223
234
  concurrent-ruby (~> 1.0)
224
235
  unf (0.1.4)
@@ -246,7 +257,10 @@ DEPENDENCIES
246
257
  pry (~> 0.11)
247
258
  rake (~> 13.0)
248
259
  rspec (~> 3.7)
260
+ simplecov (~> 0.22)
261
+ simplecov-cobertura (~> 2.1)
249
262
  solargraph (~> 0.41)
263
+ timecop (~> 0.9.5)
250
264
  webmock (= 3.7.0)
251
265
 
252
266
  BUNDLED WITH
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/gitlab-qa.svg)](https://rubygems.org/gems/gitlab-qa)
2
2
  [![build status](https://gitlab.com/gitlab-org/gitlab-qa/badges/master/pipeline.svg)](https://gitlab.com/gitlab-org/gitlab-qa/pipelines)
3
+ [![coverage report](https://gitlab.com/gitlab-org/gitlab-qa/badges/master/coverage.svg)](https://gitlab.com/gitlab-org/gitlab-qa/-/commits/master)
3
4
 
4
5
  # GitLab QA orchestrator
5
6
 
@@ -7,11 +8,11 @@
7
8
 
8
9
  - **GitLab QA framework**: A framework that allows developers to write end-to-end
9
10
  tests simply and efficiently.
10
- Located at [`gitlab-org/gitlab-ce@qa/qa/`][qa-framework].
11
+ Located at [`gitlab-org/gitlab-foss@qa/qa/`][qa-framework].
11
12
  - **GitLab QA instance-level scenarios**: RSpec scenarios that use the
12
13
  GitLab QA framework and Capybara to setup and perform individual end-to-end
13
14
  tests against a live GitLab instance.
14
- Located at [`gitlab-org/gitlab-ce@qa/qa/specs/features/`][instance-level-scenarios].
15
+ Located at [`gitlab-org/gitlab-foss@qa/qa/specs/features/`][instance-level-scenarios].
15
16
  - **GitLab QA orchestrator** (this project): An orchestration tool that enables
16
17
  running various QA test suites in a simple manner.
17
18
  - **GitLab QA orchestrated scenarios**: Scenarios where containers are started,
@@ -19,8 +20,8 @@
19
20
  instance.
20
21
  Located at [`gitlab-org/gitlab-qa@lib/gitlab/qa/scenario/test/`][orchestrated-scenarios].
21
22
 
22
- [qa-framework]: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/qa/qa/
23
- [instance-level-scenarios]: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/qa/qa/specs/features/
23
+ [qa-framework]: https://gitlab.com/gitlab-org/gitlab-foss/blob/master/qa/qa/
24
+ [instance-level-scenarios]: https://gitlab.com/gitlab-org/gitlab-foss/blob/master/qa/qa/specs/features/
24
25
  [orchestrated-scenarios]: https://gitlab.com/gitlab-org/gitlab-qa/blob/master/lib/gitlab/qa/scenario/test/
25
26
 
26
27
  ## Goals and objectives
@@ -85,8 +85,8 @@ All environment variables used by GitLab QA should be defined in [`lib/gitlab/qa
85
85
  | `QA_RUN_TYPE` |- | QA run type like `staging-full`, `canary`, `production` etc. Used in test metrics reporting | No|
86
86
  | `QA_VALIDATE_RESOURCE_REUSE` | `false` | Set to `true` to [validate resource reuse](https://docs.gitlab.com/ee/development/testing_guide/end_to_end/resources.html#reusable-resources) after a test suite | No |
87
87
  | `QA_USE_PUBLIC_IP_API` | `false` | When performing Instance tests against a remote/pre-existing instance, use an API to detect the public API for requests coming from gitlab-qa. Used by tests that exercise IP-address restrictions and similar
88
- | `GITHUB_USERNAME` |- | Username for authenticating with GitHub. | No|
89
- | `GITHUB_PASSWORD` |- | Password for authenticating with GitHub. | No|
88
+ | `QA_GITHUB_USERNAME` |- | Username for authenticating with GitHub. | No|
89
+ | `QA_GITHUB_PASSWORD` |- | Password for authenticating with GitHub. | No|
90
90
  | `GITLAB_QA_LOOP_RUNNER_MINUTES` | `1` | Minutes to run and repeat a spec while using the '--loop' option; default value is 1 minute. | No|
91
91
  | `CI_SERVER_PERSONAL_ACCESS_TOKEN` |- | Personal access token of the server that is running the CI pipeline. This is used for pulling CI_RUNNER information in certain tests. | No|
92
92
  | `GEO_MAX_FILE_REPLICATION_TIME` | `120` | Maximum time that a test will wait for a replicated file to appear on a Geo secondary node. | No|
@@ -101,7 +101,13 @@ All environment variables used by GitLab QA should be defined in [`lib/gitlab/qa
101
101
  | `COLORIZED_LOGS` | `false` | Colors GitLab QA and test logs to improve readability | No|
102
102
  | `QA_DOCKER_ADD_HOSTS` |- | Comma separated list of hosts to add to /etc/hosts in docker container | No|
103
103
  | `FIPS` |- | Set to `1` or `true` to indicate that the test is running under FIPS mode | No|
104
- | `JH_ENV` | `false` | Set to `true` to indicate tests or scenarios are running under JH env | No|
104
+ | `JH_ENV` | `false` | Set to `true` to indicate tests or scenarios are running under JH env | No |
105
+ | `QA_GITHUB_OAUTH_APP_ID` | - | Client ID for GitHub OAuth app. See https://docs.gitlab.com/ce/integration/github.html for steps to generate this token. | No |
106
+ | `QA_GITHUB_OAUTH_APP_SECRET` | - | Client Secret for GitHub OAuth app. See https://docs.gitlab.com/ce/integration/github.html for steps to generate this token. | No |
107
+ | `QA_1P_EMAIL` | - | Email address for authenticating into 1Password. | No |
108
+ | `QA_1P_PASSWORD` | - | Password for authenticating into 1Password. | No |
109
+ | `QA_1P_SECRET` | - | Secret for authenticating into 1Password. | No |
110
+ | `QA_1P_GITHUB_UUID` | - | UUID for GitHub item in GitLab-QA 1Password vault. | No |
105
111
 
106
112
  ## [Supported Remote Grid environment variables](./running_against_remote_grid.md)
107
113
 
@@ -285,29 +291,6 @@ Example:
285
291
  $ gitlab-qa Test::Omnibus::Image CE
286
292
  ```
287
293
 
288
- ### `Test::Omnibus::Update CE|EE|<full image address>`
289
-
290
- This tests that:
291
-
292
- - the GitLab Docker `latest` container works as expected by running
293
- instance-level tests against it (see `Test::Instance::Image` above)
294
- - it can be updated to a new (`nightly` or `<full image address>`) container
295
- - the new GitLab container still works as expected by running
296
- `Test::Instance::Image` against it
297
-
298
- Example:
299
-
300
- ```shell
301
- # Update from gitlab/gitlab-ce:latest to gitlab/gitlab-ce:nightly
302
- $ gitlab-qa Test::Omnibus::Update CE
303
-
304
- # Update from gitlab/gitlab-ee:latest to gitlab/gitlab-ee:nightly
305
- $ gitlab-qa Test::Omnibus::Update EE
306
-
307
- # Update from gitlab/gitlab-ce:latest to gitlab/gitlab-ce:my-custom-tag
308
- $ gitlab-qa Test::Omnibus::Update gitlab/gitlab-ce:my-custom-tag
309
- ```
310
-
311
294
  ### `Test::Omnibus::Upgrade CE|<full image address>`
312
295
 
313
296
  This tests that:
@@ -576,6 +559,48 @@ $ export EE_LICENSE=$(cat /path/to/Geo.gitlab_license)
576
559
  $ gitlab-qa Test::Integration::InstanceSAML EE
577
560
  ```
578
561
 
562
+ ### `Test::Integration::OAuth CE|EE|<full image address>`
563
+
564
+ This tests that users can sign in to a GitLab instance using external OAuth services.
565
+
566
+ The tests currently integrate with the following OAuth service providers:
567
+ * GitHub
568
+
569
+ To run tests against the GitLab containers, a GitLab QA (`gitlab/gitlab-qa`)
570
+ container is spun up and tests are run from it by running the `Test::Integration::OAuth` scenario
571
+
572
+ **Required environment variables:**
573
+
574
+ - [For EE only] `EE_LICENSE`: A valid EE license.
575
+ - `QA_GITHUB_OAUTH_APP_ID`: Client ID for GitHub OAuth app. This can be found in the shared 1Password vault.
576
+ - `QA_GITHUB_OAUTH_APP_SECRET`: Client Secret for GitHub OAuth app. This can be found in the shared 1Password vault.
577
+ - `QA_GITHUB_USERNAME`: Username for authenticating with GitHub. This can be found in the shared 1Password vault.
578
+ - `QA_GITHUB_PASSWORD`: Password for authenticating with GitHub. This can be found in the shared 1Password vault.
579
+ - `QA_1P_EMAIL`: Email address for authenticating into 1Password for GitLab-QA vault. This can be found in the shared 1Password vault.
580
+ - `QA_1P_PASSWORD`: Password for authenticating into 1Password for GitLab-QA vault. This can be found in the shared 1Password vault.
581
+ - `QA_1P_SECRET`: Secret for authenticating into 1Password. This can be found in the GitLab-QA 1Password vault.
582
+ - `QA_1P_GITHUB_UUID`: UUID for GitHub item in GitLab-QA 1Password vault. This can be found in the GitLab-QA 1Password vault.
583
+
584
+ Example:
585
+
586
+ ```
587
+ $ export QA_GITHUB_OAUTH_APP_ID=your_github_oauth_client_id
588
+ $ export QA_GITHUB_OAUTH_APP_SECRET=your_github_oauth_client_secret
589
+ $ export QA_GITHUB_USERNAME=your_github_username
590
+ $ export QA_GITHUB_PASSWORD=your_github_password
591
+ $ export QA_1P_EMAIL=1password_email
592
+ $ export QA_1P_PASSWORD=1password_password
593
+ $ export QA_1P_SECRET=1password_secret
594
+ $ export QA_1P_GITHUB_UUID=1password_github_uuid
595
+
596
+ $ gitlab-qa Test::Integration::OAuth CE
597
+
598
+ # For EE
599
+ $ export EE_LICENSE=$(cat /path/to/gitlab_license)
600
+
601
+ $ gitlab-qa Test::Integration::OAuth EE
602
+ ```
603
+
579
604
  ### `Test::Integration::Mattermost CE|EE|<full image address>`
580
605
 
581
606
  This tests that a GitLab instance works as expected when enabling the embedded
@@ -1100,17 +1125,10 @@ Sample Test:
1100
1125
 
1101
1126
  Example:
1102
1127
 
1103
- ```ruby
1128
+ ```shell
1104
1129
  $ gitlab-qa Test::Instance::Chaos
1105
1130
  ```
1106
1131
 
1107
- ----
1108
-
1109
- [Back to README.md](../README.md)
1110
-
1111
- [test-instance]: https://gitlab.com/gitlab-org/gitlab/blob/master/qa/qa/scenario/test/instance/all.rb
1112
- [smoke-instance]: https://gitlab.com/gitlab-org/gitlab/blob/master/qa/qa/scenario/test/instance/smoke.rb
1113
-
1114
1132
  ### `Test::Integration::Import`
1115
1133
 
1116
1134
  This scenario will run specs tagged with `:import` tags.
@@ -1118,4 +1136,24 @@ This scenario will run specs tagged with `:import` tags.
1118
1136
  These tests are designed to validate import functionality by importing projects from `GitHub` or another `GitLab` instance.
1119
1137
  This scenario type spins up 2 gitlab instances and additionally an instance with simple http mock server.
1120
1138
 
1121
- If environment variable `QA_MOCK_GITHUB` is set to `true`, all calls to `github.com` are rerouted to mock server.
1139
+ Example:
1140
+
1141
+ ```shell
1142
+ $ gitlab-qa Test::Integration::Import
1143
+ ```
1144
+
1145
+ #### GitHub
1146
+
1147
+ Setup uses [smocker](https://smocker.dev/) mock server for mocking all interactions with `GitHub`. By default environment variable `QA_MOCK_GITHUB` is
1148
+ set to `true` which adds host entry to `import-target` docker container to redirect all requests for `api.github.com` dns name to mock container.
1149
+
1150
+ All mock definitions are defined in [github.yml](https://gitlab.com/gitlab-org/gitlab/-/blob/master/qa/qa/fixtures/mocks/import/github.yml) file. When mock definitions
1151
+ need to be updated, it can be useful to proxy all requests to real `GitHub` instance and recording all requests and responses.
1152
+
1153
+ #### GitLab
1154
+
1155
+ Testing import [by direct transfer](https://docs.gitlab.com/ee/user/group/import/#migrate-groups-by-direct-transfer-recommended) is done by spinning up 2 omnibus installations - `import-target` and `import-source`. In order for tests to work, application setting `allow_local_requests_from_web_hooks_and_services` must be enabled in target instance. This is automatically done by test process if environment variable `QA_ALLOW_LOCAL_REQUESTS` is set to `true`.
1156
+
1157
+ ----
1158
+
1159
+ [Back to README.md](../README.md)
data/gitlab-qa.gemspec CHANGED
@@ -27,7 +27,10 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency 'pry', '~> 0.11'
28
28
  spec.add_development_dependency 'rake', '~> 13.0'
29
29
  spec.add_development_dependency 'rspec', '~> 3.7'
30
+ spec.add_development_dependency 'simplecov', '~> 0.22'
31
+ spec.add_development_dependency 'simplecov-cobertura', '~> 2.1'
30
32
  spec.add_development_dependency 'solargraph', '~> 0.41'
33
+ spec.add_development_dependency 'timecop', '~> 0.9.5'
31
34
  spec.add_development_dependency 'webmock', '3.7.0'
32
35
 
33
36
  spec.add_runtime_dependency 'activesupport', '~> 6.1'
@@ -122,7 +122,7 @@ module Gitlab
122
122
  command.volume(to, from, 'Z')
123
123
  end
124
124
 
125
- command.volume(File.join(Runtime::Env.host_artifacts_dir, name, 'logs'), '/var/log/gitlab', 'Z')
125
+ command.volume(*log_volume.values) unless log_volume.empty?
126
126
 
127
127
  @environment.to_h.each do |key, value|
128
128
  command.env(key, value)
@@ -177,6 +177,13 @@ module Gitlab
177
177
 
178
178
  attr_reader :exec_commands, :wait_until_ready, :reconfigure
179
179
 
180
+ def log_volume
181
+ @log_volume ||= {
182
+ src: File.join(Runtime::Env.host_artifacts_dir, name, 'logs'),
183
+ dest: '/var/log/gitlab'
184
+ }
185
+ end
186
+
180
187
  def assert_name!
181
188
  raise 'Invalid instance name!' unless name
182
189
  end
@@ -49,7 +49,7 @@ module Gitlab
49
49
  end
50
50
 
51
51
  def process_exec_commands
52
- exec_commands << Support::ConfigScripts.add_git_server_hooks(docker, name)
52
+ Support::ConfigScripts.add_git_server_hooks(docker, name)
53
53
 
54
54
  commands = exec_commands.flatten.uniq
55
55
  return if commands.empty?
@@ -208,12 +208,12 @@ module Gitlab
208
208
  end
209
209
 
210
210
  def process_exec_commands
211
- @docker.copy(name, DATA_SEED_PATH, DATA_PATH) if seed_admin_token || seed_db
211
+ Support::ConfigScripts.add_git_server_hooks(docker, name) unless skip_server_hooks
212
212
 
213
+ @docker.copy(name, DATA_SEED_PATH, DATA_PATH) if seed_admin_token || seed_db
213
214
  exec_commands << seed_admin_token_command if seed_admin_token
214
215
  exec_commands << seed_test_data_command if seed_db
215
216
  exec_commands << Runtime::Scenario.omnibus_exec_commands
216
- exec_commands << Support::ConfigScripts.add_git_server_hooks(docker, name) unless skip_server_hooks
217
217
 
218
218
  commands = exec_commands.flatten.uniq
219
219
  return if commands.empty?
@@ -18,6 +18,7 @@ module Gitlab
18
18
  @tls_path = "/etc/smocker/tls"
19
19
  @ports = [80, 8081]
20
20
  @environment = { "SMOCKER_MOCK_SERVER_LISTEN_PORT" => 80 }
21
+ @log_volume = {}
21
22
  end
22
23
 
23
24
  attr_reader :name
@@ -29,10 +30,22 @@ module Gitlab
29
30
  setup_tls if tls
30
31
  end
31
32
 
33
+ # Print smocker log output by using docker logs command because smocker only logs to stdout
34
+ #
35
+ # @return [void]
36
+ def teardown!
37
+ Docker::Command.execute("logs #{name}")
38
+
39
+ super
40
+ end
41
+
32
42
  private
33
43
 
34
44
  attr_reader :tls_path, :tls
35
45
 
46
+ # Set up tls certs
47
+ #
48
+ # @return [void]
36
49
  def setup_tls
37
50
  @volumes = { "smocker-ssl" => tls_path }
38
51
  @ports = [443, 8081]
@@ -79,7 +79,7 @@ module Gitlab
79
79
 
80
80
  def find_issue_notes(iid:)
81
81
  handle_gitlab_client_exceptions do
82
- Gitlab.issue_notes(project, iid, order_by: 'created_at', sort: 'asc').auto_paginate
82
+ Gitlab.issue_notes(project, iid, order_by: 'created_at', sort: 'asc')&.auto_paginate
83
83
  end
84
84
  end
85
85