Commit 32ee2a49 authored by Jacopo's avatar Jacopo

Minor review changes

parent 3097215d
...@@ -77,7 +77,7 @@ module Gitlab ...@@ -77,7 +77,7 @@ module Gitlab
match = "" match = ""
matched = reverse_line do |line| reverse_line do |line|
line.chomp! line.chomp!
matches = regex.scan(line) matches = regex.scan(line)
next unless matches.is_a?(Array) next unless matches.is_a?(Array)
...@@ -85,10 +85,10 @@ module Gitlab ...@@ -85,10 +85,10 @@ module Gitlab
match = matches.flatten.last match = matches.flatten.last
coverage = match.gsub(/\d+(\.\d+)?/).first coverage = match.gsub(/\d+(\.\d+)?/).first
break coverage if coverage.present? return coverage if coverage.present? # rubocop:disable Cop/AvoidReturnFromBlocks
end end
matched.presence nil
rescue rescue
# if bad regex or something goes wrong we dont want to interrupt transition # if bad regex or something goes wrong we dont want to interrupt transition
# so we just silently ignore error for now # so we just silently ignore error for now
......
...@@ -3,18 +3,15 @@ module Gitlab ...@@ -3,18 +3,15 @@ module Gitlab
module_function module_function
def retry_lock(subject, retries = 100, &block) def retry_lock(subject, retries = 100, &block)
loop do ActiveRecord::Base.transaction do
begin yield(subject)
ActiveRecord::Base.transaction do
return yield(subject) # rubocop:disable Cop/AvoidReturnFromBlocks
end
rescue ActiveRecord::StaleObjectError
retries -= 1
raise unless retries >= 0
subject.reload
end
end end
rescue ActiveRecord::StaleObjectError
retries -= 1
raise unless retries >= 0
subject.reload
retry
end end
alias_method :retry_optimistic_lock, :retry_lock alias_method :retry_optimistic_lock, :retry_lock
......
...@@ -20,14 +20,14 @@ module QA::Page ...@@ -20,14 +20,14 @@ module QA::Page
def running? def running?
within('.ci-header-container') do within('.ci-header-container') do
break page.has_content?('running') page.has_content?('running')
end end
end end
def has_build?(name, status: :success) def has_build?(name, status: :success)
within('.pipeline-graph') do within('.pipeline-graph') do
within('.ci-job-component', text: name) do within('.ci-job-component', text: name) do
return has_selector?(".ci-status-icon-#{status}") # rubocop:disable Cop/AvoidReturnFromBlocks has_selector?(".ci-status-icon-#{status}")
end end
end end
end end
......
...@@ -458,7 +458,7 @@ describe Gitlab::Ci::Trace do ...@@ -458,7 +458,7 @@ describe Gitlab::Ci::Trace do
context 'when job does not have trace artifact' do context 'when job does not have trace artifact' do
context 'when trace file stored in default path' do context 'when trace file stored in default path' do
let!(:build) { create(:ci_build, :success, :trace_live) } let!(:build) { create(:ci_build, :success, :trace_live) }
let!(:src_path) { trace.read { |s| break s.path } } let!(:src_path) { trace.read { |s| s.path } }
let!(:src_checksum) { Digest::SHA256.file(src_path).hexdigest } let!(:src_checksum) { Digest::SHA256.file(src_path).hexdigest }
it_behaves_like 'archive trace file' it_behaves_like 'archive trace file'
......
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