diff options
author | Sami Hiltunen <shiltunen@gitlab.com> | 2021-03-31 10:09:58 +0300 |
---|---|---|
committer | Sami Hiltunen <shiltunen@gitlab.com> | 2021-03-31 12:31:45 +0300 |
commit | f6ed983fe26f5a218086aaa627769e51729ec791 (patch) | |
tree | f8eb996f5ac55c9aa5f9389c0c1bcb15fcc20aa9 /client | |
parent | 9fb8a666e4f92f8e02c61274e3d58b67db190eaa (diff) |
remove DialWithMux from client package
DialWithMux should not be part of our public API as it is an
implementation detail between Praefect and Gitaly. Let's remove
DialWithMux from the public package thus and use the internal dialing
API in Praefect.
Diffstat (limited to 'client')
-rw-r--r-- | client/dial.go | 7 | ||||
-rw-r--r-- | client/dial_test.go | 47 |
2 files changed, 0 insertions, 54 deletions
diff --git a/client/dial.go b/client/dial.go index 214f69e1e..2886ed534 100644 --- a/client/dial.go +++ b/client/dial.go @@ -3,7 +3,6 @@ package client import ( "context" - "github.com/sirupsen/logrus" "gitlab.com/gitlab-org/gitaly/internal/gitaly/client" "google.golang.org/grpc" healthpb "google.golang.org/grpc/health/grpc_health_v1" @@ -31,12 +30,6 @@ func Dial(rawAddress string, connOpts []grpc.DialOption) (*grpc.ClientConn, erro return DialContext(context.Background(), rawAddress, connOpts) } -// DialWithMux dials with a multiplexed connection to Gitaly. Experimental, this is going to be removed and -// should not be depended upon. -func DialWithMux(ctx context.Context, rawAddress string, connOpts []grpc.DialOption, logger *logrus.Entry) (*grpc.ClientConn, error) { - return client.Dial(ctx, rawAddress, connOpts, true, logger) -} - // FailOnNonTempDialError helps to identify if remote listener is ready to accept new connections. func FailOnNonTempDialError() []grpc.DialOption { return []grpc.DialOption{ diff --git a/client/dial_test.go b/client/dial_test.go index 027aa6056..b9a1dabe2 100644 --- a/client/dial_test.go +++ b/client/dial_test.go @@ -16,11 +16,9 @@ import ( "github.com/stretchr/testify/require" "github.com/uber/jaeger-client-go" gitalyauth "gitlab.com/gitlab-org/gitaly/auth" - "gitlab.com/gitlab-org/gitaly/internal/backchannel" proxytestdata "gitlab.com/gitlab-org/gitaly/internal/praefect/grpc-proxy/testdata" "gitlab.com/gitlab-org/gitaly/internal/testhelper" gitaly_x509 "gitlab.com/gitlab-org/gitaly/internal/x509" - "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" "gitlab.com/gitlab-org/labkit/correlation" grpccorrelation "gitlab.com/gitlab-org/labkit/correlation/grpc" grpctracing "gitlab.com/gitlab-org/labkit/tracing/grpc" @@ -535,48 +533,3 @@ func TestHealthCheckDialer(t *testing.T) { require.NoError(t, err) cc.Close() } - -func TestDialWithMux(t *testing.T) { - errNonMuxed := status.Error(codes.Internal, "non-muxed connection") - errMuxed := status.Error(codes.Internal, "muxed connection") - - logger := testhelper.DiscardTestEntry(t) - - srv := grpc.NewServer( - grpc.Creds(backchannel.NewServerHandshaker(logger, backchannel.Insecure(), backchannel.NewRegistry())), - grpc.UnknownServiceHandler(func(srv interface{}, stream grpc.ServerStream) error { - _, err := backchannel.GetPeerID(stream.Context()) - if err == backchannel.ErrNonMultiplexedConnection { - return errNonMuxed - } - - assert.NoError(t, err) - return errMuxed - }), - ) - defer srv.Stop() - - ln, err := net.Listen("tcp", "localhost:0") - require.NoError(t, err) - - go srv.Serve(ln) - - ctx, cancel := testhelper.Context() - defer cancel() - - t.Run("non-muxed conn", func(t *testing.T) { - nonMuxedConn, err := DialContext(ctx, "tcp://"+ln.Addr().String(), nil) - require.NoError(t, err) - defer func() { require.NoError(t, nonMuxedConn.Close()) }() - - require.Equal(t, errNonMuxed, nonMuxedConn.Invoke(ctx, "/Service/Method", &gitalypb.VoteTransactionRequest{}, &gitalypb.VoteTransactionResponse{})) - }) - - t.Run("muxed conn", func(t *testing.T) { - nonMuxedConn, err := DialWithMux(ctx, "tcp://"+ln.Addr().String(), nil, logger) - require.NoError(t, err) - defer func() { require.NoError(t, nonMuxedConn.Close()) }() - - require.Equal(t, errMuxed, nonMuxedConn.Invoke(ctx, "/Service/Method", &gitalypb.VoteTransactionRequest{}, &gitalypb.VoteTransactionResponse{})) - }) -} |