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:
authorNick Thomas <nick@gitlab.com>2018-11-12 13:52:48 +0300
committerNick Thomas <nick@gitlab.com>2018-11-19 14:46:39 +0300
commitf1bc7b6eb5cb9beab55e4edac87cc5e0b7ceb069 (patch)
tree2e5aedd22e2fd05909c1e97c5bc52602feadc825 /spec/lib/gitlab/git/remote_mirror_spec.rb
parentb1b4c94484b0613a6a457e32218d4f62b9eb2029 (diff)
SSH public-key authentication for push mirroring
Diffstat (limited to 'spec/lib/gitlab/git/remote_mirror_spec.rb')
-rw-r--r--spec/lib/gitlab/git/remote_mirror_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git/remote_mirror_spec.rb b/spec/lib/gitlab/git/remote_mirror_spec.rb
new file mode 100644
index 00000000000..dc63eef7814
--- /dev/null
+++ b/spec/lib/gitlab/git/remote_mirror_spec.rb
@@ -0,0 +1,28 @@
+require 'spec_helper'
+
+describe Gitlab::Git::RemoteMirror do
+ describe '#update' do
+ let(:project) { create(:project, :repository) }
+ let(:repository) { project.repository }
+ let(:ref_name) { 'foo' }
+ let(:options) { { only_branches_matching: ['master'], ssh_key: 'KEY', known_hosts: 'KNOWN HOSTS' } }
+
+ subject(:remote_mirror) { described_class.new(repository, ref_name, **options) }
+
+ it 'delegates to the Gitaly client' do
+ expect(repository.gitaly_remote_client)
+ .to receive(:update_remote_mirror)
+ .with(ref_name, ['master'], ssh_key: 'KEY', known_hosts: 'KNOWN HOSTS')
+
+ remote_mirror.update
+ end
+
+ it 'wraps gitaly errors' do
+ expect(repository.gitaly_remote_client)
+ .to receive(:update_remote_mirror)
+ .and_raise(StandardError)
+
+ expect { remote_mirror.update }.to raise_error(StandardError)
+ end
+ end
+end