diff options
Diffstat (limited to 'spec/workers/concerns/gitlab/github_import/stage_methods_spec.rb')
-rw-r--r-- | spec/workers/concerns/gitlab/github_import/stage_methods_spec.rb | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/spec/workers/concerns/gitlab/github_import/stage_methods_spec.rb b/spec/workers/concerns/gitlab/github_import/stage_methods_spec.rb index fa782967441..37e686f9f92 100644 --- a/spec/workers/concerns/gitlab/github_import/stage_methods_spec.rb +++ b/spec/workers/concerns/gitlab/github_import/stage_methods_spec.rb @@ -15,6 +15,10 @@ RSpec.describe Gitlab::GithubImport::StageMethods, feature_category: :importers end.new end + it 'has a Sidekiq retry of 6' do + expect(worker.class.sidekiq_options['retry']).to eq(6) + end + describe '#perform' do it 'returns if no project could be found' do expect(worker).not_to receive(:try_import) @@ -138,6 +142,10 @@ RSpec.describe Gitlab::GithubImport::StageMethods, feature_category: :importers end describe '#try_import' do + before do + allow(worker).to receive(:jid).and_return('jid') + end + it 'imports the project' do client = double(:client) @@ -145,7 +153,7 @@ RSpec.describe Gitlab::GithubImport::StageMethods, feature_category: :importers .to receive(:import) .with(client, project) - expect(project.import_state).to receive(:refresh_jid_expiration) + expect(Gitlab::GithubImport::RefreshImportJidWorker).to receive(:perform_in_the_future).with(project.id, 'jid') worker.try_import(client, project) end @@ -153,7 +161,7 @@ RSpec.describe Gitlab::GithubImport::StageMethods, feature_category: :importers it 'reschedules the worker if RateLimitError was raised' do client = double(:client, rate_limit_resets_in: 10) - expect(project.import_state).to receive(:refresh_jid_expiration) + expect(Gitlab::GithubImport::RefreshImportJidWorker).to receive(:perform_in_the_future).with(project.id, 'jid') expect(worker) .to receive(:import) @@ -186,7 +194,7 @@ RSpec.describe Gitlab::GithubImport::StageMethods, feature_category: :importers end end - describe '.resumes_work_when_interrupted!' do + describe '.sidekiq_options!' do subject(:sidekiq_options) { worker.class.sidekiq_options } it 'does not set the `max_retries_after_interruption` if not called' do @@ -199,16 +207,8 @@ RSpec.describe Gitlab::GithubImport::StageMethods, feature_category: :importers is_expected.to include('max_retries_after_interruption' => 20) end - context 'when the flag is disabled' do - before do - stub_feature_flags(github_importer_raise_max_interruptions: false) - end - - it 'does not set `max_retries_after_interruption`' do - worker.class.resumes_work_when_interrupted! - - is_expected.not_to have_key('max_retries_after_interruption') - end + it 'sets the status_expiration' do + is_expected.to include('status_expiration' => Gitlab::Import::StuckImportJob::IMPORT_JOBS_EXPIRATION) end end end |