Commit ccc7363d authored by Brett Walker's avatar Brett Walker Committed by Stan Hu

Getting "Geo secondary database is not configured" when only running EE (sha_attribute)

parent dc2e0194
...@@ -28,6 +28,11 @@ module ShaAttribute ...@@ -28,6 +28,11 @@ module ShaAttribute
unless column.type == :binary unless column.type == :binary
raise ArgumentError.new("sha_attribute #{name.inspect} is invalid since the column type is not :binary") raise ArgumentError.new("sha_attribute #{name.inspect} is invalid since the column type is not :binary")
end end
# EE-specific start
rescue Geo::TrackingBase::SecondaryNotConfigured
# EE specific end
rescue => error rescue => error
Gitlab::AppLogger.error "ShaAttribute initialization: #{error.message}" Gitlab::AppLogger.error "ShaAttribute initialization: #{error.message}"
raise raise
......
...@@ -68,6 +68,19 @@ describe ShaAttribute do ...@@ -68,6 +68,19 @@ describe ShaAttribute do
expect { model.sha_attribute(:name) }.to raise_error(ActiveRecord::NoDatabaseError) expect { model.sha_attribute(:name) }.to raise_error(ActiveRecord::NoDatabaseError)
end end
end end
# EE-specific start
context 'when Geo database is not configured' do
it 'allows the attribute to be added' do
allow(model).to receive(:table_exists?).and_raise(Geo::TrackingBase::SecondaryNotConfigured.new)
expect(model).not_to receive(:columns)
expect(model).to receive(:attribute)
model.sha_attribute(:name)
end
end
# EE specific end
end end
context 'when in production' do context 'when in production' 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