Skip to content

Commit

Permalink
fix: wait for client conn state to complete at the end
Browse files Browse the repository at this point in the history
  • Loading branch information
aranjans committed Jul 23, 2024
1 parent 750332c commit 255ff63
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions balancer/rls/balancer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -656,12 +656,7 @@ func (s) TestPickerUpdateOnDataCacheSizeDecrease(t *testing.T) {
// Override the clientConn update hook to get notified.
clientConnUpdateDone := make(chan struct{})
origClientConnUpdateHook := clientConnUpdateHook
clientConnUpdateHook = func() {
select {
case clientConnUpdateDone <- struct{}{}:
default:
}
}
clientConnUpdateHook = func() { clientConnUpdateDone <- struct{}{} }
defer func() { clientConnUpdateHook = origClientConnUpdateHook }()

// Override the cache entry size func, and always return 1.
Expand Down Expand Up @@ -823,6 +818,10 @@ func (s) TestPickerUpdateOnDataCacheSizeDecrease(t *testing.T) {
case <-ctx.Done():
t.Errorf("client conn update could not complete: %v", ctx.Err().Error())
}

// Once picker was updated, wait for client conn update
// to complete.
<-clientConnUpdateDone
}

// TestDataCachePurging verifies that the LB policy periodically evicts expired
Expand Down

0 comments on commit 255ff63

Please sign in to comment.