From 7c8f12e8f2656d239a029552bc042bf44efdcf41 Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Tue, 31 Mar 2026 14:23:14 +0300 Subject: feat: poll for updates and show toast notifications --- tests/api_ping.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests') diff --git a/tests/api_ping.rs b/tests/api_ping.rs index 67f89c59..043d9931 100644 --- a/tests/api_ping.rs +++ b/tests/api_ping.rs @@ -2,6 +2,7 @@ use std::fs; use std::io::{BufRead, BufReader, Write}; use std::os::unix::net::UnixStream; use std::path::{Path, PathBuf}; +use std::sync::{Mutex, MutexGuard, OnceLock}; use std::thread; use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH}; @@ -20,6 +21,13 @@ struct SpawnedHerdr { child: Box, } +fn test_lock() -> MutexGuard<'static, ()> { + static LOCK: OnceLock> = OnceLock::new(); + LOCK.get_or_init(|| Mutex::new(())) + .lock() + .expect("api ping test lock poisoned") +} + fn wait_for_socket(path: &Path, timeout: Duration) { let deadline = Instant::now() + timeout; while Instant::now() < deadline { @@ -122,6 +130,7 @@ fn wait_for_event( #[test] fn ping_over_socket_returns_version() { + let _lock = test_lock(); let base = unique_test_dir(); let config_home = base.join("config"); let runtime_dir = base.join("runtime"); @@ -145,6 +154,7 @@ fn ping_over_socket_returns_version() { #[test] fn workspace_list_and_create_round_trip() { + let _lock = test_lock(); let base = unique_test_dir(); let config_home = base.join("config"); let runtime_dir = base.join("runtime"); @@ -292,6 +302,7 @@ fn workspace_list_and_create_round_trip() { #[test] fn events_subscribe_streams_lifecycle_and_agent_events() { + let _lock = test_lock(); let base = unique_test_dir(); let config_home = base.join("config"); let runtime_dir = base.join("runtime"); @@ -425,6 +436,7 @@ fn events_subscribe_streams_lifecycle_and_agent_events() { #[test] fn events_subscribe_streams_output_and_agent_state_events() { + let _lock = test_lock(); let base = unique_test_dir(); let config_home = base.join("config"); let runtime_dir = base.join("runtime"); -- cgit v1.2.3