Commit 67ebba43 authored by Oswaldo Ferreira's avatar Oswaldo Ferreira

Allows passing multiple queue sets to --negate argument

parent 834a73dd
......@@ -32,7 +32,8 @@ module Gitlab
queues =
if @negated_queues&.any?
[SidekiqConfig.queues(@rails_path, except: @negated_queues)]
parsed_queues = SidekiqCluster.parse_queues(@negated_queues)
parsed_queues.map { |queues| SidekiqConfig.queues(@rails_path, except: queues) }
else
SidekiqCluster.parse_queues(argv)
end
......@@ -98,8 +99,8 @@ module Gitlab
@rails_path = path
end
opt.on('-n', '--negate [QUEUE,QUEUE]', "Run workers for all queues except these") do |queues|
@negated_queues = queues.split(',')
opt.on('-n', '--negate "[QUEUE,QUEUE] [QUEUE]"', "Run workers for all queues except these") do |queues|
@negated_queues = queues.split
end
opt.on('-i', '--interval INT', 'The number of seconds to wait between worker checks') do |int|
......
......@@ -12,7 +12,7 @@ describe Gitlab::SidekiqCluster::CLI do
context 'with arguments' do
it 'starts the Sidekiq workers' do
expect(Gitlab::SidekiqCluster).to receive(:start).with([['foo']], 'test', Dir.pwd).and_return([])
expect(Gitlab::SidekiqCluster).to receive(:start).and_return([])
expect(cli).to receive(:write_pid)
expect(cli).to receive(:trap_signals)
expect(cli).to receive(:start_loop)
......@@ -22,17 +22,15 @@ describe Gitlab::SidekiqCluster::CLI do
context 'with --negate argument' do
it 'starts Sidekiq workers for all queues except the negated ones' do
expect(Gitlab::SidekiqConfig).to receive(:queues)
.with(Dir.pwd, except: ['foo', 'bar'])
.and_return(['baz'])
expect(Gitlab::SidekiqConfig).to receive(:queues).twice.and_return(['baz'])
expect(Gitlab::SidekiqCluster).to receive(:start)
.with([['baz']], 'test', Dir.pwd)
.with([['baz'], ['baz']], 'test', Dir.pwd)
.and_return([])
expect(cli).to receive(:write_pid)
expect(cli).to receive(:trap_signals)
expect(cli).to receive(:start_loop)
cli.run(%w(-n foo,bar))
cli.run(%w(-n "foo,bar\ foo,bar"))
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment