Skip to content

xds/clusterresolver: improve configbuilder tests by removing globals#8939

Merged
eshitachandwani merged 3 commits intogrpc:masterfrom
ulascansenturk:fix/8868-improve-configbuilder-tests
Mar 9, 2026
Merged

xds/clusterresolver: improve configbuilder tests by removing globals#8939
eshitachandwani merged 3 commits intogrpc:masterfrom
ulascansenturk:fix/8868-improve-configbuilder-tests

Conversation

@ulascansenturk
Copy link
Contributor

@ulascansenturk ulascansenturk commented Feb 25, 2026

Fixes #8868.

Summary

  • Remove package-level test globals (testLocalityIDs, testResolverEndpoints, testEndpoints, testLocalitiesP0, testLocalitiesP1) and the init() function
  • Add well-documented helper functions (makeLocalityID, makeEndpoint, makeResolverEndpoint, makeLocality) so all test state is local to each test function
  • Add documentation to the existing testEndpointWithAttrs helper

RELEASE NOTES: N/A

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
Copy link

codecov bot commented Feb 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.24%. Comparing base (b9f7967) to head (0bedb2a).
⚠️ Report is 5 commits behind head on master.

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     

see 19 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@easwars easwars self-assigned this Mar 3, 2026
@easwars easwars added this to the 1.80 Release milestone 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".
@ulascansenturk ulascansenturk force-pushed the fix/8868-improve-configbuilder-tests branch from d7eb47a to 980c528 Compare March 6, 2026 16:15
Adapt makeLocality/makeEndpoint/makeResolverEndpoint helpers to the
upstream restructuring that moved configbuilder_test.go from
clusterresolver to cdsbalancer and wrapped endpoints in EndpointConfig.
@ulascansenturk ulascansenturk requested a review from easwars March 6, 2026 16:23
@easwars
Copy link
Contributor

easwars commented Mar 6, 2026

@eshitachandwani : For second set of eyes

Copy link
Member

@eshitachandwani eshitachandwani left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for the contribution @ulascansenturk !!

@eshitachandwani eshitachandwani merged commit 81c7924 into grpc:master Mar 9, 2026
15 checks passed
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.

Improve the configbuilder tests in clusterresolver

4 participants