The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(speech): add test module for host runtime speech service
Steven Enamakel6524486aaf0d
diff --git a/crates/openhuman-core/src/inference/host_runtime/service/speech.rs b/crates/openhuman-core/src/inference/host_runtime/service/speech.rsindex 580036934e..5b03c34027 100644--- a/crates/openhuman-core/src/inference/host_runtime/service/speech.rs+++ b/crates/openhuman-core/src/inference/host_runtime/service/speech.rs@@ -153,3 +153,7 @@ pub async fn tts(voice_id: model_ids::effective_tts_voice_id(config),})}++#[cfg(test)]+#[path = "speech_tests.rs"]+mod tests;diff --git a/crates/openhuman-core/src/inference/host_runtime/service/speech_tests.rs b/crates/openhuman-core/src/inference/host_runtime/service/speech_tests.rsnew file mode 100644index 0000000000..e878328560--- /dev/null+++ b/crates/openhuman-core/src/inference/host_runtime/service/speech_tests.rs@@ -0,0 +1,41 @@+use super::*;++fn enabled_config(tmp: &tempfile::TempDir) -> Config {+ let mut config = Config::default();+ config.workspace_dir = tmp.path().join("workspace");+ config.config_path = tmp.path().join("config.toml");+ config.local_ai.runtime_enabled = true;+ std::fs::create_dir_all(&config.workspace_dir).unwrap();+ config+}++#[tokio::test]+async fn tts_rejects_empty_text_before_resolving_piper() {+ let tmp = tempfile::tempdir().unwrap();+ let config = enabled_config(&tmp);+ let service = LocalAiService::new(&config);++ let error = tts(&service, &config, " \n\t ", None).await.unwrap_err();++ assert!(error.contains("text is required"), "unexpected error: {error}");+}++#[tokio::test]+async fn tts_rejects_output_outside_allowed_roots() {+ let tmp = tempfile::tempdir().unwrap();+ let config = enabled_config(&tmp);+ let service = LocalAiService::new(&config);+ let output = tmp.path().join("outside").join("speech.wav");++ let error = tts(+ &service,+ &config,+ "hello",+ Some(output.to_str().unwrap()),+ )+ .await+ .unwrap_err();++ assert!(error.contains("output_path"), "unexpected error: {error}");+ assert!(!output.parent().unwrap().exists());+}