@@ -82,7 +82,19 @@ func TestTaggingSuite(t *testing.T) {
8282 }
8383 s := & OpentracingSuite {
8484 mockTracer : mockTracer ,
85- InterceptorTestSuite : makeInterceptorTestSuite (t , opts ),
85+ InterceptorTestSuite : makeInterceptorTestSuite (t , opts , opts ),
86+ }
87+ suite .Run (t , s )
88+ }
89+
90+ func TestTaggingSuite2 (t * testing.T ) {
91+ mockTracer := mocktracer .New ()
92+ opts := []grpc_opentracing.Option {
93+ grpc_opentracing .WithTracer (mockTracer ),
94+ }
95+ s := & OpentracingSuite {
96+ mockTracer : mockTracer ,
97+ InterceptorTestSuite : makeInterceptorTestSuite (t , nil , opts ),
8698 }
8799 suite .Run (t , s )
88100}
@@ -96,26 +108,26 @@ func TestTaggingSuiteJaeger(t *testing.T) {
96108 }
97109 s := & OpentracingSuite {
98110 mockTracer : mockTracer ,
99- InterceptorTestSuite : makeInterceptorTestSuite (t , opts ),
111+ InterceptorTestSuite : makeInterceptorTestSuite (t , opts , opts ),
100112 }
101113 suite .Run (t , s )
102114}
103115
104- func makeInterceptorTestSuite (t * testing.T , opts []grpc_opentracing.Option ) * grpc_testing.InterceptorTestSuite {
116+ func makeInterceptorTestSuite (t * testing.T , clientOpts , serverOpts []grpc_opentracing.Option ) * grpc_testing.InterceptorTestSuite {
105117
106118 return & grpc_testing.InterceptorTestSuite {
107119 TestService : & tracingAssertService {TestServiceServer : & grpc_testing.TestPingService {T : t }, T : t },
108120 ClientOpts : []grpc.DialOption {
109- grpc .WithUnaryInterceptor (grpc_opentracing .UnaryClientInterceptor (opts ... )),
110- grpc .WithStreamInterceptor (grpc_opentracing .StreamClientInterceptor (opts ... )),
121+ grpc .WithUnaryInterceptor (grpc_opentracing .UnaryClientInterceptor (clientOpts ... )),
122+ grpc .WithStreamInterceptor (grpc_opentracing .StreamClientInterceptor (clientOpts ... )),
111123 },
112124 ServerOpts : []grpc.ServerOption {
113125 grpc_middleware .WithStreamServerChain (
114126 grpc_ctxtags .StreamServerInterceptor (grpc_ctxtags .WithFieldExtractor (grpc_ctxtags .CodeGenRequestFieldExtractor )),
115- grpc_opentracing .StreamServerInterceptor (opts ... )),
127+ grpc_opentracing .StreamServerInterceptor (serverOpts ... )),
116128 grpc_middleware .WithUnaryServerChain (
117129 grpc_ctxtags .UnaryServerInterceptor (grpc_ctxtags .WithFieldExtractor (grpc_ctxtags .CodeGenRequestFieldExtractor )),
118- grpc_opentracing .UnaryServerInterceptor (opts ... )),
130+ grpc_opentracing .UnaryServerInterceptor (serverOpts ... )),
119131 },
120132 }
121133}
0 commit comments