Class: GitlabQuality::TestTooling::Report::HealthProblemReporter

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

Overview

Base class for specific health problems reporting. Uses the API to create GitLab issues for any passed test coming from JSON test reports. We expect the test reports to come from a new RSpec process where we retried failing specs.

  • Takes the JSON test reports like rspec-*.json

  • Takes a project where flaky test issues should be created

  • For every passed test in the report:

    • Find issue by test hash or create a new issue if no issue was found

    • Add a Failures/Flakiness/Slowness/… report in the “<Failures/Flakiness/Slowness/…> reports” note

Direct Known Subclasses

FailedTestIssue, FlakyTestIssue, SlowTestIssue

Constant Summary collapse

BASE_SEARCH_LABELS =
['test'].freeze
FOUND_IN_MR_LABEL =
'~"found:in MR"'
FOUND_IN_MASTER_LABEL =
'~"found:master"'

Constants included from Concerns::IssueReports

Concerns::IssueReports::DAILY_REPORTS_THRESHOLDS, Concerns::IssueReports::DISPLAYED_HISTORY_REPORTS_THRESHOLD, Concerns::IssueReports::FAILED_JOB_DESCRIPTION_REGEX, Concerns::IssueReports::JOB_URL_REGEX, Concerns::IssueReports::LATEST_REPORTS_TO_SHOW, Concerns::IssueReports::REPORT_ITEM_REGEX

Constants included from Concerns::Utils

Concerns::Utils::MAX_TITLE_LENGTH

Instance Method Summary collapse

Methods included from Concerns::IssueReports

#failed_issue_job_url, #failed_issue_job_urls, #increment_reports, #increment_total_reports_count, #initial_reports_section

Methods included from Concerns::GroupAndCategoryLabels

#group_and_category_labels_for_test

Methods inherited from ReportAsIssue

#invoke!

Methods included from Concerns::Utils

#label_names_to_label_quick_action, #new_issue_title, #partial_file_path, #pipeline, #readable_duration, #search_safe, #title_from_test

Constructor Details

#initialize(input_files: [], dry_run: false, issue_update_enabled: true, gcs_enabled: false, gcs_project_id: nil, gcs_bucket: nil, gcs_credentials: nil, **kwargs) ⇒ HealthProblemReporter

Returns a new instance of HealthProblemReporter.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/gitlab_quality/test_tooling/report/health_problem_reporter.rb', line 26

def initialize(
  input_files: [],
  dry_run: false,
  issue_update_enabled: true,
  gcs_enabled: false,
  gcs_project_id: nil,
  gcs_bucket: nil,
  gcs_credentials: nil,
  **kwargs)
  super(input_files: input_files, dry_run: dry_run, **kwargs)

  @dry_run               = dry_run
  @issue_update_enabled  = issue_update_enabled
  @gcs_enabled           = gcs_enabled
  @gcs_project_id        = gcs_project_id
  @gcs_bucket            = gcs_bucket
  @gcs_credentials       = gcs_credentials
end

Instance Method Details

#most_recent_report_date_for_issue(issue_iid:) ⇒ Object



45
46
47
48
49
50
# File 'lib/gitlab_quality/test_tooling/report/health_problem_reporter.rb', line 45

def most_recent_report_date_for_issue(issue_iid:)
  reports_note = existing_reports_note(issue_iid: issue_iid)
  return unless reports_note

  most_recent_report_from_reports_note(reports_note)&.report_date
end