Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Charlie17Li committed Mar 27, 2023
1 parent 4a87fe1 commit 5942909
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion test/ingress/conformance/tests/httproute-canary-weight.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var HTTPRouteCanaryWeight = suite.ConformanceTest{
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
tt := []struct {
assertion http.Assertion
succRate float32
succRate float64
}{
{
succRate: 1.0,
Expand Down
8 changes: 2 additions & 6 deletions test/ingress/conformance/utils/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,12 +408,8 @@ func MakeRequestAndCountExpectedResponse(t *testing.T, r roundtripper.RoundTripp

rate := float64(succ) / totalRequest
minSuccRate, maxSuccRate := math.Min(succRate-rateDeviation, 0), math.Max(succRate+rateDeviation, 1.0)
if 0 < minSuccRate && rate < minSuccRate {
t.Errorf("Test failed, expect the minSuccRate is %v, got %v", minSuccRate, rate)
return
}
if 0 < maxSuccRate && maxSuccRate > rate {
t.Errorf("Test failed, expect the maxSuccRate is %v, got %v", maxSuccRate, rate)
if rate < minSuccRate || maxSuccRate > rate {
t.Errorf("Test failed, expect the minSuccRate is %v, the maxSuccRate is %v, but got %v", minSuccRate, maxSuccRate, rate)
return
}

Expand Down

0 comments on commit 5942909

Please sign in to comment.