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

sidekiq_throttler_spec.rb « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6374ac80207b08c878fde7eb616ae7a8b8f90f20 (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
require 'spec_helper'

describe Gitlab::SidekiqThrottler do
  before do
    Sidekiq.options[:concurrency] = 35

    stub_application_setting(
      sidekiq_throttling_enabled: true,
      sidekiq_throttling_factor: 0.1,
      sidekiq_throttling_queues: %w[build project_cache]
    )
  end

  describe '#execute!' do
    it 'sets limits on the selected queues' do
      described_class.execute!

      expect(Sidekiq::Queue['build'].limit).to eq 4
      expect(Sidekiq::Queue['project_cache'].limit).to eq 4
    end

    it 'does not set limits on other queues' do
      described_class.execute!

      expect(Sidekiq::Queue['merge'].limit).to be_nil
    end
  end
end