From 34e5348c4a5311bae9154161782e4aeef1070ec7 Mon Sep 17 00:00:00 2001 From: Windfarer Date: Sat, 12 Oct 2019 16:44:01 +0800 Subject: [PATCH 1/2] fix balancer test --- pkg/net/rpc/warden/balancer/wrr/wrr_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/net/rpc/warden/balancer/wrr/wrr_test.go b/pkg/net/rpc/warden/balancer/wrr/wrr_test.go index f9e21f36e..0348f2de2 100644 --- a/pkg/net/rpc/warden/balancer/wrr/wrr_test.go +++ b/pkg/net/rpc/warden/balancer/wrr/wrr_test.go @@ -137,8 +137,8 @@ func TestBalancerDone(t *testing.T) { latency, count := picker.(*wrrPicker).subConns[0].latencySummary() expectLatency := float64(100*time.Millisecond) / 1e5 - if !(expectLatency < latency && latency < (expectLatency+100)) { - t.Fatalf("latency is less than 100ms or greter than 100ms, %f", latency) + if latency < expectLatency || latency > (expectLatency+100) { + t.Fatalf("latency is less than 100ms or greater than 110ms, %f", latency) } assert.Equal(t, int64(1), count) From 7bd03eae4397ce312f2626926c27e05a7a63c404 Mon Sep 17 00:00:00 2001 From: Windfarer Date: Sat, 12 Oct 2019 18:27:11 +0800 Subject: [PATCH 2/2] bump to 150ms --- pkg/net/rpc/warden/balancer/wrr/wrr_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/net/rpc/warden/balancer/wrr/wrr_test.go b/pkg/net/rpc/warden/balancer/wrr/wrr_test.go index 0348f2de2..c0b26262f 100644 --- a/pkg/net/rpc/warden/balancer/wrr/wrr_test.go +++ b/pkg/net/rpc/warden/balancer/wrr/wrr_test.go @@ -137,8 +137,8 @@ func TestBalancerDone(t *testing.T) { latency, count := picker.(*wrrPicker).subConns[0].latencySummary() expectLatency := float64(100*time.Millisecond) / 1e5 - if latency < expectLatency || latency > (expectLatency+100) { - t.Fatalf("latency is less than 100ms or greater than 110ms, %f", latency) + if latency < expectLatency || latency > (expectLatency+500) { + t.Fatalf("latency is less than 100ms or greater than 150ms, %f", latency) } assert.Equal(t, int64(1), count)