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(native-channel): add mock models and auth endpoints to restart e2e
Steven Enamakel4608c4d36809
diff --git a/tests/native_channel_session_restart_e2e.rs b/tests/native_channel_session_restart_e2e.rsindex 3db42b4f67..5fdc55d5d5 100644--- a/tests/native_channel_session_restart_e2e.rs+++ b/tests/native_channel_session_restart_e2e.rs@@ -19,7 +19,7 @@ use std::time::{Duration, Instant};use axum::extract::State;use axum::http::StatusCode;use axum::response::{IntoResponse, Response};-use axum::routing::post;+use axum::routing::{get, post};use axum::{Json, Router};use serde_json::{json, Value};use tokio::task::JoinHandle;@@ -64,6 +64,9 @@ async fn start_mock_servers() -> MockServers {.with_state(Arc::clone(&state));let inference_app = Router::new().route("/v1/chat/completions", post(chat_completion))+ .route("/v1/models", get(models))+ .route("/auth/me", get(auth_me))+ .route("/settings", get(auth_me)).with_state(Arc::clone(&state));let (telegram, telegram_task) = serve(telegram_app).await;let (inference, inference_task) = serve(inference_app).await;@@ -128,6 +131,14 @@ async fn ok() -> Json<Value> {Json(json!({ "ok": true, "result": true }))}+async fn models() -> Json<Value> {+ Json(json!({ "data": [{ "id": "session-model", "object": "model" }] }))+}++async fn auth_me() -> Json<Value> {+ Json(json!({ "id": "loopback-user", "email": "[email protected]" }))+}+async fn get_me() -> Json<Value> {Json(json!({ "ok": true, "result": { "id": 9, "is_bot": true, "username": "test_bot" } }))}@@ -358,9 +369,9 @@ async fn wait_for_completion(state: &MockState, count: usize) {fn model_saw_user_text(request: &Value, text: &str) -> bool {request["messages"].as_array().is_some_and(|messages| {- messages.iter().any(|message| {- message["role"] == "user" && message["content"].as_str() == Some(text)- })+ messages+ .iter()+ .any(|message| message["role"] == "user" && message["content"].as_str() == Some(text))})}