Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 895ef7c

Browse files
committed
fix(test): de-flake test_duration_collecting on fast CI runners
Writing 384 bytes (3-byte buffer x 128) can complete in sub- millisecond time on fast runners, so `as_millis() > 0` flakes. The intent is to confirm timing was accumulated (not Duration::default()), which `as_nanos() > 0` checks reliably.
1 parent 8c9ca3c commit 895ef7c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/utils.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ mod tests {
217217
#[test]
218218
fn test_duration_collecting() {
219219
let d = write_once(&[0xff, 0xff, 0xff], 128, &None).unwrap();
220-
assert!(d.as_millis() > 0);
220+
// Writing 384 bytes can finish in well under a millisecond on fast
221+
// runners; assert the timing was accumulated at all rather than
222+
// imposing an arbitrary lower bound.
223+
assert!(d.as_nanos() > 0);
221224
}
222225
}

0 commit comments

Comments
 (0)