diff options
Diffstat (limited to 'spec/lib/gitlab/database/each_database_spec.rb')
-rw-r--r-- | spec/lib/gitlab/database/each_database_spec.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/spec/lib/gitlab/database/each_database_spec.rb b/spec/lib/gitlab/database/each_database_spec.rb index 75b543bee85..2653297c81a 100644 --- a/spec/lib/gitlab/database/each_database_spec.rb +++ b/spec/lib/gitlab/database/each_database_spec.rb @@ -70,11 +70,13 @@ RSpec.describe Gitlab::Database::EachDatabase do # Clear the memoization because the return of Gitlab::Database#schemas_to_base_models depends stubbed value clear_memoization(:@schemas_to_base_models) - clear_memoization(:@schemas_to_base_models_ee) end it 'only yields the unshared connections' do - expect(Gitlab::Database).to receive(:db_config_share_with).exactly(3).times.and_return(nil, 'main', 'main') + # if this is `non-main` connection make it shared with `main` + allow(Gitlab::Database).to receive(:db_config_share_with) do |db_config| + db_config.name != 'main' ? 'main' : nil + end expect { |b| described_class.each_database_connection(include_shared: false, &b) } .to yield_successive_args([ActiveRecord::Base.connection, 'main']) |