diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 10:00:54 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 10:00:54 +0000 |
commit | 3cccd102ba543e02725d247893729e5c73b38295 (patch) | |
tree | f36a04ec38517f5deaaacb5acc7d949688d1e187 /spec/workers/bulk_import_worker_spec.rb | |
parent | 205943281328046ef7b4528031b90fbda70c75ac (diff) | |
download | gitlab-ce-3cccd102ba543e02725d247893729e5c73b38295.tar.gz |
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'spec/workers/bulk_import_worker_spec.rb')
-rw-r--r-- | spec/workers/bulk_import_worker_spec.rb | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/spec/workers/bulk_import_worker_spec.rb b/spec/workers/bulk_import_worker_spec.rb index 12e29573156..7e301efe708 100644 --- a/spec/workers/bulk_import_worker_spec.rb +++ b/spec/workers/bulk_import_worker_spec.rb @@ -56,17 +56,6 @@ RSpec.describe BulkImportWorker do end end - context 'when maximum allowed number of import entities in progress' do - it 'reenqueues itself' do - bulk_import = create(:bulk_import, :started) - (described_class::DEFAULT_BATCH_SIZE + 1).times { |_| create(:bulk_import_entity, :started, bulk_import: bulk_import) } - - expect(described_class).to receive(:perform_in).with(described_class::PERFORM_DELAY, bulk_import.id) - - subject.perform(bulk_import.id) - end - end - context 'when bulk import is created' do it 'marks bulk import as started' do bulk_import = create(:bulk_import, :created) @@ -84,7 +73,7 @@ RSpec.describe BulkImportWorker do expect { subject.perform(bulk_import.id) } .to change(BulkImports::Tracker, :count) - .by(BulkImports::Groups::Stage.new(bulk_import).pipelines.size * 2) + .by(BulkImports::Groups::Stage.new(entity_1).pipelines.size * 2) expect(entity_1.trackers).not_to be_empty expect(entity_2.trackers).not_to be_empty @@ -93,21 +82,17 @@ RSpec.describe BulkImportWorker do context 'when there are created entities to process' do let_it_be(:bulk_import) { create(:bulk_import, :created) } - before do - stub_const("#{described_class}::DEFAULT_BATCH_SIZE", 1) - end - - it 'marks a batch of entities as started, enqueues EntityWorker, ExportRequestWorker and reenqueues' do + it 'marks all entities as started, enqueues EntityWorker, ExportRequestWorker and reenqueues' do create(:bulk_import_entity, :created, bulk_import: bulk_import) create(:bulk_import_entity, :created, bulk_import: bulk_import) expect(described_class).to receive(:perform_in).with(described_class::PERFORM_DELAY, bulk_import.id) - expect(BulkImports::EntityWorker).to receive(:perform_async) - expect(BulkImports::ExportRequestWorker).to receive(:perform_async) + expect(BulkImports::EntityWorker).to receive(:perform_async).twice + expect(BulkImports::ExportRequestWorker).to receive(:perform_async).twice subject.perform(bulk_import.id) - expect(bulk_import.entities.map(&:status_name)).to contain_exactly(:created, :started) + expect(bulk_import.entities.map(&:status_name)).to contain_exactly(:started, :started) end context 'when there are project entities to process' do |