Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(tests): replace deprecated methods and improve test clarity

Steven Enamakel958624075c95
diff --git a/crates/openhuman-core/src/core/all_tests.rs b/crates/openhuman-core/src/core/all_tests.rs
index 4f80b43aa3..cb968ca6d0 100644
--- a/crates/openhuman-core/src/core/all_tests.rs
+++ b/crates/openhuman-core/src/core/all_tests.rs
@@ -250,7 +250,7 @@ fn voice_and_audio_controllers_absent_when_feature_off() {
#[test]
#[cfg(feature = "inference")]
fn inference_engine_compiled_in_when_feature_on() {
- assert!(crate::inference::INFERENCE_COMPILED_IN);
+ const { assert!(crate::inference::INFERENCE_COMPILED_IN) };
}
/// With the `inference` feature off, the marker flips and `cpal` leaves the
diff --git a/crates/openhuman-core/src/voice/bus_tests.rs b/crates/openhuman-core/src/voice/bus_tests.rs
index e97b780a5a..12a8dec3d1 100644
--- a/crates/openhuman-core/src/voice/bus_tests.rs
+++ b/crates/openhuman-core/src/voice/bus_tests.rs
@@ -42,7 +42,7 @@ async fn publishing_a_ptt_commit_reaches_a_subscriber() {
tokio::time::sleep(std::time::Duration::from_millis(50)).await;
let got = events.lock().await;
- let found = got.iter().find_map(|e| match e {
+ let found = got.iter().map(|e| match e {
VoiceEvent::PttTranscriptCommitted {
thread_id,
session_id,
diff --git a/crates/openhuman-core/src/voice/local_speech_tests.rs b/crates/openhuman-core/src/voice/local_speech_tests.rs
index 616c040498..679701418c 100644
--- a/crates/openhuman-core/src/voice/local_speech_tests.rs
+++ b/crates/openhuman-core/src/voice/local_speech_tests.rs
@@ -24,7 +24,7 @@ async fn synthesize_piper_surfaces_binary_lookup_failure() {
let opts = PiperOptions::default();
let result = synthesize_piper(&config, "hello world", &opts).await;
- let err = result.err().expect("missing piper must error");
+ let err = result.expect_err("missing piper must error");
assert!(
err.contains("piper") || err.contains("TTS"),
"should mention piper or TTS: {err}"
diff --git a/tests/json_rpc_e2e.rs b/tests/json_rpc_e2e.rs
index 7414b4e760..2c1605483c 100644
--- a/tests/json_rpc_e2e.rs
+++ b/tests/json_rpc_e2e.rs
@@ -5563,7 +5563,7 @@ async fn json_rpc_wallet_tx_reads_and_web3_gates_round_trip() {
let (wallet_rpc_addr, _raw_txs) = start_mock_wallet_evm_rpc().await;
let _evm_provider_guard = EnvVarGuard::set(
"OPENHUMAN_WALLET_RPC_EVM",
- &format!("http://{wallet_rpc_addr}"),
+ format!("http://{wallet_rpc_addr}"),
);
let (mock_addr, mock_join) = serve_on_ephemeral(mock_upstream_router()).await;
diff --git a/tests/raw_coverage/inference_local_admin_raw_coverage_e2e.rs b/tests/raw_coverage/inference_local_admin_raw_coverage_e2e.rs
index b6f3571139..08e8b3e696 100644
--- a/tests/raw_coverage/inference_local_admin_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/inference_local_admin_raw_coverage_e2e.rs
@@ -27,9 +27,12 @@ use openhuman_core::inference::provider::factory::auth_key_for_slug;
use openhuman_core::inference::provider::list_configured_models;
use openhuman_core::security::credentials::{AuthService, DEFAULT_AUTH_PROFILE_NAME};
+/// One captured mock request: method/path, optional auth header, JSON body.
+type RecordedRequest = (String, Option<String>, Value);
+
#[derive(Clone, Default)]
struct MockState {
- requests: Arc<Mutex<Vec<(String, Option<String>, Value)>>>,
+ requests: Arc<Mutex<Vec<RecordedRequest>>>,
ollama_models: Arc<Mutex<Vec<String>>>,
}
diff --git a/tests/raw_coverage/inference_provider_raw_coverage_e2e.rs b/tests/raw_coverage/inference_provider_raw_coverage_e2e.rs
index 806923f46e..2f27186c7f 100644
--- a/tests/raw_coverage/inference_provider_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/inference_provider_raw_coverage_e2e.rs
@@ -29,9 +29,12 @@ use openhuman_core::security::credentials::{
AuthService, APP_SESSION_PROVIDER, DEFAULT_AUTH_PROFILE_NAME,
};
+/// One captured mock request: method/path, optional auth header, JSON body.
+type RecordedRequest = (String, Option<String>, Value);
+
#[derive(Clone, Default)]
struct MockState {
- requests: Arc<Mutex<Vec<(String, Option<String>, Value)>>>,
+ requests: Arc<Mutex<Vec<RecordedRequest>>>,
}
// Serialize env mutation against every other aggregated suite via the
diff --git a/tests/raw_coverage/tools_composio_large_round25_raw_coverage_e2e.rs b/tests/raw_coverage/tools_composio_large_round25_raw_coverage_e2e.rs
index b5dd63e62a..8691d19466 100644
--- a/tests/raw_coverage/tools_composio_large_round25_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/tools_composio_large_round25_raw_coverage_e2e.rs
@@ -283,7 +283,7 @@ async fn composio_direct_handler(State(state): State<MockState>, request: Reques
let body_json = if body_bytes.is_empty() {
Value::Null
} else {
- serde_json::from_slice(&body_bytes).unwrap_or_else(|_| Value::Null)
+ serde_json::from_slice(&body_bytes).unwrap_or(Value::Null)
};
state