gitlab-qa 8.10.1 → 8.11.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 +4 -4
- data/.gitlab/ci/jobs/integrations.gitlab-ci.yml +5 -5
- data/Gemfile.lock +1 -1
- data/docs/what_tests_can_be_run.md +2 -2
- data/lib/gitlab/qa/component/base.rb +4 -0
- data/lib/gitlab/qa/component/mock_server.rb +21 -0
- data/lib/gitlab/qa/report/relate_failure_issue.rb +37 -4
- data/lib/gitlab/qa/report/report_results.rb +5 -37
- data/lib/gitlab/qa/scenario/test/integration/import.rb +83 -0
- data/lib/gitlab/qa/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e671dd38d183bc823c72bb1a4a7d597912b0d31e6169487d7733069bdcbadb8
|
4
|
+
data.tar.gz: e851a0dcaede0a6c33627bf4a0a794d9f083b05080fb79e7246c1e0c9bb31058
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91d4ae5bb59dfad449f73bf8b4f84cb8d8f22447611f8a19fa81bd0d2c9800c6a4ff42adfa95f4dad491d011d2f85144088e5bf91a420d02ed1fa9dd5b7ed592
|
7
|
+
data.tar.gz: 4b658660ca1c90e1764270f4c0b7b8e36210120a8a80b5c298e0d381e55ddb163a93cb2123e81d9bb461584b930fb45640dac6cbdd807513c017727f2f23ac23
|
@@ -1,14 +1,14 @@
|
|
1
|
-
|
1
|
+
ee:integrations:
|
2
2
|
extends:
|
3
|
-
- .rules:
|
3
|
+
- .rules:ee-never-when-triggered-by-feature-flag-definition-change
|
4
4
|
- .test
|
5
5
|
- .high-capacity
|
6
|
-
- .
|
6
|
+
- .ee-variables
|
7
7
|
- .rspec-report-opts
|
8
8
|
variables:
|
9
9
|
QA_SCENARIO: "Test::Integration::Integrations"
|
10
10
|
|
11
|
-
|
11
|
+
ee:integrations-quarantine:
|
12
12
|
extends:
|
13
|
-
-
|
13
|
+
- ee:integrations
|
14
14
|
- .quarantine
|
data/Gemfile.lock
CHANGED
@@ -670,7 +670,7 @@ $ export EE_LICENSE=$(cat /path/to/GitLab.gitlab_license)
|
|
670
670
|
$ gitlab-qa Test::Integration::Jira EE
|
671
671
|
```
|
672
672
|
|
673
|
-
### `Test::Integration::Integrations CE|<full image address>`
|
673
|
+
### `Test::Integration::Integrations CE|EE|<full image address>`
|
674
674
|
|
675
675
|
This scenario is intended to test the different integrations that a GitLab instance can offer, such as WebHooks to an external service, Jenkins, etc.
|
676
676
|
|
@@ -681,7 +681,7 @@ container is spun up and tests are run from it by running the
|
|
681
681
|
Example:
|
682
682
|
|
683
683
|
```
|
684
|
-
$ gitlab-qa Test::Integration::Integrations
|
684
|
+
$ gitlab-qa Test::Integration::Integrations EE
|
685
685
|
```
|
686
686
|
|
687
687
|
### `Test::Instance::Any CE|EE|<full image address>:nightly|latest|any_tag http://your.instance.gitlab`
|
@@ -43,6 +43,10 @@ module Gitlab
|
|
43
43
|
raise NotImplementedError, "#{self.class.name} must specify a docker image tag as DOCKER_IMAGE_TAG"
|
44
44
|
end
|
45
45
|
|
46
|
+
def start_instance
|
47
|
+
instance_no_teardown
|
48
|
+
end
|
49
|
+
|
46
50
|
def instance(skip_teardown: false)
|
47
51
|
instance_no_teardown do
|
48
52
|
yield self if block_given?
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Gitlab
|
4
|
+
module QA
|
5
|
+
module Component
|
6
|
+
class MockServer < Base
|
7
|
+
DOCKER_IMAGE = "thiht/smocker"
|
8
|
+
DOCKER_IMAGE_TAG = "0.18.2"
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
super
|
12
|
+
|
13
|
+
@ports = %w[8080 8081]
|
14
|
+
@name = "smocker-server"
|
15
|
+
end
|
16
|
+
|
17
|
+
attr_reader :name
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -16,6 +16,7 @@ module Gitlab
|
|
16
16
|
FAILURE_STACKTRACE_REGEX = %r{((.*Failure\/Error:(?<stacktrace>.+))|(?<stacktrace>.+))}m.freeze
|
17
17
|
ISSUE_STACKTRACE_REGEX = /### Stack trace\s*(```)#{FAILURE_STACKTRACE_REGEX}(```)/m.freeze
|
18
18
|
NEW_ISSUE_LABELS = Set.new(%w[QA Quality test failure::new priority::2]).freeze
|
19
|
+
IGNORE_EXCEPTIONS = ['Net::ReadTimeout'].freeze
|
19
20
|
|
20
21
|
MultipleIssuesFound = Class.new(StandardError)
|
21
22
|
|
@@ -37,9 +38,7 @@ module Gitlab
|
|
37
38
|
puts "=> Reporting tests in #{test_results.path}"
|
38
39
|
|
39
40
|
test_results.each do |test|
|
40
|
-
|
41
|
-
|
42
|
-
relate_failure_to_issue(test)
|
41
|
+
relate_failure_to_issue(test) if should_report?(test)
|
43
42
|
end
|
44
43
|
|
45
44
|
test_results.write
|
@@ -90,7 +89,7 @@ module Gitlab
|
|
90
89
|
end
|
91
90
|
|
92
91
|
def full_stacktrace(test)
|
93
|
-
if test.failures.first['message_lines'].empty?
|
92
|
+
if test.failures.first['message_lines'].empty? || test.failures.first['message_lines'].instance_of?(String)
|
94
93
|
test.failures.first['message']
|
95
94
|
else
|
96
95
|
test.failures.first['message_lines'].join("\n")
|
@@ -234,6 +233,40 @@ module Gitlab
|
|
234
233
|
puts " => No product group metadata found for test '#{test.name}'"
|
235
234
|
end
|
236
235
|
end
|
236
|
+
|
237
|
+
# Checks if a test failure should be reported.
|
238
|
+
#
|
239
|
+
# @return [Boolean] false if the test was skipped or failed because of a transient error that can be ignored.
|
240
|
+
# Otherwise returns true.
|
241
|
+
def should_report?(test)
|
242
|
+
return false if test.failures.empty?
|
243
|
+
|
244
|
+
if test.report.key?('exceptions')
|
245
|
+
reason = ignore_failure_reason(test.report['exceptions'])
|
246
|
+
|
247
|
+
if reason
|
248
|
+
puts "Failure reporting skipped because #{reason}"
|
249
|
+
|
250
|
+
return false
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
true
|
255
|
+
end
|
256
|
+
|
257
|
+
# Determine any reason to ignore a failure.
|
258
|
+
#
|
259
|
+
# @param [Array<Hash>] exceptions the exceptions associated with the failure.
|
260
|
+
# @return [String] the reason to ignore the exceptions, or `nil` if any exceptions should not be ignored.
|
261
|
+
def ignore_failure_reason(exceptions)
|
262
|
+
exception_classes = exceptions
|
263
|
+
.filter_map { |exception| exception['class'] if IGNORE_EXCEPTIONS.include?(exception['class']) }
|
264
|
+
.compact
|
265
|
+
return if exception_classes.empty? || exception_classes.size < exceptions.size
|
266
|
+
|
267
|
+
msg = exception_classes.many? ? 'the errors were' : 'the error was'
|
268
|
+
"#{msg} #{exception_classes.join(', ')}"
|
269
|
+
end
|
237
270
|
end
|
238
271
|
end
|
239
272
|
end
|
@@ -7,8 +7,6 @@ module Gitlab
|
|
7
7
|
class ReportResults < ReportAsIssue
|
8
8
|
attr_accessor :testcase_project_reporter, :results_issue_project_reporter, :files, :test_case_project, :results_issue_project, :gitlab
|
9
9
|
|
10
|
-
IGNORE_EXCEPTIONS = ['Net::ReadTimeout'].freeze
|
11
|
-
|
12
10
|
def initialize(token:, input_files:, test_case_project: nil, results_issue_project: nil, dry_run: false, **kwargs)
|
13
11
|
@testcase_project_reporter = Gitlab::QA::Report::ResultsInTestCases.new(token: token, input_files: input_files, project: test_case_project, dry_run: dry_run, **kwargs)
|
14
12
|
@results_issue_project_reporter = Gitlab::QA::Report::ResultsInIssues.new(token: token, input_files: input_files, project: results_issue_project, dry_run: dry_run, **kwargs)
|
@@ -24,6 +22,7 @@ module Gitlab
|
|
24
22
|
abort "Please provide valid project IDs or paths with the `--results-issue-project` and `--test-case-project` options!"
|
25
23
|
end
|
26
24
|
|
25
|
+
# rubocop:disable Metrics/AbcSize
|
27
26
|
def run!
|
28
27
|
puts "Reporting test results in `#{files.join(',')}` as test cases in project `#{test_case_project}`"\
|
29
28
|
" and issues in project `#{results_issue_project}` via the API at `#{Runtime::Env.gitlab_api_base}`."
|
@@ -32,14 +31,17 @@ module Gitlab
|
|
32
31
|
puts "Reporting tests in #{test_results.path}"
|
33
32
|
|
34
33
|
test_results.each do |test|
|
34
|
+
next if test.file.include?('/features/sanity/') || test.skipped
|
35
|
+
|
35
36
|
puts "Reporting test: #{test.file} | #{test.name}\n"
|
36
37
|
|
37
|
-
report_test(test)
|
38
|
+
report_test(test)
|
38
39
|
end
|
39
40
|
|
40
41
|
test_results.write
|
41
42
|
end
|
42
43
|
end
|
44
|
+
# rubocop:enable Metrics/AbcSize
|
43
45
|
|
44
46
|
private
|
45
47
|
|
@@ -56,40 +58,6 @@ module Gitlab
|
|
56
58
|
testcase_project_reporter.update_testcase(testcase, test)
|
57
59
|
results_issue_project_reporter.update_issue(issue, test)
|
58
60
|
end
|
59
|
-
|
60
|
-
# Checks if a test result should be reported.
|
61
|
-
#
|
62
|
-
# @return [Boolean] false if the test was skipped or failed because of a transient error that can be ignored.
|
63
|
-
# Otherwise returns true.
|
64
|
-
def should_report?(test)
|
65
|
-
return false if test.skipped
|
66
|
-
|
67
|
-
if test.report.key?('exceptions')
|
68
|
-
reason = ignore_failure_reason(test.report['exceptions'])
|
69
|
-
|
70
|
-
if reason
|
71
|
-
puts "Issue update skipped because #{reason}"
|
72
|
-
|
73
|
-
return false
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
true
|
78
|
-
end
|
79
|
-
|
80
|
-
# Determine any reason to ignore a failure.
|
81
|
-
#
|
82
|
-
# @param [Array<Hash>] exceptions the exceptions associated with the failure.
|
83
|
-
# @return [String] the reason to ignore the exceptions, or `nil` if any exceptions should not be ignored.
|
84
|
-
def ignore_failure_reason(exceptions)
|
85
|
-
exception_classes = exceptions
|
86
|
-
.filter_map { |exception| exception['class'] if IGNORE_EXCEPTIONS.include?(exception['class']) }
|
87
|
-
.compact
|
88
|
-
return if exception_classes.empty? || exception_classes.size < exceptions.size
|
89
|
-
|
90
|
-
msg = exception_classes.many? ? 'the errors were' : 'the error was'
|
91
|
-
"#{msg} #{exception_classes.join(', ')}"
|
92
|
-
end
|
93
61
|
end
|
94
62
|
end
|
95
63
|
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "parallel"
|
4
|
+
|
5
|
+
module Gitlab
|
6
|
+
module QA
|
7
|
+
module Scenario
|
8
|
+
module Test
|
9
|
+
module Integration
|
10
|
+
# Scenario type for testing importers
|
11
|
+
#
|
12
|
+
# In addition to main gitlab instance, starts another gitlab instance to act as source
|
13
|
+
# and mock server to replace all other possible import sources
|
14
|
+
#
|
15
|
+
class Import < Scenario::Template
|
16
|
+
def initialize
|
17
|
+
@source_gitlab = Component::Gitlab.new
|
18
|
+
@target_gitlab = Component::Gitlab.new
|
19
|
+
@mock_server = Component::MockServer.new
|
20
|
+
@network = "test"
|
21
|
+
end
|
22
|
+
|
23
|
+
attr_reader :source_gitlab, :target_gitlab, :mock_server, :network
|
24
|
+
|
25
|
+
def perform(release, *rspec_args)
|
26
|
+
start_mock_server
|
27
|
+
start_gitlab_instances(release)
|
28
|
+
|
29
|
+
run_specs(rspec_args)
|
30
|
+
ensure
|
31
|
+
mock_server.teardown
|
32
|
+
target_gitlab.teardown
|
33
|
+
source_gitlab.teardown
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
# Start mock server instance
|
39
|
+
#
|
40
|
+
# @return [void]
|
41
|
+
def start_mock_server
|
42
|
+
mock_server.tap do |server|
|
43
|
+
server.network = network
|
44
|
+
|
45
|
+
server.start_instance
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# Start gitlab instance
|
50
|
+
#
|
51
|
+
# @param [Gitlab::QA::Release] release
|
52
|
+
# @return [void]
|
53
|
+
def start_gitlab_instances(release)
|
54
|
+
::Parallel.each([source_gitlab, target_gitlab], in_threads: 2) do |gitlab_instance|
|
55
|
+
gitlab_instance.tap do |gitlab|
|
56
|
+
gitlab.network = network
|
57
|
+
gitlab.release = release
|
58
|
+
gitlab.seed_admin_token = true
|
59
|
+
|
60
|
+
gitlab.start_instance
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Run tests
|
66
|
+
#
|
67
|
+
# @param [Array] rspec_args
|
68
|
+
# @return [void]
|
69
|
+
def run_specs(rspec_args)
|
70
|
+
Component::Specs.perform do |specs|
|
71
|
+
specs.suite = "Test::Integration::Import"
|
72
|
+
specs.release = target_gitlab.release
|
73
|
+
specs.network = network
|
74
|
+
specs.env = { "QA_IMPORT_SOURCE_URL" => source_gitlab.address }
|
75
|
+
specs.args = [target_gitlab.address, *rspec_args]
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
data/lib/gitlab/qa/version.rb
CHANGED
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: 8.
|
4
|
+
version: 8.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitLab Quality
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: climate_control
|
@@ -332,6 +332,7 @@ files:
|
|
332
332
|
- lib/gitlab/qa/component/ldap.rb
|
333
333
|
- lib/gitlab/qa/component/mail_hog.rb
|
334
334
|
- lib/gitlab/qa/component/minio.rb
|
335
|
+
- lib/gitlab/qa/component/mock_server.rb
|
335
336
|
- lib/gitlab/qa/component/opensearch.rb
|
336
337
|
- lib/gitlab/qa/component/postgresql.rb
|
337
338
|
- lib/gitlab/qa/component/preprod.rb
|
@@ -405,6 +406,7 @@ files:
|
|
405
406
|
- lib/gitlab/qa/scenario/test/integration/gitaly_cluster.rb
|
406
407
|
- lib/gitlab/qa/scenario/test/integration/gitlab_pages.rb
|
407
408
|
- lib/gitlab/qa/scenario/test/integration/group_saml.rb
|
409
|
+
- lib/gitlab/qa/scenario/test/integration/import.rb
|
408
410
|
- lib/gitlab/qa/scenario/test/integration/instance_saml.rb
|
409
411
|
- lib/gitlab/qa/scenario/test/integration/integrations.rb
|
410
412
|
- lib/gitlab/qa/scenario/test/integration/jira.rb
|