diff options
Diffstat (limited to 'spec/tasks/gitlab/gitaly_rake_spec.rb')
-rw-r--r-- | spec/tasks/gitlab/gitaly_rake_spec.rb | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/spec/tasks/gitlab/gitaly_rake_spec.rb b/spec/tasks/gitlab/gitaly_rake_spec.rb index c5625db922d..70c7ddb1d6e 100644 --- a/spec/tasks/gitlab/gitaly_rake_spec.rb +++ b/spec/tasks/gitlab/gitaly_rake_spec.rb @@ -7,26 +7,26 @@ RSpec.describe 'gitlab:gitaly namespace rake task', :silence_stdout do Rake.application.rake_require 'tasks/gitlab/gitaly' end - describe 'install' do - let(:repo) { 'https://gitlab.com/gitlab-org/gitaly.git' } - let(:clone_path) { Rails.root.join('tmp/tests/gitaly').to_s } - let(:storage_path) { Rails.root.join('tmp/tests/repositories').to_s } - let(:version) { File.read(Rails.root.join(Gitlab::GitalyClient::SERVER_VERSION_FILE)).chomp } + let(:repo) { 'https://gitlab.com/gitlab-org/gitaly.git' } + let(:clone_path) { Rails.root.join('tmp/tests/gitaly').to_s } + let(:storage_path) { Rails.root.join('tmp/tests/repositories').to_s } + let(:version) { File.read(Rails.root.join(Gitlab::GitalyClient::SERVER_VERSION_FILE)).chomp } - subject { run_rake_task('gitlab:gitaly:install', clone_path, storage_path) } + describe 'clone' do + subject { run_rake_task('gitlab:gitaly:clone', clone_path, storage_path) } context 'no dir given' do it 'aborts and display a help message' do # avoid writing task output to spec progress allow($stderr).to receive :write - expect { run_rake_task('gitlab:gitaly:install') }.to raise_error /Please specify the directory where you want to install gitaly and the path for the default storage/ + expect { run_rake_task('gitlab:gitaly:clone') }.to raise_error /Please specify the directory where you want to install gitaly and the path for the default storage/ end end context 'no storage path given' do it 'aborts and display a help message' do allow($stderr).to receive :write - expect { run_rake_task('gitlab:gitaly:install', clone_path) }.to raise_error /Please specify the directory where you want to install gitaly and the path for the default storage/ + expect { run_rake_task('gitlab:gitaly:clone', clone_path) }.to raise_error /Please specify the directory where you want to install gitaly and the path for the default storage/ end end @@ -40,11 +40,6 @@ RSpec.describe 'gitlab:gitaly namespace rake task', :silence_stdout do end describe 'checkout or clone' do - before do - stub_env('CI', false) - expect(Dir).to receive(:chdir).with(clone_path) - end - it 'calls checkout_or_clone_version with the right arguments' do expect(main_object) .to receive(:checkout_or_clone_version).with(version: version, repo: repo, target_dir: clone_path, clone_opts: %w[--depth 1]) @@ -52,6 +47,10 @@ RSpec.describe 'gitlab:gitaly namespace rake task', :silence_stdout do subject end end + end + + describe 'install' do + subject { run_rake_task('gitlab:gitaly:install', clone_path, storage_path) } describe 'gmake/make' do before do @@ -62,10 +61,6 @@ RSpec.describe 'gitlab:gitaly namespace rake task', :silence_stdout do end context 'gmake is available' do - before do - expect(main_object).to receive(:checkout_or_clone_version) - end - it 'calls gmake in the gitaly directory' do expect(Gitlab::Popen).to receive(:popen) .with(%w[which gmake]) @@ -93,7 +88,6 @@ RSpec.describe 'gitlab:gitaly namespace rake task', :silence_stdout do context 'gmake is not available' do before do - expect(main_object).to receive(:checkout_or_clone_version) expect(Gitlab::Popen).to receive(:popen) .with(%w[which gmake]) .and_return(['', 42]) |