Class: GitlabQuality::TestTooling::JobTraceAnalyzer
- Inherits:
-
Object
- Object
- GitlabQuality::TestTooling::JobTraceAnalyzer
- Defined in:
- lib/gitlab_quality/test_tooling/job_trace_analyzer.rb
Defined Under Namespace
Classes: FailureTraceDefinition
Constant Summary collapse
- FAILURE_TRACE_DEFINITIONS =
[ FailureTraceDefinition.new( type: :rspec, trace_start: "Failures:\n", trace_end: "[TEST PROF INFO]", language: :ruby, label: '~backend' ), FailureTraceDefinition.new( type: :jest, trace_start: "Summary of all failing tests\n", trace_end: "\nRan all test suites.", language: :javascript, label: '~frontend' ), FailureTraceDefinition.new( type: :workhorse, trace_start: "make: Entering directory '/builds/gitlab-org/gitlab/workhorse'", trace_end: "make: Leaving directory '/builds/gitlab-org/gitlab/workhorse'", language: :go, label: '~workhorse' ), FailureTraceDefinition.new( type: :rubocop, trace_start: "Running RuboCop in graceful mode:", trace_end: "section_end", language: :ruby, label: '~backend' ) ].freeze
- TRANSIENT_ROOT_CAUSE_TO_TRACE_MAP =
{ failed_to_pull_image: ['job failed: failed to pull image'], gitlab_com_overloaded: ['gitlab is currently unable to handle this request due to load'], runner_disk_full: [ 'no space left on device', 'Check free disk space' ], job_timeout: [ 'ERROR: Job failed: execution took longer than', 'Rspec suite is exceeding the 80 minute limit and is forced to exit with error' ], gitaly: ['gitaly spawn failed'], infrastructure: [ 'the requested url returned error: 5', # any 5XX error code should be transient 'error: downloading artifacts from coordinator', 'error: uploading artifacts as "archive" to coordinator', '500 Internal Server Error', "Internal Server Error 500", '502 Bad Gateway', '503 Service Unavailable', 'Error: EEXIST: file already exists', 'Failed to connect to 127.0.0.1', "Failed to open TCP connection to", 'connection reset by peer', 'segmentation fault', 'no space left on device', 'Check free disk space', 'CLUSTERDOWN', 'Redis client could not fetch cluster information: Connection refused' ], flaky_test: [ "We have detected a PG::QueryCanceled error in the specs, so we're failing early" ] }.freeze
- AFTER_SCRIPT_TRACE_START_MARKER =
'Running after_script'
Instance Attribute Summary collapse
-
#job_id ⇒ Object
readonly
Returns the value of attribute job_id.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
- #found_infrastructure_error? ⇒ Boolean
-
#initialize(project:, token:, job_id:) ⇒ JobTraceAnalyzer
constructor
A new instance of JobTraceAnalyzer.
Constructor Details
#initialize(project:, token:, job_id:) ⇒ JobTraceAnalyzer
Returns a new instance of JobTraceAnalyzer.
80 81 82 83 84 |
# File 'lib/gitlab_quality/test_tooling/job_trace_analyzer.rb', line 80 def initialize(project:, token:, job_id:) @project = project @token = token @job_id = job_id end |
Instance Attribute Details
#job_id ⇒ Object (readonly)
Returns the value of attribute job_id.
8 9 10 |
# File 'lib/gitlab_quality/test_tooling/job_trace_analyzer.rb', line 8 def job_id @job_id end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
8 9 10 |
# File 'lib/gitlab_quality/test_tooling/job_trace_analyzer.rb', line 8 def project @project end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
8 9 10 |
# File 'lib/gitlab_quality/test_tooling/job_trace_analyzer.rb', line 8 def token @token end |
Instance Method Details
#found_infrastructure_error? ⇒ Boolean
86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/gitlab_quality/test_tooling/job_trace_analyzer.rb', line 86 def found_infrastructure_error? trace_to_search = failure_summary || main_trace TRANSIENT_ROOT_CAUSE_TO_TRACE_MAP[:infrastructure].any? do |search_string| found = trace_to_search.downcase.include?(search_string.downcase) puts "Found infrastructure error stacktrace: #{search_string}" if found found end end |