Commit 6a6a8cec authored by Stan Hu's avatar Stan Hu

Merge branch...

Merge branch '5926-getting-geo-secondary-database-is-not-configured-when-only-running-ee-sha_attribute' into 'master'

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

Closes #5926

See merge request gitlab-org/gitlab-ee!5614
parents dc2e0194 ccc7363d
......@@ -28,6 +28,11 @@ module ShaAttribute
unless column.type == :binary
raise ArgumentError.new("sha_attribute #{name.inspect} is invalid since the column type is not :binary")
end
# EE-specific start
rescue Geo::TrackingBase::SecondaryNotConfigured
# EE specific end
rescue => error
Gitlab::AppLogger.error "ShaAttribute initialization: #{error.message}"
raise
......
......@@ -68,6 +68,19 @@ describe ShaAttribute do
expect { model.sha_attribute(:name) }.to raise_error(ActiveRecord::NoDatabaseError)
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
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