diff --git a/hive-priv/src/egress.rs b/hive-priv/src/egress.rs index 8b8d6cc11..6fb75a9ae 100644 --- a/hive-priv/src/egress.rs +++ b/hive-priv/src/egress.rs @@ -2038,7 +2038,12 @@ mod tests { assert!(started.elapsed() >= Duration::from_millis(300)); assert!(started.elapsed() < Duration::from_secs(5)); drop(held); - lock_at(&path, Instant::now()).unwrap(); + // Taken within a few seconds, not at once: another test thread may be + // between `fork` and `exec` of a child (`run_bounded` tests), and until + // the `exec` closes the descriptor that child still shares the lock. + let freed = Instant::now(); + lock_at(&path, freed + Duration::from_secs(5)).unwrap(); + assert!(freed.elapsed() < Duration::from_secs(5)); let _ = std::fs::remove_file(&path); }