Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/workers/concerns')
-rw-r--r--spec/workers/concerns/gitlab/github_import/object_importer_spec.rb3
-rw-r--r--spec/workers/concerns/gitlab/github_import/rescheduling_methods_spec.rb2
-rw-r--r--spec/workers/concerns/gitlab/import/notify_upon_death_spec.rb (renamed from spec/workers/concerns/gitlab/notify_upon_death_spec.rb)10
-rw-r--r--spec/workers/concerns/limited_capacity/worker_spec.rb18
4 files changed, 25 insertions, 8 deletions
diff --git a/spec/workers/concerns/gitlab/github_import/object_importer_spec.rb b/spec/workers/concerns/gitlab/github_import/object_importer_spec.rb
index 3b7bbfc8a7b..27e1077b138 100644
--- a/spec/workers/concerns/gitlab/github_import/object_importer_spec.rb
+++ b/spec/workers/concerns/gitlab/github_import/object_importer_spec.rb
@@ -273,7 +273,8 @@ RSpec.describe Gitlab::GithubImport::ObjectImporter, :aggregate_failures, featur
.to receive(:notify)
.with(
job['args'].last,
- job['jid']
+ job['jid'],
+ ttl: Gitlab::Import::JOB_WAITER_TTL
)
sidekiq_retries_exhausted
diff --git a/spec/workers/concerns/gitlab/github_import/rescheduling_methods_spec.rb b/spec/workers/concerns/gitlab/github_import/rescheduling_methods_spec.rb
index 6475be0243c..c76ce6b555f 100644
--- a/spec/workers/concerns/gitlab/github_import/rescheduling_methods_spec.rb
+++ b/spec/workers/concerns/gitlab/github_import/rescheduling_methods_spec.rb
@@ -110,7 +110,7 @@ RSpec.describe Gitlab::GithubImport::ReschedulingMethods, feature_category: :imp
expect(Gitlab::JobWaiter)
.to receive(:notify)
- .with('123', 'abc123')
+ .with('123', 'abc123', ttl: Gitlab::Import::JOB_WAITER_TTL)
worker.notify_waiter('123')
end
diff --git a/spec/workers/concerns/gitlab/notify_upon_death_spec.rb b/spec/workers/concerns/gitlab/import/notify_upon_death_spec.rb
index 36faf3ee296..1f760e8542b 100644
--- a/spec/workers/concerns/gitlab/notify_upon_death_spec.rb
+++ b/spec/workers/concerns/gitlab/import/notify_upon_death_spec.rb
@@ -2,11 +2,11 @@
require 'spec_helper'
-RSpec.describe Gitlab::NotifyUponDeath, feature_category: :shared do
+RSpec.describe Gitlab::Import::NotifyUponDeath, feature_category: :importers do
let(:worker_class) do
Class.new do
include Sidekiq::Worker
- include Gitlab::NotifyUponDeath
+ include Gitlab::Import::NotifyUponDeath
end
end
@@ -16,13 +16,13 @@ RSpec.describe Gitlab::NotifyUponDeath, feature_category: :shared do
expect(Gitlab::JobWaiter)
.to receive(:notify)
- .with('123abc', '123')
+ .with('123abc', '123', ttl: Gitlab::Import::JOB_WAITER_TTL)
worker_class.sidekiq_retries_exhausted_block.call(job)
end
it 'does not notify the JobWaiter when only 2 arguments are given' do
- job = { 'args' => [12, {}], 'jid' => '123' }
+ job = { 'args' => [12, '123abc'], 'jid' => '123' }
expect(Gitlab::JobWaiter)
.not_to receive(:notify)
@@ -31,7 +31,7 @@ RSpec.describe Gitlab::NotifyUponDeath, feature_category: :shared do
end
it 'does not notify the JobWaiter when only 1 argument is given' do
- job = { 'args' => [12], 'jid' => '123' }
+ job = { 'args' => ['123abc'], 'jid' => '123' }
expect(Gitlab::JobWaiter)
.not_to receive(:notify)
diff --git a/spec/workers/concerns/limited_capacity/worker_spec.rb b/spec/workers/concerns/limited_capacity/worker_spec.rb
index 65906eef0fa..8092adec3b9 100644
--- a/spec/workers/concerns/limited_capacity/worker_spec.rb
+++ b/spec/workers/concerns/limited_capacity/worker_spec.rb
@@ -57,10 +57,26 @@ RSpec.describe LimitedCapacity::Worker, :clean_gitlab_redis_queues, :aggregate_f
it 'enqueues jobs' do
expect(worker_class)
.to receive(:bulk_perform_async)
- .with([[:arg], [:arg], [:arg]])
+ .with([[:arg], [:arg], [:arg]]).and_call_original
+
+ expect(Sidekiq::Client).to receive(:push_bulk)
perform_with_capacity
end
+
+ context 'when max_running_jobs is 0' do
+ let(:max_running_jobs) { 0 }
+
+ it 'does not enqueue jobs' do
+ expect(worker_class)
+ .to receive(:bulk_perform_async)
+ .with([]).and_call_original
+
+ expect(Sidekiq::Client).not_to receive(:push_bulk)
+
+ perform_with_capacity
+ end
+ end
end
describe '#perform' do