diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-11 15:08:39 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-11 15:08:39 +0000 |
commit | 4564f677f8d71e814e89618e81709c86cf50e3d2 (patch) | |
tree | 9ba8fffbd8b3ec3d40dc12bfc4132d842f789cfc /spec/lib | |
parent | 0b54f87a31c23544ca5917bf772ce9c64a61562c (diff) | |
download | gitlab-ce-4564f677f8d71e814e89618e81709c86cf50e3d2.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/database/load_balancing/service_discovery_spec.rb | 17 | ||||
-rw-r--r-- | spec/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job_spec.rb | 18 |
2 files changed, 16 insertions, 19 deletions
diff --git a/spec/lib/gitlab/database/load_balancing/service_discovery_spec.rb b/spec/lib/gitlab/database/load_balancing/service_discovery_spec.rb index bfd9c644ffa..9a559c7ccb4 100644 --- a/spec/lib/gitlab/database/load_balancing/service_discovery_spec.rb +++ b/spec/lib/gitlab/database/load_balancing/service_discovery_spec.rb @@ -90,7 +90,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::ServiceDiscovery, feature_catego end end - context 'with failures' do + context 'with StandardError' do before do allow(Gitlab::ErrorTracking).to receive(:track_exception) allow(service).to receive(:sleep) @@ -142,6 +142,21 @@ RSpec.describe Gitlab::Database::LoadBalancing::ServiceDiscovery, feature_catego service.perform_service_discovery end end + + context 'with Exception' do + it 'logs error and re-raises the exception' do + error = Exception.new('uncaught-test-error') + + expect(service).to receive(:refresh_if_necessary).and_raise(error) + + expect(Gitlab::Database::LoadBalancing::Logger).to receive(:error).with( + event: :service_discovery_unexpected_exception, + message: "Service discovery encountered an uncaught error: uncaught-test-error" + ) + + expect { service.perform_service_discovery }.to raise_error(Exception, error.message) + end + end end describe '#refresh_if_necessary' do diff --git a/spec/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job_spec.rb b/spec/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job_spec.rb index 8e6aea96c58..a46275d90b6 100644 --- a/spec/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job_spec.rb +++ b/spec/lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job_spec.rb @@ -64,15 +64,6 @@ RSpec.describe Gitlab::SidekiqMiddleware::DuplicateJobs::DuplicateJob, :clean_gi it_behaves_like 'scheduling with deduplication class', 'None' end end - - # This context is to be removed when FF `ci_pipeline_process_worker_dedup_until_executed` is removed - context 'when deduplication strategy is provided in the job options' do - before do - job['deduplicate'] = { 'strategy' => 'until_executed' } - end - - it_behaves_like 'scheduling with deduplication class', 'UntilExecuted' - end end describe '#perform' do @@ -490,15 +481,6 @@ RSpec.describe Gitlab::SidekiqMiddleware::DuplicateJobs::DuplicateJob, :clean_gi expect(duplicate_job.options).to eq(worker_options) end - - # This context is to be removed when FF `ci_pipeline_process_worker_dedup_until_executed` is removed - context 'when deduplication options are provided in the job options' do - it "returns the job's deduplication options" do - job['deduplicate'] = { 'options' => { 'if_deduplicated' => 'reschedule_once', 'ttl' => '60' } } - - expect(duplicate_job.options).to eq({ if_deduplicated: :reschedule_once, ttl: 60 }) - end - end end describe '#idempotent?' do |