gitlab-qa 6.0.0 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87249baf75070cf8c5362c34b9995f6163370e9b6e353a393104beefe62d4bd8
4
- data.tar.gz: 6e00eee6993c9f5c6aeb4cb187c708941bfd27cb9b59340165b23b02c30f583a
3
+ metadata.gz: 20da7f808929fe216ed49cefd35aeeab33c0e0a2c35517aa5ef15569271e2d17
4
+ data.tar.gz: d87695289a8d8f13f4c9baa5547a46e45f4777e07adcbfc78570f4f35a0db71f
5
5
  SHA512:
6
- metadata.gz: 6d621d51ca18fa402e397b13c86dda6d52039a11ca259c6a46f3e9caffeab0faa68b6b9ff58ec4f727b2dae82c386442655122571936a47c366647b3ad895a50
7
- data.tar.gz: 73bbcc44b560368e64d8bd335b3fac6d52128e8c05f6ddf582ea6139032f570d80563b6fbc9c96f41598fee2c2c345ec9155f5990f3ea4df1bde2167bede9a27
6
+ metadata.gz: ba356e43063cf62c035364bf6e929d2545d4ad9d6042159cf68b58cce15af7099843ab556622076b705fa5f633d7defc3158cbdaaa948fd2014e79eb5bfbe290
7
+ data.tar.gz: ea5048047d6c5816e0401d0bf104757be344145740063255581fbbadc27c69334ad737a23b81049ede31f488f3f13858411a1126ca07b3ee14c6a87ad8e9b030
@@ -94,7 +94,7 @@ release:
94
94
  - exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=$DEFAULT_RELEASE} -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS || test_run_exit_code=$?
95
95
  - exe/gitlab-qa-report --update-screenshot-path "gitlab-qa-run-*/**/rspec-*.xml"
96
96
  - export GITLAB_QA_ACCESS_TOKEN="$GITLAB_QA_PRODUCTION_ACCESS_TOKEN"
97
- - if [ "$TOP_UPSTREAM_SOURCE_REF" == "master" ]; then exe/gitlab-qa-report --report-in-issues "gitlab-qa-run-*/**/rspec-*.xml" --project "$QA_TESTCASES_REPORTING_PROJECT" || true; fi
97
+ - if [ "$TOP_UPSTREAM_SOURCE_REF" == "master" ] || [[ "$TOP_UPSTREAM_SOURCE_JOB" == https://ops.gitlab.net* ]]; then exe/gitlab-qa-report --report-in-issues "gitlab-qa-run-*/**/rspec-*.json" --project "$QA_TESTCASES_REPORTING_PROJECT" || true; fi
98
98
  - exit $test_run_exit_code
99
99
 
100
100
  .ce-qa:
@@ -143,7 +143,7 @@ release:
143
143
  .rspec-report-opts:
144
144
  variables:
145
145
  FILE_SAFE_JOB_NAME: $(echo $CI_JOB_NAME | sed 's/[ /]/_/g')
146
- RSPEC_REPORT_OPTS: "--format RspecJunitFormatter --out \"tmp/rspec-${CI_JOB_ID}.xml\" --format html --out \"tmp/rspec-${FILE_SAFE_JOB_NAME}.htm\" --color --format documentation"
146
+ RSPEC_REPORT_OPTS: "--format QA::Support::JsonFormatter --out \"tmp/rspec-${CI_JOB_ID}.json\" --format RspecJunitFormatter --out \"tmp/rspec-${CI_JOB_ID}.xml\" --format html --out \"tmp/rspec-${FILE_SAFE_JOB_NAME}.htm\" --color --format documentation"
147
147
 
148
148
  .quarantine:
149
149
  allow_failure: true
@@ -229,44 +229,6 @@ ee:instance-quarantine:
229
229
  variables:
230
230
  QA_RSPEC_TAGS: "--tag quarantine --tag ~orchestrated"
231
231
 
232
- ce:docker:
233
- extends:
234
- - .test
235
- - .high-capacity
236
- - .ce-qa
237
- - .rspec-report-opts
238
- variables:
239
- QA_RSPEC_TAGS: "--tag docker"
240
-
241
- ce:docker-quarantine:
242
- extends:
243
- - .test
244
- - .high-capacity
245
- - .ce-qa
246
- - .quarantine
247
- - .rspec-report-opts
248
- variables:
249
- QA_RSPEC_TAGS: "--tag docker --tag quarantine"
250
-
251
- ee:docker:
252
- extends:
253
- - .test
254
- - .high-capacity
255
- - .ee-qa
256
- - .rspec-report-opts
257
- variables:
258
- QA_RSPEC_TAGS: "--tag docker"
259
-
260
- ee:docker-quarantine:
261
- extends:
262
- - .test
263
- - .high-capacity
264
- - .ee-qa
265
- - .quarantine
266
- - .rspec-report-opts
267
- variables:
268
- QA_RSPEC_TAGS: "--tag docker --tag quarantine"
269
-
270
232
  ce:relative_url:
271
233
  extends:
272
234
  - .test
@@ -370,7 +332,7 @@ ce:update:
370
332
  script:
371
333
  - exe/gitlab-qa Test::Omnibus::Update ${RELEASE:=CE} ${RELEASE:=CE} -- $RSPEC_REPORT_OPTS || test_run_exit_code=$?
372
334
  - export GITLAB_QA_ACCESS_TOKEN="$GITLAB_QA_PRODUCTION_ACCESS_TOKEN"
373
- - if [ "$TOP_UPSTREAM_SOURCE_REF" == "master" ]; then exe/gitlab-qa-report --report-in-issues "gitlab-qa-run-*/**/rspec-*.xml" --project "$QA_TESTCASES_REPORTING_PROJECT"; fi
335
+ - if [ "$TOP_UPSTREAM_SOURCE_REF" == "master" ] || [[ "$TOP_UPSTREAM_SOURCE_JOB" == https://ops.gitlab.net* ]]; then exe/gitlab-qa-report --report-in-issues "gitlab-qa-run-*/**/rspec-*.json" --project "$QA_TESTCASES_REPORTING_PROJECT" || true; fi
374
336
  - exit $test_run_exit_code
375
337
  extends:
376
338
  - .test
@@ -384,7 +346,7 @@ ce:update-quarantine:
384
346
  script:
385
347
  - exe/gitlab-qa Test::Omnibus::Update ${RELEASE:=CE} ${RELEASE:=CE} -- --tag quarantine --tag ~orchestrated $RSPEC_REPORT_OPTS || test_run_exit_code=$?
386
348
  - export GITLAB_QA_ACCESS_TOKEN="$GITLAB_QA_PRODUCTION_ACCESS_TOKEN"
387
- - if [ "$TOP_UPSTREAM_SOURCE_REF" == "master" ]; then exe/gitlab-qa-report --report-in-issues "gitlab-qa-run-*/**/rspec-*.xml" --project "$QA_TESTCASES_REPORTING_PROJECT"; fi
349
+ - if [ "$TOP_UPSTREAM_SOURCE_REF" == "master" ] || [[ "$TOP_UPSTREAM_SOURCE_JOB" == https://ops.gitlab.net* ]]; then exe/gitlab-qa-report --report-in-issues "gitlab-qa-run-*/**/rspec-*.json" --project "$QA_TESTCASES_REPORTING_PROJECT" || true; fi
388
350
  - exit $test_run_exit_code
389
351
  extends:
390
352
  - .test
@@ -397,7 +359,7 @@ ee:update:
397
359
  script:
398
360
  - exe/gitlab-qa Test::Omnibus::Update ${RELEASE:=EE} ${RELEASE:=EE} -- $RSPEC_REPORT_OPTS || test_run_exit_code=$?
399
361
  - export GITLAB_QA_ACCESS_TOKEN="$GITLAB_QA_PRODUCTION_ACCESS_TOKEN"
400
- - if [ "$TOP_UPSTREAM_SOURCE_REF" == "master" ]; then exe/gitlab-qa-report --report-in-issues "gitlab-qa-run-*/**/rspec-*.xml" --project "$QA_TESTCASES_REPORTING_PROJECT"; fi
362
+ - if [ "$TOP_UPSTREAM_SOURCE_REF" == "master" ] || [[ "$TOP_UPSTREAM_SOURCE_JOB" == https://ops.gitlab.net* ]]; then exe/gitlab-qa-report --report-in-issues "gitlab-qa-run-*/**/rspec-*.json" --project "$QA_TESTCASES_REPORTING_PROJECT" || true; fi
401
363
  - exit $test_run_exit_code
402
364
  extends:
403
365
  - .test
@@ -411,7 +373,7 @@ ee:update-quarantine:
411
373
  script:
412
374
  - exe/gitlab-qa Test::Omnibus::Update ${RELEASE:=EE} ${RELEASE:=EE} -- --tag quarantine --tag ~orchestrated $RSPEC_REPORT_OPTS || test_run_exit_code=$?
413
375
  - export GITLAB_QA_ACCESS_TOKEN="$GITLAB_QA_PRODUCTION_ACCESS_TOKEN"
414
- - if [ "$TOP_UPSTREAM_SOURCE_REF" == "master" ]; then exe/gitlab-qa-report --report-in-issues "gitlab-qa-run-*/**/rspec-*.xml" --project "$QA_TESTCASES_REPORTING_PROJECT"; fi
376
+ - if [ "$TOP_UPSTREAM_SOURCE_REF" == "master" ] || [[ "$TOP_UPSTREAM_SOURCE_JOB" == https://ops.gitlab.net* ]]; then exe/gitlab-qa-report --report-in-issues "gitlab-qa-run-*/**/rspec-*.json" --project "$QA_TESTCASES_REPORTING_PROJECT" || true; fi
415
377
  - exit $test_run_exit_code
416
378
  extends:
417
379
  - .test
@@ -676,6 +638,7 @@ ce:kubernetes:
676
638
  - .high-capacity
677
639
  - .ce-qa
678
640
  - .rspec-report-opts
641
+ allow_failure: true
679
642
  variables:
680
643
  QA_SCENARIO: "Test::Integration::Kubernetes"
681
644
 
@@ -695,6 +658,7 @@ ee:kubernetes:
695
658
  - .high-capacity
696
659
  - .ee-qa
697
660
  - .rspec-report-opts
661
+ allow_failure: true
698
662
  variables:
699
663
  QA_SCENARIO: "Test::Integration::Kubernetes"
700
664
 
@@ -82,6 +82,8 @@ All environment variables used by GitLab QA should be defined in [`lib/gitlab/qa
82
82
  | `GEO_MAX_DB_REPLICATION_TIME` | `120` | Maximum time that a test will wait for database data to appear on a Geo secondary node. | No|
83
83
  | `JIRA_ADMIN_USERNAME` |- | Username for authenticating with Jira server as admin. | No|
84
84
  | `JIRA_ADMIN_PASSWORD` |- | Password for authenticating with Jira server as admin. | No|
85
+ | `CACHE_NAMESPACE_NAME` | `true` | Cache namespace name for groups. | No|
86
+ | `DEPLOY_VERSION` |- | The version of GitLab being tested against. | No|
85
87
 
86
88
  ## [Supported Remote Grid environment variables](./running_against_remote_grid.md)
87
89
 
@@ -135,6 +137,10 @@ For example, the following command would use the image named `gitlab/gitlab-ee:n
135
137
  $ gitlab-qa Test::Instance::Image EE
136
138
  ```
137
139
 
140
+ To run EE tests, the `EE_LICENSE` environment variable needs to be set:
141
+
142
+ `$ export EE_LICENSE=$(cat /path/to/GitLab.gitlab_license)`
143
+
138
144
  ## Examples
139
145
 
140
146
  ### `Test::Instance::Image CE|EE|<full image address>`
@@ -30,12 +30,11 @@ module Gitlab
30
30
  RETRY_BACK_OFF_DELAY = 60
31
31
  MAX_RETRY_ATTEMPTS = 3
32
32
 
33
- def initialize(token:, input_files:, project: nil, input_format: :junit)
33
+ def initialize(token:, input_files:, project: nil)
34
34
  @token = token
35
35
  @files = Array(input_files)
36
36
  @project = project
37
37
  @retry_backoff = 0
38
- @input_format = input_format.to_sym
39
38
  end
40
39
 
41
40
  def invoke!
@@ -47,11 +46,15 @@ module Gitlab
47
46
 
48
47
  Dir.glob(files).each do |file|
49
48
  puts "Reporting tests in #{file}"
50
- case input_format
51
- when :json
49
+ extension = File.extname(file)
50
+
51
+ case extension
52
+ when '.json'
52
53
  test_results = Report::JsonTestResults.new(file)
53
- when :junit
54
+ when '.xml'
54
55
  test_results = Report::JUnitTestResults.new(file)
56
+ else
57
+ raise "Unknown extension #{extension}"
55
58
  end
56
59
 
57
60
  test_results.each do |test|
@@ -62,7 +65,7 @@ module Gitlab
62
65
 
63
66
  private
64
67
 
65
- attr_reader :files, :token, :project, :input_format
68
+ attr_reader :files, :token, :project
66
69
 
67
70
  def validate_input!
68
71
  assert_project!
@@ -137,8 +140,11 @@ module Gitlab
137
140
  end
138
141
  end
139
142
 
143
+ # rubocop:disable Metrics/AbcSize
140
144
  def find_issue(test)
141
145
  handle_gitlab_client_exceptions do
146
+ return Gitlab.issue(project, id_from_testcase_url(test.testcase)) if test.testcase
147
+
142
148
  issues = Gitlab.issues(project, { search: search_term(test) })
143
149
  .auto_paginate
144
150
  .select { |issue| issue.state == 'opened' && issue.title.strip == title_from_test(test) }
@@ -148,6 +154,11 @@ module Gitlab
148
154
  issues.first
149
155
  end
150
156
  end
157
+ # rubocop:enable Metrics/AbcSize
158
+
159
+ def id_from_testcase_url(url)
160
+ url.split('/').last.to_i
161
+ end
151
162
 
152
163
  def search_term(test)
153
164
  %("#{test.file}" "#{search_safe(test.name)}")
@@ -275,7 +286,7 @@ module Gitlab
275
286
  # This error could be raised in assert_user_permission!
276
287
  # If so, we want it to terminate at that point
277
288
  raise
278
- rescue SystemCallError, OpenSSL::SSL::SSLError, Net::ReadTimeout, Gitlab::Error::Parsing => e
289
+ rescue SystemCallError, OpenSSL::SSL::SSLError, Net::OpenTimeout, Net::ReadTimeout, Gitlab::Error::InternalServerError, Gitlab::Error::Parsing => e
279
290
  @retry_backoff += RETRY_BACK_OFF_DELAY
280
291
 
281
292
  raise if @retry_backoff > RETRY_BACK_OFF_DELAY * MAX_RETRY_ATTEMPTS
@@ -4,7 +4,7 @@ module Gitlab
4
4
  module QA
5
5
  module Report
6
6
  class TestResult
7
- attr_accessor :name, :file, :skipped, :failures
7
+ attr_accessor :name, :file, :skipped, :failures, :testcase
8
8
 
9
9
  def self.from_json(test)
10
10
  new.tap do |test_result|
@@ -12,6 +12,7 @@ module Gitlab
12
12
  test_result.file = test['file_path']
13
13
  test_result.skipped = test['status'] == 'pending'
14
14
  test_result.failures = failures_from_json_exceptions(test)
15
+ test_result.testcase = test['testcase']
15
16
  end
16
17
  end
17
18
 
@@ -28,9 +29,13 @@ module Gitlab
28
29
  return [] unless test.key?('exceptions')
29
30
 
30
31
  test['exceptions'].map do |exception|
32
+ spec_file_first_index = exception['backtrace'].rindex do |line|
33
+ line.include?(File.basename(test['file_path']))
34
+ end
35
+
31
36
  {
32
37
  'message' => "#{exception['class']}: #{exception['message']}",
33
- 'stacktrace' => exception['backtrace'].join('\n')
38
+ 'stacktrace' => "#{exception['message_lines'].join("\n")}\n#{exception['backtrace'].slice(0..spec_file_first_index).join("\n")}"
34
39
  }
35
40
  end
36
41
  end
@@ -41,9 +46,14 @@ module Gitlab
41
46
  return [] if failures.empty?
42
47
 
43
48
  failures.map do |exception|
49
+ trace = exception.content.split("\n").map(&:strip)
50
+ spec_file_first_index = trace.rindex do |line|
51
+ line.include?(File.basename(test['file']))
52
+ end
53
+
44
54
  {
45
55
  'message' => "#{exception['type']}: #{exception['message']}",
46
- 'stacktrace' => exception.content
56
+ 'stacktrace' => trace.slice(0..spec_file_first_index).join("\n")
47
57
  }
48
58
  end
49
59
  end
@@ -80,7 +80,9 @@ module Gitlab
80
80
  'GEO_MAX_DB_REPLICATION_TIME' => :geo_max_db_replication_time,
81
81
  'JIRA_HOSTNAME' => :jira_hostname,
82
82
  'JIRA_ADMIN_USERNAME' => :jira_admin_username,
83
- 'JIRA_ADMIN_PASSWORD' => :jira_admin_password
83
+ 'JIRA_ADMIN_PASSWORD' => :jira_admin_password,
84
+ 'CACHE_NAMESPACE_NAME' => :cache_namespace_name,
85
+ 'DEPLOY_VERSION' => :deploy_version
84
86
  }.freeze
85
87
 
86
88
  ENV_VARIABLES.each_value do |accessor|
@@ -1,5 +1,5 @@
1
1
  module Gitlab
2
2
  module QA
3
- VERSION = '6.0.0'.freeze
3
+ VERSION = '6.2.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-qa
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 6.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grzegorz Bizon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-13 00:00:00.000000000 Z
11
+ date: 2020-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control