Use tokio::fs for I/O in config API tests

The save and patch paths under test are async, so the tests now use tokio::fs instead of blocking std::fs. The config_store tests also switch to tempfile::tempdir() for panic-safe cleanup instead of manual remove_dir_all.
This commit is contained in:
Mirotin Artem
2026-06-15 10:05:09 +03:00
parent f1f46fac42
commit e82ce634d6
2 changed files with 17 additions and 20 deletions
+2 -2
View File
@@ -333,7 +333,7 @@ mod tests {
let patch: Json = serde_json::json!({"general": {"links": {"show": ["alice"]}}});
let resp = apply_patch_to_path(&path, &patch, None).await.unwrap();
assert!(resp.changed.iter().any(|c| c == "general"));
let written = std::fs::read_to_string(&path).unwrap();
let written = tokio::fs::read_to_string(&path).await.unwrap();
let parsed: toml::Value = toml::from_str(&written).unwrap();
assert_eq!(
parsed["general"]["links"]["show"][0].as_str(),
@@ -353,7 +353,7 @@ mod tests {
let patch: Json = serde_json::json!({"general": {"links": {"public_port": 443}}});
apply_patch_to_path(&path, &patch, None).await.unwrap();
let written = std::fs::read_to_string(&path).unwrap();
let written = tokio::fs::read_to_string(&path).await.unwrap();
assert!(written.contains("public_port = 443"), "{written}");
assert!(!written.contains("443.0"), "must not be a float:\n{written}");
assert!(!written.contains("\"443\""), "must not be a string:\n{written}");