diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
commit | a09983ae35713f5a2bbb100981116d31ce99826e (patch) | |
tree | 2ee2af7bd104d57086db360a7e6d8c9d5d43667a /spec/lib/gitlab/runtime_spec.rb | |
parent | 18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff) |
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/lib/gitlab/runtime_spec.rb')
-rw-r--r-- | spec/lib/gitlab/runtime_spec.rb | 44 |
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 |