summaryrefslogtreecommitdiff
path: root/spec/gitlab_shell_spec.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-02-12 03:28:01 +0000
committerDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-02-12 03:28:01 +0000
commit63e16172e524d83e4fe04945e277bc21dda6d777 (patch)
tree032eb81a84675799500b5ecb54789fea90f3fcb6 /spec/gitlab_shell_spec.rb
parentf11e1bf914854e53217ece1ec6f8947f2894a1c7 (diff)
parent562d7eb4ecaa9ca35f970567c0f09cdb29d26521 (diff)
downloadgitlab-shell-63e16172e524d83e4fe04945e277bc21dda6d777.tar.gz
Merge branch 'internal-api-unavailable' into 'master'
Show nice error message when internal API is unreachable. Closes #27. Error message reads "Failed to authorize your Git request: internal API unreachable". See merge request !54
Diffstat (limited to 'spec/gitlab_shell_spec.rb')
-rw-r--r--spec/gitlab_shell_spec.rb21
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