summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorAhmad Sherif <me@ahmadsherif.com>2018-01-18 17:33:35 +0000
committerAhmad Sherif <me@ahmadsherif.com>2018-01-24 12:10:31 +0100
commit24625323a826d70991fdf27fbbe1f39bee845c03 (patch)
tree8c7b3e7c949638ae1be4d655345f798e2d9bea9e /spec/lib
parente2a56af930f9f7d17a6a9b638f52007a60e4cc60 (diff)
downloadgitlab-ce-24625323a826d70991fdf27fbbe1f39bee845c03.tar.gz
Migrate repository bundling to Gitalyfeature/migrate-bundle-to-disk-to-gitaly
Closes gitaly#929
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/git/repository_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb
index aec7cde6df8..36ca3980de9 100644
--- a/spec/lib/gitlab/git/repository_spec.rb
+++ b/spec/lib/gitlab/git/repository_spec.rb
@@ -1926,6 +1926,34 @@ describe Gitlab::Git::Repository, seed_helper: true do
it { expect(subject.repository_relative_path).to eq(repository.relative_path) }
end
+ describe '#bundle_to_disk' do
+ shared_examples 'bundling to disk' do
+ let(:save_path) { File.join(Dir.tmpdir, "repo-#{SecureRandom.hex}.bundle") }
+
+ after do
+ FileUtils.rm_rf(save_path)
+ end
+
+ it 'saves a bundle to disk' do
+ repository.bundle_to_disk(save_path)
+
+ success = system(
+ *%W(#{Gitlab.config.git.bin_path} -C #{repository.path} bundle verify #{save_path}),
+ [:out, :err] => '/dev/null'
+ )
+ expect(success).to be true
+ end
+ end
+
+ context 'when Gitaly bundle_to_disk feature is enabled' do
+ it_behaves_like 'bundling to disk'
+ end
+
+ context 'when Gitaly bundle_to_disk feature is disabled', :disable_gitaly do
+ it_behaves_like 'bundling to disk'
+ end
+ end
+
context 'gitlab_projects commands' do
let(:gitlab_projects) { repository.gitlab_projects }
let(:timeout) { Gitlab.config.gitlab_shell.git_timeout }