diff options
Diffstat (limited to 'spec/lib/gitlab/runtime_spec.rb')
-rw-r--r-- | spec/lib/gitlab/runtime_spec.rb | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/spec/lib/gitlab/runtime_spec.rb b/spec/lib/gitlab/runtime_spec.rb index 8ed7cc141cd..1ec14092c63 100644 --- a/spec/lib/gitlab/runtime_spec.rb +++ b/spec/lib/gitlab/runtime_spec.rb @@ -44,10 +44,11 @@ RSpec.describe Gitlab::Runtime do context "puma" do let(:puma_type) { double('::Puma') } + let(:max_workers) { 2 } before do stub_const('::Puma', puma_type) - allow(puma_type).to receive_message_chain(:cli_config, :options).and_return(max_threads: 2) + allow(puma_type).to receive_message_chain(:cli_config, :options).and_return(max_threads: 2, workers: max_workers) stub_env('ACTION_CABLE_IN_APP', 'false') end @@ -70,6 +71,20 @@ RSpec.describe Gitlab::Runtime do it_behaves_like "valid runtime", :puma, 11 end + + describe ".puma_in_clustered_mode?" do + context 'when Puma is set up with workers > 0' do + let(:max_workers) { 4 } + + specify { expect(described_class.puma_in_clustered_mode?).to be true } + end + + context 'when Puma is set up with workers = 0' do + let(:max_workers) { 0 } + + specify { expect(described_class.puma_in_clustered_mode?).to be false } + end + end end context "unicorn" do |