Commit 841a5ca4 authored by Shinya Maeda's avatar Shinya Maeda

Ignore unimportant StatusSyncError message

This commit fixes the Deployment.sync_status_with method
to ignore unimportant exception messages.
parent d9c9774f
......@@ -327,6 +327,7 @@ class Deployment < ApplicationRecord
def sync_status_with(build)
return false unless ::Deployment.statuses.include?(build.status)
return false if build.created? || build.status == self.status
update_status!(build.status)
rescue StandardError => e
......
......@@ -851,6 +851,12 @@ RSpec.describe Deployment do
context 'with created deployment' do
let(:deployment_status) { :created }
context 'with created build' do
let(:build_status) { :created }
it_behaves_like 'ignoring build'
end
context 'with running build' do
let(:build_status) { :running }
......@@ -873,12 +879,16 @@ RSpec.describe Deployment do
context 'with running deployment' do
let(:deployment_status) { :running }
context 'with created build' do
let(:build_status) { :created }
it_behaves_like 'ignoring build'
end
context 'with running build' do
let(:build_status) { :running }
it_behaves_like 'gracefully handling error' do
let(:error_message) { %Q{Status cannot transition via \"run\"} }
end
it_behaves_like 'ignoring build'
end
context 'with finished build' do
......@@ -897,6 +907,12 @@ RSpec.describe Deployment do
context 'with finished deployment' do
let(:deployment_status) { :success }
context 'with created build' do
let(:build_status) { :created }
it_behaves_like 'ignoring build'
end
context 'with running build' do
let(:build_status) { :running }
......@@ -908,9 +924,13 @@ RSpec.describe Deployment do
context 'with finished build' do
let(:build_status) { :success }
it_behaves_like 'gracefully handling error' do
let(:error_message) { %Q{Status cannot transition via \"succeed\"} }
end
it_behaves_like 'ignoring build'
end
context 'with failed build' do
let(:build_status) { :failed }
it_behaves_like 'synchronizing deployment'
end
context 'with unrelated build' do
......
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