diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 16:05:49 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 16:05:49 +0000 |
commit | 43a25d93ebdabea52f99b05e15b06250cd8f07d7 (patch) | |
tree | dceebdc68925362117480a5d672bcff122fb625b /spec/lib/gitlab/sidekiq_config/worker_router_spec.rb | |
parent | 20c84b99005abd1c82101dfeff264ac50d2df211 (diff) | |
download | gitlab-ce-16.0.0-rc42.tar.gz |
Add latest changes from gitlab-org/gitlab@16-0-stable-eev16.0.0-rc4216-0-stable
Diffstat (limited to 'spec/lib/gitlab/sidekiq_config/worker_router_spec.rb')
-rw-r--r-- | spec/lib/gitlab/sidekiq_config/worker_router_spec.rb | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/spec/lib/gitlab/sidekiq_config/worker_router_spec.rb b/spec/lib/gitlab/sidekiq_config/worker_router_spec.rb index 4a8dbe69d36..ea9d77bcfa4 100644 --- a/spec/lib/gitlab/sidekiq_config/worker_router_spec.rb +++ b/spec/lib/gitlab/sidekiq_config/worker_router_spec.rb @@ -21,7 +21,6 @@ RSpec.describe Gitlab::SidekiqConfig::WorkerRouter do create_worker('PostReceive', :git) | 'git:post_receive' create_worker('PipelineHooksWorker', :pipeline_hooks) | 'pipeline_hooks:pipeline_hooks' create_worker('Gitlab::JiraImport::AdvanceStageWorker') | 'jira_import_advance_stage' - create_worker('Gitlab::PhabricatorImport::ImportTasksWorker', :importer) | 'importer:phabricator_import_import_tasks' end with_them do @@ -127,6 +126,7 @@ RSpec.describe Gitlab::SidekiqConfig::WorkerRouter do describe '.global' do before do described_class.remove_instance_variable(:@global_worker_router) if described_class.instance_variable_defined?(:@global_worker_router) + stub_config(sidekiq: { routing_rules: routing_rules }) end after do @@ -137,10 +137,6 @@ RSpec.describe Gitlab::SidekiqConfig::WorkerRouter do include_context 'router examples setup' with_them do - before do - stub_config(sidekiq: { routing_rules: routing_rules }) - end - it 'routes the worker to the correct queue' do expect(described_class.global.route(worker)).to eql(expected_queue) end @@ -158,10 +154,6 @@ RSpec.describe Gitlab::SidekiqConfig::WorkerRouter do end end - before do - stub_config(sidekiq: { routing_rules: routing_rules }) - end - context 'invalid routing rules format' do let(:routing_rules) { ['feature_category=a'] } @@ -184,6 +176,26 @@ RSpec.describe Gitlab::SidekiqConfig::WorkerRouter do end end end + + context 'when routing rules is missing `*` as the last rule' do + let(:routing_rules) { [['resource_boundary=cpu', 'cpu']] } + + it 'logs a warning' do + expect(Gitlab::AppLogger).to receive(:warn).with(a_string_matching('sidekiq.routing_rules config is missing')) + + described_class.global + end + end + + context 'when routing rules has a `*` rule as the last rule' do + let(:routing_rules) { [['resource_boundary=cpu', 'cpu'], ['*', 'default']] } + + it 'does not log any warning' do + expect(Gitlab::AppLogger).not_to receive(:warn) + + described_class.global + end + end end describe '#route' do |