From ccd26150602dbd35dd0e769e46c2dde1e78d7905 Mon Sep 17 00:00:00 2001
From: Sean McGivern <sean@gitlab.com>
Date: Mon, 10 Feb 2020 14:17:10 +0000
Subject: [PATCH] Rename queue-query-syntax to queue-selector

queue-query-syntax is really hard to type!
---
 changelogs/unreleased/an-sidekiq-query.yml           |  2 +-
 .../operations/extra_sidekiq_processes.md            | 12 ++++++------
 ee/lib/gitlab/sidekiq_cluster/cli.rb                 |  6 +++---
 ee/spec/bin/sidekiq_cluster_spec.rb                  |  2 +-
 ee/spec/lib/gitlab/sidekiq_cluster/cli_spec.rb       | 10 +++++-----
 5 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/changelogs/unreleased/an-sidekiq-query.yml b/changelogs/unreleased/an-sidekiq-query.yml
index 1e759cc39547..b0e5239984a4 100644
--- a/changelogs/unreleased/an-sidekiq-query.yml
+++ b/changelogs/unreleased/an-sidekiq-query.yml
@@ -1,5 +1,5 @@
 ---
-title: Add experimental --queue-query-syntax option to sidekiq-cluster
+title: Add experimental --queue-selector option to sidekiq-cluster
 merge_request: 18877
 author:
 type: changed
diff --git a/doc/administration/operations/extra_sidekiq_processes.md b/doc/administration/operations/extra_sidekiq_processes.md
index 3855c615cea2..010570d1ea96 100644
--- a/doc/administration/operations/extra_sidekiq_processes.md
+++ b/doc/administration/operations/extra_sidekiq_processes.md
@@ -82,11 +82,11 @@ you list:
    sudo gitlab-ctl reconfigure
    ```
 
-## Queue query syntax (experimental)
+## Queue selector (experimental)
 
 > [Introduced](https://gitlab.com/gitlab-com/gl-infra/scalability/issues/45) in [GitLab Starter](https://about.gitlab.com/pricing/) 12.8.
 
-In addition to selecting queues by name, as above, the `queue_query_syntax`
+In addition to selecting queues by name, as above, the `queue_selector`
 option allows queue groups to be selected in a more general way using
 the following components:
 
@@ -97,7 +97,7 @@ the following components:
 
 From the [list of all available
 attributes](https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/workers/all_queues.yml),
-`queue_query_syntax` allows selecting of queues by the following attributes:
+`queue_selector` allows selecting of queues by the following attributes:
 
 - `feature_category` - the [GitLab feature
   category](https://about.gitlab.com/direction/maturity/#category-maturity) the
@@ -122,8 +122,8 @@ considered false.
 
 ### Available operators
 
-`queue_query_syntax` supports the following operators, listed from highest to
-lowest precedence:
+`queue_selector` supports the following operators, listed from highest
+to lowest precedence:
 
 - <code> </code>&nbsp;(space) - the logical OR operator. For example, `query_a
   query_b` (where `query_a` and `query_b` are queries made up of the other
@@ -151,7 +151,7 @@ In `/etc/gitlab/gitlab.rb`:
 
 ```ruby
 sidekiq_cluster['enable'] = true
-sidekiq_cluster['queue_query_syntax'] = true
+sidekiq_cluster['queue_selector'] = true
 sidekiq_cluster['queue_groups'] = [
   # Run all non-CPU-bound, queues that are latency sensitive
   'resource_boundary!=cpu,latency_sensitive=true',
diff --git a/ee/lib/gitlab/sidekiq_cluster/cli.rb b/ee/lib/gitlab/sidekiq_cluster/cli.rb
index 1ee88ac44b7d..e271ff5f5e71 100644
--- a/ee/lib/gitlab/sidekiq_cluster/cli.rb
+++ b/ee/lib/gitlab/sidekiq_cluster/cli.rb
@@ -45,7 +45,7 @@ def run(argv = ARGV)
         queue_names = SidekiqConfig::CliMethods.worker_queues(@rails_path)
 
         queue_groups =
-          if @queue_query_syntax
+          if @queue_selector
             # When using the experimental queue query syntax, we treat
             # each queue group as a worker attribute query, and resolve
             # the queues for the queue group using this query.
@@ -160,8 +160,8 @@ def option_parser
             @rails_path = path
           end
 
-          opt.on('--queue-query-syntax', 'EXPERIMENTAL: Run workers based on the provided selector') do |queue_query_syntax|
-            @queue_query_syntax = queue_query_syntax
+          opt.on('--queue-selector', 'EXPERIMENTAL: Run workers based on the provided selector') do |queue_selector|
+            @queue_selector = queue_selector
           end
 
           opt.on('-n', '--negate', 'Run workers for all queues in sidekiq_queues.yml except the given ones') do
diff --git a/ee/spec/bin/sidekiq_cluster_spec.rb b/ee/spec/bin/sidekiq_cluster_spec.rb
index 02b27409c561..05812028b7b3 100644
--- a/ee/spec/bin/sidekiq_cluster_spec.rb
+++ b/ee/spec/bin/sidekiq_cluster_spec.rb
@@ -7,7 +7,7 @@
 
   where(:args, :included, :excluded) do
     %w[--negate cronjob] | '-qdefault,1' | '-qcronjob,1'
-    %w[--queue-query-syntax resource_boundary=cpu] | '-qupdate_merge_requests,1' | '-qdefault,1'
+    %w[--queue-selector resource_boundary=cpu] | '-qupdate_merge_requests,1' | '-qdefault,1'
   end
 
   with_them do
diff --git a/ee/spec/lib/gitlab/sidekiq_cluster/cli_spec.rb b/ee/spec/lib/gitlab/sidekiq_cluster/cli_spec.rb
index 1ab589af51f5..96a2a8becad1 100644
--- a/ee/spec/lib/gitlab/sidekiq_cluster/cli_spec.rb
+++ b/ee/spec/lib/gitlab/sidekiq_cluster/cli_spec.rb
@@ -79,7 +79,7 @@
         end
       end
 
-      context 'with --queue-query-syntax' do
+      context 'with --queue-selector' do
         where do
           {
             'memory-bound queues' => {
@@ -125,7 +125,7 @@
               []
             end
 
-            cli.run(%W(--queue-query-syntax #{query}))
+            cli.run(%W(--queue-selector #{query}))
           end
 
           it 'works when negated' do
@@ -137,7 +137,7 @@
               []
             end
 
-            cli.run(%W(--negate --queue-query-syntax #{query}))
+            cli.run(%W(--negate --queue-selector #{query}))
           end
         end
 
@@ -147,13 +147,13 @@
                   .with([['chat_notification'], ['project_export']], default_options)
                   .and_return([])
 
-          cli.run(%w(--queue-query-syntax feature_category=chatops,latency_sensitive=true resource_boundary=memory,feature_category=source_code_management))
+          cli.run(%w(--queue-selector feature_category=chatops,latency_sensitive=true resource_boundary=memory,feature_category=source_code_management))
         end
 
         it 'errors on an invalid query multiple queue groups correctly' do
           expect(Gitlab::SidekiqCluster).not_to receive(:start)
 
-          expect { cli.run(%w(--queue-query-syntax unknown_field=chatops)) }
+          expect { cli.run(%w(--queue-selector unknown_field=chatops)) }
             .to raise_error(Gitlab::SidekiqConfig::CliMethods::QueryError)
         end
       end
-- 
GitLab