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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8709476aafe6dc96d2b49d1d74b18b2e3dbf6c37cb8ebb0acd631d05dbfe2ac
4
- data.tar.gz: 26d4d54613a522014b5f3b93f38c0cb62027c2e209573727265a5c2b630a6d9d
3
+ metadata.gz: 49251bc15b93d718cfff854a53a7a636c0c7146dc5ef10122da6485b61394cbd
4
+ data.tar.gz: 45aa8dde6575ec5a6aa007caaf2174e7411ce1bbab14a0612c4fc2b052eae803
5
5
  SHA512:
6
- metadata.gz: 194294ffed245e88a96e35480485f98c1748a8417766cdca1cf737ece2b090a4e29efc444fa449f5f569e292333ba50954f7c07a72fbb2f9225c9195c4b6f411
7
- data.tar.gz: 30cc7f3a5da1c15b5c3508e0850c007bddf9f22a85c9ec1361821be7bc330afd3869cd9fe74d3b424afc2d0ad2d180c4c0649b5f502f4740ca68f1b2c8119933
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.17.0)
5
- activesupport (>= 6.1, < 7.1)
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.0.8)
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.1)
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.21.2)
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)
@@ -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 set_dri_via_group(product_group, stage)
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.empty?
18
- @stage_sets.sample['username']
19
- else
20
- @group_sets.sample['username']
21
- end
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("#{error.class.name} #{error.message}")
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 = set_dri_via_group(test.product_group, test.stage)
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 + 1.month
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
- console_log.extend(ActiveSupport::Logger.broadcast(file_log))
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) || set_dri_via_group(product_group, devops_stage)
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
@@ -22,6 +22,10 @@ module GitlabQuality
22
22
  raise NotImplementedError
23
23
  end
24
24
 
25
+ def section
26
+ raise NotImplementedError
27
+ end
28
+
25
29
  def category
26
30
  raise NotImplementedError
27
31
  end
@@ -111,6 +111,10 @@ module GitlabQuality
111
111
  report['feature_category']
112
112
  end
113
113
 
114
+ def section
115
+ report['section']
116
+ end
117
+
114
118
  def category
115
119
  report['category']
116
120
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GitlabQuality
4
4
  module TestTooling
5
- VERSION = "1.17.0"
5
+ VERSION = "1.19.0"
6
6
  end
7
7
  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.17.0
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-01 00:00:00.000000000 Z
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.1'
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.1'
214
+ version: '7.2'
215
215
  - !ruby/object:Gem::Dependency
216
216
  name: amatch
217
217
  requirement: !ruby/object:Gem::Requirement