gitlab_quality-test_tooling 1.31.0 → 1.32.1
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/report/report_as_issue.rb +3 -3
- 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: e3c5680095668ee71c082a8183693ec031714d59641fbd0ba7f2ef32555a73dc
|
4
|
+
data.tar.gz: 42c9bc53f92cb752fddb7cbf529e08f951245c751dcfac35835fd002a307ed30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1f2f1791fd8e59b4e4b8e2a3ef5ca1d0c501d34ccdb9525eb621b3776495d28ac810c1280a5a0b3007b7c73aa9b08775ce87c9da5ef01cda1d396c7c79f1840
|
7
|
+
data.tar.gz: e7d5b62b448ce3e48a50368feebc11bd5d2956f61c34628de7484ad658fdc6d1ab027eee716d754b8d16d2732245820ee220a809199b1ef9295c7457b54f7ea4
|
data/Gemfile.lock
CHANGED
@@ -124,12 +124,12 @@ module GitlabQuality
|
|
124
124
|
issue_attrs = {}
|
125
125
|
|
126
126
|
new_description = new_issue_description(test)
|
127
|
-
issue_attrs[:description] = new_description
|
127
|
+
issue_attrs[:description] = new_description if issue.description != new_description
|
128
128
|
|
129
129
|
new_labels = up_to_date_labels(test: test, issue: issue).to_a
|
130
|
-
issue_attrs[:
|
130
|
+
issue_attrs[:add_labels] = new_labels if (new_labels - issue.labels).any?
|
131
131
|
|
132
|
-
gitlab.edit_issue(iid: issue.iid, options: issue_attrs)
|
132
|
+
gitlab.edit_issue(iid: issue.iid, options: issue_attrs) if issue_attrs.any?
|
133
133
|
end
|
134
134
|
|
135
135
|
def issue_labels(issue)
|
@@ -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.1
|
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-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: climate_control
|