summaryrefslogtreecommitdiff
path: root/internal/handler/exec_test.go
diff options
context:
space:
mode:
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