Skip to content

grpc/load_balancing: New tests for pick_first - #3014

Open
nathanielford wants to merge 7 commits into
grpc:masterfrom
nathanielford:refactor/pick-first-new-tests
Open

nathanielford wants to merge 7 commits into
grpc:masterfrom
nathanielford:refactor/pick-first-new-tests

Conversation

@nathanielford

@nathanielford nathanielford commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

pick_first has a number of intended behaviors around first pass behavior that are not tested.

  • If first pass reaches a subchannel during the pass already in TRANSIENT_FAILURE, it should count it as failing without retrying.
  • If the first pass creates a subchannel and it is already READY, it is selected immediately w/o asking any other subchannel to connect.
  • If the first pass reaches a subchannel that has already failed, it will be asked to connect if it is in IDLE. The pass won't end until that attempt fails.

These behaviors are all implemented but are not fully covered by tests.

Solution

The following was done:

  • Update to the test helper to allow for sending address list and setting the state chosen subchannels report.
  • Extend test_pick_first_empty_update_clears_state assertions to cover ignoring updates from old subchannels and add an address that is Ready, to prove the old selection is cleared.
  • Add test_pick_first_pass_ends_when_every_attempt_in_it_fails to test that the first pass only ends when every address has failed during the pass. This subsumes test_pick_first_happy_eyeballs_out_of_order_failure, so we remove it.
  • Add test_pick_first_new_subchannel_initially_ready to cover a subchannel that is ready when created is selected immediately.
  • Add test_pick_first_new_subchannel_initially_transient_failure to ensure a subchannel in TF counts as failed and is skipped.
  • Remove test_pick_first_steady_state_retries because it's covered by test_pick_first_steady_state_multi_backend.

@nathanielford nathanielford changed the title Refactor/pick first new tests grpc/load_balancing: New tests for pick_first Nov 9, 2026
# Conflicts:
#	grpc/src/client/load_balancing/pick_first.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants