diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-11-28 19:16:50 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-12-12 19:36:20 +0300 |
commit | b1849ee2e66b6355776397717a33dc7ada772332 (patch) | |
tree | 42cc03621690637e947c0677686ecf24a9771245 /spec/lib/gitlab/sidekiq_versioning_spec.rb | |
parent | d673628de003d1ce1402f03311066339828fb811 (diff) |
Use a dedicated queue for each worker
Diffstat (limited to 'spec/lib/gitlab/sidekiq_versioning_spec.rb')
-rw-r--r-- | spec/lib/gitlab/sidekiq_versioning_spec.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/lib/gitlab/sidekiq_versioning_spec.rb b/spec/lib/gitlab/sidekiq_versioning_spec.rb new file mode 100644 index 00000000000..fa6d42e730d --- /dev/null +++ b/spec/lib/gitlab/sidekiq_versioning_spec.rb @@ -0,0 +1,44 @@ +require 'spec_helper' + +describe Gitlab::SidekiqVersioning, :sidekiq, :redis do + let(:foo_worker) do + Class.new do + def self.name + 'FooWorker' + end + + include ApplicationWorker + end + end + + let(:bar_worker) do + Class.new do + def self.name + 'BarWorker' + end + + include ApplicationWorker + end + end + + before do + allow(Gitlab::SidekiqConfig).to receive(:workers).and_return([foo_worker, bar_worker]) + allow(Gitlab::SidekiqConfig).to receive(:worker_queues).and_return([foo_worker.queue, bar_worker.queue]) + end + + describe '.install!' do + it 'prepends SidekiqVersioning::Manager into Sidekiq::Manager' do + described_class.install! + + expect(Sidekiq::Manager).to include(Gitlab::SidekiqVersioning::Manager) + end + + it 'registers all versionless and versioned queues with Redis' do + described_class.install! + + queues = Sidekiq::Queue.all.map(&:name) + expect(queues).to include('foo') + expect(queues).to include('bar') + end + end +end |