aboutsummaryrefslogtreecommitdiff
path: root/tests/api_ping.rs
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-03-31 14:23:14 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-03-31 14:23:14 +0300
commit7c8f12e8f2656d239a029552bc042bf44efdcf41 (patch)
tree3c6ac99c9304de1f30876b4d0c5f1645e91c8430 /tests/api_ping.rs
parentb2293687afa4ba268eac98bf885bf6e5a5133180 (diff)
feat: poll for updates and show toast notifications
Diffstat (limited to 'tests/api_ping.rs')
-rw-r--r--tests/api_ping.rs12
1 files changed, 12 insertions, 0 deletions
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<dyn Child + Send + Sync>,
}
+fn test_lock() -> MutexGuard<'static, ()> {
+ static LOCK: OnceLock<Mutex<()>> = 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");