Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-05-05 16:40:52 +0300
committerSean McGivern <sean@gitlab.com>2017-05-05 16:40:52 +0300
commitfaf2ce89cd4eafdccb78823cf1a32c338a8d9a79 (patch)
tree1931a7f2929a252778400e2b97d44992f5d5725e /spec/lib/gitlab/shell_spec.rb
parent7e0e45dbf174bb82cc0ea8191a869612ad60b4f7 (diff)
parent0f1273fa44a9122bffbd5cecbaea99b1db781d7e (diff)
Merge branch 'mrchrisw-import-shell-timeout'
Diffstat (limited to 'spec/lib/gitlab/shell_spec.rb')
-rw-r--r--spec/lib/gitlab/shell_spec.rb41
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/lib/gitlab/shell_spec.rb b/spec/lib/gitlab/shell_spec.rb
index 6675d26734e..a97a0f8452b 100644
--- a/spec/lib/gitlab/shell_spec.rb
+++ b/spec/lib/gitlab/shell_spec.rb
@@ -91,4 +91,45 @@ describe Gitlab::Shell, lib: true do
end
end
end
+
+ describe 'projects commands' do
+ let(:projects_path) { 'tmp/tests/shell-projects-test/bin/gitlab-projects' }
+
+ before do
+ allow(Gitlab.config.gitlab_shell).to receive(:path).and_return('tmp/tests/shell-projects-test')
+ allow(Gitlab.config.gitlab_shell).to receive(:git_timeout).and_return(800)
+ end
+
+ describe '#fetch_remote' do
+ it 'returns true when the command succeeds' do
+ expect(Gitlab::Popen).to receive(:popen)
+ .with([projects_path, 'fetch-remote', 'current/storage', 'project/path.git', 'new/storage', '800']).and_return([nil, 0])
+
+ expect(gitlab_shell.fetch_remote('current/storage', 'project/path', 'new/storage')).to be true
+ end
+
+ it 'raises an exception when the command fails' do
+ expect(Gitlab::Popen).to receive(:popen)
+ .with([projects_path, 'fetch-remote', 'current/storage', 'project/path.git', 'new/storage', '800']).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 '#import_repository' do
+ it 'returns true when the command succeeds' do
+ expect(Gitlab::Popen).to receive(:popen)
+ .with([projects_path, 'import-project', 'current/storage', 'project/path.git', 'https://gitlab.com/gitlab-org/gitlab-ce.git', "800"]).and_return([nil, 0])
+
+ expect(gitlab_shell.import_repository('current/storage', 'project/path', 'https://gitlab.com/gitlab-org/gitlab-ce.git')).to be true
+ end
+
+ it 'raises an exception when the command fails' do
+ expect(Gitlab::Popen).to receive(:popen)
+ .with([projects_path, 'import-project', 'current/storage', 'project/path.git', 'https://gitlab.com/gitlab-org/gitlab-ce.git', "800"]).and_return(["error", 1])
+
+ expect { gitlab_shell.import_repository('current/storage', 'project/path', 'https://gitlab.com/gitlab-org/gitlab-ce.git') }.to raise_error(Gitlab::Shell::Error, "error")
+ end
+ end
+ end
end