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

global_metrics_update_worker_spec.rb « metrics « workers « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d5bfbcc928add8ecb808688942d87e409d5169dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe ::Metrics::GlobalMetricsUpdateWorker, feature_category: :metrics do
  subject { described_class.new }

  describe '#perform' do
    let(:service) { ::Metrics::GlobalMetricsUpdateService.new }

    it 'delegates to ::Metrics::GlobalMetricsUpdateService' do
      expect(::Metrics::GlobalMetricsUpdateService).to receive(:new).and_return(service)
      expect(service).to receive(:execute)

      subject.perform
    end

    context 'for an idempotent worker' do
      include_examples 'an idempotent worker' do
        it 'exports metrics' do
          allow(Gitlab).to receive(:maintenance_mode?).and_return(true).at_least(1).time

          perform_multiple

          expect(service.maintenance_mode_metric.get).to eq(1)
        end
      end
    end
  end
end