Commit 258ecad6 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'exclude-geo-from-db-config-names' into 'master'

Remove geo database from db_config_names

See merge request gitlab-org/gitlab!84991
parents f62afee0 a6034cf0
......@@ -210,7 +210,7 @@ module Gitlab
end
def self.db_config_names
::ActiveRecord::Base.configurations.configs_for(env_name: Rails.env).map(&:name)
::ActiveRecord::Base.configurations.configs_for(env_name: Rails.env).map(&:name) - ['geo']
end
# This returns all matching schemas that a given connection can use
......
......@@ -235,6 +235,26 @@ RSpec.describe Gitlab::Database do
end
end
describe '.db_config_names' do
let(:expected) { %w[foo bar] }
it 'includes only main by default' do
allow(::ActiveRecord::Base).to receive(:configurations).and_return(
double(configs_for: %w[foo bar].map { |x| double(name: x) })
)
expect(described_class.db_config_names).to eq(expected)
end
it 'excludes geo when that is included' do
allow(::ActiveRecord::Base).to receive(:configurations).and_return(
double(configs_for: %w[foo bar geo].map { |x| double(name: x) })
)
expect(described_class.db_config_names).to eq(expected)
end
end
describe '.gitlab_schemas_for_connection' do
it 'does raise exception for invalid connection' do
expect { described_class.gitlab_schemas_for_connection(:invalid) }.to raise_error /key not found: "unknown"/
......
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