Commit ad8e7eb1 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'sh-disable-route-saving-for-geo-secondary' into 'master'

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

Closes #2743

See merge request !2260
parents 1496e092 090651f0
......@@ -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