xds/clusterresolver: improve configbuilder tests by removing globals#8939
Merged
eshitachandwani merged 3 commits intogrpc:masterfrom Mar 9, 2026
Merged
Conversation
Replace package-level test globals and init() with well-documented helper functions (makeLocalityID, makeEndpoint, makeResolverEndpoint, makeLocality) so all test state is local to each test function. Fixes grpc#8868.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #8939 +/- ##
==========================================
- Coverage 83.26% 83.24% -0.02%
==========================================
Files 410 410
Lines 32572 32572
==========================================
- Hits 27120 27115 -5
- Misses 4058 4061 +3
- Partials 1394 1396 +2 🚀 New features to boost your workflow:
|
easwars
reviewed
Mar 4, 2026
- Rename makeEndpoint params (li, ei, ew) to (localityIdx, endpointIdx, endpointWeight) for self-documenting names. - Rename makeResolverEndpoint params (li, ei) to (localityIdx, endpointIdx). - Remove endpointWeight param from makeLocality and hardcode it to 1, since all callers pass 1. - Clarify "non-priority order" comment to "shuffled order to verify sorting by priority".
d7eb47a to
980c528
Compare
Adapt makeLocality/makeEndpoint/makeResolverEndpoint helpers to the upstream restructuring that moved configbuilder_test.go from clusterresolver to cdsbalancer and wrapped endpoints in EndpointConfig.
easwars
approved these changes
Mar 6, 2026
Contributor
|
@eshitachandwani : For second set of eyes |
eshitachandwani
approved these changes
Mar 9, 2026
Member
There was a problem hiding this comment.
LGTM! Thank you for the contribution @ulascansenturk !!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8868.
Summary
testLocalityIDs,testResolverEndpoints,testEndpoints,testLocalitiesP0,testLocalitiesP1) and theinit()functionmakeLocalityID,makeEndpoint,makeResolverEndpoint,makeLocality) so all test state is local to each test functiontestEndpointWithAttrshelperRELEASE NOTES: N/A