chore: add unit tests (#1615)

* test: add more tests

* test: add more tests
This commit is contained in:
Kevin Wan
2022-03-04 17:54:09 +08:00
committed by GitHub
parent 60760b52ab
commit 3b7ca86e4f
19 changed files with 108 additions and 69 deletions

View File

@@ -101,7 +101,7 @@ func TestStreamTracingInterceptor_GrpcFormat(t *testing.T) {
stream := mockedServerStream{ctx: ctx}
err := StreamTracingInterceptor(nil, &stream, &grpc.StreamServerInfo{
FullMethod: "/foo",
}, func(srv interface{}, stream grpc.ServerStream) error {
}, func(svr interface{}, stream grpc.ServerStream) error {
defer wg.Done()
atomic.AddInt32(&run, 1)
return nil
@@ -138,7 +138,7 @@ func TestStreamTracingInterceptor_FinishWithGrpcError(t *testing.T) {
stream := mockedServerStream{ctx: ctx}
err := StreamTracingInterceptor(nil, &stream, &grpc.StreamServerInfo{
FullMethod: "/foo",
}, func(srv interface{}, stream grpc.ServerStream) error {
}, func(svr interface{}, stream grpc.ServerStream) error {
defer wg.Done()
return test.err
})
@@ -175,7 +175,7 @@ func TestStreamTracingInterceptor_WithError(t *testing.T) {
stream := mockedServerStream{ctx: ctx}
err := StreamTracingInterceptor(nil, &stream, &grpc.StreamServerInfo{
FullMethod: "/foo",
}, func(srv interface{}, stream grpc.ServerStream) error {
}, func(svr interface{}, stream grpc.ServerStream) error {
defer wg.Done()
return test.err
})