diff options
author | Ahmad Sherif <me@ahmadsherif.com> | 2018-01-22 16:46:02 +0100 |
---|---|---|
committer | Ahmad Sherif <me@ahmadsherif.com> | 2018-01-24 19:02:32 +0100 |
commit | 6a28967c1461a840926940beb075e4f9285c7e82 (patch) | |
tree | bc857c77ce914db1e6be131f7023e017249bff8a /spec | |
parent | a403011e4f7adae339a3a8584e22a75f4872c3c5 (diff) | |
download | gitlab-ce-6a28967c1461a840926940beb075e4f9285c7e82.tar.gz |
Migrate restoring repo from bundle to Gitalyfeature/migrate-repo-restorer-to-gitaly
Closes gitaly#946
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/git/repository_spec.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index 36ca3980de9..f50f79ab87f 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -1954,6 +1954,42 @@ describe Gitlab::Git::Repository, seed_helper: true do end end + describe '#create_from_bundle' do + shared_examples 'creating repo from bundle' do + let(:bundle_path) { File.join(Dir.tmpdir, "repo-#{SecureRandom.hex}.bundle") } + let(:project) { create(:project) } + let(:imported_repo) { project.repository.raw } + + before { expect(repository.bundle_to_disk(bundle_path)).to be true } + after { FileUtils.rm_rf(bundle_path) } + + it 'creates a repo from a bundle file' do + expect(imported_repo).not_to exist + + result = imported_repo.create_from_bundle(bundle_path) + + expect(result).to be true + expect(imported_repo).to exist + expect { imported_repo.fsck }.not_to raise_exception + end + + it 'creates a symlink to the global hooks dir' do + imported_repo.create_from_bundle(bundle_path) + hooks_path = File.join(imported_repo.path, 'hooks') + + expect(File.readlink(hooks_path)).to eq(Gitlab.config.gitlab_shell.hooks_path) + end + end + + context 'when Gitaly create_repo_from_bundle feature is enabled' do + it_behaves_like 'creating repo from bundle' + end + + context 'when Gitaly create_repo_from_bundle feature is disabled', :disable_gitaly do + it_behaves_like 'creating repo from bundle' + end + end + context 'gitlab_projects commands' do let(:gitlab_projects) { repository.gitlab_projects } let(:timeout) { Gitlab.config.gitlab_shell.git_timeout } |