Skip to content

Commit 30da850

Browse files
committed
fix: resolve Windows CI test failure in storage error handling
- Fixed test_storage_error_handling to work across all platforms - Replaced platform-specific invalid path test with cross-platform file-as-directory test - Test now verifies error handling when trying to create directory over existing file - All storage tests now pass on Windows, Linux, and macOS closes #CI-failure
1 parent e711121 commit 30da850

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

crates/codeprism-storage/src/backends.rs

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,22 +1213,37 @@ mod tests {
12131213

12141214
#[tokio::test]
12151215
async fn test_storage_error_handling() {
1216-
// Test FileGraphStorage with invalid path
1217-
let invalid_path = PathBuf::from("/invalid/path/that/should/not/exist");
1218-
let result = FileGraphStorage::new(&invalid_path).await;
1219-
assert!(result.is_err());
1220-
1221-
// Test loading non-existent graph
1216+
// Test loading non-existent graph from FileGraphStorage
12221217
let temp_dir = tempdir().unwrap();
12231218
let storage = FileGraphStorage::new(temp_dir.path()).await.unwrap();
12241219
let result = storage.load_graph("nonexistent").await.unwrap();
12251220
assert!(result.is_none());
12261221

1227-
// Test SQLite with read-only directory (if possible)
1222+
// Test loading non-existent graph from SQLiteGraphStorage
12281223
let temp_dir = tempdir().unwrap();
12291224
let storage = SqliteGraphStorage::new(temp_dir.path()).await.unwrap();
12301225
let result = storage.load_graph("nonexistent").await.unwrap();
12311226
assert!(result.is_none());
1227+
1228+
// Test FileGraphStorage with a file as path (should fail)
1229+
let temp_dir = tempdir().unwrap();
1230+
let file_path = temp_dir.path().join("not_a_directory.txt");
1231+
fs::write(&file_path, "test").await.unwrap();
1232+
let result = FileGraphStorage::new(&file_path).await;
1233+
assert!(
1234+
result.is_err(),
1235+
"Should fail when trying to create directory over a file"
1236+
);
1237+
1238+
// Test SQLiteGraphStorage with a file as path (should fail)
1239+
let temp_dir = tempdir().unwrap();
1240+
let file_path = temp_dir.path().join("not_a_directory.txt");
1241+
fs::write(&file_path, "test").await.unwrap();
1242+
let result = SqliteGraphStorage::new(&file_path).await;
1243+
assert!(
1244+
result.is_err(),
1245+
"Should fail when trying to create directory over a file"
1246+
);
12321247
}
12331248

12341249
#[tokio::test]

0 commit comments

Comments
 (0)