Skip to content

Commit 5942909

Browse files
committed
fix
1 parent 4a87fe1 commit 5942909

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

test/ingress/conformance/tests/httproute-canary-weight.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ var HTTPRouteCanaryWeight = suite.ConformanceTest{
3232
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
3333
tt := []struct {
3434
assertion http.Assertion
35-
succRate float32
35+
succRate float64
3636
}{
3737
{
3838
succRate: 1.0,

test/ingress/conformance/utils/http/http.go

+2-6
Original file line numberDiff line numberDiff line change
@@ -408,12 +408,8 @@ func MakeRequestAndCountExpectedResponse(t *testing.T, r roundtripper.RoundTripp
408408

409409
rate := float64(succ) / totalRequest
410410
minSuccRate, maxSuccRate := math.Min(succRate-rateDeviation, 0), math.Max(succRate+rateDeviation, 1.0)
411-
if 0 < minSuccRate && rate < minSuccRate {
412-
t.Errorf("Test failed, expect the minSuccRate is %v, got %v", minSuccRate, rate)
413-
return
414-
}
415-
if 0 < maxSuccRate && maxSuccRate > rate {
416-
t.Errorf("Test failed, expect the maxSuccRate is %v, got %v", maxSuccRate, rate)
411+
if rate < minSuccRate || maxSuccRate > rate {
412+
t.Errorf("Test failed, expect the minSuccRate is %v, the maxSuccRate is %v, but got %v", minSuccRate, maxSuccRate, rate)
417413
return
418414
}
419415

0 commit comments

Comments
 (0)