diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2017-02-22 15:43:01 +0100 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2017-02-22 15:47:53 +0100 |
commit | cf521c95761540f273804d23a1150dbb0af4e63b (patch) | |
tree | 99fdbd856f706dd0422dabf096c0b67774a0f2a5 /spec/lib | |
parent | 12ac140a119b6802ebdfc3c596264f7fc292d4df (diff) | |
download | gitlab-ce-cf521c95761540f273804d23a1150dbb0af4e63b.tar.gz |
Allow setting of a custom connection pool host
This allows you to set a custom host when calling
Gitlab::Database.create_connection_pool. This is necessary for load
balancing as in this case we want to inherit all settings except for the
hostname.
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/database_spec.rb | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/spec/lib/gitlab/database_spec.rb b/spec/lib/gitlab/database_spec.rb index f01c42aff91..edd01d032c8 100644 --- a/spec/lib/gitlab/database_spec.rb +++ b/spec/lib/gitlab/database_spec.rb @@ -119,9 +119,24 @@ describe Gitlab::Database, lib: true do it 'creates a new connection pool with specific pool size' do pool = described_class.create_connection_pool(5) - expect(pool) - .to be_kind_of(ActiveRecord::ConnectionAdapters::ConnectionPool) - expect(pool.spec.config[:pool]).to eq(5) + begin + expect(pool) + .to be_kind_of(ActiveRecord::ConnectionAdapters::ConnectionPool) + + expect(pool.spec.config[:pool]).to eq(5) + ensure + pool.disconnect! + end + end + + it 'allows setting of a custom hostname' do + pool = described_class.create_connection_pool(5, '127.0.0.1') + + begin + expect(pool.spec.config[:host]).to eq('127.0.0.1') + ensure + pool.disconnect! + end end end |