2020-02-25 03:08:49 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 18:09:03 +00:00
|
|
|
RSpec.describe Gitlab::ConfigChecker::PumaRuggedChecker do
|
2020-02-25 03:08:49 +00:00
|
|
|
describe '#check' do
|
|
|
|
subject { described_class.check }
|
|
|
|
|
|
|
|
context 'application is not puma' do
|
|
|
|
before do
|
|
|
|
allow(Gitlab::Runtime).to receive(:puma?).and_return(false)
|
|
|
|
end
|
|
|
|
|
|
|
|
it { is_expected.to be_empty }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'application is puma' do
|
|
|
|
let(:notice_multi_threaded_puma_with_rugged) do
|
|
|
|
{
|
|
|
|
type: 'warning',
|
2020-02-28 18:09:07 +00:00
|
|
|
message: 'Puma is running with a thread count above 1 and the Rugged '\
|
2020-02-25 03:08:49 +00:00
|
|
|
'service is enabled. This may decrease performance in some environments. '\
|
|
|
|
'See our <a href="https://docs.gitlab.com/ee/administration/operations/puma.html#performance-caveat-when-using-puma-with-rugged">documentation</a> '\
|
|
|
|
'for details of this issue.'
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
before do
|
|
|
|
allow(Gitlab::Runtime).to receive(:puma?).and_return(true)
|
|
|
|
allow(described_class).to receive(:running_puma_with_multiple_threads?).and_return(multithreaded_puma)
|
|
|
|
allow(described_class).to receive(:rugged_enabled_through_feature_flag?).and_return(rugged_enabled)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'not multithreaded_puma and rugged API enabled' do
|
|
|
|
let(:multithreaded_puma) { false }
|
|
|
|
let(:rugged_enabled) { true }
|
|
|
|
|
2020-02-28 18:09:07 +00:00
|
|
|
it { is_expected.to be_empty }
|
2020-02-25 03:08:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'not multithreaded_puma and rugged API is not enabled' do
|
|
|
|
let(:multithreaded_puma) { false }
|
|
|
|
let(:rugged_enabled) { false }
|
|
|
|
|
2020-02-28 18:09:07 +00:00
|
|
|
it { is_expected.to be_empty }
|
2020-02-25 03:08:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'multithreaded_puma and rugged API is not enabled' do
|
|
|
|
let(:multithreaded_puma) { true }
|
|
|
|
let(:rugged_enabled) { false }
|
|
|
|
|
2020-02-28 18:09:07 +00:00
|
|
|
it { is_expected.to be_empty }
|
2020-02-25 03:08:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'multithreaded_puma and rugged API is enabled' do
|
|
|
|
let(:multithreaded_puma) { true }
|
|
|
|
let(:rugged_enabled) { true }
|
|
|
|
|
2020-02-28 18:09:07 +00:00
|
|
|
it 'report multi_threaded_puma_with_rugged notices' do
|
|
|
|
is_expected.to contain_exactly(notice_multi_threaded_puma_with_rugged)
|
2020-02-25 03:08:49 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|