-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stubserver: support xds-enabled grpc server #7613
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7613 +/- ##
==========================================
- Coverage 82.01% 81.84% -0.18%
==========================================
Files 361 361
Lines 27813 27817 +4
==========================================
- Hits 22812 22767 -45
- Misses 3822 3853 +31
- Partials 1179 1197 +18
|
internal/stubserver/stubserver.go
Outdated
@@ -39,6 +40,15 @@ import ( | |||
testpb "google.golang.org/grpc/interop/grpc_testing" | |||
) | |||
|
|||
// StoppableServiceRegistrar is an interface that extends the grpc.ServiceRegistrar | |||
// interface with additional methods to stop and gracefully stop the server. | |||
type StoppableServiceRegistrar interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you feel about calling this GRPCServer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
internal/stubserver/stubserver.go
Outdated
@@ -154,9 +171,14 @@ func (ss *StubServer) StartHandlerServer(sopts ...grpc.ServerOption) error { | |||
return err | |||
} | |||
|
|||
handler, ok := ss.S.(interface{ http.Handler }) | |||
if !ok { | |||
return fmt.Errorf("server of type %T does not implement http.Handler", ss.S) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
panic
instead? This is a programming error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switched to panic
. The ServeHTTP
method is only supported by the grpc.Server
and not by the xds.GRPCServer
, but I think it's fine to panic here since tests shouldn't be trying to server HTTP using an xds-enabled grpc server.
Addresses #7291
RELEASE NOTES: none