gitlab_quality-test_tooling 2.13.0 → 2.16.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: 886a32709ca918a9c86d8a770239f809fa51dce3392891b7712f2b085b52a409
4
- data.tar.gz: 1ee8b80242894a606e11c395b23f498d9a5f8d5fcf65447b93ce21006ecb1aaa
3
+ metadata.gz: 0017f4373fb21a5d7313301ca050e381a4e462ec74a50a41aab37ab2afbd31d7
4
+ data.tar.gz: 10c3f5d6750b27058de16f482b3286b5bc96c57b3565f2494965d2d255512462
5
5
  SHA512:
6
- metadata.gz: 5a23f34a8668c4a4d863aa2cfb16fbc1505c4534f2c06f2df43e257b71704f706e9977efa3c18a8dc81d9d2bb6dfa7c09dc65a5a993a50b79468e683022214d7
7
- data.tar.gz: 4685c3fd432a26940b23a69d48e9214aa33950697f91ed43d0b9fa6ecd113f25dd68ab5d95a7cbbcdd129ebff3801cd83c8dcd0a52cabaf860bc332cb1f7f13d
6
+ metadata.gz: c4963020e2f5e405efd8e984966e918430eedb95ba354a6aff4fef068330cd3a152d68d5008b0d4325c5871654c54251206f11e2386f58fa34893e7338f5bb76
7
+ data.tar.gz: 5489a80567198e869517b5aca8e9f1d35871ec470d9e716f62c97e6b15e8afae7f5f7f7622e62e6273294f9268845e1874bcba9677c5f2f52bf5ccefb806774e
data/Gemfile.lock CHANGED
@@ -1,17 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab_quality-test_tooling (2.13.0)
4
+ gitlab_quality-test_tooling (2.16.0)
5
5
  activesupport (>= 7.0, < 7.3)
6
6
  amatch (~> 0.4.1)
7
7
  fog-google (~> 1.24, >= 1.24.1)
8
- gitlab (>= 4.19, < 6.0)
8
+ gitlab (>= 4.19, < 7.0)
9
9
  http (~> 5.0)
10
10
  influxdb-client (~> 3.1)
11
11
  nokogiri (~> 1.10)
12
12
  parallel (>= 1, < 2)
13
13
  rainbow (>= 3, < 4)
14
- rspec-parameterized (>= 1.0.0, < 3.0)
14
+ rspec-parameterized (>= 1.0, < 3.0)
15
15
  table_print (= 1.5.7)
16
16
  zeitwerk (>= 2, < 3)
17
17
 
@@ -175,7 +175,7 @@ module GitlabQuality
175
175
  def find_commit_parent(project, sha)
176
176
  handle_gitlab_client_exceptions do
177
177
  # In a merged results commit, the first parent is the one from
178
- # the main branch, and the second parent is from the branch
178
+ # the default branch, and the second parent is from the branch
179
179
  # itself (more likely to have caused the issue)
180
180
  client.commit(project, sha).parent_ids.last
181
181
  end
@@ -4,7 +4,7 @@ module GitlabQuality
4
4
  module TestTooling
5
5
  module GitlabClient
6
6
  class IssuesDryClient < IssuesClient
7
- def create_issue(title:, description:, labels:, issue_type: 'issue', confidential: false)
7
+ def create_issue(title:, description:, labels:, issue_type: 'issue', _assignee_id: nil, _due_date: nil, confidential: false)
8
8
  attrs = { description: description, labels: labels, confidential: confidential }
9
9
 
10
10
  puts "The following #{issue_type} would have been created:"
@@ -36,7 +36,7 @@ module GitlabQuality
36
36
  end
37
37
 
38
38
  def new_issue_labels(_test)
39
- %w[Quality status::automated]
39
+ %w[E2E status::automated]
40
40
  end
41
41
 
42
42
  def up_to_date_labels(test:, issue: nil, new_labels: Set.new)
@@ -43,9 +43,9 @@ module GitlabQuality
43
43
  # Some of those run in their own project, so CI_PROJECT_NAME is the name we need. Those are:
44
44
  # nightly, staging, canary, production, and preprod
45
45
  #
46
- # MR, master/main, and gitlab tests run in gitlab-qa, but we only want to report tests run on
47
- # master/main because the other pipelines will be monitored by the author of the MR that triggered them.
48
- # So we assume that we're reporting a master/main pipeline if the project name is 'gitlab'.
46
+ # MR, master, and gitlab tests run in gitlab-qa, but we only want to report tests run on
47
+ # master because the other pipelines will be monitored by the author of the MR that triggered them.
48
+ # So we assume that we're reporting a master pipeline if the project name is 'gitlab'.
49
49
 
50
50
  @pipeline ||= Runtime::Env.pipeline_from_project_name
51
51
  end
@@ -33,7 +33,7 @@ module GitlabQuality
33
33
  issue = gitlab.create_issue(
34
34
  title: "#{Time.now.strftime('%Y-%m-%d')} Test session report | #{Runtime::Env.qa_run_type}",
35
35
  description: generate_description(tests),
36
- labels: ['automation:bot-authored', 'Quality', 'QA', 'triage report', pipeline_name_label],
36
+ labels: ['automation:bot-authored', 'E2E', 'triage report', pipeline_name_label],
37
37
  confidential: confidential
38
38
  )
39
39
 
@@ -25,14 +25,21 @@ module GitlabQuality
25
25
 
26
26
  NEW_ISSUE_LABELS = Set.new(%w[test failure::new priority::2 automation:bot-authored type::maintenance]).freeze
27
27
  SCREENSHOT_IGNORED_ERRORS = ['500 Internal Server Error', 'fabricate_via_api!', 'Error Code 500'].freeze
28
-
28
+ FAILURE_ISSUE_GUIDE_URL = "https://handbook.gitlab.com/handbook/engineering/testing/guide-to-e2e-test-failure-issues/"
29
+ FAILURE_ISSUE_HANDBOOK_GUIDE = "**:rotating_light: [End-to-End Test Failure Issue Debugging Guide](#{FAILURE_ISSUE_GUIDE_URL}) :rotating_light:**\n".freeze
29
30
  # Map commits to security fork (gitlab-org/security/gitlab) for gitlab-org/gitlab since security patches exist
30
31
  # there before being released to the public repository
31
32
  DIFF_PROJECT_MAPPINGS = {
33
+ 'gitlab-org/quality/e2e-test-issues' => 'gitlab-org/security/gitlab',
32
34
  'gitlab-org/gitlab' => 'gitlab-org/security/gitlab',
33
35
  'gitlab-org/customers-gitlab-com' => 'gitlab-org/customers-gitlab-com'
34
36
  }.freeze
35
37
 
38
+ # Don't use the E2E test issues project for commit parent
39
+ COMMIT_PROJECT_MAPPINGS = {
40
+ 'gitlab-org/quality/e2e-test-issues' => 'gitlab-org/gitlab'
41
+ }.freeze
42
+
36
43
  # The project contains record of the deployments we use to determine the commit diff
37
44
  OPS_RELEASES_METADATA_PROJECT = 'gitlab-org/release/metadata'
38
45
 
@@ -179,7 +186,9 @@ module GitlabQuality
179
186
  end
180
187
 
181
188
  created_issue = super
182
- test.failure_issue ||= created_issue.web_url
189
+
190
+ # On a dry run, created_issue may not be populated
191
+ test.failure_issue ||= created_issue&.web_url
183
192
 
184
193
  created_issue
185
194
  end
@@ -300,7 +309,7 @@ module GitlabQuality
300
309
  end
301
310
 
302
311
  def new_issue_description(test)
303
- super + [
312
+ FAILURE_ISSUE_HANDBOOK_GUIDE + super + [
304
313
  "\n#{commit_diff_section}",
305
314
  "### Stack trace",
306
315
  "```\n#{test.full_stacktrace}\n```",
@@ -321,7 +330,7 @@ module GitlabQuality
321
330
  pipeline = ops_gitlab_client.find_pipeline(Runtime::Env.ci_project_path, Runtime::Env.ci_pipeline_id.to_i)
322
331
  generate_ops_gitlab_diff(pipeline)
323
332
  else
324
- pipeline = gitlab.find_pipeline(project, Runtime::Env.ci_pipeline_id.to_i)
333
+ pipeline = gitlab.find_pipeline(Runtime::Env.ci_project_path, Runtime::Env.ci_pipeline_id.to_i)
325
334
  generate_gitlab_diff(pipeline)
326
335
  end
327
336
  end
@@ -429,7 +438,8 @@ module GitlabQuality
429
438
 
430
439
  def generate_gitlab_diff(pipeline)
431
440
  pipeline_sha = pipeline.sha
432
- parent_sha = gitlab.find_commit_parent(project, pipeline_sha)
441
+ commit_project = COMMIT_PROJECT_MAPPINGS.fetch(project, project)
442
+ parent_sha = gitlab.find_commit_parent(commit_project, pipeline_sha)
433
443
  diff_project = if DIFF_PROJECT_MAPPINGS.key?(project)
434
444
  DIFF_PROJECT_MAPPINGS[project]
435
445
  else
@@ -544,6 +554,8 @@ module GitlabQuality
544
554
  end
545
555
 
546
556
  def screenshot_artifact_url(test)
557
+ return "" unless test.screenshot_image
558
+
547
559
  ci_job_url = test.ci_job_url
548
560
  screenshot_path = test.screenshot_image[%r{qa/.*$}]
549
561
 
@@ -46,7 +46,7 @@ module GitlabQuality
46
46
  end
47
47
 
48
48
  def default_branch
49
- env_var_value_if_defined('QA_DEFAULT_BRANCH') || 'main'
49
+ 'master'
50
50
  end
51
51
 
52
52
  def ci_api_v4_url
@@ -97,7 +97,7 @@ module GitlabQuality
97
97
 
98
98
  This MR was created based on data from reliable e2e test report: #{context.report_issue}
99
99
 
100
- /label ~"Quality" ~"QA" ~"type::maintenance"
100
+ /label ~"E2E" ~"type::maintenance"
101
101
  /label ~"devops::#{devops_stage}"
102
102
  #{context.label_from_product_group(product_group)}
103
103
 
@@ -137,7 +137,7 @@ module GitlabQuality
137
137
  - [ ] To ensure a faster turnaround, ask in the `#quality_maintainers` Slack channel for someone to review and merge the merge request, rather than assigning it directly.
138
138
 
139
139
  <!-- Base labels. -->
140
- /label ~"Quality" ~"QA" ~"type::maintenance" ~"maintenance::pipelines"
140
+ /label ~"E2E" ~"type::maintenance" ~"maintenance::pipelines"
141
141
 
142
142
  <!--
143
143
  Choose the stage that appears in the test path, e.g. ~"devops::create" for
@@ -14,7 +14,8 @@ module GitlabQuality
14
14
  "Error reference number: 502",
15
15
  "(502): `GitLab is not responding`",
16
16
  "<head><title>502 Bad Gateway</title></head>",
17
- "14:connections to all backends failing"
17
+ "14:connections to all backends failing",
18
+ "gitlab_canary=true cookie was set in browser but 'Next' badge was not shown on UI"
18
19
  ].freeze
19
20
 
20
21
  SHARED_EXAMPLES_CALLERS = %w[include_examples it_behaves_like].freeze
@@ -114,7 +115,7 @@ module GitlabQuality
114
115
  end
115
116
 
116
117
  def file_base_url
117
- @file_base_url ||= "https://gitlab.com/#{project}/-/blob/#{ref}/"
118
+ @file_base_url ||= "https://gitlab.com/#{project == 'gitlab-org/quality/e2e-test-issues' ? 'gitlab-org/gitlab' : project}/-/blob/#{ref}/"
118
119
  end
119
120
 
120
121
  def test_file_link
@@ -143,15 +144,23 @@ module GitlabQuality
143
144
  def files_client
144
145
  @files_client ||= GitlabClient::RepositoryFilesClient.new(
145
146
  token: token,
146
- project: project,
147
+ project: mapped_project,
147
148
  file_path: file,
148
- ref: ref)
149
+ ref: ref.nil? || ref.empty? ? 'master' : ref)
149
150
  end
150
151
 
151
152
  private
152
153
 
153
154
  attr_reader :token, :project, :ref
154
155
 
156
+ def mapped_project
157
+ if project == 'gitlab-org/quality/e2e-test-issues'
158
+ 'gitlab-org/gitlab'
159
+ else
160
+ project
161
+ end
162
+ end
163
+
155
164
  def screenshot
156
165
  report.fetch('screenshot', nil)
157
166
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GitlabQuality
4
4
  module TestTooling
5
- VERSION = "2.13.0"
5
+ VERSION = "2.16.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: 2.13.0
4
+ version: 2.16.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: 2025-05-23 00:00:00.000000000 Z
11
+ date: 2025-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control
@@ -263,7 +263,7 @@ dependencies:
263
263
  version: '4.19'
264
264
  - - "<"
265
265
  - !ruby/object:Gem::Version
266
- version: '6.0'
266
+ version: '7.0'
267
267
  type: :runtime
268
268
  prerelease: false
269
269
  version_requirements: !ruby/object:Gem::Requirement
@@ -273,7 +273,7 @@ dependencies:
273
273
  version: '4.19'
274
274
  - - "<"
275
275
  - !ruby/object:Gem::Version
276
- version: '6.0'
276
+ version: '7.0'
277
277
  - !ruby/object:Gem::Dependency
278
278
  name: http
279
279
  requirement: !ruby/object:Gem::Requirement