summaryrefslogtreecommitdiff
path: root/spec/initializers
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-16 03:08:47 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-16 03:08:47 +0000
commit08ed6a867b690a04fe7a74c9ba697cf18f6107d7 (patch)
tree9561a9aeee9a57cec168b143a76e6f65fd92ae0b /spec/initializers
parentb0f27742e78a4aa4208c271536b6b9d84c53b49e (diff)
downloadgitlab-ce-08ed6a867b690a04fe7a74c9ba697cf18f6107d7.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/initializers')
-rw-r--r--spec/initializers/database_config_spec.rb24
1 files changed, 9 insertions, 15 deletions
diff --git a/spec/initializers/database_config_spec.rb b/spec/initializers/database_config_spec.rb
index 9200a625b38..85577ce007a 100644
--- a/spec/initializers/database_config_spec.rb
+++ b/spec/initializers/database_config_spec.rb
@@ -11,14 +11,12 @@ describe 'Database config initializer' do
allow(ActiveRecord::Base).to receive(:establish_connection)
end
- context "when using Puma" do
- let(:puma) { double('puma') }
- let(:puma_options) { { max_threads: 8 } }
+ context "when using multi-threaded runtime" do
+ let(:max_threads) { 8 }
before do
- allow(Gitlab::Runtime).to receive(:puma?).and_return(true)
- stub_const("Puma", puma)
- allow(puma).to receive_message_chain(:cli_config, :options).and_return(puma_options)
+ allow(Gitlab::Runtime).to receive(:multi_threaded?).and_return(true)
+ allow(Gitlab::Runtime).to receive(:max_threads).and_return(max_threads)
end
context "and no existing pool size is set" do
@@ -27,23 +25,23 @@ describe 'Database config initializer' do
end
it "sets it to the max number of worker threads" do
- expect { subject }.to change { Gitlab::Database.config['pool'] }.from(nil).to(8)
+ expect { subject }.to change { Gitlab::Database.config['pool'] }.from(nil).to(max_threads)
end
end
context "and the existing pool size is smaller than the max number of worker threads" do
before do
- stub_database_config(pool_size: 7)
+ stub_database_config(pool_size: max_threads - 1)
end
it "sets it to the max number of worker threads" do
- expect { subject }.to change { Gitlab::Database.config['pool'] }.from(7).to(8)
+ expect { subject }.to change { Gitlab::Database.config['pool'] }.by(1)
end
end
context "and the existing pool size is larger than the max number of worker threads" do
before do
- stub_database_config(pool_size: 9)
+ stub_database_config(pool_size: max_threads + 1)
end
it "keeps the configured pool size" do
@@ -52,11 +50,7 @@ describe 'Database config initializer' do
end
end
- context "when not using Puma" do
- before do
- stub_database_config(pool_size: 7)
- end
-
+ context "when using single-threaded runtime" do
it "does nothing" do
expect { subject }.not_to change { Gitlab::Database.config['pool'] }
end