diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 14:01:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 14:01:45 +0300 |
commit | 9297025d0b7ddf095eb618dfaaab2ff8f2018d8b (patch) | |
tree | 865198c01d1824a9b098127baa3ab980c9cd2c06 /spec/workers/concerns/gitlab/github_import/object_importer_spec.rb | |
parent | 6372471f43ee03c05a7c1f8b0c6ac6b8a7431dbe (diff) |
Add latest changes from gitlab-org/gitlab@16-7-stable-eev16.7.0-rc42
Diffstat (limited to 'spec/workers/concerns/gitlab/github_import/object_importer_spec.rb')
-rw-r--r-- | spec/workers/concerns/gitlab/github_import/object_importer_spec.rb | 19 |
1 files changed, 7 insertions, 12 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 b2bc502d156..bba855f5095 100644 --- a/spec/workers/concerns/gitlab/github_import/object_importer_spec.rb +++ b/spec/workers/concerns/gitlab/github_import/object_importer_spec.rb @@ -67,10 +67,8 @@ RSpec.describe Gitlab::GithubImport::ObjectImporter, :aggregate_failures, featur describe '#import', :clean_gitlab_redis_cache do before do - expect(worker) - .to receive(:importer_class) - .at_least(:once) - .and_return(importer_class) + allow(Gitlab::Redis::SharedState).to receive(:with).and_return('OK') + expect(worker).to receive(:importer_class).at_least(:once).and_return(importer_class) end it 'imports the object' do @@ -203,25 +201,22 @@ RSpec.describe Gitlab::GithubImport::ObjectImporter, :aggregate_failures, featur expect(project.import_failures.last.exception_message).to eq('some error') end - context 'without github_identifiers defined' do + context 'when a NoMethod error is raised' do let(:stubbed_representation) { representation_class.instance_eval { undef_method :github_identifiers } } - it 'logs error when representation does not have a github_id' do - expect(importer_class).not_to receive(:new) - + it 'logs the error but does not re-raise it, so the worker does not retry' do expect(Gitlab::Import::ImportFailureService) .to receive(:track) .with( project_id: project.id, exception: a_kind_of(NoMethodError), error_source: 'klass_name', - fail_import: true, + fail_import: false, external_identifiers: { object_type: 'dummy' } ) .and_call_original - expect { worker.import(project, client, { 'number' => 10 }) } - .to raise_error(NoMethodError, /^undefined method `github_identifiers/) + worker.import(project, client, { 'number' => 10 }) end end @@ -239,7 +234,7 @@ RSpec.describe Gitlab::GithubImport::ObjectImporter, :aggregate_failures, featur .and_raise(exception) end - it 'logs an error' do + it 'logs the error but does not re-raise it, so the worker does not retry' do expect(Gitlab::GithubImport::Logger) .to receive(:info) .with( |