Skip to content

Commit 7ac6440

Browse files
alphaqiuclaude
andcommitted
fix: add serial_test to watcher tests
Watcher tests were flaky on macOS CI due to file system events being unreliable and potential test interference. Added serial_test attribute to all tests to ensure sequential execution. Co-Authored-By: Claude (glm-4.7) <noreply@anthropic.com>
1 parent 24e99f3 commit 7ac6440

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

tests/watcher_test.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
use keyring_cli::sync::watcher::{SyncEvent, SyncWatcher};
2+
use serial_test::serial;
23
use tempfile::TempDir;
34
use std::fs::File;
45
use std::io::Write;
56
use std::time::Duration;
67
use std::path::PathBuf;
78

89
#[tokio::test]
10+
#[serial]
911
async fn test_watch_file_changes() {
1012
let temp_dir = TempDir::new().unwrap();
1113
let watch_path = temp_dir.path().to_path_buf();
@@ -57,6 +59,7 @@ async fn test_watch_file_changes() {
5759
}
5860

5961
#[tokio::test]
62+
#[serial]
6063
async fn test_watch_file_creation() {
6164
let temp_dir = TempDir::new().unwrap();
6265
let watch_path = temp_dir.path().to_path_buf();
@@ -107,6 +110,7 @@ async fn test_watch_file_creation() {
107110
}
108111

109112
#[tokio::test]
113+
#[serial]
110114
async fn test_watch_file_deletion() {
111115
let temp_dir = TempDir::new().unwrap();
112116
let watch_path = temp_dir.path().to_path_buf();
@@ -162,6 +166,7 @@ async fn test_watch_file_deletion() {
162166
}
163167

164168
#[tokio::test]
169+
#[serial]
165170
async fn test_watch_json_files_only() {
166171
let temp_dir = TempDir::new().unwrap();
167172
let watch_path = temp_dir.path().to_path_buf();
@@ -221,6 +226,7 @@ async fn test_watch_json_files_only() {
221226
}
222227

223228
#[tokio::test]
229+
#[serial]
224230
async fn test_watcher_creation() {
225231
let temp_dir = TempDir::new().unwrap();
226232
let watch_path = temp_dir.path().to_path_buf();
@@ -230,6 +236,7 @@ async fn test_watcher_creation() {
230236
}
231237

232238
#[tokio::test]
239+
#[serial]
233240
async fn test_watcher_invalid_path() {
234241
let invalid_path = PathBuf::from("/nonexistent/path/that/does/not/exist");
235242

0 commit comments

Comments
 (0)