Commit 090651f0 authored by Stan Hu's avatar Stan Hu

Don't attempt to save a new route on Geo secondary

The lazy initializer doesn't work on Geo for projects that have not
yet been visited. Geo would fail to sync projects that had this issue.

Closes #2743
parent 9188a762
......@@ -144,6 +144,8 @@ module Routable
end
def update_route
return if Gitlab::Geo.secondary?
prepare_route
route.save
end
......
......@@ -12,6 +12,16 @@ describe Group, 'Routable' do
it { is_expected.to have_many(:redirect_routes).dependent(:destroy) }
end
describe 'Geo secondary' do
it 'does not save route if route is not present' do
group.route.path = ''
allow(Gitlab::Geo).to receive(:secondary?).and_return(true)
expect(group).to receive(:update_route).and_call_original
expect { group.full_path }.to change { Route.count }.by(0)
end
end
describe 'Callbacks' do
it 'creates route record on create' do
expect(group.route.path).to eq(group.path)
......
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