Commit 2de4647f authored by Marius Bobin's avatar Marius Bobin

Implement reviewer feedback

parent 4b37c7bf
...@@ -199,18 +199,14 @@ class CommitStatus < ApplicationRecord ...@@ -199,18 +199,14 @@ class CommitStatus < ApplicationRecord
end end
# Extracts common job name for matrix and parallel builds: # Extracts common job name for matrix and parallel builds:
# 'rspec:linux: [aws, max memory]' => 'rspec:linux'
# 'rspec:linux: 1/10' => 'rspec:linux' # 'rspec:linux: 1/10' => 'rspec:linux'
# 'rspec:linux: [aws, max memory]' => 'rspec:linux'
# #
def group_name def group_name
if Gitlab::Ci::Features.new_matrix_job_names_enabled? group_name = name.to_s.gsub(%r{\d+[\s:\/\\]+\d+\s*}, '')
matches = name.to_s.match(/\A(.*?): \[+(.*, )+(.*)\]\z/) group_name.gsub!(%r{: \[.+, .+\]\s*\z}, '') if Gitlab::Ci::Features.new_matrix_job_names_enabled?
group_name = matches.to_a[1] || name group_name.strip!
else group_name
group_name = name
end
group_name.to_s.gsub(%r{\d+[\s:/\\]+\d+\s*}, '').strip
end end
def failed_but_allowed? def failed_but_allowed?
......
...@@ -514,9 +514,10 @@ RSpec.describe CommitStatus do ...@@ -514,9 +514,10 @@ RSpec.describe CommitStatus do
'rspec: [aws]' => 'rspec: [aws]', 'rspec: [aws]' => 'rspec: [aws]',
'rspec: [aws] 0/1' => 'rspec: [aws]', 'rspec: [aws] 0/1' => 'rspec: [aws]',
'rspec: [aws, max memory]' => 'rspec', 'rspec: [aws, max memory]' => 'rspec',
'rspec:linux: [aws, max memory]' => 'rspec:linux', 'rspec:linux: [aws, max memory, data]' => 'rspec:linux',
'rspec: [inception: [something, other thing], value]' => 'rspec', 'rspec: [inception: [something, other thing], value]' => 'rspec',
'rspec:windows 0/1: [name, other]' => 'rspec:windows' 'rspec:windows 0/1: [name, other]' => 'rspec:windows',
'rspec:windows: [name, other] 0/1' => 'rspec:windows'
} }
tests.each do |name, group_name| tests.each do |name, group_name|
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment