chore: Remove blocking read strings
This commit is contained in:
parent
bc0be9a3c1
commit
b9af601943
26 changed files with 331 additions and 243 deletions
|
|
@ -3385,8 +3385,8 @@ tool_dispatcher = "xml"
|
|||
assert_eq!(parsed.agent.tool_dispatcher, "xml");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn config_save_and_load_tmpdir() {
|
||||
#[tokio::test]
|
||||
async fn config_save_and_load_tmpdir() {
|
||||
let dir = std::env::temp_dir().join("zeroclaw_test_config");
|
||||
let _ = fs::remove_dir_all(&dir);
|
||||
fs::create_dir_all(&dir).unwrap();
|
||||
|
|
@ -3431,7 +3431,7 @@ tool_dispatcher = "xml"
|
|||
config.save().unwrap();
|
||||
assert!(config_path.exists());
|
||||
|
||||
let contents = fs::read_to_string(&config_path).unwrap();
|
||||
let contents = tokio::fs::read_to_string(&config_path).await.unwrap();
|
||||
let loaded: Config = toml::from_str(&contents).unwrap();
|
||||
assert!(loaded
|
||||
.api_key
|
||||
|
|
@ -3446,8 +3446,8 @@ tool_dispatcher = "xml"
|
|||
let _ = fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn config_save_encrypts_nested_credentials() {
|
||||
#[tokio::test]
|
||||
async fn config_save_encrypts_nested_credentials() {
|
||||
let dir = std::env::temp_dir().join(format!(
|
||||
"zeroclaw_test_nested_credentials_{}",
|
||||
uuid::Uuid::new_v4()
|
||||
|
|
@ -3477,7 +3477,9 @@ tool_dispatcher = "xml"
|
|||
|
||||
config.save().unwrap();
|
||||
|
||||
let contents = fs::read_to_string(config.config_path.clone()).unwrap();
|
||||
let contents = tokio::fs::read_to_string(config.config_path.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
let stored: Config = toml::from_str(&contents).unwrap();
|
||||
let store = crate::security::SecretStore::new(&dir, true);
|
||||
|
||||
|
|
@ -3527,8 +3529,8 @@ tool_dispatcher = "xml"
|
|||
let _ = fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn config_save_atomic_cleanup() {
|
||||
#[tokio::test]
|
||||
async fn config_save_atomic_cleanup() {
|
||||
let dir =
|
||||
std::env::temp_dir().join(format!("zeroclaw_test_config_{}", uuid::Uuid::new_v4()));
|
||||
fs::create_dir_all(&dir).unwrap();
|
||||
|
|
@ -3545,7 +3547,7 @@ tool_dispatcher = "xml"
|
|||
config.default_model = Some("model-b".into());
|
||||
config.save().unwrap();
|
||||
|
||||
let contents = fs::read_to_string(&config_path).unwrap();
|
||||
let contents = tokio::fs::read_to_string(&config_path).await.unwrap();
|
||||
assert!(contents.contains("model-b"));
|
||||
|
||||
let names: Vec<String> = fs::read_dir(&dir)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue