Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/runtime_spec.rb')
-rw-r--r--spec/lib/gitlab/runtime_spec.rb44
1 files changed, 30 insertions, 14 deletions
diff --git a/spec/lib/gitlab/runtime_spec.rb b/spec/lib/gitlab/runtime_spec.rb
index 8f920bb2e01..8ed7cc141cd 100644
--- a/spec/lib/gitlab/runtime_spec.rb
+++ b/spec/lib/gitlab/runtime_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-describe Gitlab::Runtime do
+RSpec.describe Gitlab::Runtime do
shared_examples "valid runtime" do |runtime, max_threads|
it "identifies itself" do
expect(subject.identify).to eq(runtime)
@@ -48,18 +48,47 @@ describe Gitlab::Runtime do
before do
stub_const('::Puma', puma_type)
allow(puma_type).to receive_message_chain(:cli_config, :options).and_return(max_threads: 2)
+ stub_env('ACTION_CABLE_IN_APP', 'false')
end
it_behaves_like "valid runtime", :puma, 3
+
+ context "when ActionCable in-app mode is enabled" do
+ before do
+ stub_env('ACTION_CABLE_IN_APP', 'true')
+ stub_env('ACTION_CABLE_WORKER_POOL_SIZE', '3')
+ end
+
+ it_behaves_like "valid runtime", :puma, 6
+ end
+
+ context "when ActionCable standalone is run" do
+ before do
+ stub_const('ACTION_CABLE_SERVER', true)
+ stub_env('ACTION_CABLE_WORKER_POOL_SIZE', '8')
+ end
+
+ it_behaves_like "valid runtime", :puma, 11
+ end
end
context "unicorn" do
before do
stub_const('::Unicorn', Module.new)
stub_const('::Unicorn::HttpServer', Class.new)
+ stub_env('ACTION_CABLE_IN_APP', 'false')
end
it_behaves_like "valid runtime", :unicorn, 1
+
+ context "when ActionCable in-app mode is enabled" do
+ before do
+ stub_env('ACTION_CABLE_IN_APP', 'true')
+ stub_env('ACTION_CABLE_WORKER_POOL_SIZE', '3')
+ end
+
+ it_behaves_like "valid runtime", :unicorn, 4
+ end
end
context "sidekiq" do
@@ -105,17 +134,4 @@ describe Gitlab::Runtime do
it_behaves_like "valid runtime", :rails_runner, 1
end
-
- context "action_cable" do
- before do
- stub_const('ACTION_CABLE_SERVER', true)
- stub_const('::Puma', Module.new)
-
- allow(Gitlab::Application).to receive_message_chain(:config, :action_cable, :worker_pool_size).and_return(8)
- end
-
- it "reports its maximum concurrency based on ActionCable's worker pool size" do
- expect(subject.max_threads).to eq(9)
- end
- end
end