Class: GitlabQuality::TestTooling::Report::FlakyTestIssue
- Inherits:
-
HealthProblemReporter
- Object
- ReportAsIssue
- HealthProblemReporter
- GitlabQuality::TestTooling::Report::FlakyTestIssue
- 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 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 flakiness report in the “Flakiness reports” note
-
Constant Summary collapse
- IDENTITY_LABELS =
['test', 'failure::flaky-test', 'test-health:pass-after-retry', 'automation:bot-authored'].freeze
- NEW_ISSUE_LABELS =
Set.new(['type::maintenance', 'priority::3', 'severity::3', 'suppress-contributor-links', *IDENTITY_LABELS]).freeze
- REPORT_SECTION_HEADER =
'### Flakiness reports'- REPORTS_DOCUMENTATION =
"Flaky tests were detected. Please refer to the [Flaky tests reproducibility instructions](https://docs.gitlab.com/development/testing_guide/unhealthy_tests/#how-to-reproduce-a-flaky-test-locally)\nto learn more about how to reproduce them.\n"
Constants inherited from HealthProblemReporter
HealthProblemReporter::BASE_SEARCH_LABELS, HealthProblemReporter::FOUND_IN_MASTER_LABEL, HealthProblemReporter::FOUND_IN_MR_LABEL
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
-
#initialize(base_issue_labels: nil, **kwargs) ⇒ FlakyTestIssue
constructor
A new instance of FlakyTestIssue.
Methods inherited from HealthProblemReporter
#most_recent_report_date_for_issue
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
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(base_issue_labels: nil, **kwargs) ⇒ FlakyTestIssue
Returns a new instance of FlakyTestIssue.
23 24 25 26 27 28 29 |
# File 'lib/gitlab_quality/test_tooling/report/flaky_test_issue.rb', line 23 def initialize( base_issue_labels: nil, **kwargs) super(**kwargs) @base_issue_labels = Set.new(base_issue_labels) end |