Skip to content

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

test(channels): move runtime storage test into its own module

Steven Enamakel707a3066887c
diff --git a/crates/openhuman-core/src/channels/routes_runtime_storage_tests.rs b/crates/openhuman-core/src/channels/routes_runtime_storage_tests.rs
new file mode 100644
index 0000000000..a55b157763
--- /dev/null
+++ b/crates/openhuman-core/src/channels/routes_runtime_storage_tests.rs
@@ -0,0 +1,43 @@
+use super::*;
+
+#[tokio::test]
+async fn handle_runtime_command_telegram_new_reports_unavailable_storage() {
+ let tempdir = tempfile::tempdir().unwrap();
+ let ctx = runtime_context(tempdir.path().to_path_buf());
+ let channel_impl = Arc::new(RecordingChannel::default());
+ let channel: Arc<dyn Channel> = channel_impl.clone();
+ let sender_key = "telegram_alice_chat-remote";
+
+ ctx.conversation_histories.lock().unwrap().insert(
+ sender_key.to_string(),
+ vec![ChatMessage::user("old history")],
+ );
+
+ let msg = inbound(
+ "1".into(),
+ "alice".into(),
+ "chat-remote".into(),
+ "/new".into(),
+ "telegram".into(),
+ Some("42".into()),
+ );
+ assert!(
+ handle_runtime_command_if_needed(
+ &ctx,
+ &msg,
+ Some(&channel),
+ &conversation_history_key(&msg)
+ )
+ .await
+ );
+ let sent = channel_impl.sent.lock().unwrap();
+ assert_eq!(sent.len(), 1);
+ assert!(
+ sent_text(&sent[0]).contains("Created thread"),
+ "{}",
+ sent_text(&sent[0])
+ );
+ assert!(sent_text(&sent[0]).contains("failed to persist the chat binding"));
+ assert!(sent_text(&sent[0]).contains("host storage is unavailable"));
+ assert_eq!(sent[0].thread_id.as_deref(), Some("42"));
+}
diff --git a/crates/openhuman-core/src/channels/routes_tests.rs b/crates/openhuman-core/src/channels/routes_tests.rs
index 8cb722ff90..4fc43f9073 100644
--- a/crates/openhuman-core/src/channels/routes_tests.rs
+++ b/crates/openhuman-core/src/channels/routes_tests.rs
@@ -49,6 +49,9 @@ fn inbound(
#[path = "routes_compat_tests.rs"]
mod compat;
+#[path = "routes_runtime_storage_tests.rs"]
+mod runtime_storage;
+
struct DummyTool;
#[async_trait]
@@ -709,44 +712,3 @@ async fn handle_runtime_command_telegram_new_status_and_sessions_round_trip() {
.all(|message| message.thread_id.as_deref() == Some("42")));
}
-#[tokio::test]
-async fn handle_runtime_command_telegram_new_reports_unavailable_storage() {
- let tempdir = tempfile::tempdir().unwrap();
- let ctx = runtime_context(tempdir.path().to_path_buf());
- let channel_impl = Arc::new(RecordingChannel::default());
- let channel: Arc<dyn Channel> = channel_impl.clone();
- let sender_key = "telegram_alice_chat-remote";
-
- ctx.conversation_histories.lock().unwrap().insert(
- sender_key.to_string(),
- vec![ChatMessage::user("old history")],
- );
-
- let msg = inbound(
- "1".into(),
- "alice".into(),
- "chat-remote".into(),
- "/new".into(),
- "telegram".into(),
- Some("42".into()),
- );
- assert!(
- handle_runtime_command_if_needed(
- &ctx,
- &msg,
- Some(&channel),
- &conversation_history_key(&msg)
- )
- .await
- );
- let sent = channel_impl.sent.lock().unwrap();
- assert_eq!(sent.len(), 1);
- assert!(
- sent_text(&sent[0]).contains("Created thread"),
- "{}",
- sent_text(&sent[0])
- );
- assert!(sent_text(&sent[0]).contains("failed to persist the chat binding"));
- assert!(sent_text(&sent[0]).contains("host storage is unavailable"));
- assert_eq!(sent[0].thread_id.as_deref(), Some("42"));
-}