diff options
author | Igor Drozdov <idrozdov@gitlab.com> | 2021-09-17 18:29:59 +0300 |
---|---|---|
committer | Igor Drozdov <idrozdov@gitlab.com> | 2021-09-17 18:48:54 +0300 |
commit | 3fee6d5d70465bc57e0ba201d82ce1561052efb7 (patch) | |
tree | 378baec653f1ed6b880660cb694c293c956e4a4f /internal/handler/exec_test.go | |
parent | 37025e61e570e748613d9a5a57a7ae5de1b45af5 (diff) | |
download | gitlab-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.go | 14 |
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 |