gitlab_quality-test_tooling 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d991bf33f977c242a64aeaef438f73085f6aeaf7575674ace10a36ea62484be
|
4
|
+
data.tar.gz: 7e2b37d11e14b21d2acb9b8bcd49094331d0fd06e799cf041a494413295367d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d73508a586cacef8d59d4e40d39ae198d61f22b900f0995705ddf5753467b23676eb71adb90b08e4a9064aa94f250edb78665dd371edef1e735f36e57ccbc547
|
7
|
+
data.tar.gz: f858ca470f52e7b5dfe86e49016f5f45ab19132c3946ea5f3d9c445ca739da336bfa5ee0d36fab79d88b8d6d26af5392812cef400a75b52cd9dc9a3081d06627
|
data/Gemfile.lock
CHANGED
@@ -7,6 +7,38 @@ module GitlabQuality
|
|
7
7
|
class JobTraceAnalyzer
|
8
8
|
attr_reader :project, :token, :job_id
|
9
9
|
|
10
|
+
FailureTraceDefinition = Struct.new(:type, :trace_start, :trace_end, :language, :label, keyword_init: true)
|
11
|
+
FAILURE_TRACE_DEFINITIONS = [
|
12
|
+
FailureTraceDefinition.new(
|
13
|
+
type: :rspec,
|
14
|
+
trace_start: "Failures:\n",
|
15
|
+
trace_end: "[TEST PROF INFO]",
|
16
|
+
language: :ruby,
|
17
|
+
label: '~backend'
|
18
|
+
),
|
19
|
+
FailureTraceDefinition.new(
|
20
|
+
type: :jest,
|
21
|
+
trace_start: "Summary of all failing tests\n",
|
22
|
+
trace_end: "\nRan all test suites.",
|
23
|
+
language: :javascript,
|
24
|
+
label: '~frontend'
|
25
|
+
),
|
26
|
+
FailureTraceDefinition.new(
|
27
|
+
type: :workhorse,
|
28
|
+
trace_start: "make: Entering directory '/builds/gitlab-org/gitlab/workhorse'",
|
29
|
+
trace_end: "make: Leaving directory '/builds/gitlab-org/gitlab/workhorse'",
|
30
|
+
language: :go,
|
31
|
+
label: '~workhorse'
|
32
|
+
),
|
33
|
+
FailureTraceDefinition.new(
|
34
|
+
type: :rubocop,
|
35
|
+
trace_start: "Running RuboCop in graceful mode:",
|
36
|
+
trace_end: "section_end",
|
37
|
+
language: :ruby,
|
38
|
+
label: '~backend'
|
39
|
+
)
|
40
|
+
].freeze
|
41
|
+
|
10
42
|
TRANSIENT_ROOT_CAUSE_TO_TRACE_MAP =
|
11
43
|
{
|
12
44
|
failed_to_pull_image: ['job failed: failed to pull image'],
|
@@ -42,6 +74,8 @@ module GitlabQuality
|
|
42
74
|
]
|
43
75
|
}.freeze
|
44
76
|
|
77
|
+
AFTER_SCRIPT_TRACE_START_MARKER = 'Running after_script'
|
78
|
+
|
45
79
|
def initialize(project:, token:, job_id:)
|
46
80
|
@project = project
|
47
81
|
@token = token
|
@@ -49,8 +83,10 @@ module GitlabQuality
|
|
49
83
|
end
|
50
84
|
|
51
85
|
def found_infrastructure_error?
|
86
|
+
trace_to_search = failure_summary || main_trace
|
87
|
+
|
52
88
|
TRANSIENT_ROOT_CAUSE_TO_TRACE_MAP[:infrastructure].any? do |search_string|
|
53
|
-
found =
|
89
|
+
found = trace_to_search.downcase.include?(search_string.downcase)
|
54
90
|
|
55
91
|
puts "Found infrastructure error stacktrace: #{search_string}" if found
|
56
92
|
|
@@ -60,9 +96,35 @@ module GitlabQuality
|
|
60
96
|
|
61
97
|
private
|
62
98
|
|
99
|
+
def detected_failure_trace_definition
|
100
|
+
return @detected_failure_trace_definition if defined?(@detected_failure_trace_definition)
|
101
|
+
|
102
|
+
@detected_failure_trace_definition = FAILURE_TRACE_DEFINITIONS.find do |failure_trace_definition|
|
103
|
+
job_trace.include?(failure_trace_definition.trace_start) &&
|
104
|
+
job_trace.include?(failure_trace_definition.trace_end)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
63
108
|
def job_trace
|
64
109
|
@job_trace ||= GitlabClient::JobClient.new(project: project, token: token, job_id: job_id).job_trace
|
65
110
|
end
|
111
|
+
|
112
|
+
def main_trace
|
113
|
+
return job_trace unless job_trace.include?(AFTER_SCRIPT_TRACE_START_MARKER)
|
114
|
+
|
115
|
+
job_trace.split(AFTER_SCRIPT_TRACE_START_MARKER).first
|
116
|
+
end
|
117
|
+
|
118
|
+
def failure_summary
|
119
|
+
return unless detected_failure_trace_definition
|
120
|
+
|
121
|
+
@failure_summary ||= main_trace
|
122
|
+
.split(detected_failure_trace_definition.trace_start)
|
123
|
+
.last
|
124
|
+
.split(detected_failure_trace_definition.trace_end)
|
125
|
+
.first
|
126
|
+
.chomp
|
127
|
+
end
|
66
128
|
end
|
67
129
|
end
|
68
130
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab_quality-test_tooling
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitLab Quality
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: climate_control
|