feat: conversation active_count test
- verify active_count increments on send_message, decrements on reset
This commit is contained in:
@@ -4802,6 +4802,27 @@ mod conversation_extended_tests {
|
||||
assert!(registry.get_conversation_id(&room_b).await.is_none());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_conversation_active_count() {
|
||||
let Some(api_key) = load_env() else { eprintln!("Skipping: no API key"); return; };
|
||||
let mistral = Arc::new(
|
||||
mistralai_client::v1::client::Client::new(Some(api_key), None, None, None).unwrap(),
|
||||
);
|
||||
let store = Arc::new(Store::open_memory().unwrap());
|
||||
let registry = ConversationRegistry::new("mistral-medium-latest".into(), 118000, store);
|
||||
|
||||
assert_eq!(registry.active_count().await, 0);
|
||||
|
||||
let room = format!("test-count-{}", uuid::Uuid::new_v4());
|
||||
let input = mistralai_client::v1::conversations::ConversationInput::Text("hi".into());
|
||||
registry.send_message(&room, input, true, &mistral, None).await.unwrap();
|
||||
|
||||
assert_eq!(registry.active_count().await, 1);
|
||||
|
||||
registry.reset(&room).await;
|
||||
assert_eq!(registry.active_count().await, 0);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_conversation_with_context_hint() {
|
||||
let Some(api_key) = load_env() else { eprintln!("Skipping: no API key"); return; };
|
||||
|
||||
Reference in New Issue
Block a user