diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-08 06:15:41 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-08 06:15:41 +0300 |
commit | 777ef5e9b2cb049db6c25867d8321a191cec8f72 (patch) | |
tree | 8e2458bdde3047bb367e99e9d7de9862107e6212 /spec/services | |
parent | 6352d2f7c2a9e62e07f854861f9f57dacbd6f4a4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/projects/import_service_spec.rb | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/spec/services/projects/import_service_spec.rb b/spec/services/projects/import_service_spec.rb index 1aac6ac8adb..dd6e82b9ef2 100644 --- a/spec/services/projects/import_service_spec.rb +++ b/spec/services/projects/import_service_spec.rb @@ -183,81 +183,6 @@ RSpec.describe Projects::ImportService, feature_category: :importers do expect(result[:status]).to eq :error expect(result[:message]).to eq "Error importing repository #{project.safe_import_url} into #{project.full_path} - Failed to import the repository [FILTERED]" end - - context 'when bitbucket_parallel_importer feature flag is disabled' do - before do - stub_feature_flags(bitbucket_parallel_importer: false) - end - - it 'succeeds if repository import is successful' do - expect(project.repository).to receive(:import_repository).and_return(true) - expect_next_instance_of(Gitlab::BitbucketImport::Importer) do |importer| - expect(importer).to receive(:execute).and_return(true) - end - - expect_next_instance_of(Projects::LfsPointers::LfsImportService) do |service| - expect(service).to receive(:execute).and_return(status: :success) - end - - result = subject.execute - - expect(result[:status]).to eq :success - end - - it 'fails if repository import fails' do - expect(project.repository) - .to receive(:import_repository) - .with('https://bitbucket.org/vim/vim.git', resolved_address: '') - .and_raise(Gitlab::Git::CommandError, 'Failed to import the repository /a/b/c') - - result = subject.execute - - expect(result[:status]).to eq :error - expect(result[:message]).to eq "Error importing repository #{project.safe_import_url} into #{project.full_path} - Failed to import the repository [FILTERED]" - end - - context 'when lfs import fails' do - it 'logs the error' do - error_message = 'error message' - - expect(project.repository).to receive(:import_repository).and_return(true) - - expect_next_instance_of(Gitlab::BitbucketImport::Importer) do |importer| - expect(importer).to receive(:execute).and_return(true) - end - - expect_next_instance_of(Projects::LfsPointers::LfsImportService) do |service| - expect(service).to receive(:execute).and_return(status: :error, message: error_message) - end - - expect(Gitlab::AppLogger).to receive(:error).with("The Lfs import process failed. #{error_message}") - - subject.execute - end - end - - context 'when repository import scheduled' do - before do - expect(project.repository).to receive(:import_repository).and_return(true) - allow(subject).to receive(:import_data) - end - - it 'downloads lfs objects if lfs_enabled is enabled for project' do - allow(project).to receive(:lfs_enabled?).and_return(true) - - expect_any_instance_of(Projects::LfsPointers::LfsImportService).to receive(:execute) - - subject.execute - end - - it 'does not download lfs objects if lfs_enabled is not enabled for project' do - allow(project).to receive(:lfs_enabled?).and_return(false) - expect_any_instance_of(Projects::LfsPointers::LfsImportService).not_to receive(:execute) - - subject.execute - end - end - end end end end |