Class: GitlabQuality::TestTooling::Report::RelateFailureIssue
- Inherits:
-
ReportAsIssue
- Object
- ReportAsIssue
- GitlabQuality::TestTooling::Report::RelateFailureIssue
- Defined in:
- lib/gitlab_quality/test_tooling/report/relate_failure_issue.rb
Overview
Uses the API to create or update GitLab issues with the results of tests from RSpec report files.
-
Uses the API to create or update GitLab issues with the results of tests from RSpec report files.
-
Takes the JSON test run reports, e.g. ‘$CI_PROJECT_DIR/gitlab-qa-run-/*/rspec-*.json`
-
Takes a project where failure issues should be created
-
Find issue by title (with test description or test file), then further filter by stack trace, then pick the better-matching one
-
Add the failed job to the issue description, and update labels
-
Can group similar failures together when group_similar option is enabled
Constant Summary collapse
- DEFAULT_MAX_DIFF_RATIO_FOR_DETECTION =
0.15- SYSTEMIC_EXCEPTIONS_THRESHOLD =
10- SPAM_THRESHOLD_FOR_FAILURE_ISSUES =
3- FAILURE_STACKTRACE_REGEX =
%r{(?:(?:.*Failure/Error:(?<stacktrace>.+))|(?<stacktrace>.+))}m- ISSUE_STACKTRACE_REGEX =
/### Stack trace\s*(```)#{FAILURE_STACKTRACE_REGEX}(```)\n*\n###/m- NEW_ISSUE_LABELS =
Set.new(%w[test failure::new priority::2 automation:bot-authored type::maintenance suppress-contributor-links]).freeze
- SCREENSHOT_IGNORED_ERRORS =
['500 Internal Server Error', 'fabricate_via_api!', 'Error Code 500'].freeze
- FAILURE_ISSUE_GUIDE_URL =
"https://handbook.gitlab.com/handbook/engineering/testing/guide-to-e2e-test-failure-issues/"- FAILURE_ISSUE_HANDBOOK_GUIDE =
"**:rotating_light: [End-to-End Test Failure Issue Debugging Guide](#{FAILURE_ISSUE_GUIDE_URL}) :rotating_light:**\n".freeze
- DIFF_PROJECT_MAPPINGS =
Map commits to security fork (gitlab-org/security/gitlab) for gitlab-org/gitlab since security patches exist there before being released to the public repository
{ 'gitlab-org/quality/e2e-test-issues' => 'gitlab-org/security/gitlab', 'gitlab-org/quality/test-failure-issues' => 'gitlab-org/security/gitlab', 'gitlab-org/gitlab' => 'gitlab-org/security/gitlab', 'gitlab-org/customers-gitlab-com' => 'gitlab-org/customers-gitlab-com' }.freeze
- COMMIT_PROJECT_MAPPINGS =
Don’t use the E2E test issues project for commit parent
{ 'gitlab-org/quality/e2e-test-issues' => 'gitlab-org/gitlab', 'gitlab-org/quality/test-failure-issues' => 'gitlab-org/gitlab' }.freeze
- OPS_RELEASES_METADATA_PROJECT =
The project contains record of the deployments we use to determine the commit diff
'gitlab-org/release/metadata'- ENVIRONMENT_MAPPING =
Naming of the environments are different between ‘gitlab-org/release/metadata` and `gitlab-org/quality` This maps the gitlab-org/quality environment names to the equivalent in `gitlab-org/release/metadata`
{ 'production' => 'gprd', 'canary' => 'gprd-cny', 'staging' => 'gstg', 'staging-canary' => 'gstg-cny', 'staging-ref' => 'gstg-ref', 'preprod' => 'pre', 'release' => 'release' }.freeze
- MultipleIssuesFound =
Class.new(StandardError)
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(max_diff_ratio: DEFAULT_MAX_DIFF_RATIO_FOR_DETECTION, system_logs: [], base_issue_labels: nil, exclude_labels_for_search: nil, metrics_files: [], group_similar: false, environment_issues_output_file: nil, **kwargs) ⇒ RelateFailureIssue
constructor
A new instance of RelateFailureIssue.
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 included from Concerns::FindSetDri
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(max_diff_ratio: DEFAULT_MAX_DIFF_RATIO_FOR_DETECTION, system_logs: [], base_issue_labels: nil, exclude_labels_for_search: nil, metrics_files: [], group_similar: false, environment_issues_output_file: nil, **kwargs) ⇒ RelateFailureIssue
Returns a new instance of RelateFailureIssue.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/gitlab_quality/test_tooling/report/relate_failure_issue.rb', line 67 def initialize( max_diff_ratio: DEFAULT_MAX_DIFF_RATIO_FOR_DETECTION, system_logs: [], base_issue_labels: nil, exclude_labels_for_search: nil, metrics_files: [], group_similar: false, environment_issues_output_file: nil, **kwargs) super @max_diff_ratio = max_diff_ratio.to_f @system_logs = Dir.glob(system_logs) @base_issue_labels = Set.new(base_issue_labels) @exclude_labels_for_search = Set.new(exclude_labels_for_search) @issue_type = 'issue' @commented_issue_list = Set.new @metrics_files = Array(metrics_files) @group_similar = group_similar @environment_issues_output_file = environment_issues_output_file end |