mirror of
https://github.com/openai/codex.git
synced 2026-10-19 17:28:46 +00:00
Fix PID reservation test race and update guardian heartbeat snapshot (#47871)
## Why The PID reservation test could race with the backend's read on Windows by deleting the PID file from its cleanup task. The guardian heartbeat snapshot and environment normalization also needed to match the current permission-context wording. ## What changed - Release the reservation lock and let `stop()` remove the stale PID file, then assert that the file is gone. - Update the guardian heartbeat snapshot and normalization pattern to use `The active permission profile for environment`. GitOrigin-RevId: d9cadae0e5d36cb2e1ab0517e2d7121cf2d0715d
This commit is contained in:
@@ -109,16 +109,16 @@ async fn stop_waits_for_live_reservation_to_resolve() {
|
||||
.await
|
||||
.expect("open pid lock file");
|
||||
assert!(try_lock_file(&reservation).expect("lock reservation"));
|
||||
let cleanup = tokio::spawn(async move {
|
||||
tokio::time::sleep(Duration::from_millis(50)).await;
|
||||
let release_reservation = tokio::spawn(async move {
|
||||
tokio::time::sleep(Duration::from_millis(/*millis*/ 50)).await;
|
||||
// Let stop() remove the stale PID file under the reservation lock.
|
||||
// Deleting it here would race with the backend's read on Windows.
|
||||
drop(reservation);
|
||||
tokio::fs::remove_file(pid_file)
|
||||
.await
|
||||
.expect("remove pid file");
|
||||
});
|
||||
|
||||
backend.stop().await.expect("stop");
|
||||
cleanup.await.expect("cleanup task");
|
||||
release_reservation.await.expect("release reservation task");
|
||||
assert!(!pid_file.exists());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
Reference in New Issue
Block a user