gitlab_quality-test_tooling 1.18.0 → 1.19.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: 948fbcd939a7800a4538113fddc717642c4d9fed7dab6d650cd9052c1832f19b
4
- data.tar.gz: fbc4cee23cbcd3f7631ac6a03d41f2b8e287590777fef813289013d982efc4f7
3
+ metadata.gz: 49251bc15b93d718cfff854a53a7a636c0c7146dc5ef10122da6485b61394cbd
4
+ data.tar.gz: 45aa8dde6575ec5a6aa007caaf2174e7411ce1bbab14a0612c4fc2b052eae803
5
5
  SHA512:
6
- metadata.gz: 34c8a65eaf48e4ef9800df34a66f0086d3915252444091631fbd76273731008f70be149e3c92d5954644e55839d8a314eb3442411e3a389061e460d66c9d1ea2
7
- data.tar.gz: 29f34824d1c5bba8dbe979a10c0e93a8c4c06e7b0b174b96b0150c19e3d6f71bb0fa9a8ef285a2d650af407547084a5e1a7bb2925817dce5d200b6755e864d4c
6
+ metadata.gz: 5b17466220585713a72b202d3760ccc634e0d5cf99696b0e80ef46e3bcd88a57a832dbbcb59d45bf5117bdc5809667a720c0a6c85322820484d2b0446ed40271
7
+ data.tar.gz: fa1128da178f0744ec2c07544fb316c28e8d8e58e2aa9dff6c8118f6dd4f0ed0ffb84ef3716f08366fef6d2b0f3e0d54023fe287b60a2eea6d0635e8cd74e61d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab_quality-test_tooling (1.18.0)
4
+ gitlab_quality-test_tooling (1.19.0)
5
5
  activesupport (>= 6.1, < 7.2)
6
6
  amatch (~> 0.4.1)
7
7
  gitlab (~> 4.19)
@@ -31,7 +31,7 @@ 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|
34
+ opts.on('--pipeline-stages STAGES', String, 'Comma-separated list of pipeline stages to include in test session issue') do |pipeline_stages|
35
35
  params[:pipeline_stages] = pipeline_stages.split(',')
36
36
  end
37
37
 
@@ -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(" "))
@@ -328,7 +328,7 @@ module GitlabQuality
328
328
  def new_issue_assignee_id(test)
329
329
  return unless test.product_group?
330
330
 
331
- dri = set_dri_via_group(test.product_group, test.stage)
331
+ dri = test_dri(test.product_group, test.stage, test.section)
332
332
  puts " => Assigning #{dri} as DRI for the issue."
333
333
 
334
334
  gitlab.find_user_id(username: dri)
@@ -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.18.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.18.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-08 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