Commit fb82afd
committed
pkg/rate: fix TestMaxParallelRequests flake under CI load
TestMaxParallelRequests configured MaxWaitDuration to 1ms, expecting only
the third request to fail once both parallel slots are taken. But
MaxWaitDuration is measured from the moment a request is scheduled and
also covers the time spent acquiring the parallel-requests semaphore. On a
loaded CI runner the scheduling overhead of the very first, uncontended
request alone exceeded 1ms, so wait() took the "wait duration exceeds
maximum" branch and returned:
request would have to wait 0s to be served (maximum wait duration: -215.915µs)
failing the require.NoError on request 1 rather than on the intended
request 3.
Raise MaxWaitDuration to 100ms. That is far above any realistic scheduling
jitter for the two uncontended requests, while the third request still
fails deterministically because both slots stay occupied for its entire
wait window. The test keeps exercising parallel-slot exhaustion, not
wall-clock jitter.
This commit was prepared with AIL:3.
Signed-off-by: André Martins <andre@cilium.io>1 parent f52ff46 commit fb82afd
1 file changed
Lines changed: 10 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
291 | 291 | | |
292 | 292 | | |
293 | 293 | | |
294 | | - | |
295 | | - | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
296 | 303 | | |
297 | 304 | | |
298 | | - | |
| 305 | + | |
299 | 306 | | |
300 | 307 | | |
301 | 308 | | |
| |||
0 commit comments