diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-28 21:08:52 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-28 21:08:52 +0300 |
commit | 3e49ae159acbb703f005f5014772072cd90ef97b (patch) | |
tree | a65e942c5e207461419c4a266ebe6952733c8520 /spec/lib/gitlab/bitbucket_server_import/importer_spec.rb | |
parent | 77d49e6a73b3a1e142ec865d05dc3dd9a708ab6a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/bitbucket_server_import/importer_spec.rb')
-rw-r--r-- | spec/lib/gitlab/bitbucket_server_import/importer_spec.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/lib/gitlab/bitbucket_server_import/importer_spec.rb b/spec/lib/gitlab/bitbucket_server_import/importer_spec.rb index 80ec5ec1fc7..18bcf779d31 100644 --- a/spec/lib/gitlab/bitbucket_server_import/importer_spec.rb +++ b/spec/lib/gitlab/bitbucket_server_import/importer_spec.rb @@ -525,4 +525,36 @@ RSpec.describe Gitlab::BitbucketServerImport::Importer do expect { subject.execute }.to change { MergeRequest.count }.by(1) end end + + context "lfs files" do + before do + allow(project).to receive(:lfs_enabled?).and_return(true) + allow(subject).to receive(:import_repository) + allow(subject).to receive(:import_pull_requests) + end + + it "downloads lfs objects if lfs_enabled is enabled for project" do + expect_next_instance_of(Projects::LfsPointers::LfsImportService) do |lfs_import_service| + expect(lfs_import_service).to receive(:execute).and_return(status: :success) + end + + subject.execute + end + + it "adds the error message when the lfs download fails" do + allow_next_instance_of(Projects::LfsPointers::LfsImportService) do |lfs_import_service| + expect(lfs_import_service).to receive(:execute).and_return(status: :error, message: "LFS server not reachable") + end + + subject.execute + + expect(project.import_state.reload.last_error).to eq(Gitlab::Json.dump({ + message: "The remote data could not be fully imported.", + errors: [{ + type: "lfs_objects", + errors: "The Lfs import process failed. LFS server not reachable" + }] + })) + end + end end |