Skip to content

Commit 81aa758

Browse files
authored
hack: change internal package name for grpc.reflection.v1 to prevent possible init crash (#555)
1 parent 7923b75 commit 81aa758

File tree

6 files changed

+240
-194
lines changed

6 files changed

+240
-194
lines changed

grpcreflect/client_test.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,11 @@ func TestAutoVersion(t *testing.T) {
376376
testClientAuto(t,
377377
func(s *grpc.Server) {
378378
grpc_reflection_v1.Register(s)
379+
// HACK: The above won't show up in list of service names, so we need at least one other.
380+
testprotosgrpc.RegisterDummyServiceServer(s, testService{})
379381
},
380382
[]string{
381-
"grpc.reflection.v1.ServerReflection",
383+
"testprotos.DummyService",
382384
},
383385
[]string{
384386
"/grpc.reflection.v1.ServerReflection/ServerReflectionInfo",
@@ -392,9 +394,11 @@ func TestAutoVersion(t *testing.T) {
392394
testClientAuto(t,
393395
func(s *grpc.Server) {
394396
reflection.Register(s)
397+
testprotosgrpc.RegisterDummyServiceServer(s, testService{})
395398
},
396399
[]string{
397400
"grpc.reflection.v1alpha.ServerReflection",
401+
"testprotos.DummyService",
398402
},
399403
[]string{
400404
// first one fails, so falls back to v1alpha
@@ -414,10 +418,11 @@ func TestAutoVersion(t *testing.T) {
414418
func(s *grpc.Server) {
415419
grpc_reflection_v1.Register(s)
416420
reflection.Register(s)
421+
testprotosgrpc.RegisterDummyServiceServer(s, testService{})
417422
},
418423
[]string{
419-
"grpc.reflection.v1.ServerReflection",
420424
"grpc.reflection.v1alpha.ServerReflection",
425+
"testprotos.DummyService",
421426
},
422427
[]string{
423428
// never uses v1alpha since v1 works

0 commit comments

Comments
 (0)