Commit f0dcc2d1 authored by Sean McGivern's avatar Sean McGivern

Remove deprecated `--experimental-queue-selector` flag for Sidekiq

This is now just called `--queue-selector`.

Changelog: removed
parent 0e0f1aef
......@@ -47,12 +47,6 @@ module Gitlab
option_parser.parse!(argv)
# Remove with https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/646
if @queue_selector && @experimental_queue_selector
raise CommandError,
'You cannot specify --queue-selector and --experimental-queue-selector together'
end
worker_metadatas = SidekiqConfig::CliMethods.worker_metadatas(@rails_path)
worker_queues = SidekiqConfig::CliMethods.worker_queues(@rails_path)
......@@ -63,8 +57,7 @@ module Gitlab
# as a worker attribute query, and resolve the queues for the
# queue group using this query.
# Simplify with https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/646
if @queue_selector || @experimental_queue_selector
if @queue_selector
SidekiqConfig::CliMethods.query_queues(queues_or_query_string, worker_metadatas)
else
SidekiqConfig::CliMethods.expand_queues(queues_or_query_string.split(','), worker_queues)
......@@ -194,11 +187,6 @@ module Gitlab
@queue_selector = queue_selector
end
# Remove with https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/646
opt.on('--experimental-queue-selector', 'DEPRECATED: use --queue-selector-instead') do |experimental_queue_selector|
@experimental_queue_selector = experimental_queue_selector
end
opt.on('-n', '--negate', 'Run workers for all queues in sidekiq_queues.yml except the given ones') do
@negate_queues = true
end
......
......@@ -10,8 +10,6 @@ RSpec.describe 'bin/sidekiq-cluster' do
where(:args, :included, :excluded) do
%w[--negate cronjob] | '-qdefault,1' | '-qcronjob,1'
%w[--queue-selector resource_boundary=cpu] | '-qupdate_merge_requests,1' | '-qdefault,1'
# Remove with https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/646
%w[--experimental-queue-selector resource_boundary=cpu] | '-qupdate_merge_requests,1' | '-qdefault,1'
end
with_them do
......@@ -31,9 +29,7 @@ RSpec.describe 'bin/sidekiq-cluster' do
context 'when selecting all queues' do
[
%w[*],
%w[--queue-selector *],
# Remove with https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/646
%w[--experimental-queue-selector *]
%w[--queue-selector *]
].each do |args|
it "runs successfully with `#{args}`", :aggregate_failures do
cmd = %w[bin/sidekiq-cluster --dryrun] + args
......
......@@ -108,19 +108,7 @@ RSpec.describe Gitlab::SidekiqCluster::CLI do
end
end
# Remove with https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/646
context 'with --queue-selector and --experimental-queue-selector' do
it 'errors' do
expect(Gitlab::SidekiqCluster).not_to receive(:start)
expect { cli.run(%w(--queue-selector name=foo --experimental-queue-selector name=bar)) }
.to raise_error(described_class::CommandError)
end
end
# Simplify with https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/646
['--queue-selector', '--experimental-queue-selector'].each do |flag|
context "with #{flag}" do
context "with --queue-selector" do
where do
{
'memory-bound queues' => {
......@@ -166,7 +154,7 @@ RSpec.describe Gitlab::SidekiqCluster::CLI do
[]
end
cli.run(%W(#{flag} #{query}))
cli.run(%W(--queue-selector #{query}))
end
it 'works when negated' do
......@@ -178,7 +166,7 @@ RSpec.describe Gitlab::SidekiqCluster::CLI do
[]
end
cli.run(%W(--negate #{flag} #{query}))
cli.run(%W(--negate --queue-selector #{query}))
end
end
......@@ -188,7 +176,7 @@ RSpec.describe Gitlab::SidekiqCluster::CLI do
.with([['chat_notification'], ['project_export']], default_options)
.and_return([])
cli.run(%W(#{flag} feature_category=chatops&has_external_dependencies=true resource_boundary=memory&feature_category=importers))
cli.run(%w(--queue-selector feature_category=chatops&has_external_dependencies=true resource_boundary=memory&feature_category=importers))
end
it 'allows the special * selector' do
......@@ -200,26 +188,25 @@ RSpec.describe Gitlab::SidekiqCluster::CLI do
expect(Gitlab::SidekiqCluster)
.to receive(:start).with([worker_queues], default_options)
cli.run(%W(#{flag} *))
cli.run(%w(--queue-selector *))
end
it 'errors when the selector matches no queues' do
expect(Gitlab::SidekiqCluster).not_to receive(:start)
expect { cli.run(%W(#{flag} has_external_dependencies=true&has_external_dependencies=false)) }
expect { cli.run(%w(--queue-selector has_external_dependencies=true&has_external_dependencies=false)) }
.to raise_error(described_class::CommandError)
end
it 'errors on an invalid query multiple queue groups correctly' do
expect(Gitlab::SidekiqCluster).not_to receive(:start)
expect { cli.run(%W(#{flag} unknown_field=chatops)) }
expect { cli.run(%w(--queue-selector unknown_field=chatops)) }
.to raise_error(Gitlab::SidekiqConfig::WorkerMatcher::QueryError)
end
end
end
end
end
describe '#write_pid' do
context 'when a PID is specified' do
......
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