summaryrefslogtreecommitdiff
path: root/internal/handler/exec_test.go
diff options
context:
space:
mode:
authorIgor Drozdov <idrozdov@gitlab.com>2021-09-17 18:29:59 +0300
committerIgor Drozdov <idrozdov@gitlab.com>2021-09-17 18:48:54 +0300
commit3fee6d5d70465bc57e0ba201d82ce1561052efb7 (patch)
tree378baec653f1ed6b880660cb694c293c956e4a4f /internal/handler/exec_test.go
parent37025e61e570e748613d9a5a57a7ae5de1b45af5 (diff)
downloadgitlab-shell-3fee6d5d70465bc57e0ba201d82ce1561052efb7.tar.gz
Improve err message given when Gitaly unavailable
Diffstat (limited to 'internal/handler/exec_test.go')
-rw-r--r--internal/handler/exec_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/handler/exec_test.go b/internal/handler/exec_test.go
index 5ad0675..1d714ef 100644
--- a/internal/handler/exec_test.go
+++ b/internal/handler/exec_test.go
@@ -7,7 +7,9 @@ import (
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
+ grpccodes "google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
+ grpcstatus "google.golang.org/grpc/status"
pb "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
"gitlab.com/gitlab-org/gitlab-shell/internal/config"
@@ -45,6 +47,18 @@ func TestMissingGitalyAddress(t *testing.T) {
require.EqualError(t, err, "no gitaly_address given")
}
+func TestUnavailableGitalyErr(t *testing.T) {
+ cmd := GitalyCommand{
+ Config: &config.Config{},
+ Address: "tcp://localhost:9999",
+ }
+
+ expectedErr := grpcstatus.Error(grpccodes.Unavailable, "error")
+ err := cmd.RunGitalyCommand(context.Background(), makeHandler(t, expectedErr))
+
+ require.EqualError(t, err, "Git service is temporarily unavailable")
+}
+
func TestRunGitalyCommandMetadata(t *testing.T) {
tests := []struct {
name string