Stabilize code-mode panic and process metrics tests (#63767)

## Why

Formatting a panic backtrace can outlast the process metrics RPC deadline.
A timed-out RPC can also hold the collector permit before its worker starts,
so checking the invocation count immediately can race with worker scheduling.

## What changed

- Trigger the collector unwind without running the panic hook. Check the
  collection failure, panic, and busy errors explicitly, and wait for the
  blocked collector to start before checking invocation and connection counts.
- Await the V8 runtime thread panic notifications directly in both tests,
  removing their one-second receive timeouts.

GitOrigin-RevId: 9b2c36577e838c9d327592f9729d3a8a7868c56b
This commit is contained in:
Dylan Hurd
2026-11-24 23:39:47 +00:00
committed by copyberry
parent ff146c344d
commit bc6728ef68
2 changed files with 21 additions and 11 deletions
@@ -388,10 +388,7 @@ mod tests {
);
assert_eq!(
tokio::time::timeout(Duration::from_secs(1), failure_rx.recv())
.await
.expect("runtime failure timeout")
.expect("runtime failure"),
failure_rx.recv().await.expect("runtime failure"),
"code-mode V8 runtime thread panicked"
);
}
@@ -406,9 +403,7 @@ mod tests {
);
assert!(matches!(
tokio::time::timeout(Duration::from_secs(1), event_rx.recv())
.await
.expect("runtime panic event timeout"),
event_rx.recv().await,
Some(RuntimeEvent::ThreadPanicked)
));
}