Skip to content

Commit 7cb6912

Browse files
committed
Remove a flaky got_timeout assert from two channel tests
In CI, the receiver thread can be descheduled for a surprisingly long time, so there's no guarantee that a timeout actually occurs.
1 parent 80282b1 commit 7cb6912

File tree

2 files changed

+0
-6
lines changed

2 files changed

+0
-6
lines changed

‎library/std/tests/sync/mpmc.rs‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,23 +475,20 @@ fn stress_recv_timeout_two_threads() {
475475
});
476476

477477
let mut recv_count = 0;
478-
let mut got_timeout = false;
479478
loop {
480479
match rx.recv_timeout(timeout) {
481480
Ok(n) => {
482481
assert_eq!(n, 1usize);
483482
recv_count += 1;
484483
}
485484
Err(RecvTimeoutError::Timeout) => {
486-
got_timeout = true;
487485
continue;
488486
}
489487
Err(RecvTimeoutError::Disconnected) => break,
490488
}
491489
}
492490

493491
assert_eq!(recv_count, stress);
494-
assert!(got_timeout);
495492
}
496493

497494
#[test]

‎library/std/tests/sync/mpsc.rs‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,23 +438,20 @@ fn stress_recv_timeout_two_threads() {
438438
});
439439

440440
let mut recv_count = 0;
441-
let mut got_timeout = false;
442441
loop {
443442
match rx.recv_timeout(timeout) {
444443
Ok(n) => {
445444
assert_eq!(n, 1usize);
446445
recv_count += 1;
447446
}
448447
Err(RecvTimeoutError::Timeout) => {
449-
got_timeout = true;
450448
continue;
451449
}
452450
Err(RecvTimeoutError::Disconnected) => break,
453451
}
454452
}
455453

456454
assert_eq!(recv_count, stress);
457-
assert!(got_timeout);
458455
}
459456

460457
#[test]

0 commit comments

Comments
 (0)