summaryrefslogtreecommitdiff
path: root/spec/lib/prometheus
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-22 09:07:51 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-22 09:07:51 +0000
commit3ad11f24ca52d42694a8ce920a87ead6085d3f85 (patch)
treed5b664aafa7c2b65f470a700431d336d908c0ebc /spec/lib/prometheus
parent62fcb9ffa9e40db6f34e7dd0d36804d73ef01435 (diff)
downloadgitlab-ce-3ad11f24ca52d42694a8ce920a87ead6085d3f85.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/prometheus')
-rw-r--r--spec/lib/prometheus/pid_provider_spec.rb18
1 files changed, 4 insertions, 14 deletions
diff --git a/spec/lib/prometheus/pid_provider_spec.rb b/spec/lib/prometheus/pid_provider_spec.rb
index 6fdc11b14c4..5a17f25f144 100644
--- a/spec/lib/prometheus/pid_provider_spec.rb
+++ b/spec/lib/prometheus/pid_provider_spec.rb
@@ -6,16 +6,13 @@ describe Prometheus::PidProvider do
describe '.worker_id' do
subject { described_class.worker_id }
- let(:sidekiq_module) { Module.new }
-
before do
- allow(sidekiq_module).to receive(:server?).and_return(false)
- stub_const('Sidekiq', sidekiq_module)
+ allow(Gitlab::Runtime).to receive(:sidekiq?).and_return(false)
end
context 'when running in Sidekiq server mode' do
before do
- expect(Sidekiq).to receive(:server?).and_return(true)
+ allow(Gitlab::Runtime).to receive(:sidekiq?).and_return(true)
end
context 'in a clustered setup' do
@@ -33,8 +30,7 @@ describe Prometheus::PidProvider do
context 'when running in Unicorn mode' do
before do
- stub_const('Unicorn::Worker', Class.new)
- hide_const('Puma')
+ allow(Gitlab::Runtime).to receive(:unicorn?).and_return(true)
expect(described_class).to receive(:process_name)
.at_least(:once)
@@ -94,8 +90,7 @@ describe Prometheus::PidProvider do
context 'when running in Puma mode' do
before do
- stub_const('Puma', Module.new)
- hide_const('Unicorn::Worker')
+ allow(Gitlab::Runtime).to receive(:puma?).and_return(true)
expect(described_class).to receive(:process_name)
.at_least(:once)
@@ -116,11 +111,6 @@ describe Prometheus::PidProvider do
end
context 'when running in unknown mode' do
- before do
- hide_const('Puma')
- hide_const('Unicorn::Worker')
- end
-
it { is_expected.to eq "process_#{Process.pid}" }
end
end