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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-08-19 12:08:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-08-19 12:08:42 +0300
commitb76ae638462ab0f673e5915986070518dd3f9ad3 (patch)
treebdab0533383b52873be0ec0eb4d3c66598ff8b91 /spec/lib/gitlab/github_import/importer/repository_importer_spec.rb
parent434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff)
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'spec/lib/gitlab/github_import/importer/repository_importer_spec.rb')
-rw-r--r--spec/lib/gitlab/github_import/importer/repository_importer_spec.rb59
1 files changed, 30 insertions, 29 deletions
diff --git a/spec/lib/gitlab/github_import/importer/repository_importer_spec.rb b/spec/lib/gitlab/github_import/importer/repository_importer_spec.rb
index 3839303b881..58a8fb1b7e4 100644
--- a/spec/lib/gitlab/github_import/importer/repository_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/repository_importer_spec.rb
@@ -202,7 +202,7 @@ RSpec.describe Gitlab::GithubImport::Importer::RepositoryImporter do
expect(repository)
.to receive(:fetch_as_mirror)
- .with(project.import_url, refmap: Gitlab::GithubImport.refmap, forced: true, remote_name: 'github')
+ .with(project.import_url, refmap: Gitlab::GithubImport.refmap, forced: true)
service = double
expect(Repositories::HousekeepingService)
@@ -211,17 +211,6 @@ RSpec.describe Gitlab::GithubImport::Importer::RepositoryImporter do
expect(importer.import_repository).to eq(true)
end
-
- it 'marks the import as failed when an error was raised' do
- expect(project).to receive(:ensure_repository)
- .and_raise(Gitlab::Git::Repository::NoRepository)
-
- expect(importer)
- .to receive(:fail_import)
- .and_return(false)
-
- expect(importer.import_repository).to eq(false)
- end
end
describe '#import_wiki_repository' do
@@ -234,28 +223,40 @@ RSpec.describe Gitlab::GithubImport::Importer::RepositoryImporter do
expect(importer.import_wiki_repository).to eq(true)
end
- it 'marks the import as failed and creates an empty repo if an error was raised' do
- expect(wiki_repository)
- .to receive(:import_repository)
- .with(importer.wiki_url)
- .and_raise(Gitlab::Git::CommandError)
+ context 'when it raises a Gitlab::Git::CommandError' do
+ context 'when the error is not a "repository not exported"' do
+ it 'creates the wiki and re-raise the exception' do
+ exception = Gitlab::Git::CommandError.new
- expect(importer)
- .to receive(:fail_import)
- .and_return(false)
+ expect(wiki_repository)
+ .to receive(:import_repository)
+ .with(importer.wiki_url)
+ .and_raise(exception)
- expect(project)
- .to receive(:create_wiki)
+ expect(project)
+ .to receive(:create_wiki)
- expect(importer.import_wiki_repository).to eq(false)
- end
- end
+ expect { importer.import_wiki_repository }
+ .to raise_error(exception)
+ end
+ end
+
+ context 'when the error is a "repository not exported"' do
+ it 'returns true' do
+ exception = Gitlab::Git::CommandError.new('repository not exported')
- describe '#fail_import' do
- it 'marks the import as failed' do
- expect(project.import_state).to receive(:mark_as_failed).with('foo')
+ expect(wiki_repository)
+ .to receive(:import_repository)
+ .with(importer.wiki_url)
+ .and_raise(exception)
- expect(importer.fail_import('foo')).to eq(false)
+ expect(project)
+ .not_to receive(:create_wiki)
+
+ expect(importer.import_wiki_repository)
+ .to eq(true)
+ end
+ end
end
end