xds_test: Wait for server to start serving in RBAC test#8287
Conversation
b5f5007 to
ec7668d
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #8287 +/- ##
==========================================
+ Coverage 82.14% 82.31% +0.17%
==========================================
Files 417 419 +2
Lines 41344 41904 +560
==========================================
+ Hits 33961 34494 +533
- Misses 5957 5960 +3
- Partials 1426 1450 +24 🚀 New features to boost your workflow:
|
| defer cleanup2() | ||
| // Initialize a test gRPC server, assign it to the stub server, and start | ||
| // the test service. | ||
| lis, err := testutils.LocalTCPListener() |
There was a problem hiding this comment.
I don't know how many tests that use an xDS-enabled gRPC server have this boilerplate that creates a listener, a stub server, a gRPC server, and then starts serving. The stubserver.StartTestService is very convenient for tests that don't need an xDS-enabled gRPC server. Maybe we can have a helper for the tests that need an xDS-enabled gRPC server, similar to stubserver.StartTestService? (and maybe we can get some TVC to work on that?).
There was a problem hiding this comment.
setupGRPCServer in this package is a helper that creates an xDS enabled gRPC server. I changed the test to to not use it because I wanted to set a server option for setting the serving mode callback. The helper was already setting this server option. I made the setupGRPCServer accept a variadic list of server options, similar to StartTestService. Callers can override the default options set by setupGRPCServer as setupGRPCServer appends the passed options to the end of the list used to create the new server.
Fixes: #8286
This PR makes the test wait for the xds server to enter SERVING mode, otherwise it closes the net.Conn without returning any error.
grpc-go/xds/internal/server/listener_wrapper.go
Lines 287 to 297 in 763d093
Analysis: #8286 (comment)
Testing
Verified the test passes 10^5 runs on forge.
RELEASE NOTES: N/A