Skip to content

Commit f65d853

Browse files
authored
chore: fix flaky weight test (#7574)
fix flaky weight test Signed-off-by: Huabing Zhao <[email protected]>
1 parent 8eb898b commit f65d853

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

test/e2e/testdata/weighted-backend-mixed-valid-and-invalid.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ spec:
1414
backendRefs:
1515
- name: infra-backend-v1
1616
port: 8080
17-
weight: 80
17+
weight: 9
1818
- name: infra-backend-not-existing
1919
port: 8080
20-
weight: 20
20+
weight: 1

test/e2e/tests/weighted_backend.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ func testMixedValidAndInvalid(t *testing.T, suite *suite.ConformanceTestSuite) {
168168
}
169169
}
170170

171-
if !AlmostEquals(successCount, 40, 5) { // The weight of valid backend is 80%, so the expected success count is 50*80%=40
171+
if !AlmostEquals(successCount, sendRequests*.9, 3) { // The weight of valid backend is 90%
172172
t.Errorf("The actual success count is not within the expected range, success %d", successCount)
173173
}
174174
}

0 commit comments

Comments
 (0)