debian-mirror-gitlab/spec/tasks/gitlab/shell_rake_spec.rb

45 lines
1.4 KiB
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
require 'rake_helper'
2021-09-04 01:27:46 +05:30
RSpec.describe 'gitlab:shell rake tasks', :silence_stdout do
2017-08-17 22:00:37 +05:30
before do
Rake.application.rake_require 'tasks/gitlab/shell'
stub_warn_user_is_not_gitlab
end
describe 'install task' do
2019-09-04 21:01:54 +05:30
it 'installs and compiles gitlab-shell' do
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
2019-12-21 20:55:43 +05:30
expect_any_instance_of(Gitlab::TaskHelpers).to receive(:checkout_or_clone_version)
allow(Kernel).to receive(:system).with('bin/install', *storages).and_return(true)
2019-12-26 22:10:19 +05:30
allow(Kernel).to receive(:system).with('make', 'build').and_return(true)
2017-08-17 22:00:37 +05:30
run_rake_task('gitlab:shell:install')
end
end
2023-03-04 22:38:38 +05:30
describe 'setup task' do
it 'writes authorized keys into the file' do
allow(Gitlab::CurrentSettings).to receive(:authorized_keys_enabled?).and_return(true)
stub_env('force', 'yes')
auth_key = create(:key)
auth_and_signing_key = create(:key, usage_type: :auth_and_signing)
create(:key, usage_type: :signing)
expect_next_instance_of(Gitlab::AuthorizedKeys) do |instance|
expect(instance).to receive(:batch_add_keys).once do |keys|
expect(keys).to match_array([auth_key, auth_and_signing_key])
end
end
run_rake_task('gitlab:shell:setup')
end
end
2017-08-17 22:00:37 +05:30
end