Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix random fail of test #1085

Merged
merged 1 commit into from
Sep 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix random fail of test
  • Loading branch information
suchen-sci committed Sep 4, 2023
commit 1d2b6adfc6f04fcc437e994f97045207c2d80dd1
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
Loading