gitlab_quality-test_tooling 1.31.0 → 1.32.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/test_meta/processor/add_to_blocking_processor.rb +6 -3
- data/lib/gitlab_quality/test_tooling/test_meta/processor/add_to_quarantine_processor.rb +6 -3
- data/lib/gitlab_quality/test_tooling/test_meta/test_meta_updater.rb +20 -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: f3c72dad2be7e5a1e112667f8239dff242bac1d69298fd5bf664745c707d26ba
|
4
|
+
data.tar.gz: 2261f70832512fd425cc4f49316f3a0a2e5211b4a0d83d5149ae72cb9d899cb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0395ec1d6abafc42099e47d961c468690265996fd903c1c105742735122aeef300baf27597163ccd510dc61d33721fa92180a72990881144f6a9a017a7a5d616'
|
7
|
+
data.tar.gz: 7b179fbba4870967780b53fc68b98f0f237bcc0c5595d9b68c37e5976b3964f286aeb480d321ff4e5daa1b8456881f1f49e3d72fb929809bc175ace04d70437e
|
data/Gemfile.lock
CHANGED
@@ -50,18 +50,21 @@ module GitlabQuality
|
|
50
50
|
|
51
51
|
private
|
52
52
|
|
53
|
-
attr_reader :context, :file_path, :file, :file_contents, :example_name, :mr_title, :changed_line_no
|
53
|
+
attr_reader :context, :file_path, :file, :file_contents, :example_name, :mr_title, :changed_line_no, :matched_lines
|
54
54
|
|
55
55
|
# Checks if there is already an MR open
|
56
56
|
#
|
57
57
|
# @return [Boolean]
|
58
|
-
def proceed_with_commit?
|
58
|
+
def proceed_with_commit? # rubocop:disable Metrics/AbcSize
|
59
59
|
if changed_line_no.negative?
|
60
60
|
Runtime::Logger.info(" No lines were changed in #{file_path}. Will not proceed with creating MR.")
|
61
61
|
return false
|
62
62
|
elsif context.commit_processed?(file_path, changed_line_no)
|
63
63
|
Runtime::Logger.info(" Record already processed for #{file_path}:#{changed_line_no}. Will not proceed with creating MR.")
|
64
64
|
return false
|
65
|
+
elsif context.quarantined?(matched_lines, file_contents)
|
66
|
+
Runtime::Logger.info(" This test is in quarantine: #{file_path}:#{changed_line_no}. Will not proceed with creating MR.")
|
67
|
+
return false
|
65
68
|
end
|
66
69
|
|
67
70
|
true
|
@@ -120,7 +123,7 @@ module GitlabQuality
|
|
120
123
|
#
|
121
124
|
# @return [Array<String, Integer>] first value holds the new content, the second value holds the line number of the test
|
122
125
|
def add_metadata # rubocop:disable Metrics/AbcSize
|
123
|
-
matched_lines = context.find_example_match_lines(file_contents, example_name)
|
126
|
+
@matched_lines = context.find_example_match_lines(file_contents, example_name)
|
124
127
|
|
125
128
|
if matched_lines.any? { |line| line[0].include?(':blocking') }
|
126
129
|
Runtime::Logger.info("Example '#{example_name}' is already blocking")
|
@@ -60,12 +60,12 @@ module GitlabQuality
|
|
60
60
|
private
|
61
61
|
|
62
62
|
attr_reader :context, :file_path, :file_contents, :failure_issue_url, :example_name,
|
63
|
-
:mr_title, :failure_issue, :changed_line_no
|
63
|
+
:mr_title, :failure_issue, :changed_line_no, :matched_lines
|
64
64
|
|
65
65
|
# Checks if the failure issue is closed or if there is already an MR open
|
66
66
|
#
|
67
67
|
# @return [Boolean]
|
68
|
-
def proceed_with_commit?
|
68
|
+
def proceed_with_commit? # rubocop:disable Metrics/AbcSize
|
69
69
|
if context.issue_is_closed?(failure_issue)
|
70
70
|
Runtime::Logger.info(" Failure issue '#{failure_issue_url}' is closed. Will not proceed with creating MR.")
|
71
71
|
return false
|
@@ -75,6 +75,9 @@ module GitlabQuality
|
|
75
75
|
elsif failure_is_related_to_test_environment?
|
76
76
|
Runtime::Logger.info(" Failure issue '#{failure_issue_url}' is environment related. Will not proceed with creating MR.")
|
77
77
|
return false
|
78
|
+
elsif context.quarantined?(matched_lines, file_contents)
|
79
|
+
Runtime::Logger.info(" This test is already in quarantine: #{file_path}:#{changed_line_no}. Will not proceed with creating MR.")
|
80
|
+
return false
|
78
81
|
end
|
79
82
|
|
80
83
|
true
|
@@ -199,7 +202,7 @@ module GitlabQuality
|
|
199
202
|
#
|
200
203
|
# @return [Array<String, Integer>] first value holds the new content, the second value holds the line number of the test
|
201
204
|
def add_metadata # rubocop:disable Metrics/AbcSize
|
202
|
-
matched_lines = context.find_example_match_lines(file_contents, example_name)
|
205
|
+
@matched_lines = context.find_example_match_lines(file_contents, example_name)
|
203
206
|
|
204
207
|
context.update_matched_line(matched_lines.last, file_contents.dup) do |line|
|
205
208
|
indentation = context.indentation(line)
|
@@ -129,6 +129,26 @@ module GitlabQuality
|
|
129
129
|
matched_lines
|
130
130
|
end
|
131
131
|
|
132
|
+
# Scans the content from the matched line until `do` is found to look for quarantine token
|
133
|
+
#
|
134
|
+
# @param [Array] matched_lines an array of arrays containing the matched line and their index
|
135
|
+
# @param [String] file_contents the content of the spec file
|
136
|
+
# @return [Bolean]
|
137
|
+
def quarantined?(matched_lines, file_contents)
|
138
|
+
lines = file_contents.split("\n")
|
139
|
+
|
140
|
+
matched_lines.each do |matched_line|
|
141
|
+
matched_line_starting_index = matched_line[1]
|
142
|
+
|
143
|
+
lines[matched_line_starting_index..].each do |line|
|
144
|
+
return true if line.include?('quarantine: {')
|
145
|
+
break if / do$/.match?(line)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
false
|
150
|
+
end
|
151
|
+
|
132
152
|
# Update the provided matched_line with content from the block if given
|
133
153
|
#
|
134
154
|
# @param [Array<String, Integer>] matched_line first value holds the line content, the second value holds the line number
|
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: 1.
|
4
|
+
version: 1.32.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-07-
|
11
|
+
date: 2024-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: climate_control
|