summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/cluster/puma_worker_killer_initializer_spec.rb
blob: cb13a711857a796974a3b4e762137a98bad4bfac (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 'fast_spec_helper'
require 'puma_worker_killer'

RSpec.describe Gitlab::Cluster::PumaWorkerKillerInitializer do
  describe '.start' do
    context 'when GITLAB_MEMORY_WATCHDOG_ENABLED is false' do
      before do
        stub_env('GITLAB_MEMORY_WATCHDOG_ENABLED', 'false')
      end

      it 'configures and start PumaWorkerKiller' do
        expect(PumaWorkerKiller).to receive(:config)
        expect(PumaWorkerKiller).to receive(:start)

        described_class.start({})
      end
    end

    context 'when GITLAB_MEMORY_WATCHDOG_ENABLED is not set' do
      it 'configures and start PumaWorkerKiller' do
        expect(PumaWorkerKiller).not_to receive(:config)
        expect(PumaWorkerKiller).not_to receive(:start)

        described_class.start({})
      end
    end
  end
end