Skip to content

Commit bcfefab

Browse files
committed
chore(test): Double refill time for RX rate limiter
Although we increased the refill time in the past in commit 347f877 ("unittest: net: eliminate ReadTapMock::MockFrame") to avoid intermittent issues, it still fails rarely (maybe due to resource contention). We are not sure the enough refill time, but it's worth a try and may reduce the chance of kicking the retry of the whole unit tests manually. Signed-off-by: Takahiro Itazuri <[email protected]>
1 parent c75c861 commit bcfefab

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/vmm/src/devices/virtio/net/device.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2153,7 +2153,7 @@ pub mod tests {
21532153
// Test RX bandwidth rate limiting
21542154
{
21552155
// create bandwidth rate limiter that allows 2000 bytes/s with bucket size 1000 bytes
2156-
let mut rl = RateLimiter::new(1000, 0, 500, 0, 0, 0).unwrap();
2156+
let mut rl = RateLimiter::new(1000, 0, 1000, 0, 0, 0).unwrap();
21572157

21582158
// set up RX
21592159
assert!(th.net().rx_buffer.used_descriptors == 0);
@@ -2195,9 +2195,9 @@ pub mod tests {
21952195
assert_eq!(th.net().metrics.rx_rate_limiter_throttled.count(), 2);
21962196
}
21972197

2198-
// wait for 500ms to give the rate-limiter timer a chance to replenish
2199-
// wait for an extra 500ms to make sure the timerfd event makes its way from the kernel
2200-
thread::sleep(Duration::from_millis(1000));
2198+
// wait for 1000ms to give the rate-limiter timer a chance to replenish
2199+
// wait for an extra 1000ms to make sure the timerfd event makes its way from the kernel
2200+
thread::sleep(Duration::from_millis(2000));
22012201

22022202
// following RX procedure should succeed because bandwidth should now be available
22032203
{
@@ -2276,7 +2276,7 @@ pub mod tests {
22762276
// Test RX ops rate limiting
22772277
{
22782278
// create ops rate limiter that allows 2 ops/s with bucket size 1 ops
2279-
let mut rl = RateLimiter::new(0, 0, 0, 1, 0, 500).unwrap();
2279+
let mut rl = RateLimiter::new(0, 0, 0, 1, 0, 1000).unwrap();
22802280

22812281
// set up RX
22822282
assert!(th.net().rx_buffer.used_descriptors == 0);
@@ -2319,9 +2319,9 @@ pub mod tests {
23192319
assert_eq!(th.rxq.used.idx.get(), 0);
23202320
}
23212321

2322-
// wait for 500ms to give the rate-limiter timer a chance to replenish
2323-
// wait for an extra 500ms to make sure the timerfd event makes its way from the kernel
2324-
thread::sleep(Duration::from_millis(1000));
2322+
// wait for 1000ms to give the rate-limiter timer a chance to replenish
2323+
// wait for an extra 1000ms to make sure the timerfd event makes its way from the kernel
2324+
thread::sleep(Duration::from_millis(2000));
23252325

23262326
// following RX procedure should succeed because ops should now be available
23272327
{

0 commit comments

Comments
 (0)