diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-02-11 23:43:57 +0100 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-02-11 23:43:57 +0100 |
commit | 562d7eb4ecaa9ca35f970567c0f09cdb29d26521 (patch) | |
tree | 032eb81a84675799500b5ecb54789fea90f3fcb6 /spec/gitlab_shell_spec.rb | |
parent | f92a9c5a5f3f1cfc8a827abcf67a508133f39f04 (diff) | |
download | gitlab-shell-562d7eb4ecaa9ca35f970567c0f09cdb29d26521.tar.gz |
Show nice error message when internal API is unreachable.
Diffstat (limited to 'spec/gitlab_shell_spec.rb')
-rw-r--r-- | spec/gitlab_shell_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/gitlab_shell_spec.rb b/spec/gitlab_shell_spec.rb index 5df2391..4ca7984 100644 --- a/spec/gitlab_shell_spec.rb +++ b/spec/gitlab_shell_spec.rb @@ -135,6 +135,27 @@ describe GitlabShell do api.should_receive(:discover).with(key_id) end end + + context "failed connection" do + before { + ssh_cmd 'git-upload-pack gitlab-ci.git' + api.stub(:check_access).and_raise(GitlabNet::ApiUnreachableError) + } + after { subject.exec } + + it "should not process the command" do + subject.should_not_receive(:process_cmd) + end + + it "should not execute the command" do + subject.should_not_receive(:exec_cmd) + end + + it "should log the failed connection" do + message = "gitlab-shell: Failed to connect to internal API" + $logger.should_receive(:warn).with(message) + end + end end describe :validate_access do |