Skip to content

Commit

Permalink
fix random fail of test (#1085)
Browse files Browse the repository at this point in the history
  • Loading branch information
suchen-sci committed Sep 4, 2023
1 parent e686c2f commit 6b315e0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/filters/proxies/loadbalance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ func TestRandomLoadBalancePolicy(t *testing.T) {
lb := NewGeneralLoadBalancer(&LoadBalanceSpec{Policy: LoadBalancePolicyRandom}, servers)
lb.Init(nil, nil, nil)

for i := 0; i < 10000; i++ {
for i := 0; i < 100000; i++ {
svr := lb.ChooseServer(nil)
counter[svr.Weight-1]++
}

for i := 0; i < 10; i++ {
if v := counter[i]; v < 900 || v > 1100 {
if v := counter[i]; v < 8000 || v > 12000 {
t.Errorf("possibility is not even with value %v", v)
}
}
Expand Down

0 comments on commit 6b315e0

Please sign in to comment.