summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/cluster/puma_worker_killer_observer_spec.rb
blob: 948de161235f33bd41a36545aa4d27cf89aca996 (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 '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