chore: change interface{} to any (#2818)
* chore: change interface{} to any
* chore: update goctl version to 1.5.0
* chore: update goctl deps
This commit is contained in:
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// StreamAuthorizeInterceptor returns a func that uses given authenticator in processing stream requests.
|
||||
func StreamAuthorizeInterceptor(authenticator *auth.Authenticator) grpc.StreamServerInterceptor {
|
||||
return func(svr interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo,
|
||||
return func(svr any, stream grpc.ServerStream, info *grpc.StreamServerInfo,
|
||||
handler grpc.StreamHandler) error {
|
||||
if err := authenticator.Authenticate(stream.Context()); err != nil {
|
||||
return err
|
||||
@@ -21,8 +21,8 @@ func StreamAuthorizeInterceptor(authenticator *auth.Authenticator) grpc.StreamSe
|
||||
|
||||
// UnaryAuthorizeInterceptor returns a func that uses given authenticator in processing unary requests.
|
||||
func UnaryAuthorizeInterceptor(authenticator *auth.Authenticator) grpc.UnaryServerInterceptor {
|
||||
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo,
|
||||
handler grpc.UnaryHandler) (interface{}, error) {
|
||||
return func(ctx context.Context, req any, info *grpc.UnaryServerInfo,
|
||||
handler grpc.UnaryHandler) (any, error) {
|
||||
if err := authenticator.Authenticate(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ func TestStreamAuthorizeInterceptor(t *testing.T) {
|
||||
})
|
||||
ctx := metadata.NewIncomingContext(context.Background(), md)
|
||||
stream := mockedStream{ctx: ctx}
|
||||
err = interceptor(nil, stream, nil, func(_ interface{}, _ grpc.ServerStream) error {
|
||||
err = interceptor(nil, stream, nil, func(_ any, _ grpc.ServerStream) error {
|
||||
return nil
|
||||
})
|
||||
if test.hasError {
|
||||
@@ -131,7 +131,7 @@ func TestUnaryAuthorizeInterceptor(t *testing.T) {
|
||||
})
|
||||
ctx := metadata.NewIncomingContext(context.Background(), md)
|
||||
_, err = interceptor(ctx, nil, nil,
|
||||
func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
func(ctx context.Context, req any) (any, error) {
|
||||
return nil, nil
|
||||
})
|
||||
if test.hasError {
|
||||
@@ -141,7 +141,7 @@ func TestUnaryAuthorizeInterceptor(t *testing.T) {
|
||||
}
|
||||
if test.strict {
|
||||
_, err = interceptor(context.Background(), nil, nil,
|
||||
func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
func(ctx context.Context, req any) (any, error) {
|
||||
return nil, nil
|
||||
})
|
||||
assert.NotNil(t, err)
|
||||
@@ -149,7 +149,7 @@ func TestUnaryAuthorizeInterceptor(t *testing.T) {
|
||||
var md metadata.MD
|
||||
ctx := metadata.NewIncomingContext(context.Background(), md)
|
||||
_, err = interceptor(ctx, nil, nil,
|
||||
func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
func(ctx context.Context, req any) (any, error) {
|
||||
return nil, nil
|
||||
})
|
||||
assert.NotNil(t, err)
|
||||
@@ -160,7 +160,7 @@ func TestUnaryAuthorizeInterceptor(t *testing.T) {
|
||||
})
|
||||
ctx = metadata.NewIncomingContext(context.Background(), md)
|
||||
_, err = interceptor(ctx, nil, nil,
|
||||
func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
func(ctx context.Context, req any) (any, error) {
|
||||
return nil, nil
|
||||
})
|
||||
assert.NotNil(t, err)
|
||||
@@ -188,10 +188,10 @@ func (m mockedStream) Context() context.Context {
|
||||
return m.ctx
|
||||
}
|
||||
|
||||
func (m mockedStream) SendMsg(v interface{}) error {
|
||||
func (m mockedStream) SendMsg(v any) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m mockedStream) RecvMsg(v interface{}) error {
|
||||
func (m mockedStream) RecvMsg(v any) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
// StreamBreakerInterceptor is an interceptor that acts as a circuit breaker.
|
||||
func StreamBreakerInterceptor(svr interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo,
|
||||
func StreamBreakerInterceptor(svr any, stream grpc.ServerStream, info *grpc.StreamServerInfo,
|
||||
handler grpc.StreamHandler) (err error) {
|
||||
breakerName := info.FullMethod
|
||||
return breaker.DoWithAcceptable(breakerName, func() error {
|
||||
@@ -18,8 +18,8 @@ func StreamBreakerInterceptor(svr interface{}, stream grpc.ServerStream, info *g
|
||||
}
|
||||
|
||||
// UnaryBreakerInterceptor is an interceptor that acts as a circuit breaker.
|
||||
func UnaryBreakerInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo,
|
||||
handler grpc.UnaryHandler) (resp interface{}, err error) {
|
||||
func UnaryBreakerInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo,
|
||||
handler grpc.UnaryHandler) (resp any, err error) {
|
||||
breakerName := info.FullMethod
|
||||
err = breaker.DoWithAcceptable(breakerName, func() error {
|
||||
var err error
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
func TestStreamBreakerInterceptor(t *testing.T) {
|
||||
err := StreamBreakerInterceptor(nil, nil, &grpc.StreamServerInfo{
|
||||
FullMethod: "any",
|
||||
}, func(_ interface{}, _ grpc.ServerStream) error {
|
||||
}, func(_ any, _ grpc.ServerStream) error {
|
||||
return status.New(codes.DeadlineExceeded, "any").Err()
|
||||
})
|
||||
assert.NotNil(t, err)
|
||||
@@ -22,7 +22,7 @@ func TestStreamBreakerInterceptor(t *testing.T) {
|
||||
func TestUnaryBreakerInterceptor(t *testing.T) {
|
||||
_, err := UnaryBreakerInterceptor(context.Background(), nil, &grpc.UnaryServerInfo{
|
||||
FullMethod: "any",
|
||||
}, func(_ context.Context, _ interface{}) (interface{}, error) {
|
||||
}, func(_ context.Context, _ any) (any, error) {
|
||||
return nil, status.New(codes.DeadlineExceeded, "any").Err()
|
||||
})
|
||||
assert.NotNil(t, err)
|
||||
|
||||
@@ -33,8 +33,8 @@ var (
|
||||
)
|
||||
|
||||
// UnaryPrometheusInterceptor reports the statistics to the prometheus server.
|
||||
func UnaryPrometheusInterceptor(ctx context.Context, req interface{},
|
||||
info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
|
||||
func UnaryPrometheusInterceptor(ctx context.Context, req any,
|
||||
info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error) {
|
||||
startTime := timex.Now()
|
||||
resp, err := handler(ctx, req)
|
||||
metricServerReqDur.Observe(int64(timex.Since(startTime)/time.Millisecond), info.FullMethod)
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
func TestUnaryPromMetricInterceptor_Disabled(t *testing.T) {
|
||||
_, err := UnaryPrometheusInterceptor(context.Background(), nil, &grpc.UnaryServerInfo{
|
||||
FullMethod: "/",
|
||||
}, func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
}, func(ctx context.Context, req any) (any, error) {
|
||||
return nil, nil
|
||||
})
|
||||
assert.Nil(t, err)
|
||||
@@ -25,7 +25,7 @@ func TestUnaryPromMetricInterceptor_Enabled(t *testing.T) {
|
||||
})
|
||||
_, err := UnaryPrometheusInterceptor(context.Background(), nil, &grpc.UnaryServerInfo{
|
||||
FullMethod: "/",
|
||||
}, func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
}, func(ctx context.Context, req any) (any, error) {
|
||||
return nil, nil
|
||||
})
|
||||
assert.Nil(t, err)
|
||||
|
||||
@@ -11,9 +11,9 @@ import (
|
||||
)
|
||||
|
||||
// StreamRecoverInterceptor catches panics in processing stream requests and recovers.
|
||||
func StreamRecoverInterceptor(svr interface{}, stream grpc.ServerStream, _ *grpc.StreamServerInfo,
|
||||
func StreamRecoverInterceptor(svr any, stream grpc.ServerStream, _ *grpc.StreamServerInfo,
|
||||
handler grpc.StreamHandler) (err error) {
|
||||
defer handleCrash(func(r interface{}) {
|
||||
defer handleCrash(func(r any) {
|
||||
err = toPanicError(r)
|
||||
})
|
||||
|
||||
@@ -21,22 +21,22 @@ func StreamRecoverInterceptor(svr interface{}, stream grpc.ServerStream, _ *grpc
|
||||
}
|
||||
|
||||
// UnaryRecoverInterceptor catches panics in processing unary requests and recovers.
|
||||
func UnaryRecoverInterceptor(ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo,
|
||||
handler grpc.UnaryHandler) (resp interface{}, err error) {
|
||||
defer handleCrash(func(r interface{}) {
|
||||
func UnaryRecoverInterceptor(ctx context.Context, req any, _ *grpc.UnaryServerInfo,
|
||||
handler grpc.UnaryHandler) (resp any, err error) {
|
||||
defer handleCrash(func(r any) {
|
||||
err = toPanicError(r)
|
||||
})
|
||||
|
||||
return handler(ctx, req)
|
||||
}
|
||||
|
||||
func handleCrash(handler func(interface{})) {
|
||||
func handleCrash(handler func(any)) {
|
||||
if r := recover(); r != nil {
|
||||
handler(r)
|
||||
}
|
||||
}
|
||||
|
||||
func toPanicError(r interface{}) error {
|
||||
func toPanicError(r any) error {
|
||||
logx.Errorf("%+v\n\n%s", r, debug.Stack())
|
||||
return status.Errorf(codes.Internal, "panic: %v", r)
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ func init() {
|
||||
|
||||
func TestStreamCrashInterceptor(t *testing.T) {
|
||||
err := StreamRecoverInterceptor(nil, nil, nil, func(
|
||||
svr interface{}, stream grpc.ServerStream) error {
|
||||
svr any, stream grpc.ServerStream) error {
|
||||
panic("mock panic")
|
||||
})
|
||||
assert.NotNil(t, err)
|
||||
@@ -23,7 +23,7 @@ func TestStreamCrashInterceptor(t *testing.T) {
|
||||
|
||||
func TestUnaryCrashInterceptor(t *testing.T) {
|
||||
_, err := UnaryRecoverInterceptor(context.Background(), nil, nil,
|
||||
func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
func(ctx context.Context, req any) (any, error) {
|
||||
panic("mock panic")
|
||||
})
|
||||
assert.NotNil(t, err)
|
||||
|
||||
@@ -20,8 +20,8 @@ var (
|
||||
func UnarySheddingInterceptor(shedder load.Shedder, metrics *stat.Metrics) grpc.UnaryServerInterceptor {
|
||||
ensureSheddingStat()
|
||||
|
||||
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo,
|
||||
handler grpc.UnaryHandler) (val interface{}, err error) {
|
||||
return func(ctx context.Context, req any, info *grpc.UnaryServerInfo,
|
||||
handler grpc.UnaryHandler) (val any, err error) {
|
||||
sheddingStat.IncrementTotal()
|
||||
var promise load.Promise
|
||||
promise, err = shedder.Allow()
|
||||
|
||||
@@ -47,7 +47,7 @@ func TestUnarySheddingInterceptor(t *testing.T) {
|
||||
interceptor := UnarySheddingInterceptor(shedder, metrics)
|
||||
_, err := interceptor(context.Background(), nil, &grpc.UnaryServerInfo{
|
||||
FullMethod: "/",
|
||||
}, func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
}, func(ctx context.Context, req any) (any, error) {
|
||||
return nil, test.handleErr
|
||||
})
|
||||
assert.Equal(t, test.expect, err)
|
||||
|
||||
@@ -34,8 +34,8 @@ func SetSlowThreshold(threshold time.Duration) {
|
||||
|
||||
// UnaryStatInterceptor returns a func that uses given metrics to report stats.
|
||||
func UnaryStatInterceptor(metrics *stat.Metrics) grpc.UnaryServerInterceptor {
|
||||
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo,
|
||||
handler grpc.UnaryHandler) (resp interface{}, err error) {
|
||||
return func(ctx context.Context, req any, info *grpc.UnaryServerInfo,
|
||||
handler grpc.UnaryHandler) (resp any, err error) {
|
||||
startTime := timex.Now()
|
||||
defer func() {
|
||||
duration := timex.Since(startTime)
|
||||
@@ -49,7 +49,7 @@ func UnaryStatInterceptor(metrics *stat.Metrics) grpc.UnaryServerInterceptor {
|
||||
}
|
||||
}
|
||||
|
||||
func logDuration(ctx context.Context, method string, req interface{}, duration time.Duration) {
|
||||
func logDuration(ctx context.Context, method string, req any, duration time.Duration) {
|
||||
var addr string
|
||||
client, ok := peer.FromContext(ctx)
|
||||
if ok {
|
||||
|
||||
@@ -24,7 +24,7 @@ func TestUnaryStatInterceptor(t *testing.T) {
|
||||
interceptor := UnaryStatInterceptor(metrics)
|
||||
_, err := interceptor(context.Background(), nil, &grpc.UnaryServerInfo{
|
||||
FullMethod: "/",
|
||||
}, func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
}, func(ctx context.Context, req any) (any, error) {
|
||||
return nil, nil
|
||||
})
|
||||
assert.Nil(t, err)
|
||||
@@ -38,7 +38,7 @@ func TestLogDuration(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
ctx context.Context
|
||||
req interface{}
|
||||
req any
|
||||
duration time.Duration
|
||||
}{
|
||||
{
|
||||
@@ -92,7 +92,7 @@ func TestLogDurationWithoutContent(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
ctx context.Context
|
||||
req interface{}
|
||||
req any
|
||||
duration time.Duration
|
||||
}{
|
||||
{
|
||||
|
||||
@@ -15,17 +15,17 @@ import (
|
||||
|
||||
// UnaryTimeoutInterceptor returns a func that sets timeout to incoming unary requests.
|
||||
func UnaryTimeoutInterceptor(timeout time.Duration) grpc.UnaryServerInterceptor {
|
||||
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo,
|
||||
handler grpc.UnaryHandler) (interface{}, error) {
|
||||
return func(ctx context.Context, req any, info *grpc.UnaryServerInfo,
|
||||
handler grpc.UnaryHandler) (any, error) {
|
||||
ctx, cancel := context.WithTimeout(ctx, timeout)
|
||||
defer cancel()
|
||||
|
||||
var resp interface{}
|
||||
var resp any
|
||||
var err error
|
||||
var lock sync.Mutex
|
||||
done := make(chan struct{})
|
||||
// create channel with buffer size 1 to avoid goroutine leak
|
||||
panicChan := make(chan interface{}, 1)
|
||||
panicChan := make(chan any, 1)
|
||||
go func() {
|
||||
defer func() {
|
||||
if p := recover(); p != nil {
|
||||
|
||||
@@ -16,7 +16,7 @@ func TestUnaryTimeoutInterceptor(t *testing.T) {
|
||||
interceptor := UnaryTimeoutInterceptor(time.Millisecond * 10)
|
||||
_, err := interceptor(context.Background(), nil, &grpc.UnaryServerInfo{
|
||||
FullMethod: "/",
|
||||
}, func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
}, func(ctx context.Context, req any) (any, error) {
|
||||
return nil, nil
|
||||
})
|
||||
assert.Nil(t, err)
|
||||
@@ -27,7 +27,7 @@ func TestUnaryTimeoutInterceptor_panic(t *testing.T) {
|
||||
assert.Panics(t, func() {
|
||||
_, _ = interceptor(context.Background(), nil, &grpc.UnaryServerInfo{
|
||||
FullMethod: "/",
|
||||
}, func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
}, func(ctx context.Context, req any) (any, error) {
|
||||
panic("any")
|
||||
})
|
||||
})
|
||||
@@ -42,7 +42,7 @@ func TestUnaryTimeoutInterceptor_timeout(t *testing.T) {
|
||||
wg.Add(1)
|
||||
_, err := interceptor(ctx, nil, &grpc.UnaryServerInfo{
|
||||
FullMethod: "/",
|
||||
}, func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
}, func(ctx context.Context, req any) (any, error) {
|
||||
defer wg.Done()
|
||||
tm, ok := ctx.Deadline()
|
||||
assert.True(t, ok)
|
||||
@@ -62,7 +62,7 @@ func TestUnaryTimeoutInterceptor_timeoutExpire(t *testing.T) {
|
||||
wg.Add(1)
|
||||
_, err := interceptor(ctx, nil, &grpc.UnaryServerInfo{
|
||||
FullMethod: "/",
|
||||
}, func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
}, func(ctx context.Context, req any) (any, error) {
|
||||
defer wg.Done()
|
||||
time.Sleep(time.Millisecond * 50)
|
||||
return nil, nil
|
||||
@@ -81,7 +81,7 @@ func TestUnaryTimeoutInterceptor_cancel(t *testing.T) {
|
||||
wg.Add(1)
|
||||
_, err := interceptor(ctx, nil, &grpc.UnaryServerInfo{
|
||||
FullMethod: "/",
|
||||
}, func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
}, func(ctx context.Context, req any) (any, error) {
|
||||
defer wg.Done()
|
||||
time.Sleep(time.Millisecond * 50)
|
||||
return nil, nil
|
||||
|
||||
@@ -15,8 +15,8 @@ import (
|
||||
)
|
||||
|
||||
// UnaryTracingInterceptor is a grpc.UnaryServerInterceptor for opentelemetry.
|
||||
func UnaryTracingInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo,
|
||||
handler grpc.UnaryHandler) (interface{}, error) {
|
||||
func UnaryTracingInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo,
|
||||
handler grpc.UnaryHandler) (any, error) {
|
||||
ctx, span := startSpan(ctx, info.FullMethod)
|
||||
defer span.End()
|
||||
|
||||
@@ -41,7 +41,7 @@ func UnaryTracingInterceptor(ctx context.Context, req interface{}, info *grpc.Un
|
||||
}
|
||||
|
||||
// StreamTracingInterceptor returns a grpc.StreamServerInterceptor for opentelemetry.
|
||||
func StreamTracingInterceptor(svr interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo,
|
||||
func StreamTracingInterceptor(svr any, ss grpc.ServerStream, info *grpc.StreamServerInfo,
|
||||
handler grpc.StreamHandler) error {
|
||||
ctx, span := startSpan(ss.Context(), info.FullMethod)
|
||||
defer span.End()
|
||||
@@ -74,7 +74,7 @@ func (w *serverStream) Context() context.Context {
|
||||
return w.ctx
|
||||
}
|
||||
|
||||
func (w *serverStream) RecvMsg(m interface{}) error {
|
||||
func (w *serverStream) RecvMsg(m any) error {
|
||||
err := w.ServerStream.RecvMsg(m)
|
||||
if err == nil {
|
||||
w.receivedMessageID++
|
||||
@@ -84,7 +84,7 @@ func (w *serverStream) RecvMsg(m interface{}) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (w *serverStream) SendMsg(m interface{}) error {
|
||||
func (w *serverStream) SendMsg(m any) error {
|
||||
err := w.ServerStream.SendMsg(m)
|
||||
w.sentMessageID++
|
||||
ztrace.MessageSent.Event(w.Context(), w.sentMessageID, m)
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
func TestUnaryOpenTracingInterceptor_Disable(t *testing.T) {
|
||||
_, err := UnaryTracingInterceptor(context.Background(), nil, &grpc.UnaryServerInfo{
|
||||
FullMethod: "/",
|
||||
}, func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
}, func(ctx context.Context, req any) (any, error) {
|
||||
return nil, nil
|
||||
})
|
||||
assert.Nil(t, err)
|
||||
@@ -36,7 +36,7 @@ func TestUnaryOpenTracingInterceptor_Enabled(t *testing.T) {
|
||||
|
||||
_, err := UnaryTracingInterceptor(context.Background(), nil, &grpc.UnaryServerInfo{
|
||||
FullMethod: "/package.TestService.GetUser",
|
||||
}, func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
}, func(ctx context.Context, req any) (any, error) {
|
||||
return nil, nil
|
||||
})
|
||||
assert.Nil(t, err)
|
||||
@@ -48,7 +48,7 @@ func TestUnaryTracingInterceptor(t *testing.T) {
|
||||
wg.Add(1)
|
||||
_, err := UnaryTracingInterceptor(context.Background(), nil, &grpc.UnaryServerInfo{
|
||||
FullMethod: "/",
|
||||
}, func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
}, func(ctx context.Context, req any) (any, error) {
|
||||
defer wg.Done()
|
||||
atomic.AddInt32(&run, 1)
|
||||
return nil, nil
|
||||
@@ -84,7 +84,7 @@ func TestUnaryTracingInterceptor_WithError(t *testing.T) {
|
||||
ctx := metadata.NewIncomingContext(context.Background(), md)
|
||||
_, err := UnaryTracingInterceptor(ctx, nil, &grpc.UnaryServerInfo{
|
||||
FullMethod: "/",
|
||||
}, func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
}, func(ctx context.Context, req any) (any, error) {
|
||||
defer wg.Done()
|
||||
return nil, test.err
|
||||
})
|
||||
@@ -103,7 +103,7 @@ func TestStreamTracingInterceptor_GrpcFormat(t *testing.T) {
|
||||
stream := mockedServerStream{ctx: ctx}
|
||||
err := StreamTracingInterceptor(nil, &stream, &grpc.StreamServerInfo{
|
||||
FullMethod: "/foo",
|
||||
}, func(svr interface{}, stream grpc.ServerStream) error {
|
||||
}, func(svr any, stream grpc.ServerStream) error {
|
||||
defer wg.Done()
|
||||
atomic.AddInt32(&run, 1)
|
||||
return nil
|
||||
@@ -140,7 +140,7 @@ func TestStreamTracingInterceptor_FinishWithGrpcError(t *testing.T) {
|
||||
stream := mockedServerStream{ctx: ctx}
|
||||
err := StreamTracingInterceptor(nil, &stream, &grpc.StreamServerInfo{
|
||||
FullMethod: "/foo",
|
||||
}, func(svr interface{}, stream grpc.ServerStream) error {
|
||||
}, func(svr any, stream grpc.ServerStream) error {
|
||||
defer wg.Done()
|
||||
return test.err
|
||||
})
|
||||
@@ -177,7 +177,7 @@ func TestStreamTracingInterceptor_WithError(t *testing.T) {
|
||||
stream := mockedServerStream{ctx: ctx}
|
||||
err := StreamTracingInterceptor(nil, &stream, &grpc.StreamServerInfo{
|
||||
FullMethod: "/foo",
|
||||
}, func(svr interface{}, stream grpc.ServerStream) error {
|
||||
}, func(svr any, stream grpc.ServerStream) error {
|
||||
defer wg.Done()
|
||||
return test.err
|
||||
})
|
||||
@@ -270,10 +270,10 @@ func (m *mockedServerStream) Context() context.Context {
|
||||
return m.ctx
|
||||
}
|
||||
|
||||
func (m *mockedServerStream) SendMsg(v interface{}) error {
|
||||
func (m *mockedServerStream) SendMsg(v any) error {
|
||||
return m.err
|
||||
}
|
||||
|
||||
func (m *mockedServerStream) RecvMsg(v interface{}) error {
|
||||
func (m *mockedServerStream) RecvMsg(v any) error {
|
||||
return m.err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user