Skip to content
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

Merged
merged 2 commits into from
Sep 12, 2024

Conversation

easwars
Copy link
Contributor

@easwars easwars commented Sep 10, 2024

Addresses #7291

RELEASE NOTES: none

Copy link

codecov bot commented Sep 10, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 81.84%. Comparing base (8f920c6) to head (30fdff2).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
internal/stubserver/stubserver.go 71.42% 1 Missing and 1 partial ⚠️
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     
Files with missing lines Coverage Δ
orca/service.go 77.50% <100.00%> (+5.00%) ⬆️
internal/stubserver/stubserver.go 83.48% <71.42%> (-1.28%) ⬇️

... and 20 files with indirect coverage changes

@@ -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 {
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -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)
Copy link
Member

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?

Copy link
Contributor Author

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.

@dfawley dfawley assigned easwars and unassigned dfawley Sep 12, 2024
@easwars easwars assigned dfawley and unassigned easwars Sep 12, 2024
@dfawley dfawley assigned easwars and unassigned dfawley Sep 12, 2024
@easwars easwars merged commit cf5d541 into grpc:master Sep 12, 2024
14 checks passed
@easwars easwars deleted the stubserver_enhancement branch September 12, 2024 22:00
arjan-bal added a commit to arjan-bal/grpc-go that referenced this pull request Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants