Commit 32ee2a49 authored by Jacopo's avatar Jacopo

Minor review changes

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