summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/cluster/puma_worker_killer_observer_spec.rb
blob: cf532cf7be6bca83b636da8180e217a62aa475a1 (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
# frozen_string_literal: true

require 'fast_spec_helper'

RSpec.describe Gitlab::Cluster::PumaWorkerKillerObserver do
  let(:counter) { Gitlab::Metrics::NullMetric.instance }

  before do
    allow(Gitlab::Metrics).to receive(:counter)
      .with(any_args)
      .and_return(counter)
  end

  describe '#callback' do
    subject { described_class.new }

    it 'increments timeout counter' do
      worker = double(index: 0)

      expect(counter).to receive(:increment)

      subject.callback.call(worker)
    end
  end
end