gitlab_quality-test_tooling 1.17.0 → 1.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +15 -5
- data/exe/generate-test-session +4 -0
- data/lib/gitlab_quality/test_tooling/concerns/find_set_dri.rb +21 -9
- data/lib/gitlab_quality/test_tooling/gitlab_client/gitlab_client.rb +1 -1
- data/lib/gitlab_quality/test_tooling/report/generate_test_session.rb +5 -2
- data/lib/gitlab_quality/test_tooling/report/relate_failure_issue.rb +2 -4
- data/lib/gitlab_quality/test_tooling/report/report_as_issue.rb +0 -1
- data/lib/gitlab_quality/test_tooling/report/slow_test_issue.rb +1 -1
- data/lib/gitlab_quality/test_tooling/runtime/logger.rb +1 -1
- data/lib/gitlab_quality/test_tooling/test_meta/processor/add_to_blocking_processor.rb +2 -1
- data/lib/gitlab_quality/test_tooling/test_meta/test_meta_updater.rb +2 -2
- data/lib/gitlab_quality/test_tooling/test_result/base_test_result.rb +4 -0
- data/lib/gitlab_quality/test_tooling/test_result/json_test_result.rb +4 -0
- data/lib/gitlab_quality/test_tooling/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49251bc15b93d718cfff854a53a7a636c0c7146dc5ef10122da6485b61394cbd
|
4
|
+
data.tar.gz: 45aa8dde6575ec5a6aa007caaf2174e7411ce1bbab14a0612c4fc2b052eae803
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b17466220585713a72b202d3760ccc634e0d5cf99696b0e80ef46e3bcd88a57a832dbbcb59d45bf5117bdc5809667a720c0a6c85322820484d2b0446ed40271
|
7
|
+
data.tar.gz: fa1128da178f0744ec2c07544fb316c28e8d8e58e2aa9dff6c8118f6dd4f0ed0ffb84ef3716f08366fef6d2b0f3e0d54023fe287b60a2eea6d0635e8cd74e61d
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gitlab_quality-test_tooling (1.
|
5
|
-
activesupport (>= 6.1, < 7.
|
4
|
+
gitlab_quality-test_tooling (1.19.0)
|
5
|
+
activesupport (>= 6.1, < 7.2)
|
6
6
|
amatch (~> 0.4.1)
|
7
7
|
gitlab (~> 4.19)
|
8
8
|
http (~> 5.0)
|
@@ -16,10 +16,15 @@ PATH
|
|
16
16
|
GEM
|
17
17
|
remote: https://rubygems.org/
|
18
18
|
specs:
|
19
|
-
activesupport (7.
|
19
|
+
activesupport (7.1.3.2)
|
20
|
+
base64
|
21
|
+
bigdecimal
|
20
22
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
23
|
+
connection_pool (>= 2.2.5)
|
24
|
+
drb
|
21
25
|
i18n (>= 1.6, < 2)
|
22
26
|
minitest (>= 5.1)
|
27
|
+
mutex_m
|
23
28
|
tzinfo (~> 2.0)
|
24
29
|
addressable (2.8.6)
|
25
30
|
public_suffix (>= 2.0.2, < 6.0)
|
@@ -28,7 +33,9 @@ GEM
|
|
28
33
|
tins (~> 1.0)
|
29
34
|
ast (2.4.2)
|
30
35
|
backport (1.2.0)
|
36
|
+
base64 (0.2.0)
|
31
37
|
benchmark (0.3.0)
|
38
|
+
bigdecimal (3.1.6)
|
32
39
|
binding_of_caller (1.0.0)
|
33
40
|
debug_inspector (>= 0.0.1)
|
34
41
|
byebug (11.1.3)
|
@@ -41,6 +48,7 @@ GEM
|
|
41
48
|
coderay (1.1.3)
|
42
49
|
colored2 (3.1.2)
|
43
50
|
concurrent-ruby (1.2.3)
|
51
|
+
connection_pool (2.4.1)
|
44
52
|
cork (0.3.0)
|
45
53
|
colored2 (~> 3.1)
|
46
54
|
crack (0.4.5)
|
@@ -65,6 +73,7 @@ GEM
|
|
65
73
|
diff-lcs (1.5.0)
|
66
74
|
docile (1.4.0)
|
67
75
|
domain_name (0.6.20240107)
|
76
|
+
drb (2.2.1)
|
68
77
|
e2mmap (0.1.0)
|
69
78
|
faraday (2.9.0)
|
70
79
|
faraday-net_http (>= 2.0, < 3.2)
|
@@ -119,7 +128,7 @@ GEM
|
|
119
128
|
httparty (0.21.0)
|
120
129
|
mini_mime (>= 1.0.0)
|
121
130
|
multi_xml (>= 0.5.2)
|
122
|
-
i18n (1.14.
|
131
|
+
i18n (1.14.4)
|
123
132
|
concurrent-ruby (~> 1.0)
|
124
133
|
jaro_winkler (1.5.6)
|
125
134
|
json (2.7.1)
|
@@ -138,10 +147,11 @@ GEM
|
|
138
147
|
method_source (1.0.0)
|
139
148
|
mini_mime (1.1.5)
|
140
149
|
mini_portile2 (2.8.5)
|
141
|
-
minitest (5.
|
150
|
+
minitest (5.22.2)
|
142
151
|
mize (0.4.1)
|
143
152
|
protocol (~> 2.0)
|
144
153
|
multi_xml (0.6.0)
|
154
|
+
mutex_m (0.2.0)
|
145
155
|
nap (1.1.0)
|
146
156
|
nenv (0.3.0)
|
147
157
|
net-http (0.4.1)
|
data/exe/generate-test-session
CHANGED
@@ -31,6 +31,10 @@ options = OptionParser.new do |opts|
|
|
31
31
|
params[:issue_url_file] = issue_url_file
|
32
32
|
end
|
33
33
|
|
34
|
+
opts.on('--pipeline-stages STAGES', String, 'Comma-separated list of pipeline stages to include in test session issue') do |pipeline_stages|
|
35
|
+
params[:pipeline_stages] = pipeline_stages.split(',')
|
36
|
+
end
|
37
|
+
|
34
38
|
opts.on('--confidential', "Makes test session issue confidential") do
|
35
39
|
params[:confidential] = true
|
36
40
|
end
|
@@ -6,19 +6,23 @@ module GitlabQuality
|
|
6
6
|
module TestTooling
|
7
7
|
module Concerns
|
8
8
|
module FindSetDri
|
9
|
-
def
|
9
|
+
def test_dri(product_group, stage, section)
|
10
10
|
parse_json_with_sets
|
11
|
+
fetch_section_sets(section)
|
11
12
|
fetch_stage_sets(stage)
|
12
|
-
|
13
|
-
return @sets.sample['username'] if @stage_sets.empty?
|
14
|
-
|
15
13
|
fetch_group_sets(product_group)
|
16
14
|
|
17
|
-
if @group_sets.
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
15
|
+
set_dris = if @group_sets.any?
|
16
|
+
@group_sets
|
17
|
+
elsif @stage_sets.any?
|
18
|
+
@stage_sets
|
19
|
+
elsif @section_sets.any?
|
20
|
+
@section_sets
|
21
|
+
else
|
22
|
+
@sets
|
23
|
+
end
|
24
|
+
|
25
|
+
set_dris.sample['username']
|
22
26
|
end
|
23
27
|
|
24
28
|
private
|
@@ -30,6 +34,14 @@ module GitlabQuality
|
|
30
34
|
@sets = JSON.parse(response.body).select { |user| user['role'].include?('software-engineer-in-test') }
|
31
35
|
end
|
32
36
|
|
37
|
+
def fetch_section_sets(section)
|
38
|
+
return if section.nil?
|
39
|
+
|
40
|
+
@section_sets = @sets.select do |user|
|
41
|
+
user['role'].include?(section.split("_").map(&:capitalize).join(" "))
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
33
45
|
def fetch_stage_sets(stage)
|
34
46
|
@stage_sets = @sets.select do |user|
|
35
47
|
user['role'].include?(stage.split("_").map(&:capitalize).join(" "))
|
@@ -27,7 +27,7 @@ module GitlabQuality
|
|
27
27
|
|
28
28
|
raise if @retry_backoff > RETRY_BACK_OFF_DELAY * MAX_RETRY_ATTEMPTS
|
29
29
|
|
30
|
-
warn("#{
|
30
|
+
warn("#{e.class.name} #{e.message}")
|
31
31
|
warn("Sleeping for #{@retry_backoff} seconds before retrying...")
|
32
32
|
sleep @retry_backoff
|
33
33
|
|
@@ -7,15 +7,16 @@ module GitlabQuality
|
|
7
7
|
module TestTooling
|
8
8
|
module Report
|
9
9
|
class GenerateTestSession < ReportAsIssue
|
10
|
-
def initialize(ci_project_token:, **kwargs)
|
10
|
+
def initialize(ci_project_token:, pipeline_stages: nil, **kwargs)
|
11
11
|
super
|
12
12
|
@ci_project_token = ci_project_token
|
13
|
+
@pipeline_stages = Set.new(pipeline_stages)
|
13
14
|
@issue_type = 'issue'
|
14
15
|
end
|
15
16
|
|
16
17
|
private
|
17
18
|
|
18
|
-
attr_reader :ci_project_token
|
19
|
+
attr_reader :ci_project_token, :pipeline_stages
|
19
20
|
|
20
21
|
# rubocop:disable Metrics/AbcSize
|
21
22
|
def run!
|
@@ -27,6 +28,8 @@ module GitlabQuality
|
|
27
28
|
TestResults::JsonTestResults.new(path).to_a
|
28
29
|
end
|
29
30
|
|
31
|
+
tests = tests.select { |test| pipeline_stages.include? test.report["stage"] } unless pipeline_stages.empty?
|
32
|
+
|
30
33
|
issue = gitlab.create_issue(
|
31
34
|
title: "#{Time.now.strftime('%Y-%m-%d')} Test session report | #{Runtime::Env.qa_run_type}",
|
32
35
|
description: generate_description(tests),
|
@@ -1,9 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'nokogiri'
|
4
|
-
require 'active_support/core_ext/enumerable'
|
5
4
|
require 'rubygems/text'
|
6
|
-
require 'active_support/core_ext/integer/time'
|
7
5
|
require 'amatch'
|
8
6
|
|
9
7
|
module GitlabQuality
|
@@ -330,7 +328,7 @@ module GitlabQuality
|
|
330
328
|
def new_issue_assignee_id(test)
|
331
329
|
return unless test.product_group?
|
332
330
|
|
333
|
-
dri =
|
331
|
+
dri = test_dri(test.product_group, test.stage, test.section)
|
334
332
|
puts " => Assigning #{dri} as DRI for the issue."
|
335
333
|
|
336
334
|
gitlab.find_user_id(username: dri)
|
@@ -339,7 +337,7 @@ module GitlabQuality
|
|
339
337
|
def new_issue_due_date(test)
|
340
338
|
return unless test.product_group?
|
341
339
|
|
342
|
-
Date.today
|
340
|
+
Date.today.next_month
|
343
341
|
end
|
344
342
|
|
345
343
|
def update_reports(issue, test)
|
@@ -60,7 +60,6 @@ module GitlabQuality
|
|
60
60
|
| Description | `#{test.name}` |
|
61
61
|
| Test level | #{test.level} |
|
62
62
|
| Hash | `#{test_hash(test)}` |
|
63
|
-
| Reference duration | #{test.run_time} seconds |
|
64
63
|
| Expected duration | < #{test.max_duration_for_test} seconds |
|
65
64
|
#{"| Test case | #{test.testcase} |" if test.testcase}
|
66
65
|
DESCRIPTION
|
@@ -93,7 +93,7 @@ module GitlabQuality
|
|
93
93
|
current_reports_content: reports_note&.body.to_s,
|
94
94
|
test: test,
|
95
95
|
reports_section_header: REPORT_SECTION_HEADER,
|
96
|
-
item_extra_content: found_label,
|
96
|
+
item_extra_content: "(#{test.run_time} seconds) #{found_label}",
|
97
97
|
reports_extra_content: REPORTS_DOCUMENTATION
|
98
98
|
)
|
99
99
|
end
|
@@ -38,7 +38,7 @@ module GitlabQuality
|
|
38
38
|
console_log = console_logger(source: source, level: Env.log_level)
|
39
39
|
file_log = file_logger(source: source, path: log_path)
|
40
40
|
|
41
|
-
|
41
|
+
ActiveSupport::BroadcastLogger.new(console_log, file_log, file_log)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
@@ -17,6 +17,7 @@ module GitlabQuality
|
|
17
17
|
@existing_mrs = nil
|
18
18
|
@file_path = spec["file_path"]
|
19
19
|
testcase = spec["testcase"]
|
20
|
+
product_section = spec["section"]
|
20
21
|
devops_stage = spec["stage"]
|
21
22
|
product_group = spec["product_group"]
|
22
23
|
@example_name = spec["name"]
|
@@ -36,7 +37,7 @@ module GitlabQuality
|
|
36
37
|
#{"Promote to blocking: #{example_name}".truncate(72)}
|
37
38
|
COMMIT_MESSAGE
|
38
39
|
|
39
|
-
reviewer_id, assignee_handle = context.fetch_dri_id(product_group, devops_stage)
|
40
|
+
reviewer_id, assignee_handle = context.fetch_dri_id(product_group, devops_stage, product_section)
|
40
41
|
|
41
42
|
gitlab_bot_user_id = context.user_id_for_username(Runtime::Env.gitlab_bot_username)
|
42
43
|
|
@@ -190,8 +190,8 @@ module GitlabQuality
|
|
190
190
|
# @param [String] product_group
|
191
191
|
# @param [String] devops_stage
|
192
192
|
# @return [Array<Integer, String>]
|
193
|
-
def fetch_dri_id(product_group, devops_stage)
|
194
|
-
assignee_handle = ENV.fetch('QA_TEST_DRI_HANDLE', nil) ||
|
193
|
+
def fetch_dri_id(product_group, devops_stage, section)
|
194
|
+
assignee_handle = ENV.fetch('QA_TEST_DRI_HANDLE', nil) || test_dri(product_group, devops_stage, section)
|
195
195
|
|
196
196
|
[user_id_for_username(assignee_handle), assignee_handle]
|
197
197
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab_quality-test_tooling
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.19.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: 2024-03-
|
11
|
+
date: 2024-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: climate_control
|
@@ -201,7 +201,7 @@ dependencies:
|
|
201
201
|
version: '6.1'
|
202
202
|
- - "<"
|
203
203
|
- !ruby/object:Gem::Version
|
204
|
-
version: '7.
|
204
|
+
version: '7.2'
|
205
205
|
type: :runtime
|
206
206
|
prerelease: false
|
207
207
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -211,7 +211,7 @@ dependencies:
|
|
211
211
|
version: '6.1'
|
212
212
|
- - "<"
|
213
213
|
- !ruby/object:Gem::Version
|
214
|
-
version: '7.
|
214
|
+
version: '7.2'
|
215
215
|
- !ruby/object:Gem::Dependency
|
216
216
|
name: amatch
|
217
217
|
requirement: !ruby/object:Gem::Requirement
|