Commit a6034cf0 authored by Ian Baum's avatar Ian Baum Committed by Rémy Coutable

Remove geo database from db_config_names

* Breaks the gitlab:background_migrations:finalize on GDK instances
  using Geo
* Other usage of db_config_names does not apply to the 'geo' instance

Changelog: fixed
parent 26bc5803
......@@ -228,7 +228,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
......
......@@ -245,6 +245,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