diff options
author | Mikhail Mazurskiy <mmazurskiy@gitlab.com> | 2021-04-23 14:26:26 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-06-11 09:11:14 +0300 |
commit | d32f88d89abe04a500ad64eabf8ea0d619f2259f (patch) | |
tree | 5474dd2a3ec1f752642d457e2e8cb2296ee93392 /client | |
parent | 62cb10ffed99c3c3a2e0dcaec9d673b90dda437a (diff) |
Fix issues in tests
Changelog: changed
Diffstat (limited to 'client')
-rw-r--r-- | client/dial_test.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/client/dial_test.go b/client/dial_test.go index 4399cdfb3..ac8e26f0f 100644 --- a/client/dial_test.go +++ b/client/dial_test.go @@ -18,6 +18,7 @@ import ( gitalyauth "gitlab.com/gitlab-org/gitaly/v14/auth" proxytestdata "gitlab.com/gitlab-org/gitaly/v14/internal/praefect/grpc-proxy/testdata" "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper" + "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testassert" gitaly_x509 "gitlab.com/gitlab-org/gitaly/v14/internal/x509" "gitlab.com/gitlab-org/labkit/correlation" grpccorrelation "gitlab.com/gitlab-org/labkit/correlation/grpc" @@ -293,6 +294,7 @@ func TestDial_Tracing(t *testing.T) { t.Run("unary", func(t *testing.T) { reporter := jaeger.NewInMemoryReporter() tracer, tracerCloser := jaeger.NewTracer("", jaeger.NewConstSampler(true), reporter) + defer tracerCloser.Close() defer func(old opentracing.Tracer) { opentracing.SetGlobalTracer(old) }(opentracing.GlobalTracer()) opentracing.SetGlobalTracer(tracer) @@ -318,7 +320,6 @@ func TestDial_Tracing(t *testing.T) { require.NoError(t, err) span.Finish() - tracerCloser.Close() spans := reporter.GetSpans() require.Len(t, spans, 3) @@ -350,6 +351,7 @@ func TestDial_Tracing(t *testing.T) { t.Run("stream", func(t *testing.T) { reporter := jaeger.NewInMemoryReporter() tracer, tracerCloser := jaeger.NewTracer("", jaeger.NewConstSampler(true), reporter) + defer tracerCloser.Close() defer func(old opentracing.Tracer) { opentracing.SetGlobalTracer(old) }(opentracing.GlobalTracer()) opentracing.SetGlobalTracer(tracer) @@ -380,7 +382,6 @@ func TestDial_Tracing(t *testing.T) { require.Nil(t, resp) span.Finish() - tracerCloser.Close() spans := reporter.GetSpans() require.Len(t, spans, 3) @@ -526,9 +527,9 @@ func TestHealthCheckDialer(t *testing.T) { defer cancel() _, err := HealthCheckDialer(DialContext)(ctx, addr, nil) - require.Equal(t, status.Error(codes.Unauthenticated, "authentication required"), err, "should fail without token configured") + testassert.GrpcEqualErr(t, status.Error(codes.Unauthenticated, "authentication required"), err) cc, err := HealthCheckDialer(DialContext)(ctx, addr, []grpc.DialOption{grpc.WithPerRPCCredentials(gitalyauth.RPCCredentialsV2("token"))}) require.NoError(t, err) - cc.Close() + require.NoError(t, cc.Close()) } |