MCPcopy Index your code
hub / github.com/AI45Lab/Code / test_session_save_and_load

Function test_session_save_and_load

core/src/agent_api/tests.rs:2041–2059  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2039
2040#[tokio::test(flavor = "multi_thread")]
2041async fn test_session_save_and_load() {
2042 let store = Arc::new(crate::store::MemorySessionStore::new());
2043 let agent = Agent::from_config(test_config()).await.unwrap();
2044
2045 let opts = SessionOptions::new()
2046 .with_session_store(store.clone())
2047 .with_session_id("persist-test");
2048 let session = agent.session("/tmp/test-ws-persist", Some(opts)).unwrap();
2049
2050 // Save empty session
2051 session.save().await.unwrap();
2052
2053 // Verify it was stored
2054 assert!(store.exists("persist-test").await.unwrap());
2055
2056 let data = store.load("persist-test").await.unwrap().unwrap();
2057 assert_eq!(data.id, "persist-test");
2058 assert!(data.messages.is_empty());
2059}
2060
2061#[tokio::test(flavor = "multi_thread")]
2062async fn test_session_save_persists_runtime_config() {

Callers

nothing calls this directly

Calls 7

with_session_storeMethod · 0.80
test_configFunction · 0.70
with_session_idMethod · 0.45
cloneMethod · 0.45
sessionMethod · 0.45
saveMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected