test(daemon): make socket/pty integration tests robust under parallel load

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-09 20:05:23 +07:00
parent 4b1a544923
commit 8d0b5b8d1d
2 changed files with 6 additions and 6 deletions
+4 -4
View File
@@ -309,7 +309,7 @@ mod tests {
}
}
#[tokio::test]
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn open_new_surface_attach_streams_output() {
let dir = tempdir_path();
let sock = dir.join("sock");
@@ -335,7 +335,7 @@ mod tests {
// Now read frames looking for an Output evt containing STREAM_OK.
let mut got = String::new();
let deadline = tokio::time::Instant::now() + tokio::time::Duration::from_secs(2);
let deadline = tokio::time::Instant::now() + tokio::time::Duration::from_secs(6);
while tokio::time::Instant::now() < deadline {
if let Ok(Ok(Some(Envelope::Evt(Evt::Output { bytes, .. })))) =
tokio::time::timeout(tokio::time::Duration::from_millis(200), read_frame(&mut s)).await {
@@ -346,7 +346,7 @@ mod tests {
assert!(got.contains("STREAM_OK"), "got: {got:?}");
}
#[tokio::test]
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn unknown_surface_returns_not_found() {
let dir = tempdir_path();
let sock = dir.join("sock");
@@ -380,7 +380,7 @@ mod tests {
}
async fn wait_for_socket(sock: &Path) {
for _ in 0..100 {
for _ in 0..300 {
if UnixStream::connect(sock).await.is_ok() { return; }
tokio::time::sleep(tokio::time::Duration::from_millis(20)).await;
}
+2 -2
View File
@@ -74,7 +74,7 @@ mod tests {
}
}
#[tokio::test]
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn attach_receives_output() {
let pty = PtyHandle::spawn(spec("printf HELLO; sleep 0.3")).unwrap();
let (exit_tx, _exit_rx) = mpsc::unbounded_channel();
@@ -97,7 +97,7 @@ mod tests {
assert!(String::from_utf8_lossy(&collected).contains("HELLO"));
}
#[tokio::test]
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn exit_is_reported() {
let pty = PtyHandle::spawn(spec("exit 7")).unwrap();
let (exit_tx, mut exit_rx) = mpsc::unbounded_channel();