Skip to content

Commit f2b8e02

Browse files
committed
fix: combine checks with select sentence
1 parent c74418d commit f2b8e02

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

internal/balancergroup/balancergroup_test.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -789,17 +789,14 @@ func (s) TestBalancerExitIdle_All(t *testing.T) {
789789
for i := 0; i < len(balancerNames); i++ {
790790
select {
791791
case name := <-exitIdleCh:
792+
if called[name] {
793+
t.Fatalf("ExitIdle was called multiple times for sub-balancer %q", name)
794+
}
792795
called[name] = true
793796
case <-time.After(time.Second):
794797
t.Fatalf("Timeout: ExitIdle not called for all sub-balancers, got %d/%d", len(called), len(balancerNames))
795798
}
796799
}
797-
798-
for _, expected := range balancerNames {
799-
if !called[expected] {
800-
t.Errorf("ExitIdle was not called for sub-balancer registered as %q", expected)
801-
}
802-
}
803800
}
804801

805802
func (s) TestBalancerGroup_ExitIdle_AfterClose(t *testing.T) {

0 commit comments

Comments
 (0)