Class: GitlabQuality::TestTooling::Report::FlakyTestIssue

Inherits:
ReportAsIssue
  • Object
show all
Includes:
Concerns::IssueReports
Defined in:
lib/gitlab_quality/test_tooling/report/flaky_test_issue.rb

Overview

Uses the API to create GitLab issues for any passed test coming from JSON test reports. We expect the test reports to come from rspec-retry, or from a new RSpec process where we retried failing specs.

  • Takes the JSON test reports like rspec-*.json (typically from rspec-retry gem)`
  • Takes a project where flaky test issues should be created
  • For every passed test in the report:
    • Find issue by test hash
    • Reopen issue if it already exists, but is closed

Constant Summary collapse

NEW_ISSUE_LABELS =
Set.new(['type::maintenance', 'priority::3', 'severity::3', 'failure::flaky-test']).freeze
FOUND_IN_MR_LABEL =
'found:in MR'
FOUND_IN_MASTER_LABEL =
'found:master'

Constants included from Concerns::IssueReports

Concerns::IssueReports::FAILED_JOB_DESCRIPTION_REGEX, Concerns::IssueReports::JOB_URL_REGEX, Concerns::IssueReports::REPORT_ITEM_REGEX

Constants included from Concerns::Utils

Concerns::Utils::MAX_TITLE_LENGTH

Instance Method Summary collapse

Methods included from Concerns::IssueReports

#add_report_to_issue_description, #failed_issue_job_url, #failed_issue_job_urls, #initial_reports_section

Methods inherited from ReportAsIssue

#invoke!

Methods included from Concerns::Utils

#partial_file_path, #pipeline, #search_safe, #title_from_test

Constructor Details

#initialize(token:, input_files:, base_issue_labels: nil, confidential: false, dry_run: false, merge_request_iid: nil, project: nil, **_kwargs) ⇒ FlakyTestIssue

Returns a new instance of FlakyTestIssue.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/gitlab_quality/test_tooling/report/flaky_test_issue.rb', line 22

def initialize(
  token:,
  input_files:,
  base_issue_labels: nil,
  confidential: false,
  dry_run: false,
  merge_request_iid: nil,
  project: nil,
  **_kwargs)
  super(token: token, input_files: input_files, project: project, confidential: confidential, dry_run: dry_run)

  @base_issue_labels = Set.new(base_issue_labels)
  @merge_request_iid = merge_request_iid
end