Commit 7d2d4939 authored by Sean McGivern's avatar Sean McGivern

Merge branch '1907-add-timeout-to-push-mirrors' into 'master'

adds timeout option to push mirrors

Closes #1907

See merge request !1439
parents 94278340 968104b0
---
title: Adds timeout option to push mirrors
merge_request: 1439
author:
......@@ -307,7 +307,7 @@ module Gitlab
# push_remote_branches('upstream', 'feature')
#
def push_remote_branches(storage, project_name, remote_name, branch_names)
args = [gitlab_shell_projects_path, 'push-branches', storage, "#{project_name}.git", remote_name, *branch_names]
args = [gitlab_shell_projects_path, 'push-branches', storage, "#{project_name}.git", remote_name, '600', *branch_names]
output, status = Popen.popen(args)
raise Error, output unless status.zero?
true
......
......@@ -54,7 +54,7 @@ describe Gitlab::Shell, lib: true do
allow(Gitlab.config.gitlab_shell).to receive(:path).and_return('tmp/tests/shell-projects-test')
end
describe 'mv_repository' do
describe '#mv_repository' do
it 'executes the command' do
expect(Gitlab::Utils).to receive(:system_silent)
.with([projects_path, 'mv-project', 'storage/path', 'project/path.git', 'new/path.git'])
......@@ -62,13 +62,45 @@ describe Gitlab::Shell, lib: true do
end
end
describe 'mv_storage' do
describe '#mv_storage' do
it 'executes the command' do
expect(Gitlab::Utils).to receive(:system_silent)
.with([projects_path, 'mv-storage', 'current/storage', 'project/path.git', 'new/storage'])
gitlab_shell.mv_storage('current/storage', 'project/path', 'new/storage')
end
end
describe '#fetch_remote' do
it 'executes the command' do
expect(Gitlab::Popen).to receive(:popen)
.with([projects_path, 'fetch-remote', 'current/storage', 'project/path.git', 'new/storage', '600']).and_return([nil, 0])
expect(gitlab_shell.fetch_remote('current/storage', 'project/path', 'new/storage')).to be true
end
it 'fails to execute the command' do
expect(Gitlab::Popen).to receive(:popen)
.with([projects_path, 'fetch-remote', 'current/storage', 'project/path.git', 'new/storage', '600']).and_return(["error", 1])
expect { gitlab_shell.fetch_remote('current/storage', 'project/path', 'new/storage') }.to raise_error(Gitlab::Shell::Error, "error")
end
end
describe '#push_remote_branches' do
it 'executes the command' do
expect(Gitlab::Popen).to receive(:popen)
.with([projects_path, 'push-branches', 'current/storage', 'project/path.git', 'new/storage', '600', 'master']).and_return([nil, 0])
expect(gitlab_shell.push_remote_branches('current/storage', 'project/path', 'new/storage', ['master'])).to be true
end
it 'fails to execute the command' do
expect(Gitlab::Popen).to receive(:popen)
.with([projects_path, 'push-branches', 'current/storage', 'project/path.git', 'new/storage', '600', 'master']).and_return(["error", 1])
expect { gitlab_shell.push_remote_branches('current/storage', 'project/path', 'new/storage', ['master']) }.to raise_error(Gitlab::Shell::Error, "error")
end
end
end
describe '#add_key' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment