2017-08-17 22:00:37 +05:30
|
|
|
require 'rake_helper'
|
|
|
|
|
|
|
|
describe 'gitlab:shell rake tasks' do
|
|
|
|
before do
|
|
|
|
Rake.application.rake_require 'tasks/gitlab/shell'
|
|
|
|
|
|
|
|
stub_warn_user_is_not_gitlab
|
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
after do
|
|
|
|
TestEnv.create_fake_git_hooks
|
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
describe 'install task' do
|
|
|
|
it 'invokes create_hooks task' do
|
|
|
|
expect(Rake::Task['gitlab:shell:create_hooks']).to receive(:invoke)
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
storages = Gitlab::GitalyClient::StorageSettings.allow_disk_access do
|
|
|
|
Gitlab.config.repositories.storages.values.map(&:legacy_disk_path)
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(Kernel).to receive(:system).with('bin/install', *storages).and_call_original
|
|
|
|
expect(Kernel).to receive(:system).with('bin/compile').and_call_original
|
|
|
|
|
|
|
|
run_rake_task('gitlab:shell:install')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'create_hooks task' do
|
|
|
|
it 'calls gitlab-shell bin/create_hooks' do
|
|
|
|
expect_any_instance_of(Object).to receive(:system)
|
2018-03-17 18:26:18 +05:30
|
|
|
.with("#{Gitlab.config.gitlab_shell.path}/bin/create-hooks",
|
|
|
|
*Gitlab::TaskHelpers.repository_storage_paths_args)
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
run_rake_task('gitlab:shell:create_hooks')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|