gitlab_quality-test_tooling 2.3.0 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/gitlab_quality/test_tooling/job_trace_analyzer.rb +65 -2
- data/lib/gitlab_quality/test_tooling/report/relate_failure_issue.rb +1 -1
- data/lib/gitlab_quality/test_tooling/test_result/base_test_result.rb +6 -0
- data/lib/gitlab_quality/test_tooling/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd181fe7622793361cd772d2f949d1a8922f4b0762c2d50ae9f839fdfd69bb86
|
4
|
+
data.tar.gz: aaa900d8e19eff7ae0016bda52bf6dc3722aa4e4fe288f16c16d6685254c831a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b5e1a85230726944574ec3c92c9fbe0e8a547776a6a7f7ce07d4db1889abf1a23b35a8b13b55d79eaf90eb3b7cfac4ec47960efa9eedaa509ffa02dd9655077
|
7
|
+
data.tar.gz: 47f438135b5ac5d4cc2cfc95a30e6a917f6de4c714bd8f42ed74c4d51439af925ac1424bf2105e71c76cd581f5faf287d8d0a415bf4c220df36df2fd85ec6149
|
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'],
|
@@ -35,13 +67,16 @@ module GitlabQuality
|
|
35
67
|
'segmentation fault',
|
36
68
|
'no space left on device',
|
37
69
|
'Check free disk space',
|
38
|
-
'CLUSTERDOWN'
|
70
|
+
'CLUSTERDOWN',
|
71
|
+
'Redis client could not fetch cluster information: Connection refused'
|
39
72
|
],
|
40
73
|
flaky_test: [
|
41
74
|
"We have detected a PG::QueryCanceled error in the specs, so we're failing early"
|
42
75
|
]
|
43
76
|
}.freeze
|
44
77
|
|
78
|
+
AFTER_SCRIPT_TRACE_START_MARKER = 'Running after_script'
|
79
|
+
|
45
80
|
def initialize(project:, token:, job_id:)
|
46
81
|
@project = project
|
47
82
|
@token = token
|
@@ -49,8 +84,10 @@ module GitlabQuality
|
|
49
84
|
end
|
50
85
|
|
51
86
|
def found_infrastructure_error?
|
87
|
+
trace_to_search = failure_summary || main_trace
|
88
|
+
|
52
89
|
TRANSIENT_ROOT_CAUSE_TO_TRACE_MAP[:infrastructure].any? do |search_string|
|
53
|
-
found =
|
90
|
+
found = trace_to_search.downcase.include?(search_string.downcase)
|
54
91
|
|
55
92
|
puts "Found infrastructure error stacktrace: #{search_string}" if found
|
56
93
|
|
@@ -60,9 +97,35 @@ module GitlabQuality
|
|
60
97
|
|
61
98
|
private
|
62
99
|
|
100
|
+
def detected_failure_trace_definition
|
101
|
+
return @detected_failure_trace_definition if defined?(@detected_failure_trace_definition)
|
102
|
+
|
103
|
+
@detected_failure_trace_definition = FAILURE_TRACE_DEFINITIONS.find do |failure_trace_definition|
|
104
|
+
job_trace.include?(failure_trace_definition.trace_start) &&
|
105
|
+
job_trace.include?(failure_trace_definition.trace_end)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
63
109
|
def job_trace
|
64
110
|
@job_trace ||= GitlabClient::JobClient.new(project: project, token: token, job_id: job_id).job_trace
|
65
111
|
end
|
112
|
+
|
113
|
+
def main_trace
|
114
|
+
return job_trace unless job_trace.include?(AFTER_SCRIPT_TRACE_START_MARKER)
|
115
|
+
|
116
|
+
job_trace.split(AFTER_SCRIPT_TRACE_START_MARKER).first
|
117
|
+
end
|
118
|
+
|
119
|
+
def failure_summary
|
120
|
+
return unless detected_failure_trace_definition
|
121
|
+
|
122
|
+
@failure_summary ||= main_trace
|
123
|
+
.split(detected_failure_trace_definition.trace_start)
|
124
|
+
.last
|
125
|
+
.split(detected_failure_trace_definition.trace_end)
|
126
|
+
.first
|
127
|
+
.chomp
|
128
|
+
end
|
66
129
|
end
|
67
130
|
end
|
68
131
|
end
|
@@ -106,7 +106,7 @@ module GitlabQuality
|
|
106
106
|
begin
|
107
107
|
issue = find_issue_and_update_reports(test)
|
108
108
|
|
109
|
-
issue = create_issue(test) unless issue || test.quarantine?
|
109
|
+
issue = create_issue(test) unless issue || (test.quarantine? && !test.conditional_quarantine?)
|
110
110
|
|
111
111
|
issue
|
112
112
|
rescue MultipleIssuesFound => e
|
@@ -100,6 +100,12 @@ module GitlabQuality
|
|
100
100
|
!!quarantine
|
101
101
|
end
|
102
102
|
|
103
|
+
def conditional_quarantine?
|
104
|
+
return true if quarantine? && quarantine.is_a?(Hash) && quarantine.has_key?('only')
|
105
|
+
|
106
|
+
false
|
107
|
+
end
|
108
|
+
|
103
109
|
def file
|
104
110
|
@file ||= relative_file.start_with?('qa/') ? "qa/#{relative_file}" : relative_file
|
105
111
|
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.5.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:
|
11
|
+
date: 2025-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: climate_control
|