From 1d2b6adfc6f04fcc437e994f97045207c2d80dd1 Mon Sep 17 00:00:00 2001 From: chen Date: Mon, 4 Sep 2023 14:52:56 +0800 Subject: [PATCH] fix random fail of test --- pkg/filters/proxies/loadbalance_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/filters/proxies/loadbalance_test.go b/pkg/filters/proxies/loadbalance_test.go index 27fafaad56..25ea3f0904 100644 --- a/pkg/filters/proxies/loadbalance_test.go +++ b/pkg/filters/proxies/loadbalance_test.go @@ -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) } }